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

Move processing of endpoints to UriEndpoint and SocketEndpoint #3950

Merged
merged 4 commits into from
Oct 3, 2023

Conversation

BrynCooke
Copy link
Contributor

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.

  • Changes are compatible1
  • Documentation2 completed
  • Performance impact assessed and acceptable
  • Tests added and passing3
    • Unit Tests
    • Integration Tests
    • Manual Tests

Exceptions

Note any exceptions here

Notes

Footnotes

  1. 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.

  2. Configuration is an important part of many changes. Where applicable please try to document configuration examples.

  3. Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2023

@BrynCooke, please consider creating a changeset entry in /.changesets/. These instructions describe the process and tooling.

@router-perf
Copy link

router-perf bot commented Oct 2, 2023

CI performance tests

  • events_big_cap_high_rate - Stress test for events with a lot of users, deduplication enabled and high rate event with a big queue capacity
  • events_without_dedup - Stress test for events with a lot of users and deduplication DISABLED
  • events - Stress test for events with a lot of users and deduplication ENABLED
  • large-request - Stress test with a 1 MB request payload
  • step - Basic stress test that steps up the number of users over time
  • xlarge-request - Stress test with 10 MB request payload
  • reload - Reload test over a long period of time at a constant rate of users
  • no-graphos - Basic stress test, no GraphOS.
  • xxlarge-request - Stress test with 100 MB request payload
  • step-jemalloc-tuning - Clone of the basic stress test for jemalloc tuning
  • const - Basic stress test that runs with a constant number of users

This removes duplicated logic across exporters.

Part of #3226
@BrynCooke BrynCooke requested review from Geal, bnjjj, a team and lrlna October 2, 2023 12:03
@@ -5336,6 +5333,9 @@ expression: "&schema"
"zipkin": {
"description": "Zipkin exporter configuration",
"type": "object",
"required": [
Copy link
Contributor Author

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"
Copy link
Contributor Author

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.

Copy link
Contributor Author

@BrynCooke BrynCooke Oct 2, 2023

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'
Copy link
Contributor Author

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>,
Copy link
Contributor

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 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@BrynCooke BrynCooke requested a review from bnjjj October 3, 2023 10:28
@BrynCooke BrynCooke merged commit 1c851d5 into dev Oct 3, 2023
2 checks passed
@BrynCooke BrynCooke deleted the bryn/endpoint2 branch October 3, 2023 13:34
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.

2 participants