Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ request adding CHANGELOG notes for breaking (!) changes and possibly other secti

### Deprecations

* The property `polaris.log.request-id-header-name` is deprecated and has been renamed to
`polaris.correlation-id.header-name`; the old name is still supported for backwards compatibility,
but will generate a warning.

### Fixes

### Commits
Expand Down
6 changes: 4 additions & 2 deletions helm/polaris/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ ct install --namespace polaris --charts ./helm/polaris
| configMapLabels | object | `{}` | Additional Labels to apply to polaris configmap. |
| containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"runAsNonRoot":true,"runAsUser":10000,"seccompProfile":{"type":"RuntimeDefault"}}` | Security context for the polaris container. See https://kubernetes.io/docs/tasks/configure-pod-container/security-context/. |
| containerSecurityContext.runAsUser | int | `10000` | UID 10000 is compatible with Polaris OSS default images; change this if you are using a different image. |
| correlationId | object | `{"generator":{"type":"default"},"headerName":"Polaris-Request-Id"}` | Configuration for correlation IDs. |
| correlationId.generator.type | string | `"default"` | The type of the correlation ID generator to use. |
| correlationId.headerName | string | `"Polaris-Request-Id"` | The name of the header that contains the correlation ID. If a request does not contain this header, it will be assigned a new correlation ID generated using the configured generator. All responses will include the correlation ID in this header. |
| cors | object | `{"accessControlAllowCredentials":null,"accessControlMaxAge":null,"allowedHeaders":[],"allowedMethods":[],"allowedOrigins":[],"exposedHeaders":[]}` | Polaris CORS configuration. |
| cors.accessControlAllowCredentials | string | `nil` | The `Access-Control-Allow-Credentials` response header. The value of this header will default to `true` if `allowedOrigins` property is set and there is a match with the precise `Origin` header. |
| cors.accessControlMaxAge | string | `nil` | The `Access-Control-Max-Age` response header value indicating how long the results of a pre-flight request can be cached. Must be a valid duration. |
Expand Down Expand Up @@ -247,7 +250,7 @@ ct install --namespace polaris --charts ./helm/polaris
| livenessProbe.successThreshold | int | `1` | Minimum consecutive successes for the probe to be considered successful after having failed. Minimum value is 1. |
| livenessProbe.terminationGracePeriodSeconds | int | `30` | Optional duration in seconds the pod needs to terminate gracefully upon probe failure. Minimum value is 1. |
| livenessProbe.timeoutSeconds | int | `10` | Number of seconds after which the probe times out. Minimum value is 1. |
| logging | object | `{"categories":{"org.apache.iceberg.rest":"INFO","org.apache.polaris":"INFO"},"console":{"enabled":true,"format":"%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c{3.}] [%X{requestId},%X{realmId}] [%X{traceId},%X{parentId},%X{spanId},%X{sampled}] (%t) %s%e%n","json":false,"threshold":"ALL"},"file":{"enabled":false,"fileName":"polaris.log","format":"%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c{3.}] [%X{requestId},%X{realmId}] [%X{traceId},%X{parentId},%X{spanId},%X{sampled}] (%t) %s%e%n","json":false,"logsDir":"/deployments/logs","rotation":{"fileSuffix":null,"maxBackupIndex":5,"maxFileSize":"100Mi"},"storage":{"className":"standard","selectorLabels":{},"size":"512Gi"},"threshold":"ALL"},"level":"INFO","mdc":{},"requestIdHeaderName":"Polaris-Request-Id"}` | Logging configuration. |
| logging | object | `{"categories":{"org.apache.iceberg.rest":"INFO","org.apache.polaris":"INFO"},"console":{"enabled":true,"format":"%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c{3.}] [%X{requestId},%X{realmId}] [%X{traceId},%X{parentId},%X{spanId},%X{sampled}] (%t) %s%e%n","json":false,"threshold":"ALL"},"file":{"enabled":false,"fileName":"polaris.log","format":"%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c{3.}] [%X{requestId},%X{realmId}] [%X{traceId},%X{parentId},%X{spanId},%X{sampled}] (%t) %s%e%n","json":false,"logsDir":"/deployments/logs","rotation":{"fileSuffix":null,"maxBackupIndex":5,"maxFileSize":"100Mi"},"storage":{"className":"standard","selectorLabels":{},"size":"512Gi"},"threshold":"ALL"},"level":"INFO","mdc":{}}` | Logging configuration. |
| logging.categories | object | `{"org.apache.iceberg.rest":"INFO","org.apache.polaris":"INFO"}` | Configuration for specific log categories. |
| logging.console | object | `{"enabled":true,"format":"%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c{3.}] [%X{requestId},%X{realmId}] [%X{traceId},%X{parentId},%X{spanId},%X{sampled}] (%t) %s%e%n","json":false,"threshold":"ALL"}` | Configuration for the console appender. |
| logging.console.enabled | bool | `true` | Whether to enable the console appender. |
Expand All @@ -271,7 +274,6 @@ ct install --namespace polaris --charts ./helm/polaris
| logging.file.threshold | string | `"ALL"` | The log level of the file appender. |
| logging.level | string | `"INFO"` | The log level of the root category, which is used as the default log level for all categories. |
| logging.mdc | object | `{}` | Configuration for MDC (Mapped Diagnostic Context). Values specified here will be added to the log context of all incoming requests and can be used in log patterns. |
| logging.requestIdHeaderName | string | `"Polaris-Request-Id"` | The header name to use for the request ID. |
| managementService | object | `{"annotations":{},"clusterIP":"None","externalTrafficPolicy":null,"internalTrafficPolicy":null,"ports":[{"name":"polaris-mgmt","nodePort":null,"port":8182,"protocol":null,"targetPort":null}],"sessionAffinity":null,"trafficDistribution":null,"type":"ClusterIP"}` | Management service settings. These settings are used to configure liveness and readiness probes, and to configure the dedicated headless service that will expose health checks and metrics, e.g. for metrics scraping and service monitoring. |
| managementService.annotations | object | `{}` | Annotations to add to the service. |
| managementService.clusterIP | string | `"None"` | By default, the management service is headless, i.e. it does not have a cluster IP. This is generally the right option for exposing health checks and metrics, e.g. for metrics scraping and service monitoring. |
Expand Down
5 changes: 4 additions & 1 deletion helm/polaris/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ data:
{{- range $k, $v := $categories -}}
{{- $_ = set $map (printf "quarkus.log.category.\"%s\".level" $k) $v -}}
{{- end -}}
{{- $_ = set $map "polaris.log.request-id-header-name" .Values.logging.requestIdHeaderName -}}
{{- $mdc := dict -}}
{{- list .Values.logging.mdc "" $mdc | include "polaris.mergeConfigTree" -}}
{{- range $k, $v := $mdc -}}
Expand Down Expand Up @@ -208,6 +207,10 @@ data:
{{- $_ = set $map "quarkus.micrometer.enabled" "false" -}}
{{- end -}}

{{- /* Correlation ID */ -}}
{{- $_ = set $map "polaris.correlation-id.header-name" .Values.correlationId.headerName -}}
{{- $_ = set $map "polaris.correlation-id.generator.type" .Values.correlationId.generator.type -}}

{{- /* Advanced Configuration (must be done last since it can override any of the settings above) */ -}}
{{- list .Values.advancedConfig "" $map | include "polaris.mergeConfigTree" -}}

Expand Down
12 changes: 10 additions & 2 deletions helm/polaris/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,6 @@ serviceMonitor:
logging:
# -- The log level of the root category, which is used as the default log level for all categories.
level: INFO
# -- The header name to use for the request ID.
requestIdHeaderName: Polaris-Request-Id
# -- Configuration for the console appender.
console:
# -- Whether to enable the console appender.
Expand Down Expand Up @@ -518,6 +516,16 @@ realmContext:
realms:
- POLARIS

# -- Configuration for correlation IDs.
correlationId:
Copy link
Contributor

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 🤔

https://opentelemetry.io/docs/concepts/context-propagation/

Copy link
Contributor Author

@adutra adutra Oct 21, 2025

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.

Copy link
Contributor

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 😉

Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

# -- The name of the header that contains the correlation ID.
# If a request does not contain this header, it will be assigned a new correlation ID generated
# using the configured generator. All responses will include the correlation ID in this header.
headerName: Polaris-Request-Id
generator:
# -- The type of the correlation ID generator to use.
type: default

# -- Polaris features configuration.
features:
# -- Features to enable or disable globally. If a feature is not present in the map, the default
Expand Down
7 changes: 5 additions & 2 deletions runtime/defaults/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ quarkus.oidc.tenant-enabled=false
# quarkus.oidc.idp1.auth-server-url=https://auth.example.com/realms/polaris2
# quarkus.oidc.idp1.client-id=polaris2

# quarkus.otel.sdk.disabled is set to `true` by default to avoid spuriour errors about
# OpenTelemetry settings.
# quarkus.otel.sdk.disabled is set to `true` by default to avoid spurious errors about
# trace collector connections being impossible to establish. This setting can be enabled
# at runtime after configuring other OTel properties for proper trace data collection.
quarkus.otel.sdk.disabled=true
Expand All @@ -106,6 +107,9 @@ quarkus.fault-tolerance.global.timeout.enabled=false
# quarkus.fault-tolerance.global.timeout.unit=minutes
# quarkus.fault-tolerance.global.timeout.value=10

polaris.correlation-id.header-name=Polaris-Request-Id
Copy link
Contributor Author

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.

polaris.correlation-id.generator.type=default

polaris.realm-context.type=default
polaris.realm-context.realms=POLARIS
polaris.realm-context.header-name=Polaris-Realm
Expand Down Expand Up @@ -146,7 +150,6 @@ polaris.event-listener.type=no-op
# polaris.event-listener.aws-cloudwatch.region=us-east-1
# polaris.event-listener.aws-cloudwatch.synchronous-mode=false

polaris.log.request-id-header-name=Polaris-Request-Id
# polaris.log.mdc.aid=polaris
# polaris.log.mdc.sid=polaris-service

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.polaris.service.config;

import io.smallrye.config.RelocateConfigSourceInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ConfigRelocationInterceptor extends RelocateConfigSourceInterceptor {
Copy link
Member

Choose a reason for hiding this comment

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

👍 for adding this!


private static final Logger LOGGER = LoggerFactory.getLogger(ConfigRelocationInterceptor.class);

public ConfigRelocationInterceptor() {
super(ConfigRelocationInterceptor::applyRelocations);
}

private static String applyRelocations(String name) {
if (name.equals("polaris.log.request-id-header-name")) {
String replacement = "polaris.correlation-id.header-name";
LOGGER.warn("Property '{}' is deprecated, use '{}' instead", name, replacement);
return replacement;
}
return name;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import jakarta.ws.rs.Priorities;

public final class FilterPriorities {
public static final int REQUEST_ID_FILTER = Priorities.AUTHENTICATION - 101;
public static final int REALM_CONTEXT_FILTER = REQUEST_ID_FILTER + 1;
public static final int CORRELATION_ID_FILTER = Priorities.AUTHENTICATION - 101;
public static final int REALM_CONTEXT_FILTER = CORRELATION_ID_FILTER + 1;
public static final int RATE_LIMITER_FILTER = Priorities.USER;
public static final int MDC_FILTER = REALM_CONTEXT_FILTER + 1;
public static final int TRACING_FILTER = REALM_CONTEXT_FILTER + 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
import org.apache.polaris.service.context.RealmContextConfiguration;
import org.apache.polaris.service.context.RealmContextFilter;
import org.apache.polaris.service.context.RealmContextResolver;
import org.apache.polaris.service.correlation.CorrelationIdConfiguration;
import org.apache.polaris.service.correlation.CorrelationIdGenerator;
import org.apache.polaris.service.credentials.PolarisCredentialManagerConfiguration;
import org.apache.polaris.service.events.PolarisEventListenerConfiguration;
import org.apache.polaris.service.events.listeners.PolarisEventListener;
Expand Down Expand Up @@ -402,6 +404,14 @@ public PolarisCredentialManager polarisCredentialManager(
return credentialManagers.select(Identifier.Literal.of(config.type())).get();
}

@Produces
@ApplicationScoped
public CorrelationIdGenerator correlationIdGenerator(
CorrelationIdConfiguration config,
@Any Instance<CorrelationIdGenerator> correlationIdGenerators) {
return correlationIdGenerators.select(Identifier.Literal.of(config.generator().type())).get();
}

public void closeTaskExecutor(@Disposes @Identifier("task-executor") ManagedExecutor executor) {
executor.close();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.correlation;

import io.smallrye.config.ConfigMapping;

@ConfigMapping(prefix = "polaris.correlation-id")
public interface CorrelationIdConfiguration {

/**
* The name of the header that contains the correlation ID.
*
* <p>If a request does not contain this header, it will be assigned a new correlation ID
* generated using the configured {@link #generator()}.
*
* <p>All responses will include the correlation ID in this header.
*/
String headerName();
Copy link
Member

Choose a reason for hiding this comment

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

Nit: add a @WithDefault?

Copy link
Contributor Author

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 :-)

Copy link
Member

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.


/**
* The correlation ID generator to use, when a request does not contain the {@link #headerName()}.
*/
Generator generator();

interface Generator {

/**
* The type of the correlation ID generator. Must be a registered {@link CorrelationIdGenerator}
* identifier.
*/
String type();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.tracing;
package org.apache.polaris.service.correlation;

import io.smallrye.mutiny.Uni;
import jakarta.inject.Inject;
Expand All @@ -26,39 +26,38 @@
import jakarta.ws.rs.core.Response;
import org.apache.iceberg.rest.responses.ErrorResponse;
import org.apache.polaris.service.config.FilterPriorities;
import org.apache.polaris.service.logging.LoggingConfiguration;
import org.jboss.resteasy.reactive.server.ServerRequestFilter;
import org.jboss.resteasy.reactive.server.ServerResponseFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class RequestIdFilter {
public class CorrelationIdFilter {

public static final String REQUEST_ID_KEY = "requestId";
public static final String CORRELATION_ID_KEY = "requestId";
Copy link
Contributor Author

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.


private static final Logger LOGGER = LoggerFactory.getLogger(RequestIdFilter.class);
private static final Logger LOGGER = LoggerFactory.getLogger(CorrelationIdFilter.class);

@Inject LoggingConfiguration loggingConfiguration;
@Inject RequestIdGenerator requestIdGenerator;
@Inject CorrelationIdConfiguration correlationIdConfiguration;
@Inject CorrelationIdGenerator correlationIdGenerator;

@ServerRequestFilter(preMatching = true, priority = FilterPriorities.REQUEST_ID_FILTER)
@ServerRequestFilter(preMatching = true, priority = FilterPriorities.CORRELATION_ID_FILTER)
public Uni<Response> assignRequestId(ContainerRequestContext rc) {
var requestId = rc.getHeaderString(loggingConfiguration.requestIdHeaderName());
return (requestId != null
? Uni.createFrom().item(requestId)
: requestIdGenerator.generateRequestId(rc))
var correlationId = rc.getHeaderString(correlationIdConfiguration.headerName());
return (correlationId != null
? Uni.createFrom().item(correlationId)
: correlationIdGenerator.generateCorrelationId(rc))
.onItem()
.invoke(id -> rc.setProperty(REQUEST_ID_KEY, id))
.invoke(id -> rc.setProperty(CORRELATION_ID_KEY, id))
.onItemOrFailure()
.transform((id, error) -> error == null ? null : errorResponse(error));
}

@ServerResponseFilter
public void addResponseHeader(
ContainerRequestContext request, ContainerResponseContext response) {
String requestId = (String) request.getProperty(REQUEST_ID_KEY);
if (requestId != null) { // can be null if request ID generation fails
response.getHeaders().add(loggingConfiguration.requestIdHeaderName(), requestId);
String correlationId = (String) request.getProperty(CORRELATION_ID_KEY);
if (correlationId != null) { // can be null if request ID generation fails
response.getHeaders().add(correlationIdConfiguration.headerName(), correlationId);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@
* under the License.
*/

package org.apache.polaris.service.tracing;
package org.apache.polaris.service.correlation;

import io.smallrye.mutiny.Uni;
import jakarta.ws.rs.container.ContainerRequestContext;

/**
* A generator for request IDs.
* A generator for correlation IDs.
*
* @see RequestIdFilter
* @see CorrelationIdFilter
*/
public interface RequestIdGenerator {
public interface CorrelationIdGenerator {

/**
* Generates a new request ID. IDs must be fast to generate and unique.
* Generates a new correlation ID. IDs must be fast to generate and unique.
*
* @param requestContext The JAX-RS request context
*/
Uni<String> generateRequestId(ContainerRequestContext requestContext);
Uni<String> generateCorrelationId(ContainerRequestContext requestContext);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
* under the License.
*/

package org.apache.polaris.service.tracing;
package org.apache.polaris.service.correlation;

import io.smallrye.common.annotation.Identifier;
import io.smallrye.mutiny.Uni;
import jakarta.annotation.Nonnull;
import jakarta.enterprise.context.ApplicationScoped;
Expand All @@ -27,8 +28,8 @@
import java.util.concurrent.atomic.AtomicReference;

/**
* Default implementation of {@link RequestIdGenerator}, striking a balance between randomness and
* performance.
* Default implementation of {@link CorrelationIdGenerator}, striking a balance between randomness
* and performance.
*
* <p>The IDs generated by this generator are of the form: {@code UUID_COUNTER}. The UUID part is
* randomly generated at startup, and the counter is incremented for each request.
Expand All @@ -37,7 +38,8 @@
* reset to 1.
*/
@ApplicationScoped
public class DefaultRequestIdGenerator implements RequestIdGenerator {
@Identifier("default")
public class DefaultCorrelationIdGenerator implements CorrelationIdGenerator {

record RequestId(UUID uuid, long counter) {

Expand All @@ -59,7 +61,7 @@ RequestId increment() {
final AtomicReference<RequestId> state = new AtomicReference<>(new RequestId());

@Override
public Uni<String> generateRequestId(ContainerRequestContext requestContext) {
public Uni<String> generateCorrelationId(ContainerRequestContext requestContext) {
return Uni.createFrom().item(nextRequestId().toString());
}

Expand Down
Loading