A swift OpenTelemetry client
This package includes several libraries. The
OpenTelemetryApi library includes protocols and no-op implementations that comprise the OpenTelemetry API following the specification. The
OpenTelemetrySdk library is the reference implementation of the API.
Libraries that produce telemetry data should only depend on
OpenTelemetryApi, and defer the choice of the SDK to the application developer. Applications may depend on
OpenTelemetrySdk or another package that implements the API.
Please note that this library is currently in alpha, and shouldn't be used in production environments.
Adding the dependency
opentelemetry-swift is designed for Swift 5. To depend on the opentelemetry-swift package, you need to declare your dependency in your
.package(url: "https://github.com/undefinedlabs/opentelemetry-swift", from: "0.1.0"),
and to your application/library target, add
dependencies, e.g. like this:
.target(name: "ExampleTelemetryProducerApp", dependencies: ["OpenTelemetryApi"]),
.target(name: "ExampleApp", dependencies: ["OpenTelemetrySdk"]),
Currently Tracing, Metrics and Correlation Context API's and SDK are implemented, also OpenTracing shims, for compatibility with existing Opentracing code.
Implemented traces exporters: simple stdout, Jaeger, Zipkin, Datadog and OpenTelemetry collector
Implemented metrics exporters: Prometheus
The package includes some example projects with basic functionality:
Logging Tracer- Simple api implementation of a Tracer that logs every api call
Simple Exporter- Shows the Jaeger an Stdout exporters in action using a MultiSpanExporter. Can be easily modified for other exporters
Prometheus Sample- Shows the Prometheus exporter reporting metrics to a Prometheus instance
You may find interesting
0.4.0 - 2020-12-11T19:05:55
First release of the library Compatible with opentelemetry-proto 0.4.0
Components implemented (maturity):
- Api and Sdk for Tracing (Beta)
- Api and Sdk for Metrics (Alpha)
- Api and Sdk for Correlation Context (Alpha)
- OpenTracing shims (Beta)
- Traces exporters: OpenTelemetry collector (Alpha), Jaeger ( Alpha), Zipkin (Alpha), Datadog (Beta) and stdout (Beta)
- Metrics exporters: Prometheus ( Alpha)
This is the first version where all the components for an official beta are implemented. Some components are already being actively used by some projects and code in those is more mature. API is going to be updated soon, and some breaking changes will happen