opentelemetry-php icon indicating copy to clipboard operation
opentelemetry-php copied to clipboard

Merge HTTP and GRPC OTLP Exporters into a single interface

Open SeanHood opened this issue 4 years ago • 7 comments

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 avatar Jul 21 '21 19:07 SeanHood

@SeanHood - are you planning on working on this ticket or are you hoping someone else will work on it?

bobstrecansky avatar Aug 05 '21 13:08 bobstrecansky

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.

SeanHood avatar Aug 16 '21 16:08 SeanHood

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.

SeanHood avatar Sep 15 '21 10:09 SeanHood

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

SeanHood avatar Oct 31 '21 12:10 SeanHood

I've started working on this, PR coming soon once I self-review.

brettmc avatar Nov 25 '21 15:11 brettmc

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.

stale[bot] avatar Feb 18 '22 09:02 stale[bot]

This issue has been automatically closed because it has not had recent activity, but it can be reopened. Thank you for your contributions.

stale[bot] avatar Feb 27 '22 01:02 stale[bot]