Merge HTTP and GRPC OTLP Exporters into a single interface
Is your feature request related to a problem? As a telemetry implementer, I'd like to easily switch between OTLP/HTTP and OTLP/GRPC
Describe the solution you'd like
There should be a single OTLP Exporter interface, which based on a configuration option based on OTEL_EXPORTER_OTLP_PROTOCOL should accept http/protobuf or grpc and use the correct Exporter accordingly.
What this interface should look like, I'm not sure or if it's feasible. Currently the two Exporters take different sets of parameters.
Describe alternatives you've considered Having the two exporters separately I believe makes it harder to switch as this requires a code change rather than a config change.
Additional context This is a draft issue to be filled out with examples from around the Otel community on how it's been done in other languages.
@SeanHood - are you planning on working on this ticket or are you hoping someone else will work on it?
Happy to work on it, had a few ideas over the weekend.
I'm thinking a new class e.g. OpenTelemetry\Contrib\Otlp\ConfigOpts() which could then be passed to either the OtlpGrpc or OtlpHttp Exporters.
End users would see some interfaces like so:
$exporterOpts = new ConfigOpts([
'endpoint' => 'api.example.com:4317',
'compression' => 'gzip'
]);
$exp = OTLPExporter(..., $exporterOpts);
or
$exporterOpts = new ConfigOpts();
$exporterOpts->endpoint = 'api.example.com';
$exporterOpts->compression = 'gzip';
$exp = OTLPExporter(..., $exporterOpts);
ConfigOpts() would also take care of figuring out all of the Env var configuration and precedence.
This idea doesn't quite go far enough to normalise the HTTP or GRPC Exporter signatures to make them easily interchangeable but it wouldn't be far off.
Just had a thought: I was going to do this as part of this issue but maybe could be split into a new issue(?). Would be to merge OtlpHttp/SpanConverter and OtlpGrpc/SpanConverter into Otlp/SpanConverter. From when I worked on them I think they're 99-100% the same but this would save some duplication of effort between updates to either.
WIP can be found here: https://github.com/open-telemetry/opentelemetry-php/compare/main...SeanHood:otlp-config-opts
Haven't made to many changes recently
I've started working on this, PR coming soon once I self-review.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had recent activity, but it can be reopened. Thank you for your contributions.