Skip to content

zig-o11y/opentelemetry-sdk

Repository files navigation

OpenTelemetry Zig

Zig docs   •   Installation   •   Contributing

Caution

This project is in alpha stage. While it is ready for usage and testing, it has not been battle-tested in production environments. Use with caution and expect breaking changes between releases.

This is an implementation of the OpenTelemetry specification for the Zig programming language.

The version of the OpenTelemetry specification targeted here is 1.48.0.

Goals

  1. Provide a Zig library implementing the stable features of an OpenTelemetry SDK
  2. Provide a reference implementation of the OpenTelemetry API
  3. Provide examples on how to use the library in real-world use cases

Installation

Run the following command to add the package to your build.zig.zon dependencies, replacing <ref> with a release version:

zig fetch --save "git+https://github.com/zig-o11y/opentelemetry-sdk#<ref>"

Then in your build.zig:

const sdk = b.dependency("opentelemetry-sdk", .{
    .target = target,
    .optimize = optimize,
});

Specification Support State

Signals

Signal Status
Traces
Metrics
Logs
Profiles

OTLP Protocol

Feature Status
HTTP/Protobuf
HTTP/JSON
gRPC
Compression (gzip)

Examples

Check out the examples folder for practical usage examples of traces, metrics, and logs.

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines on how to contribute to this project, including:

  • Running tests locally
  • Running benchmarks
  • Test and benchmark options

Origins

This project originated from a proposal in the OpenTelemetry community to create a native Zig implementation of the OpenTelemetry SDK.

You can read more about the original proposal and discussion at:

open-telemetry/community#2514

For a more in-depth read of why OpenTelemetry needs a Zig SDK, see "Zig is great for Observability".