open-telemetry / opentelemetry-swift

OpenTelemetry API for Swift
https://opentelemetry.io/docs/instrumentation/swift/
Apache License 2.0
224 stars 148 forks source link

OpenTelemetry Icon opentelemetry-swift

CI codecov

About

The repository contains the Swift OpenTelemetry client

Getting Started

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.

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: "1.0.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"]),

Cocoapods

As of version 1.11.0, OpenTelemetry-Swift support cocoapods. Two pods are provided:

OpenTelemetry-Swift-Api is a dependency of OpenTelemetry-Swift-Sdk.

Most users will want to add the following to their pod file:

pod 'OpenTelemetry-Swift-Sdk'

This will add both the API and SDK. If you're only interesting in Adding the API add the following:

pod 'OpenTelemetry-Swift-Api'

Documentation

Official documentation for the library can be found in the official opentelemetry documentation page, including:

Current status

API and SDK

Tracing and Baggage are considered stable

Logs are considered beta quality

Metrics is implemented using an outdated spec, is fully functional but will change in the future

Supported exporters and importers

Traces

Metrics

Logs

NOTE: OTLP exporters are supported both in GRPC and HTTP, only GRPC is production ready, HTTP is still experimental

Instrumentation libraries

Examples

The package includes some example projects with basic functionality:

Contributing

We'd love your help!. Use tags [help wanted][help wanted] and [good first issue][good first issues] to get started with the project. For an overview of how to contribute, see the contributing guide in CONTRIBUTING.md.

We have a weekly SIG meeting! See the community page for meeting details and notes.

We are also available in the #otel-swift channel in the CNCF slack. Please join us there for OTel Swift discussions.

Community members

Maintainers (@open-telemetry/swift-maintainers)

Find more about the maintainer role in the community repository.

Approvers (@open-telemetry/swift-approvers)

Find more about the approver role in the community repository.

Triager (@open-telemetry/swift-triagers)

Find more about the triager role in the community repository.