Swiftpack.co -  Package - open-telemetry/opentelemetry-swift
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
open-telemetry/opentelemetry-swift
OpenTelemetry API for Swift
.package(url: "https://github.com/open-telemetry/opentelemetry-swift.git", from: "0.6.0")

opentelemetry-swift

A swift OpenTelemetry client

Installation

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 development, and you should be careful before using 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.swift:

.package(url: "https://github.com/open-telemetry/opentelemetry-swift", from: "0.6.0"),

and to your application/library target, add OpenTelemetryApi or OpenTelemetrySdkto your dependencies, e.g. like this:

.target(name: "ExampleTelemetryProducerApp", dependencies: ["OpenTelemetryApi"]),

or

.target(name: "ExampleApp", dependencies: ["OpenTelemetrySdk"]),

Current status

Currently Tracing, Metrics and Baggage API's and SDK are implemented, also OpenTracing shim, for compatibility with existing Opentracing code.

Implemented traces exporters: Stdout, Jaeger, Zipkin, Datadog and OpenTelemetry collector

Implemented metrics exporters: Prometheus, Datadog, and OpenTelemetry collector

Examples

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

GitHub

link
Stars: 34
Last commit: 4 hours ago

Release Notes

0.6.0
5 weeks ago

0.6.0 complies with version 1.0.1 of the OpenTelemetry Tracing Spec, and supports OTLP spec 0.7.0.

It also includes the following list of changes:

Swift package

  • It depends now on GRPC version 1.0.0 #113

Traces

  • Status is now an enum, with associated description for error #113
  • TraceState mutating functions should not be used outside the library so are now internal #113
  • Renamed TraceConfig to SpanLimits, and move Sampler to TracerSharedState #113
  • Update SpanLimit attribute names, and update default values #113
  • Added timeout property to BatchSpanProcessor #113
  • Rename Probability sampler to TraceIdRatioBased #113
  • allow usage of parent based sampling #113
  • Rename IdsGenerator protocol to IdGenerator #113

Metrics

  • Refactored Metrics API #108

OpenTelemetryProtocol (OTLP) Exporter

  • Add support for exporting Metrics #108
  • Update collector exporter to spec 0.7.0 #113

Zipkin Exporter

  • Added additionalHeaders property to ZipkinExporterOptions #109

Datadog Exporter

  • Renamed configuration fields #112

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco