Skip to content

[connector/servicegraph] change database_name_attribute to accept a list of values #37777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rlankfo opened this issue Feb 7, 2025 · 3 comments · Fixed by #39133
Closed

[connector/servicegraph] change database_name_attribute to accept a list of values #37777

rlankfo opened this issue Feb 7, 2025 · 3 comments · Fixed by #39133
Assignees
Labels

Comments

@rlankfo
Copy link
Member

rlankfo commented Feb 7, 2025

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

@rlankfo rlankfo added enhancement New feature or request needs triage New item requiring triage labels Feb 7, 2025
Copy link
Contributor

github-actions bot commented Feb 7, 2025

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@Frapschen
Copy link
Contributor

Although it is a breaking change, I think it’s worth making that change.

@JaredTan95 JaredTan95 removed the needs triage New item requiring triage label Apr 3, 2025
@JaredTan95
Copy link
Member

make sense, I will update.

@JaredTan95 JaredTan95 self-assigned this Apr 3, 2025
@atoulme atoulme closed this as completed in a9518cd Apr 7, 2025
dmathieu pushed a commit to dmathieu/opentelemetry-collector-contrib that referenced this issue Apr 8, 2025
…ist of values (open-telemetry#39133)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Supporting a prioritized list of attribute names for database
identification (e.g., db.name, db.system, db.system.name, database.name,
sql.database)

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes
open-telemetry#37777

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

---------

Signed-off-by: Jared Tan <[email protected]>
Co-authored-by: Antoine Toulme <[email protected]>
LucianoGiannotti pushed a commit to LucianoGiannotti/opentelemetry-collector-contrib that referenced this issue Apr 9, 2025
…ist of values (open-telemetry#39133)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Supporting a prioritized list of attribute names for database
identification (e.g., db.name, db.system, db.system.name, database.name,
sql.database)

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes
open-telemetry#37777

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

---------

Signed-off-by: Jared Tan <[email protected]>
Co-authored-by: Antoine Toulme <[email protected]>
Fiery-Fenix pushed a commit to Fiery-Fenix/opentelemetry-collector-contrib that referenced this issue Apr 24, 2025
…ist of values (open-telemetry#39133)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Supporting a prioritized list of attribute names for database
identification (e.g., db.name, db.system, db.system.name, database.name,
sql.database)

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes
open-telemetry#37777

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

---------

Signed-off-by: Jared Tan <[email protected]>
Co-authored-by: Antoine Toulme <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants