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

fix: append service.name to prevent it being overidden #22

Merged
merged 3 commits into from
May 9, 2024

Conversation

FinnDore
Copy link
Contributor

@FinnDore FinnDore commented Apr 7, 2024

It looks like the with_resource function overrides previous resources if called more than once leading to the service.name to be deleted :(.

Here's a small video of the current behaviour and the proposed fix. here's the repro

Kapture.2024-04-07.at.11.24.03.mp4

@FinnDore
Copy link
Contributor Author

FinnDore commented Apr 7, 2024

That's rough, couldn't get a unit test to run consistently. Guess the Otel stuff is doing stuff behind the scenes.

Kapture.2024-04-07.at.12.33.30.mp4
    #[tokio::test]
    async fn test_service_name_set() {
        let tracer = Builder::new()
            .with_token("xaat-fake-token")
            .with_dataset("fake-dataset")
            .no_env()
            .with_service_name("test")
            .tracer()
            .unwrap();
        let is_present = tracer.provider().filter(|p| {
            p.config()
                .resource
                .iter()
                .any(|(key, value)| key.as_str() == SERVICE_NAME && value.as_str() == "test")
        });

        is_present.expect("Service name not set");
    }

Copy link
Contributor

@Licenser Licenser left a comment

Choose a reason for hiding this comment

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

Good catch! Thank you 😊

@Licenser Licenser merged commit 853ba50 into axiomhq:main May 9, 2024
4 checks passed
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