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

Unable to see traces via service.name but trace.id only #655

Open
Anshul0311 opened this issue Jul 30, 2024 · 4 comments
Open

Unable to see traces via service.name but trace.id only #655

Anshul0311 opened this issue Jul 30, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Anshul0311
Copy link

Anshul0311 commented Jul 30, 2024

Summary : Unable to see traces on NewRelic via service.name but via trace.id

Description
I am using opentelemetry-otlp to send traces to otel-collector and then otel-collector-config has an endpoint to send data to NewRelic.
I am following below example to send data to otel-collector and get the logs shown as shown in the example.
https://github.com/open-telemetry/opentelemetry-rust/tree/main/opentelemetry-otlp/examples/basic-otlp

And using this example to send traces data to newrelic.
https://github.com/newrelic/newrelic-opentelemetry-examples/tree/main/other-examples/collector/nr-config

I am able to see trace data using trace.id but not service.name . service.name is present under Resource attributes like mentioned on NewRelic opentelemetry documentation as well.

Resource SchemaURL:
Resource attributes:
-> service.name: Str(basic-otlp-example)

https://github.com/newrelic/newrelic-opentelemetry-examples/tree/main/other-examples/collector/nr-config.

Log output on otel-collector :

Resource SchemaURL:
Resource attributes:
     -> service.name: Str(basic-otlp-example)
ScopeSpans #0
ScopeSpans SchemaURL:
InstrumentationScope basic
InstrumentationScope attributes:
     -> scope-key: Str(scope-value)
Span #0
    Trace ID       : f3f6a43579f63734fe866d34d9aa0b88
    Parent ID      : b66eacd1fcc728d3
    ID             : af01696ea60b9229
    Name           : Sub operation...
    Kind           : Internal
    Start time     : 2024-05-22 20:25:42.877134 +0000 UTC
    End time       : 2024-05-22 20:25:42.8771425 +0000 UTC
    Status code    : Unset
    Status message :
Attributes:
     -> another.key: Str(yes)
Events:
SpanEvent #0
     -> Name: Sub span event
     -> Timestamp: 2024-05-22 20:25:42.8771371 +0000 UTC
     -> DroppedAttributesCount: 0

Language used : rust

Code Reference (Rust)

static RESOURCE: Lazy<Resource> = Lazy::new(|| {
    Resource::new(vec![KeyValue::new(
        opentelemetry_semantic_conventions::resource::SERVICE_NAME,
        "basic-otlp-example",
    )])
});

fn init_tracer_provider() -> Result<sdktrace::TracerProvider, TraceError> {
    opentelemetry_otlp::new_pipeline()
        .tracing()
        .with_exporter(
            opentelemetry_otlp::new_exporter()
                .tonic()
                .with_endpoint("http://localhost:4317"),
        )
        .with_trace_config(Config::default().with_resource(RESOURCE.clone()))
        .install_batch(runtime::Tokio)
}

fn main() {
    let tracer_provider = init_tracer_provider().unwrap();
    let otel_layer = tracing_opentelemetry::layer().with_layer(tracer_provider.tracer("my-tracer"));
    let subscriber = Registry::default()
                                 .with(otel_layer);
     tracing_subscriber::set_global_default(subscriber).expect("Failed");
}
@Anshul0311 Anshul0311 added the bug Something isn't working label Jul 30, 2024
@jack-berg
Copy link
Contributor

Take a look at this guide for troubleshooting issues with sending OTLP data to New Relic: https://docs.newrelic.com/docs/opentelemetry/best-practices/opentelemetry-otlp-troubleshooting/

One thing that sticks out is that your span's timestamps are quite old: 2024-05-22 20:25:42.877134. New Relic generates NrIntegrationErrors for spans that are older than 20 minutes.

If you're still experiencing issues, please open a support ticket so we can give support specific to your account.

@Anshul0311
Copy link
Author

@jack-berg Hey Jack , Thanks for your response. Span that I have posted are for examples to demonstrate that I am getting spans in this format . However the attribute that I want to highlight is service.name that is a required field as mentioned in this documentation and I am getting that under the Resources Attributes section as mentioned in the log but not in the traces section of NewRelic

https://docs.newrelic.com/docs/opentelemetry/best-practices/opentelemetry-best-practices-resources/

Also I don't get any errors as such but will surely look at the documentation that you have mentioned for troubleshooting.

@jack-berg
Copy link
Contributor

Nothing else looks wrong about the data from here. I would need to know more account details to assist further, but suggest you open a support ticket for that since it wouldn't be good to share account details on github.

@Anshul0311
Copy link
Author

@jack-berg Additionally, I would like to you to know that , My service.name i.e loom-screen-service is getting printed here. And when I open the trace I get this error. No root span .

I am attaching screenshots for your reference , if you would like to add some points here.

Screenshot 2024-07-31 at 3 03 54 AM Screenshot 2024-07-31 at 3 01 17 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants