Skip to content

TrogonStack/otel.pony

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

otel.pony

A pure Pony OpenTelemetry client that exports spans to any OTLP-compatible collector over HTTP/JSON.

otel.pony provides a fluent span builder, a batching tracer actor, and spec-compliant OTLP JSON serialization. It includes an HTTP exporter built on courier, GenAI semantic conventions for LLM tracing (tokens, models, costs), and W3C Trace Context (traceparent) generation for distributed tracing.

Pony's actor model makes concurrent tracing natural, but the ecosystem lacks an OpenTelemetry client. otel.pony fills that gap with zero-copy attribute serialization, automatic batch flushing, and a NoopExporter for testing — so you get observability without fighting the type system.

Built for Pony developers who want to ship traces to Grafana, Jaeger, or any OTLP collector without leaving the language. If you're building actor-based services in Pony and need production observability, this is the library.

Installation

Add to your corral.json:

{
  "locator": "github.com/TrogonStack/otel.pony.git",
  "version": "0.1.0"
}

Then:

corral fetch

Usage

use "otel"

actor Main
  new create(env: Env) =>
    // Create an exporter (or NoopExporter for testing)
    let exporter = OtlpHttpExporter(env.root, "127.0.0.1", "4318")

    // Create a tracer
    let tracer = Tracer(exporter, "my-service", "1.0.0")

    // Build and record a span
    let rand = Rand(Time.nanos(), Time.nanos())
    let ctx = SpanContext(OtelId.trace_id(rand), OtelId.span_id(rand))
    let span = SpanBuilder("my.operation", ctx)
      .>set_kind(SpanClient)
      .>attr("key", "value")
      .>attr_int("count", 42)
      .>set_status(SpanStatus.ok())
      .finish()
    tracer.record(span)

Testing

corral fetch
corral run -- ponyc otel/test -o build -b otel-test -Dopenssl_3.0.x
./build/otel-test

57 tests (unit + property-based).

Dependencies

  • courier (HTTP client)
  • lori (TCP, transitive via courier)
  • Pony 0.58+

License

MIT

About

Pony OpenTelemetry client — OTLP JSON export, span builder, tracer actor

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages