Closed
Description
Component(s)
connector/servicegraph
Is your feature request related to a problem? Please describe.
Different telemetry sources may use different attribute names for database identification (e.g., db.name, db.system, db.system.name, database.name, sql.database). Supporting a prioritized list will ensure proper extraction of the database name regardless of source.
Currently, the DatabaseNameAttribute field in the ServiceGraph Connector component is a single string value:
// DatabaseNameAttribute is the attribute name used to identify the database name from span attributes.
// The default value is db.name.
DatabaseNameAttribute string `mapstructure:"database_name_attribute"`
This field should instead support a list of attribute names, where the first non-null value from the list is used. This will allow for more flexible configurations when different sources use varying attribute names.
Describe the solution you'd like
- Change DatabaseNameAttribute from string to []string:
DatabaseNameAttribute []string `mapstructure:"database_name_attribute"`
- Modify the logic to iterate over the list and select the first non-null value.
Describe alternatives you've considered
No response
Additional context
No response