Enriching the data
You may have noticed in output from the previous examples that each span emitted contains a resource
attribute. The resource
attribute provides an immutable set of attributes, representing the entity producing the telemetry. resource
attributes are not specific to tracing. Any signal that emits telemetry leverages resource attributes by adding them to the data produced at export time. As covered in Chapter 1, The History and Concepts of Observability, the resource in an application is associated with the telemetry generator, which, in the case of tracing, is TracerProvider
. The resource attribute on the span output we've seen so far is automatically provided by the SDK with some information about the SDK itself, as well as a default service.name
. The service name is used by many backends to identify the services sending traces to them; however, as you can see, the default value of unknown_service
is not a super useful name. Let's fix this. The following...