-
Notifications
You must be signed in to change notification settings - Fork 20
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
Extended jinja template to generate template-type semantic attributes. #24
Extended jinja template to generate template-type semantic attributes. #24
Conversation
360ece4
to
0e2eb5c
Compare
0e2eb5c
to
f48f66e
Compare
Signed-off-by: Alexander Wert <alexander.wert@elastic.co>
f48f66e
to
e58f9eb
Compare
@open-telemetry/java-approvers PTAL, I think this would allow to replace some custom helpers in the agent with generated constants for this type of attributes |
cc @breedx-splk @mateuszrzeszutek to review new public API surface if you have a chance |
src/main/java/io/opentelemetry/semconv/AttributeKeyTemplate.java
Outdated
Show resolved
Hide resolved
src/main/java/io/opentelemetry/semconv/AttributeKeyTemplate.java
Outdated
Show resolved
Hide resolved
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 looks good to me. Just have the one idea around the key cache being static, but otherwise seems like a nice addition.
84be830
to
3bff4fc
Compare
Signed-off-by: Alexander Wert <alexander.wert@elastic.co>
3bff4fc
to
fa5b74d
Compare
src/main/java/io/opentelemetry/semconv/AttributeKeyTemplate.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Alexander Wert <alexander.wert@elastic.co>
e121d5d
to
23a4dc7
Compare
@jack-berg , @trask , @mateuszrzeszutek , @breedx-splk Based on the discussions above I reverted the implementation to use a final , inline-initialized map (with initial size 1) again. |
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.
LGTM, I left one more minor JavaDoc comment.
Thanks!
src/main/java/io/opentelemetry/semconv/AttributeKeyTemplate.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Alexander Wert <alexander.wert@elastic.co>
38872ca
to
3d7b883
Compare
OK, then I think it's ready to be merged. |
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.
Couple nits and a question about whether the methods to create AttributeKeyTemplate
should be public to allow users to create their own templates. None of the comments should block this PR.
With open-telemetry/build-tools#186, template-type attributes (such as
http.request.header.<key>
) can be defined in semantic convention model yaml files. With that, these template attributes can be used in code generation for the semantic conventions.This PR adds a new class
AttributeKeyTemplate
for this kind of attribute keys and extends the code generation to cover attributes likehttp.request.header.<key>
,db.elasticsearch.path_parts.<key>
,rpc.grpc.request.metadata.<key>
, etc.With this change utility classes like
CapturedHttpHeadersUtil
in the java-instrumentation repo can be replaced with instances (and corresponding constants) of the more genericAttributeKeyTemplate
class.