cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Question: OpenTelemetry all Spans have informational message: "initial value not set"

ErikPost
Visitor

Hello all,

 

I have a question about a combination of Dynatrace and OpenTelemetry. By way of testing I've created a simple Spring application with one endpoint which is instrumented with OpenTelemetry(manually instrumented) and has a Dynatrace OneAgent on the host which also injects into the application.

Everything seems to be working and I get all the expected data into Dynatrace.

I do have two questions I hope someone can help me with.

 

For all Span Attributes the following message is shown in Dynatrace: "initial value not set" and there is a general message on the purepath as well with "Some attributes have not been set at span start. They cannot be used in Span capturing settings". I tried both custom Attributes and SemanticAttributes set like below and both have the same result.

 

 

parentSpan.setAttribute("http.dynaguild.name", name);
parentSpan.setAttribute(SemanticAttributes.ENDUSER_SCOPE, name);

 

 

value-not-set.png

Any idea what I am doing wrong, or what I should set?

 

And the second question is about nesting. I have two spans, a parent span and a child span. I think I set the parenting correctly but in Dynatrace they are not nested. I think all that is required is the following:

 

 

Span childSpan = tracer.spanBuilder("child-span").setParent(Context.current().with(parentSpan)).startSpan();

 

 

nesting.png 

Any ideas?

 

Thanks in advance and kind regards,

Erik

9 REPLIES 9

josef_schiessl
Dynatrace Helper
Dynatrace Helper

Hi,

regarding "initial value not set", this means that the attribute is set after span creation, so the OneAgent does not know of it when he decides based on the "Span capturing" settings if the span should be captured or not.

 

Have you tried directly setting the attribute directly in the

 

tracer.spanBuilder("span").setAttribute(...)..

 

 

And regarding setting the parent, try this:

void parentOne() {
  Span parentSpan = tracer.spanBuilder("parent").startSpan();
  try {
    childOne(parentSpan);
  } finally {
    parentSpan.end();
  }
}

void childOne(Span parentSpan) {
  Span childSpan = tracer.spanBuilder("child")
        .setParent(Context.current().with(parentSpan))
        .startSpan();
  try {
    // do stuff  } finally {
    childSpan.end();
  }
}

Let me know if it worked!

 

Cheers,

Josef

Hi @josef_schiessl ,

 

Thanks a lot for the reply!

 

Regarding your first point you are totally right, after also setting the Attributes when creating the Span the message dissapears 🙂

 

Regarding your second solution about setting the parent. Unfortunately that seems like what I was already doing and even after copying your code 1 on 1, I get the same results. Do you have any other idea what I can try?

 

Kind regards,

Erik

Hi Erik!

I just verfied this with the team and you are doing everything correct.
This is currently a limitation by the OneAgent, so spans are always reported in a flat hierarchy. But this is currently actively being worked on for all technologies. So this will work in the near future!

 

Cheers,

Josef

Hi @josef_schiessl 

 

Thanks again for answering, much appreciated!

Any idea when this will be released? I know that the automatic instrumentation is planned for OneAgent 1.237. Will this feature then also be released?

 

Kind regards,

Erik

Hi,

I cannot give you an ETA - for Java it will not be in 1.237, but as I mentioned, its currently being worked on so it should not be too many versions from that. 

 

Cheers,

Josef

Alright thanks! 🙂

No worries 🙂

I'm curious about what progress the Dynatrace team has made on the flat vs. nested hierarchy capability with native tracing tools, such as with the ActivitySource and Activity types in .NET. Is there a setting that needs to be turned on within Dynatrace to change flat span hierarchies into nested relationships, or is this feature still not yet supported in .NET?

Hi,

If you enable the OneAgent feature "Improved .NET In-Process Context Propagation [Opt-In]" for the corresponding process group (requires a restart) , you should see the nested hierarchy in .NET. Please note that spans cannot have PurePath nodes as children (except the root span/activity).

Best regards,
Gurpreet

Featured Posts