Skip to content

Conversation

will-bem
Copy link

What does this PR do?

When using package github.com/DataDog/dd-trace-go/contrib/gorm.io/gorm.v1/v2, I want to override the resource name (because the SQL is long and unwieldy). Alas, I cannot do this with gormtrace.WithCustomTag(ext.ResourceName, ... because the span.SetTag(ext.ResourceName, db.Statement.SQL.String()) call is done after processing custom tags. Thus, I propose moving the custom tag processing to below where the default resource name is set.

Thank you for your consideration!

@will-bem will-bem requested review from a team as code owners August 21, 2025 15:19
Copy link
Member

@darccio darccio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, leaving to @rarguelloF the definitive approval. I wonder if this should be applied to other contribs with this behaviour.

@will-bem will-bem force-pushed the contrib-gorm-resource-name branch 2 times, most recently from f211614 to a1a4af1 Compare August 29, 2025 12:07
@will-bem will-bem force-pushed the contrib-gorm-resource-name branch from a1a4af1 to 4102032 Compare September 19, 2025 13:22
@will-bem
Copy link
Author

@rarguelloF Would you mind if I asked for a review of this please? I would love to be able to override the resource name! Thanks for your consideration!

Copy link
Contributor

@rarguelloF rarguelloF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes LGTM, but we should add a test for this change to ensure we don't introduce regressions in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants