-
Notifications
You must be signed in to change notification settings - Fork 17
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
Observation otel IT #297
base: main
Are you sure you want to change the base?
Observation otel IT #297
Conversation
e72ea9e
to
d10383f
Compare
df73490
to
58c8a10
Compare
d81b882
to
f4d5752
Compare
f4d5752
to
7660fd5
Compare
Need to make the tests more resilient. |
7660fd5
to
198230b
Compare
new OpenTelemetryObservationHandler(tracer))) | ||
// todo duplicate the tracer strategy for baggage, adding a condition to bypass when no baggage is present | ||
// todo just implement the receiver and sender handlers | ||
// todo. Alternatively we can split in 2 the tracing handlers, one to create spans (in the current .observationHandler(new ObservationHandler.FirstMatchingCompositeObservationHandler ) | ||
// todo. A new .observationHandler bloc to process the baggage on the receiver side. | ||
// todo. Another to propagate the context in a new .observationHandler ) | ||
// todo. We assume on the receiver side we open and close the baggage once because it should have just 1 scope app wide and the | ||
// todo. user will use the baggage api itself. We are just making sure we don't break the propagation to the user. |
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.
Is this ok?
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.
It means it doesn't provide baggage propagation through the Observation API. The OTel API can be used instead...
Implementing this is not trivial and the comment explains the possible approach.
@@ -56,6 +56,7 @@ public String get(C carrier, String key) { | |||
return getter.get(carrier, key); | |||
} | |||
}); | |||
// extracted.makeCurrent(); // this actually fixes the baggage test |
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.
Is this ok?
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.
Basically, if you uncomment, baggage propagation will be fixed, is there for reference... We can remove these comments but I will need to document these things somewhere, maybe on a README... What do you think?
final Attributes highCardAttributes = context.get(HIGH_CARD_ATTRIBUTES); | ||
setOtelAttributes(span, highCardAttributes); | ||
|
||
final Attributes lowCardAttributes = context.get(LOW_CARD_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.
Are these always set, no matter what?
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.
The low cardinality ones, yes.
The high cardinality are only used in traces.
This is there to go around a limitation of the Observation API... Currently, It only supports storage of Strings. Will file a feature request there.
|
||
final Attributes lowCardAttributes = context.get(LOW_CARD_ATTRIBUTES); | ||
setOtelAttributes(span, lowCardAttributes); | ||
|
||
for (KeyValue keyValue : context.getAllKeyValues()) { |
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 it contain keys from HIGH_CARD_ATTRIBUTES
and LOW_CARD_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.
yes, but originally stored in 2 different structures.
|
||
@Override | ||
public KeyName[] getHighCardinalityKeyNames() { | ||
return KeyName.merge(HighCardinalityValues.values(), ServerHighCardinalityValues.values()); |
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.
Probably cache the merge?
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.
They are session scoped
|
||
@Override | ||
public KeyName[] getHighCardinalityKeyNames() { | ||
return KeyName.merge(HighCardinalityValues.values(), ClientHighCardinalityValues.values()); |
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.
Probably cache the merge?
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.
They are session scoped
} | ||
}; | ||
|
||
public enum LowCardinalityValues implements KeyName { |
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.
Do the names come from some spec or it is our feeling?
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.
From the OTel semconv, yes. I followed the latest versions
builder.put(HTTP_ROUTE.getKey(), request.getUri().getPath().toString());// Fixme must contain a template /users/:userID? | ||
|
||
builder.put(HTTP_REQUEST_METHOD, request.getMethod());// FIXME semantic conventions |
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.
Is this ok?
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 needs updating. Will fix
No description provided.