-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
swift: add telemetry client #263
swift: add telemetry client #263
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Not sure how to properly build, nor with what version to do so. So, used the swift:6.0.3 image from the dockerhub, and the build fails:
$ swift build Fetching https://github.com/apple/swift-atomics.git Fetching https://github.com/apple/swift-system.git Fetching https://github.com/apple/swift-http-types Fetching https://github.com/open-telemetry/opentelemetry-swift.git Fetching https://github.com/apple/swift-nio-ssl.git Fetching https://github.com/apple/swift-nio-http2.git Fetching https://github.com/apple/swift-metrics.git Fetching https://github.com/grpc/grpc-swift.git Fetching https://github.com/swift-server-community/mqtt-nio.git Fetching https://github.com/apple/swift-collections.git Fetching https://github.com/undefinedlabs/opentracing-objc Fetching https://github.com/apple/swift-nio-transport-services.git Fetching https://github.com/apple/swift-nio-extras.git Fetching https://github.com/apple/swift-nio.git Fetching https://github.com/apple/swift-log.git Fetched https://github.com/apple/swift-log.git from cache (0.90s) Fetching https://github.com/apple/swift-protobuf.git Fetched https://github.com/undefinedlabs/opentracing-objc from cache (3.61s) Fetching https://github.com/undefinedlabs/Thrift-Swift Fetched https://github.com/apple/swift-collections.git from cache (3.62s) Fetched https://github.com/apple/swift-http-types from cache (3.95s) Fetched https://github.com/apple/swift-system.git from cache (3.95s) Fetched https://github.com/open-telemetry/opentelemetry-swift.git from cache (3.95s) Fetched https://github.com/swift-server-community/mqtt-nio.git from cache (3.96s) Computing version for https://github.com/open-telemetry/opentelemetry-swift.git Fetched https://github.com/apple/swift-nio-http2.git from cache (3.96s) Fetched https://github.com/apple/swift-nio-ssl.git from cache (3.96s) Fetched https://github.com/apple/swift-atomics.git from cache (4.09s) Fetched https://github.com/apple/swift-metrics.git from cache (4.09s) Fetched https://github.com/grpc/grpc-swift.git from cache (4.10s) Computed https://github.com/open-telemetry/opentelemetry-swift.git at 1.12.1 (0.31s) Fetched https://github.com/undefinedlabs/Thrift-Swift from cache (0.65s) Fetched https://github.com/apple/swift-protobuf.git from cache (6.14s) Fetched https://github.com/apple/swift-nio-transport-services.git from cache (9.10s) Fetched https://github.com/apple/swift-nio-extras.git from cache (9.10s) Fetched https://github.com/apple/swift-nio.git from cache (9.13s) Computing version for https://github.com/swift-server-community/mqtt-nio.git Computed https://github.com/swift-server-community/mqtt-nio.git at 2.11.0 (0.86s) Computing version for https://github.com/apple/swift-atomics.git Computed https://github.com/apple/swift-atomics.git at 1.2.0 (0.27s) Computing version for https://github.com/apple/swift-metrics.git Computed https://github.com/apple/swift-metrics.git at 2.5.0 (0.25s) Computing version for https://github.com/apple/swift-log.git Computed https://github.com/apple/swift-log.git at 1.6.2 (0.25s) Computing version for https://github.com/apple/swift-protobuf.git Computed https://github.com/apple/swift-protobuf.git at 1.28.2 (0.26s) Computing version for https://github.com/grpc/grpc-swift.git Computed https://github.com/grpc/grpc-swift.git at 1.24.2 (0.34s) Computing version for https://github.com/apple/swift-nio.git Computed https://github.com/apple/swift-nio.git at 2.77.0 (0.34s) Computing version for https://github.com/apple/swift-nio-transport-services.git Computed https://github.com/apple/swift-nio-transport-services.git at 1.23.0 (0.26s) Computing version for https://github.com/apple/swift-nio-ssl.git Computed https://github.com/apple/swift-nio-ssl.git at 2.29.0 (0.29s) Computing version for https://github.com/apple/swift-collections.git Computed https://github.com/apple/swift-collections.git at 1.1.4 (0.36s) Computing version for https://github.com/apple/swift-nio-extras.git Computed https://github.com/apple/swift-nio-extras.git at 1.24.1 (0.27s) Computing version for https://github.com/apple/swift-nio-http2.git Computed https://github.com/apple/swift-nio-http2.git at 1.35.0 (0.28s) Computing version for https://github.com/apple/swift-system.git Computed https://github.com/apple/swift-system.git at 1.4.0 (0.25s) Computing version for https://github.com/apple/swift-http-types Computed https://github.com/apple/swift-http-types at 1.3.1 (0.26s) Creating working copy for https://github.com/apple/swift-nio-http2.git Working copy of https://github.com/apple/swift-nio-http2.git resolved at 1.35.0 Creating working copy for https://github.com/apple/swift-atomics.git Working copy of https://github.com/apple/swift-atomics.git resolved at 1.2.0 Creating working copy for https://github.com/apple/swift-collections.git Working copy of https://github.com/apple/swift-collections.git resolved at 1.1.4 Creating working copy for https://github.com/apple/swift-nio-ssl.git Working copy of https://github.com/apple/swift-nio-ssl.git resolved at 2.29.0 Creating working copy for https://github.com/apple/swift-system.git Working copy of https://github.com/apple/swift-system.git resolved at 1.4.0 Creating working copy for https://github.com/open-telemetry/opentelemetry-swift.git Working copy of https://github.com/open-telemetry/opentelemetry-swift.git resolved at 1.12.1 Creating working copy for https://github.com/apple/swift-metrics.git Working copy of https://github.com/apple/swift-metrics.git resolved at 2.5.0 Creating working copy for https://github.com/apple/swift-nio-extras.git Working copy of https://github.com/apple/swift-nio-extras.git resolved at 1.24.1 Creating working copy for https://github.com/apple/swift-nio-transport-services.git Working copy of https://github.com/apple/swift-nio-transport-services.git resolved at 1.23.0 Creating working copy for https://github.com/grpc/grpc-swift.git Working copy of https://github.com/grpc/grpc-swift.git resolved at 1.24.2 Creating working copy for https://github.com/swift-server-community/mqtt-nio.git Working copy of https://github.com/swift-server-community/mqtt-nio.git resolved at 2.11.0 Creating working copy for https://github.com/apple/swift-protobuf.git Working copy of https://github.com/apple/swift-protobuf.git resolved at 1.28.2 Creating working copy for https://github.com/apple/swift-log.git Working copy of https://github.com/apple/swift-log.git resolved at 1.6.2 Creating working copy for https://github.com/apple/swift-http-types Working copy of https://github.com/apple/swift-http-types resolved at 1.3.1 Creating working copy for https://github.com/apple/swift-nio.git Working copy of https://github.com/apple/swift-nio.git resolved at 2.77.0 Building for debugging... error: emit-module command failed with exit code 1 (use -v to see invocation) [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Logs/Processors/BatchLogRecordProcessor.swift:41:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 39 | } 40 | 41 | private class BatchWorker : Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 42 | let logRecordExporter : LogRecordExporter 43 | let scheduleDelay : TimeInterval [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Trace/SpanProcessors/BatchSpanProcessor.swift:74:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 72 | /// the data. 73 | /// The list of batched data is protected by a NSCondition which ensures full concurrency. 74 | private class BatchWorker: Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 75 | let spanExporter: SpanExporter 76 | let meterProvider: StableMeterProvider? [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Trace/SpanProcessors/BatchSpanProcessor.swift:74:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 72 | /// the data. 73 | /// The list of batched data is protected by a NSCondition which ensures full concurrency. 74 | private class BatchWorker: Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 75 | let spanExporter: SpanExporter 76 | let meterProvider: StableMeterProvider? [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Trace/SpanProcessors/BatchSpanProcessor.swift:74:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 72 | /// the data. 73 | /// The list of batched data is protected by a NSCondition which ensures full concurrency. 74 | private class BatchWorker: Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 75 | let spanExporter: SpanExporter 76 | let meterProvider: StableMeterProvider? [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Trace/SpanProcessors/BatchSpanProcessor.swift:74:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 72 | /// the data. 73 | /// The list of batched data is protected by a NSCondition which ensures full concurrency. 74 | private class BatchWorker: Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 75 | let spanExporter: SpanExporter 76 | let meterProvider: StableMeterProvider? [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Trace/SpanProcessors/BatchSpanProcessor.swift:74:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 72 | /// the data. 73 | /// The list of batched data is protected by a NSCondition which ensures full concurrency. 74 | private class BatchWorker: Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 75 | let spanExporter: SpanExporter 76 | let meterProvider: StableMeterProvider? [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Trace/SpanProcessors/BatchSpanProcessor.swift:74:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 72 | /// the data. 73 | /// The list of batched data is protected by a NSCondition which ensures full concurrency. 74 | private class BatchWorker: Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 75 | let spanExporter: SpanExporter 76 | let meterProvider: StableMeterProvider? [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Trace/SpanProcessors/BatchSpanProcessor.swift:74:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 72 | /// the data. 73 | /// The list of batched data is protected by a NSCondition which ensures full concurrency. 74 | private class BatchWorker: Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 75 | let spanExporter: SpanExporter 76 | let meterProvider: StableMeterProvider? [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Trace/SpanProcessors/BatchSpanProcessor.swift:74:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 72 | /// the data. 73 | /// The list of batched data is protected by a NSCondition which ensures full concurrency. 74 | private class BatchWorker: Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 75 | let spanExporter: SpanExporter 76 | let meterProvider: StableMeterProvider? [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Trace/SpanProcessors/BatchSpanProcessor.swift:74:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 72 | /// the data. 73 | /// The list of batched data is protected by a NSCondition which ensures full concurrency. 74 | private class BatchWorker: Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 75 | let spanExporter: SpanExporter 76 | let meterProvider: StableMeterProvider? [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Trace/SpanProcessors/BatchSpanProcessor.swift:74:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 72 | /// the data. 73 | /// The list of batched data is protected by a NSCondition which ensures full concurrency. 74 | private class BatchWorker: Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 75 | let spanExporter: SpanExporter 76 | let meterProvider: StableMeterProvider? [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Logs/Processors/BatchLogRecordProcessor.swift:41:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 39 | } 40 | 41 | private class BatchWorker : Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 42 | let logRecordExporter : LogRecordExporter 43 | let scheduleDelay : TimeInterval [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Logs/Processors/BatchLogRecordProcessor.swift:41:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 39 | } 40 | 41 | private class BatchWorker : Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 42 | let logRecordExporter : LogRecordExporter 43 | let scheduleDelay : TimeInterval [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Logs/Processors/BatchLogRecordProcessor.swift:41:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 39 | } 40 | 41 | private class BatchWorker : Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 42 | let logRecordExporter : LogRecordExporter 43 | let scheduleDelay : TimeInterval [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Logs/Processors/BatchLogRecordProcessor.swift:41:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 39 | } 40 | 41 | private class BatchWorker : Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 42 | let logRecordExporter : LogRecordExporter 43 | let scheduleDelay : TimeInterval [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Logs/Processors/BatchLogRecordProcessor.swift:41:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 39 | } 40 | 41 | private class BatchWorker : Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 42 | let logRecordExporter : LogRecordExporter 43 | let scheduleDelay : TimeInterval [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Logs/Processors/BatchLogRecordProcessor.swift:41:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 39 | } 40 | 41 | private class BatchWorker : Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 42 | let logRecordExporter : LogRecordExporter 43 | let scheduleDelay : TimeInterval [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Logs/Processors/BatchLogRecordProcessor.swift:41:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 39 | } 40 | 41 | private class BatchWorker : Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 42 | let logRecordExporter : LogRecordExporter 43 | let scheduleDelay : TimeInterval [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Logs/Processors/BatchLogRecordProcessor.swift:41:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 39 | } 40 | 41 | private class BatchWorker : Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 42 | let logRecordExporter : LogRecordExporter 43 | let scheduleDelay : TimeInterval [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Logs/Processors/BatchLogRecordProcessor.swift:41:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 39 | } 40 | 41 | private class BatchWorker : Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 42 | let logRecordExporter : LogRecordExporter 43 | let scheduleDelay : TimeInterval [.../its-client]/swift/ITSClient/.build/checkouts/opentelemetry-swift/Sources/OpenTelemetrySdk/Logs/Processors/BatchLogRecordProcessor.swift:41:15: error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 39 | } 40 | 41 | private class BatchWorker : Thread { | `- error: cannot inherit from class 'Thread' (compiled with Swift 6.0.3) because it has overridable members that could not be loaded in Swift 5.10 42 | let logRecordExporter : LogRecordExporter 43 | let scheduleDelay : TimeInterval [966/995] Compiling OpenTelemetrySdk EmptyExponentialHistogramBuckets.swift $ echo $? 1
- The build does not leave a clean repository:
$ git diff diff --git a/swift/ITSClient/Package.resolved b/swift/ITSClient/Package.resolved index a92b2e0..d3f1929 100644 --- a/swift/ITSClient/Package.resolved +++ b/swift/ITSClient/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "ec284ca5fac3dac5fdf7e779cd882ab66e8cabd9efc13a683df3b2436fa540e2", + "originHash" : "4dc7c78df30570880b3a00fcf4de485d50553d10de408adfb1096b138fe10822", "pins" : [ { "identity" : "grpc-swift", @@ -28,15 +28,6 @@ "version" : "1.12.1" } }, - { - "identity" : "opentracing-objc", - "kind" : "remoteSourceControl", - "location" : "https://github.com/undefinedlabs/opentracing-objc", - "state" : { - "revision" : "18c1a35ca966236cee0c5a714a51a73ff33384c1", - "version" : "0.5.2" - } - }, { "identity" : "swift-atomics", "kind" : "remoteSourceControl", @@ -144,15 +135,6 @@ "revision" : "c8a44d836fe7913603e246acab7c528c2e780168", "version" : "1.4.0" } - }, - { - "identity" : "thrift-swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/undefinedlabs/Thrift-Swift", - "state" : { - "revision" : "18ff09e6b30e589ed38f90a1af23e193b8ecef8e", - "version" : "1.1.2" - } } ], "version" : 3
6806615
to
4510d9a
Compare
To sum up, for now we can't build on Linux because there's a bug in swift-core lib-foundations about Thread in swift 6 (See open-telemetry/opentelemetry-swift#615). |
Thanks for investigating my build failure! :-) This is an upstream swift issue that is non-trivial to fix. The conclusion from our discusion: don't expect to build on Linux for now, and focus on the actual target which is building with X-Code 16+. |
Signed-off-by: François Suc <[email protected]>
Signed-off-by: François Suc <[email protected]>
Signed-off-by: François Suc <[email protected]>
4510d9a
to
3520479
Compare
Signed-off-by: François Suc <[email protected]>
Signed-off-by: François Suc <[email protected]>
Signed-off-by: François Suc <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Code peer-reviewed IRL 👍
- Tests demonstrated IRL 👍
What's new
Add a implementation of an OpenTelemetry client with open-telemetry-swift
How to test
swift test --filter OpenTelemetryClientTests.send_several_consumer_and_producer_spans
swift test --filter OpenTelemetryClientTests.send_producer_and_child_consumer_span
swift test --filter OpenTelemetryClientTests.send_producer_span_with_error
Closes #257