open-telemetry / opentelemetry-swift

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

HTTP exporter auth #455

Closed emoragaf closed 11 months ago

emoragaf commented 1 year ago

Hello, first time working with swift. And I'm building a thin wrapper around this lib, using the OTLP http exporter for traces

I need to set some headers for authentication, a case I feel is common enough, but not covered in the example.

Any pointers on how to accomplish it?

bryce-b commented 1 year ago

You need to set it in the headers parameter in the OtlpConfiguration object before passing it to your exporter.

emoragaf commented 1 year ago

@bryce-b I don't get the option listed to pass config to the exporter 🤔 (I do see it for the grpc exporter in contrast) could you give me an example for it please

bryce-b commented 1 year ago

@emoragaf Ah, it looks like the OTLP Http trace exported doesn't have the same interface implemented. This is an oversight. I'll create an issue to get it fixed, but it may not be fixed swiftly. Alternatively, you could use the GRPC variant, in the interim.

bryce-b commented 1 year ago

https://github.com/open-telemetry/opentelemetry-swift/issues/457

bryce-b commented 12 months ago

@emoragaf the HTTP client should accept http headers now.