Documentation
¶
Overview ¶
Package semconv contains semantic convention definitions and utilities for database attributes used by the otelsql package.
Index ¶
Constants ¶
const OTelSemConvStabilityOptIn = "OTEL_SEMCONV_STABILITY_OPT_IN"
OTelSemConvStabilityOptIn is an environment variable. It can be set to "database/dup" to emit both the old and the stable database conventions, allowing for a seamless transition.
Variables ¶
This section is empty.
Functions ¶
func ErrorTypeAttributes ¶
ErrorTypeAttributes converts an error to a slice of attribute.KeyValue.
func NewDBQueryTextAttributes ¶
func NewDBQueryTextAttributes(optInType OTelSemConvStabilityOptInType) func(query string) []attribute.KeyValue
NewDBQueryTextAttributes returns a function that generates appropriate database query attributes based on the provided OTelSemConvStabilityOptInType.
- OTelSemConvStabilityOptInNone: Only legacy db.statement attribute
- OTelSemConvStabilityOptInDup: Both legacy db.statement and stable db.query.text attributes
- OTelSemConvStabilityOptInStable: Only stable db.query.text attribute
Types ¶
type OTelSemConvStabilityOptInType ¶
type OTelSemConvStabilityOptInType int
OTelSemConvStabilityOptInType represents the type of semantic convention stability opt-in.
const ( // OTelSemConvStabilityOptInNone indicates no opt-in. // This is the default behavior. It only emits the old database semantic conventions. OTelSemConvStabilityOptInNone OTelSemConvStabilityOptInType = iota // OTelSemConvStabilityOptInDup indicates to emit both old and new stable database conventions. OTelSemConvStabilityOptInDup // OTelSemConvStabilityOptInStable indicates to only emit new stable database conventions. OTelSemConvStabilityOptInStable )
func ParseOTelSemConvStabilityOptIn ¶
func ParseOTelSemConvStabilityOptIn() OTelSemConvStabilityOptInType
ParseOTelSemConvStabilityOptIn reads the OTEL_SEMCONV_STABILITY_OPT_IN environment variable and returns the corresponding OTelSemConvStabilityOptInType value based on its content. It prioritizes checking for "database/dup" before "database" to determine the opt-in type.