-
Notifications
You must be signed in to change notification settings - Fork 320
Rename request ID to correlation ID #2757
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
base: main
Are you sure you want to change the base?
Conversation
| # under the License. | ||
| # | ||
|
|
||
| org.apache.polaris.service.config.ConfigRelocationInterceptor No newline at end of file |
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.
nit : newline ?
| # polaris.metrics.tags.region=us-west-2 | ||
|
|
||
| polaris.tracing.request-id-generator.type=default | ||
| polaris.tracing.request-id-generator.header-name=Polaris-Request-Id |
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.
minor / optional : does the header name has to to do anything with the generator, wondering if we just reuse the name we had earlier, WDYT ?
| polaris.tracing.request-id-generator.header-name=Polaris-Request-Id | |
| polaris.tracing.request-id-header-name=Polaris-Request-Id |
CHANGELOG.md
Outdated
| * The property `polaris.log.request-id-header-name` has been renamed to | ||
| `polaris.tracing.request-id-generator.header-name`; the old name is still supported for backwards | ||
| compatibility, but will generate a warning. |
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.
should we use word deperecated ?
|
@singhpk234 thanks for the review, but due to the Helm chart test failures, I think we need to find a new root for the request ID configuration. Mixing it with Let me put this into draft state and think a bit more about this. Sorry for that. |
8d8ac7c to
abd90f6
Compare
630691c to
b3cbcb1
Compare
|
@singhpk234 sorry for the late reply, I was OOO last week. I think I have a better solution now, although it requires renaming a few existing classes. LMK what you think. Thanks! |
| # quarkus.fault-tolerance.global.timeout.unit=minutes | ||
| # quarkus.fault-tolerance.global.timeout.value=10 | ||
|
|
||
| polaris.correlation-id.header-name=Polaris-Request-Id |
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 didn't change the value of this setting as this would be a breaking change, but Polaris-Correlation-Id would have been a better default.
| public class CorrelationIdFilter { | ||
|
|
||
| public static final String REQUEST_ID_KEY = "requestId"; | ||
| public static final String CORRELATION_ID_KEY = "requestId"; |
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.
Same here, correlationId would have been more appropriate imho, but it's too late.
|
|
||
| @Nullable | ||
| @Override | ||
| protected String getRequestId() { |
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 also didn't change this method and didn't change PolarisEvent.requestId because it's persisted in the database under the column name request_id. I think it's not worth changing this.
b3cbcb1 to
1146eed
Compare
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.
Code changes LGTM 👍
| - POLARIS | ||
|
|
||
| # -- Configuration for correlation IDs. | ||
| correlationId: |
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.
Sorry for coming late to this PR, but I wonder if we may want to support standard OTel context propagation techniques instead 🤔
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.
We already support that :-) In Quarkus, W3C Trace Context propagation is enabled by default:
https://quarkus.io/guides/opentelemetry-tracing#propagators
IOW, Polaris correlation ID can be considered a simplified alternative to OTel context propagation; but the former doesn't preclude the latter. You can perfectly combine both techniques together.
Polaris correlation ID has one small advantage though: it is included in Polaris events, while OTel context is not. So the only way to correlate a Polaris event with an OTel trace is to first locate the trace using the correlation ID from the event.
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.
Interesting... I think we should propagate OTel context into events. OTel has a concept of "detached" links... This is certainly beyond this scope of this PR, though 😉
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.
For ref: I think Span kinds of Producer (Polaris side) and Consumer (event receiver) would fit this kind of context propagation.
https://opentelemetry.io/docs/concepts/signals/traces/#producer
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 the choice to use a specific SpanKind depends on the event receiver and what it does with events.
A span with SpanKind.PRODUCER would be the right thing to do if the event is being sent to a message queue.
But if the event is being sent via HTTP or gRPC to a remote system, a span with SpanKind.CLIENT would be more appropriate.
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.
Good point 👍 I was actually thinking of embedding an outgoing OTel context into the event itself. This way regardless of the event delivery technology, consumers may want to perform async tasks that actually related to the event data, so in that case they would have the option of linking a CONSUMER span to the Polaris Event's PRODUCER span.... just an idea.
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.
Hmm I'm not sure I fully understand your example. I'd imagine that, if some event listener wants to send the event to a remote system and propagate OTel context, it would leverage the OTel SDK and do something like this:
@Inject Tracer tracer;
void processEvent(PolarisEvent event) {
var span = tracer.spanBuilder("polaris event delivery").setSpanKind(SpanKind.PRODUCER).startSpan();
try (Scope scope = span.makeCurrent()) {
sendEventToMessageQueue(event);
}
}The created span would have the current request span as its parent, then the OTel magic would kick in when the appropriate propagator is invoked.
We might not even have to do this btw, some message queue clients probably already add a PRODUCER span transparently whenever they produce a record to the message broker.
The CONSUMER span kind would have to be created on the receiving side (the message broker) for this to work, but I bet this is the case for most popular message queues as they have the required instrumentation already.
Would that example solve your problem?
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 question how context propagation happens... sendEventToMessageQueue will probably use some integration code that takes the context and passes it to the message queue as a "header" of sorts.
If out intention is to correlate with Polaris events using only Polaris "specs", we could put the outgoing context into the event as an attribute.
1146eed to
35d0208
Compare
| * | ||
| * <p>All responses will include the correlation ID in this header. | ||
| */ | ||
| String headerName(); |
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.
Nit: add a @WithDefault?
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 seems we prefer in Polaris to have a default declared in runtime/defaults/src/main/resources/application.properties, rather than a default declared in the Java class.
Do you prefer the other way around? I don't have a strong preference 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 don't mind either.
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| public class ConfigRelocationInterceptor extends RelocateConfigSourceInterceptor { |
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.
👍 for adding this!
|
Putting this again back to draft 😅 – waiting on the ML discussion outcome: https://lists.apache.org/thread/bb1qyxjt827t3tomv2xp0s1kovxjsp94 My apologies to those who already reviewed, but I think we are making good progress towards a thorough design. |
Context: #2720 (comment)
I moved everything to the `polaris.tracing` config root because it was the easiest move, but we could move the configuration to some other root – just let me know.EDIT
After giving this some more thought I decided to give a better name to this functionality: after some googling it seems that "correlation ID" is a fairly common name, hence I renamed
RequestIdFilterandRequestIdGeneratortoCorrelationIdFilterandCorrelationIdGenerator.The configuration is now under the root
polaris.correlation-id. The helm chart exposes this configuration undercorrelationId.The old config is still supported.