What does the status_code label of a span metric mean?

According to the documentation the metrics processor adds a status_code label to each metric, which can have following values:

STATUS_CODE_UNSET - Result of the span was unset/unknown
STATUS_CODE_OK - The span operation completed successfully
STATUS_CODE_ERROR - The span operation completed with an error
(Span metrics | Grafana Tempo documentation)

Even with this short description it is still unclear to me what those status codes mean and how they can be used effectively.
Some questions that come to my mind are: What even is the result of span? And in what cases can it be unknown? What types of erros can occur during a span operation?

It might be helpful for me to have some examples for these status codes. Also some guidance on how they can be used to generate meaningful insights is appreciated.

Hi @johgey. Status comes from the OTel spec for status. It tells the status of the operation it’s measuring, not of the span itself. So a span with status = error means that the operation failed. That could be an HTTP request, a db insert, or anything else that span might be recording.

1 Like