-
Notifications
You must be signed in to change notification settings - Fork 272
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
Move processing of endpoints to UriEndpoint and SocketEndpoint #3950
Conversation
@BrynCooke, please consider creating a changeset entry in |
CI performance tests
|
9f3777a
to
26bcbe8
Compare
This removes duplicated logic across exporters. Part of #3226
26bcbe8
to
9e01cd6
Compare
@@ -5336,6 +5333,9 @@ expression: "&schema" | |||
"zipkin": { | |||
"description": "Zipkin exporter configuration", | |||
"type": "object", | |||
"required": [ |
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 should have been required all along.
@@ -4949,8 +4947,7 @@ expression: "&schema" | |||
"properties": { | |||
"endpoint": { | |||
"description": "The endpoint to send reports to", | |||
"type": "string", | |||
"format": "uri" |
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.
I may follow up to reintroduce format
into the schema.
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.
Actually, this is a mistake. We accept default
, which is not a URI, so this must just be a string.
We may move away from accepting default
in future.
} | ||
let mut url = Url::parse(&s).map_err(serde::de::Error::custom)?; | ||
|
||
// support the case of 'collector:4317' where url parses 'collector' |
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.
Note this is tested in UriEndpoint:
assert_eq!(
UriEndpoint::from(Uri::from_static("example.com:2000"))
.to_uri(&Uri::from_static("http://localhost:9411/path2"))
.unwrap(),
Uri::from_static("http://example.com:2000/path2")
);
```
|
||
#[derive(Debug, Clone, Default, Eq, PartialEq)] | ||
pub(crate) struct UriEndpoint { | ||
uri: Option<Uri>, |
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.
The option is only needed to support the legacy format with default
? If yes, could you document it here please ?
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.
We have multiple places in the code that deal with endpoint parsing for otel exporters.
This PR removes duplicated logic across exporters and adds some tests.
The new types implement default and will allow us to use serde default in a follow up PR.
Part of #3226
Checklist
Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.
Exceptions
Note any exceptions here
Notes
Footnotes
It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this. ↩
Configuration is an important part of many changes. Where applicable please try to document configuration examples. ↩
Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions. ↩