How span.type is setting if using OTel exporter?

Hey, I'm trying to send traces over opentelemetry library and send them to Elastic APM (v7.17) via exporter.

I saw that there is field in metadata that's called span.type, while using apm-go-agent, I can set value for this field, but in OTel spans I can't.

So, the question is from where does APM gets this span.type and how to replace it to my own value.

I tried googling but didn't find something that could help me

Hey @axw, sorry for tagging, maybe you know the answer? Or somebody who know?

I want to see colored spans like if I use apm-go-agent

@gvencadze OTel does not have a concept of "span type", so it's not currently possible to specify it explicitly. We do infer the span.type value from OTel semantic convention attributes. For example, if your OTel span has db.* attributes, then we'll set the span type to "db".

Can you give an example of a span where you would like to explicitly set the span type? Maybe we can find an alternative, such as expanding the inference logic.

@axw
I've take a look, and I would like to see http/grpc calls to different systems in different colors. For now, using apm-go-agent I'm setting span type to http:firstSvc and http:secondSvc and it helps me to understand what exactly was done during span much faster. For example, I know that firstSvc is colored blue and second is red, so I can skip transactions without red span or something like that

I'm not sure that current way for setting span.type is correct, so maybe I shouldn't write service name after http/grpc, If you can provide a link to some docs/books/etc about making better observability I would appreciate

@gvencadze thanks for the context.

I'm not sure that current way for setting span.type is correct, so maybe I shouldn't write service name after http/grpc, If you can provide a link to some docs/books/etc about making better observability I would appreciate

This isn't how span.type is intended to be used; its value generally shouldn't be changed. I don't think we're currently doing anything special with span.type, but in the future we might for example render the UI a bit differently for spans with span.type: external and span.subtype: http.

I'm not sure that current way for setting span.type is correct, so maybe I shouldn't write service name after http/grpc, If you can provide a link to some docs/books/etc about making better observability I would appreciate

I'm not aware of any specific docs to point at for the problem you're trying to solve. I will bring this thread to the attention of the rest of the APM team, in case they have any suggestions.

@axw I've suggestion to make colors based not on span.type or span.subtype, instead of this maybe use span.destination.service.resource? I think it should resolve my problem and it's good enhancement for APM at all

1 Like

@gvencadze yes, I had the same thought, and passed the suggestion (and a link to this thread) to the APM UI team.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.