Standard and custom semantic conventions for creating consistent, comparable attribute.Keys across services.
Import semconv and use it exclusively for defining attribute keys in telemetry.
import (
"github.com/getlantern/semconv"
"go.opentelemetry.io/otel/attribute"
)Example attribute map:
attrs := map[attribute.Key]attribute.Value{
semconv.GeoCountryISOCodeKey: attribute.StringValue("US"),
semconv.HostNameKey: attribute.StringValue("phost-abcd"),
semconv.TrackNameKey: attribute.StringValue("nidoran"),
semconv.ProxyProtocolKey: attribute.StringValue("HTTPS"),
}Example attribute slice:
attrs := []attribute.KeyValue{
{
Key: semconv.GeoCountryISOCodeKey,
Value: attribute.StringValue("US"),
},
{
Key: semconv.HostNameKey,
Value: attribute.StringValue("phost-abcd"),
},
{
Key: semconv.TrackNameKey,
Value: attribute.StringValue("nidoran"),
},
{
Key: semconv.ProxyProtocolKey,
Value: attribute.StringValue("HTTPS"),
},
}