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

Add HttpSender abstraction #5505

Merged
merged 3 commits into from
Jun 13, 2023
Merged

Conversation

jack-berg
Copy link
Member

Part of #5351.

This is the first of several phases. Adds HttpSender interface, with OkHttpHttpSender implementation. All of this still lives in opentelemetry-exporter-common so this is just a refactor with no functional change at this point.

@jack-berg jack-berg requested a review from a team June 5, 2023 16:47
@codecov
Copy link

codecov bot commented Jun 5, 2023

Codecov Report

Patch coverage: 90.05% and project coverage change: +0.02 🎉

Comparison is base (9bc34d7) 91.31% compared to head (d9cdfbd) 91.34%.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5505      +/-   ##
============================================
+ Coverage     91.31%   91.34%   +0.02%     
- Complexity     4892     4893       +1     
============================================
  Files           547      546       -1     
  Lines         14412    14432      +20     
  Branches       1354     1351       -3     
============================================
+ Hits          13161    13183      +22     
+ Misses          866      863       -3     
- Partials        385      386       +1     
Impacted Files Coverage Δ
...rter/otlp/http/metrics/OtlpHttpMetricExporter.java 84.61% <ø> (ø)
...telemetry/exporter/internal/http/HttpExporter.java 78.18% <78.18%> (ø)
...ry/exporter/internal/http/HttpExporterBuilder.java 90.69% <90.69%> (ø)
...try/exporter/internal/okhttp/OkHttpHttpSender.java 98.43% <98.43%> (ø)
...elemetry/exporter/internal/auth/Authenticator.java 100.00% <100.00%> (ø)
...entelemetry/exporter/internal/retry/RetryUtil.java 100.00% <100.00%> (ø)
...rter/otlp/http/logs/OtlpHttpLogRecordExporter.java 77.77% <100.00%> (ø)
...lp/http/logs/OtlpHttpLogRecordExporterBuilder.java 90.00% <100.00%> (ø)
...lp/http/metrics/OtlpHttpMetricExporterBuilder.java 95.23% <100.00%> (ø)
...exporter/otlp/http/trace/OtlpHttpSpanExporter.java 77.77% <100.00%> (ø)
... and 1 more

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

* @see HttpExporter
* @see HttpExporterBuilder
*/
public interface HttpSender {
Copy link
Contributor

Choose a reason for hiding this comment

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

I've had to create this thing in multiple projects now. It's almost like the java ecosystem needs an http client equivalent of slf4j. 🤔

Copy link
Member Author

@jack-berg jack-berg Jun 7, 2023

Choose a reason for hiding this comment

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

jdk http client theoretically could put the "which http client" question to rest. Needs performance to be very competitive though, and probably full support for http2 (i.e. trailing headers)..

Copy link
Contributor

Choose a reason for hiding this comment

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

And be based on an interface, not an abstract class. 😿

*/
void send(
Consumer<OutputStream> marshaler,
int contentLength,
Copy link
Contributor

Choose a reason for hiding this comment

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

since this is still internal, it's probably fine to just have this sitting here for now, but I would imagine we might want to create a "HttpMetadata" interface or something to pass in here, which might need to include more headers/etc in the future.

Copy link
Contributor

@jkwatson jkwatson left a comment

Choose a reason for hiding this comment

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

Thanks!

@jack-berg jack-berg merged commit f89fc05 into open-telemetry:main Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants