-
Notifications
You must be signed in to change notification settings - Fork 1k
Deprecate DbClientCommonAttributesGetter #15139
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
Conversation
...ava/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlClientAttributesGetter.java
Show resolved
Hide resolved
...ava/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlClientAttributesGetter.java
Show resolved
Hide resolved
| @Override | ||
| public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST request) { | ||
| super.onStart(attributes, parentContext, request); | ||
| // Common attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could consider placing the common part to util class or perhaps even a static package private method in DbClientAttributesExtractor that could also be called from here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this worked out, ptal
...ava/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlClientAttributesGetter.java
Show resolved
Hide resolved
| import io.opentelemetry.instrumentation.api.internal.SpanKeyProvider; | ||
| import javax.annotation.Nullable; | ||
|
|
||
| abstract class DbClientCommonAttributesExtractor< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can delete this right away since not public
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could also consider keeping the common extractor, since it is just an implementation detail, deleting it is fine too
| public final class SqlClientAttributesExtractor<REQUEST, RESPONSE> | ||
| extends DbClientCommonAttributesExtractor< | ||
| REQUEST, RESPONSE, SqlClientAttributesGetter<REQUEST, RESPONSE>> { | ||
| implements AttributesExtractor<REQUEST, RESPONSE>, SpanKeyProvider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is ok since DbClientCommonAttributesExtractor wasn't public
| /** | ||
| * SqlClientAttributesExtractor will try to populate db.operation.name based on {@link | ||
| * #getRawQueryTexts(REQUEST)}, but this can be used to explicitly provide the operation name. | ||
| */ | ||
| @Override | ||
| @Nullable | ||
| default String getDbOperationName(REQUEST request) { | ||
| return null; | ||
| } | ||
|
|
||
| /** | ||
| * SqlClientAttributesExtractor will try to populate db.operation.name based on {@link | ||
| * #getRawQueryTexts(REQUEST)}, but this can be used to explicitly provide the operation name. | ||
| */ | ||
| @Override | ||
| @Nullable | ||
| default String getDbQueryText(REQUEST request) { | ||
| return null; | ||
| } | ||
|
|
||
| /** | ||
| * SqlClientAttributesExtractor will try to populate db.operation.name based on {@link | ||
| * #getRawQueryTexts(REQUEST)}, but this can be used to explicitly provide the operation name. | ||
| */ | ||
| @Override | ||
| @Nullable | ||
| default String getDbQuerySummary(REQUEST request) { | ||
| return null; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these methods have same defaults in super interface, but we have comments to remove the defaults in the super interface at which time we'll still want them here
| extends DbClientCommonAttributesExtractor< | ||
| REQUEST, RESPONSE, DbClientAttributesGetter<REQUEST, RESPONSE>> { | ||
| implements AttributesExtractor<REQUEST, RESPONSE>, SpanKeyProvider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is ok since DbClientCommonAttributesExtractor wasn't public
|
🔧 The result from spotlessApply was committed to the PR branch. |
Semconv doesn't have this concept.
HttpCommonAttributesGetter makes sense b/c it's common attributes across both client and server.
But in semconv, Sql "extends" Db semantic conventions, and so I think our getter hierarchy should do the same.
In practice, this means that Sql getter now has things like getDbOperationName(), which I think is probably good, though we can default them to
nullin the Sql getter interface to make them not required.Related to #12608