-
Notifications
You must be signed in to change notification settings - Fork 851
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
enhance OTLP Exporter configuration #1373
enhance OTLP Exporter configuration #1373
Conversation
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
Codecov Report
@@ Coverage Diff @@
## master #1373 +/- ##
=========================================
Coverage 92.00% 92.00%
Complexity 888 888
=========================================
Files 114 114
Lines 3178 3178
Branches 262 262
=========================================
Hits 2924 2924
Misses 173 173
Partials 81 81 Continue to review full report at Codecov.
|
* </ul> | ||
* | ||
* <p>For environment variables, {@link OtlpGrpcSpanExporter} will look for the following names: | ||
* | ||
* <ul> | ||
* <li>{@code OTEL_OTLP_SPAN_TIMEOUT}: to set the max waiting time allowed to send each span | ||
* batch. | ||
* <li>{@code OTEL_OTLP_ENDPOINT}: to set the endpoint to connect to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a proposal in the specs to standardize environment variables for this sort of thing. Can you please add a comment to https://github.com/open-telemetry/opentelemetry-specification/pull/666/files with the needs here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. We'll almost certainly need to update all of these env vars when the env var proposal gets merged. |
Overall good, I definitely prefer to have it here than in the agent code. Two small things:
My preference would be to simplify things and remove the option to specify a |
private ManagedChannel channel; | ||
private long deadlineMs = 1_000; // 1 second | ||
private String endpoint; | ||
private boolean useTls; | ||
private Metadata metadata; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nullable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
private ManagedChannel channel; | ||
private long deadlineMs = 1_000; // 1 second | ||
private String endpoint; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nullable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
if (metadataValue != null) { | ||
for (String keyValueString : Splitter.on(';').split(metadataValue)) { | ||
final List<String> keyValue = Splitter.on('=').splitToList(keyValueString); | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra semicolon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like it's still there...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed one more time
String metadataValue = getStringProperty(KEY_METADATA, configMap); | ||
if (metadataValue != null) { | ||
for (String keyValueString : Splitter.on(';').split(metadataValue)) { | ||
final List<String> keyValue = Splitter.on('=').splitToList(keyValueString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Believe you can use Splitter.withKeyValueSeparator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to create a static final with the splitter
`private static final Splitter.MapSplitter METADATA_PROPERTY_SPLITTER = Splitter.on(';').trimResults().omitEmptyStrings().withKeyValueSplitter('=');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
withKeyValueSeparator
is annotated by @Beta
, should we use it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof - good catch, I always forget that. Yeah let's not use it.
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
|
Let's try this out - it seems @anuraaga's feedback has been all addressed, so we are ready to merge this? ;) |
I think so. |
I'd suggest only annotating with |
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
@trask I removed |
OTLP Exporter in opentelemetry-java-instrumentation is not configurable to:
From PR open-telemetry/opentelemetry-java-instrumentation#567 (comment)
Decided to try add configuration directly to OTLP Exporter.