{"id":23057113,"url":"https://github.com/swift-otel/swift-otel","last_synced_at":"2026-05-03T12:05:03.611Z","repository":{"id":37754519,"uuid":"319988084","full_name":"swift-otel/swift-otel","owner":"swift-otel","description":"An OpenTelemetry Protocol (OTLP) backend for Swift Log, Swift Metrics, and Swift Distributed Tracing.","archived":false,"fork":false,"pushed_at":"2026-04-29T07:21:41.000Z","size":10128,"stargazers_count":199,"open_issues_count":22,"forks_count":46,"subscribers_count":11,"default_branch":"main","last_synced_at":"2026-04-29T09:25:18.817Z","etag":null,"topics":["distributed-tracing","logging","metrics","observability","opentelemetry","otel","swift","swift-distributed-tracing","swift-log","swift-metrics","swift-otel","tracing"],"latest_commit_sha":null,"homepage":"https://swiftpackageindex.com/swift-otel/swift-otel","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swift-otel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE.txt","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-12-09T14:50:57.000Z","updated_at":"2026-04-29T07:21:43.000Z","dependencies_parsed_at":"2026-01-07T09:10:08.383Z","dependency_job_id":null,"html_url":"https://github.com/swift-otel/swift-otel","commit_stats":{"total_commits":184,"total_committers":8,"mean_commits":23.0,"dds":"0.23369565217391308","last_synced_commit":"90d63b478fbc4c97f396c1cf9ad011979a83f10b"},"previous_names":["swift-otel/swift-otel","slashmo/swift-otel"],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/swift-otel/swift-otel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swift-otel%2Fswift-otel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swift-otel%2Fswift-otel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swift-otel%2Fswift-otel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swift-otel%2Fswift-otel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swift-otel","download_url":"https://codeload.github.com/swift-otel/swift-otel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swift-otel%2Fswift-otel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32568037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["distributed-tracing","logging","metrics","observability","opentelemetry","otel","swift","swift-distributed-tracing","swift-log","swift-metrics","swift-otel","tracing"],"created_at":"2024-12-16T02:04:22.494Z","updated_at":"2026-05-03T12:05:03.606Z","avatar_url":"https://github.com/swift-otel.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Swift OTel\n\nAn [OpenTelemetry Protocol (OTLP)][otlp] backend for Swift Log, Swift Metrics, and Swift Distributed Tracing.\n\n\u003e Note: This package does not provide an OTel instrumentation API, or general-purpose OTel SDK.\n\n- 📚 **Documentation** is available on the [Swift Package Index][docs]\n- 💻 **Examples** are available in the [Examples][examples] directory\n- 🪪 **License** is Apache 2.0, repeated in [LICENSE][license]\n- 🔀 **Related Repositories**:\n  - [`swift-log`][swift-log] Logging API package for Swift.\n  - [`swift-metrics`][swift-metrics] Metrics API package for Swift.\n  - [`swift-distributed-tracing`][swift-distributed-tracing] Tracing API package for Swift.\n  - [`opentelemetry-swift`][opentelemetry-swift] OpenTelemetry API and SDK package.\n\n## Quickstart\n\nAdd the dependencies to your package and target:\n\n```swift\n// swift-tools-version: 6.1\nimport PackageDescription\n\nlet package = Package(\n    name: \"Application\",\n    platforms: [.macOS(\"13.0\")],\n    dependencies: [\n        // ...\n        .package(url: \"https://github.com/swift-otel/swift-otel.git\", from: \"1.0.0\"),\n    ],\n    targets: [\n        .executableTarget(\n            name: \"Server\",\n            dependencies: [\n                // ...\n                .product(name: \"OTel\", package: \"swift-otel\"),\n            ]\n        )\n    ]\n)\n```\n\nThen in your target:\n\n```swift\nimport OTel\n\n// Bootstrap observability backends.\nlet observability = try OTel.bootstrap()\n\n// Run the observability background tasks, alongside your application logic.\nawait withThrowingTaskGroup { group in\n    group.addTask { try await observability.run() }\n    // Your application logic here...\n}\n```\n\n### Swift Service Lifecycle integration\n\nThe value returned from the bootstrap API conforms to `Service` so it can be run within a `ServiceGroup`:\n\n```swift\nimport OTel\nimport ServiceLifecycle\n\n// Bootstrap observability backends.\nlet observability = try OTel.bootstrap()\n\n// Run observability services in a service group with your services.\nlet service: Service = // ...\nlet serviceGroup = ServiceGroup(services: [observability, service], logger: .init(label: \"ServiceGroup\"))\ntry await serviceGroup.run()\n```\n\nOr, if another dependency has APIs for running additional services, you can use those. For example, using Hummingbird:\n\n```swift\nimport OTel\nimport Hummingbird\n\n// Bootstrap observability backends.\nlet observability = try OTel.bootstrap()\n\n// Create an HTTP server with instrumentation middlewares.\nlet router = Router()\nrouter.middlewares.add(TracingMiddleware())\nrouter.middlewares.add(MetricsMiddleware())\nrouter.middlewares.add(LogRequestsMiddleware(.info))\nrouter.get(\"hello\") { _, _ in \"hello\" }\nvar app = Application(router: router)\n\n// Add the observability service to the Hummingbird service group and run the server.\napp.addServices(observability)\ntry await app.runService()\n```\n\n\u003e [!Tip]\n\u003e This, and other examples, can be be found in the [Examples][examples] directory.\n\n[otlp]: https://opentelemetry.io/docs/specs/otel/protocol\n[docs]: https://swiftpackageindex.com/swift-otel/swift-otel/documentation\n[examples]: https://github.com/swift-otel/swift-otel/tree/main/Examples/\n[license]: https://github.com/swift-otel/swift-otel/tree/main/LICENSE.txt\n[swift-log]: https://github.com/apple/swift-log\n[swift-metrics]: https://github.com/apple/swift-metrics\n[swift-distributed-tracing]: https://github.com/apple/swift-distributed-tracing\n[opentelemetry-swift]: https://github.com/open-telemetry/opentelemetry-swift\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswift-otel%2Fswift-otel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswift-otel%2Fswift-otel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswift-otel%2Fswift-otel/lists"}