Repository navigation
feat: implement an otlp http client - #2432
thompson-tomo wants to merge 19 commits into
Conversation
c334002 to
71d7d44
Compare
71d7d44 to
26d00ff
Compare
afa4ba6 to
dd3e92b
Compare
| if options.nil? | ||
| options = OpenTelemetry::Exporter::OTLP::HTTP::OtlpHttpExporterConfig.new( | ||
| tls: OpenTelemetry::Exporter::OTLP::HTTP::HttpTlsConfig.new( | ||
| ca_file: OpenTelemetry::Common::Utilities.config_opt("OTEL_EXPORTER_OTLP_#{service}_CERTIFICATE", 'OTEL_EXPORTER_OTLP_CERTIFICATE'), | ||
| cert_file: OpenTelemetry::Common::Utilities.config_opt("OTEL_EXPORTER_OTLP_#{service}_CLIENT_CERTIFICATE", 'OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE'), | ||
| key_file: OpenTelemetry::Common::Utilities.config_opt("OTEL_EXPORTER_OTLP_#{service}_CLIENT_KEY", 'OTEL_EXPORTER_OTLP_CLIENT_KEY') | ||
| ), | ||
| ssl_verify_mode: ssl_verify_mode | ||
| ) | ||
| @uri = OpenTelemetry::Exporter::OTLP::Common::Utilities.build_uri(nil, base_path, "OTEL_EXPORTER_OTLP_#{service}_ENDPOINT", 'OTEL_EXPORTER_OTLP_ENDPOINT', 'http://localhost:4318/') |
There was a problem hiding this comment.
bug: if any options are passed, env variables are ignored. For example, with_env('OTEL_EXPORTER_OTLP_CERTIFICATE' => 'cert') { TraceExporter.new(endpoint: 'https://example.com') } loses certificate
There was a problem hiding this comment.
Actually it was intended so that programatic configuration matches the behaviour of config file with a clear precedence and programatic configuration maps directly to the in-memory model. I also note The exporter is not yet stable.
| def ssl_verify_mode | ||
| if ENV['OTEL_RUBY_EXPORTER_OTLP_SSL_VERIFY_PEER'] == 'true' | ||
| OpenSSL::SSL::VERIFY_PEER | ||
| elsif ENV['OTEL_RUBY_EXPORTER_OTLP_SSL_VERIFY_NONE'] == 'true' |
There was a problem hiding this comment.
the == true behaviour was only in otlp-logs, whereas other gems used just checked for truthiness. This is a breaking change.
There was a problem hiding this comment.
Interesting it seems that none of the 4 current implementations match the feature definition in the readmes which states in the doc linked that the values are OpenSSL::SSL::VERIFY_NONE or OpenSSL::SSL::VERIFY_PEER. With OpenSSL::SSL::VERIFY_PEER being the default value.
And in fact as per https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#parsing-empty-value
The SDK MUST interpret an empty value of an environment variable the same way as when the variable is unset.
Hence old option is not compliant
|
A separate |
|
@pitr the reason for seperate is that this functionality only applicable to http especially given that it creates a http client which is not usable in either the grpc exporters & eventually file exporter. Note this is only the first pr there a second pr which adds the send functionality to the http client in the client. |
c4bccde to
3fe6e33
Compare
3fe6e33 to
0d7a6cb
Compare
Description
Progresses #2170 (issue)
Changes
This introduces an otlp http client which all http exporters use hence centralising functionality on how the http client is created.
In the future (#2447) this client will offer a send bytes method which will provide immense code consolidation with the exporters becoming simple wrappers around the client.
Authorship