[go: nahoru, domu]

Skip to content
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

refactor otlp exporter #838

Merged
merged 38 commits into from
Nov 2, 2022
Merged

refactor otlp exporter #838

merged 38 commits into from
Nov 2, 2022

Conversation

brettmc
Copy link
Collaborator
@brettmc brettmc commented Oct 7, 2022

Remove OtlpHttp and OtlpGrpc exporters, and replace with Otlp\SpanExporter and Otlp\MetricExporter using a transport to manage grpc and http/protobuf complexity.
Allow setting signal and protocol on transport factories (particularly for grpc, which uses signal to look up grpc method)
Adding BC for OtlpHttp and OtlpGrpc, which will still fail but with a more helpful message.
Fix failing examples.
Send user-agent header with otlp exports.
Allow otlp http/json

continuing on from Nevay's work, this removes the individual OtlpHttp and OtlpGrpc exporters, and replaces with
Otlp\Exporter using a transport to manage grpc and http/protobuf complexity.
verified that the call attributes have the same values when using TraceServiceClient
@codecov
Copy link
codecov bot commented Oct 7, 2022

Codecov Report

Merging #838 (0bc286e) into main (ba98992) will decrease coverage by 0.09%.
The diff coverage is 39.39%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #838      +/-   ##
============================================
- Coverage     80.90%   80.80%   -0.10%     
+ Complexity     1973     1951      -22     
============================================
  Files           246      248       +2     
  Lines          5173     5122      -51     
============================================
- Hits           4185     4139      -46     
+ Misses          988      983       -5     
Flag Coverage Δ
7.4 80.29% <39.39%> (-0.10%) ⬇️
8.0 80.80% <39.39%> (-0.10%) ⬇️
8.1 80.94% <39.39%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/API/Common/Signal/Signals.php 0.00% <0.00%> (ø)
src/Contrib/Grpc/GrpcTransportFactory.php 53.33% <ø> (-2.23%) ⬇️
src/Contrib/Otlp/MetricExporter.php 38.70% <ø> (+38.70%) ⬆️
src/Contrib/Otlp/ProtobufSerializer.php 0.00% <ø> (ø)
src/Contrib/Otlp/Protocols.php 0.00% <0.00%> (ø)
src/Contrib/Otlp/SpanExporterFactory.php 0.00% <0.00%> (ø)
...DK/Common/Export/Stream/StreamTransportFactory.php 0.00% <0.00%> (ø)
src/SDK/Resource/Detectors/Process.php 100.00% <ø> (ø)
src/SDK/Common/Export/Http/PsrTransportFactory.php 72.22% <16.66%> (-27.78%) ⬇️
src/Contrib/Grpc/GrpcTransport.php 53.12% <75.00%> (+3.12%) ⬆️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba98992...0bc286e. Read the comment docs.

@brettmc brettmc changed the title efactor otlp exporter refactor otlp exporter Oct 7, 2022
This reverts commit bbb685b.
Mocking proto-generated files segfaults with ext-protobuf (which is harder to diagnose when running in a child process, which
was required for fancy mockery mocking of "new". So, back to the prototype approach, and skip the tests if ext-protobuf enabled.
@brettmc brettmc linked an issue Oct 7, 2022 that may be closed by this pull request
@brettmc brettmc marked this pull request as draft October 12, 2022 00:08
@brettmc brettmc marked this pull request as ready for review October 12, 2022 05:59
@bobstrecansky
Copy link
Collaborator

LGTM sans the conflict.

src/Contrib/Grpc/GrpcTransportFactory.php Outdated Show resolved Hide resolved
src/SDK/Common/Export/TransportFactoryInterface.php Outdated Show resolved Hide resolved
src/Contrib/OtlpHttp/OtlpHttpTransportFactory.php Outdated Show resolved Hide resolved
{
$factoryClass = self::KNOWN_TRANSPORT_FACTORIES[self::normalizeProtocol($protocol)];
self::validateClass($factoryClass);
$factory = new $factoryClass();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users should be able to provide custom transport factory implementations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we would need to invent a new env var for that, something like OTEL_PHP_TRANSPORT_FACTORY_CLASS...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking of a follow-up PR which allows registering exporter and transport factories, and using composer autoload->files to register our initial set.

src/SDK/Common/Environment/EnvironmentVariablesTrait.php Outdated Show resolved Hide resolved
src/Contrib/Grpc/GrpcTransportFactory.php Outdated Show resolved Hide resolved
src/Contrib/Grpc/composer.json Outdated Show resolved Hide resolved
@bobstrecansky bobstrecansky merged commit 0b43fac into open-telemetry:main Nov 2, 2022
@erdemkose
Copy link
Contributor
erdemkose commented Nov 3, 2022

Great improvement. Thanks for the effort. I want to try it on a small project to see it in a real-world environment. Do you plan to create a new tag (0.0.16) with the changes?

@brettmc
Copy link
Collaborator Author
brettmc commented Nov 3, 2022

Hi @erdemkose good idea, we'll get one out soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants