Skip to content

Commit 3c28e6b

Browse files
committed
Restore original Request ID functionality
This PR enacts the action items decided in the following ML thread: https://lists.apache.org/thread/4gmlcn84o7n8d12qnpl7grfbm4zypk7b The action items are: 1. Restore the original functionality for request IDs, change the default header name back to x-request-id 2. Remove RequestIdGenerator and related functionality. 3. Update PolarisEvent, expose request ID if available, expose OTel context if available. 4. Update events table SQL schema: insert request ID if available, insert OTel context if available. Furthermore, this PR also fixes #2913 and adds a small integration test for the JDBC events sink: `InMemoryBufferEventListenerIntegrationTest`. Finally, it modifies the Helm chart to reflect the configuration changes.
1 parent 8e344c7 commit 3c28e6b

File tree

27 files changed

+578
-481
lines changed

27 files changed

+578
-481
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,17 @@ request adding CHANGELOG notes for breaking (!) changes and possibly other secti
3131

3232
### Upgrade notes
3333

34+
- JDBC persistence: a new column has been added to the `events` table to store the OpenTelemetry
35+
context that was active when the event was emitted. This column is nullable. To update your schema
36+
to the latest version, run the following SQL statement:
37+
```sql
38+
ALTER TABLE POLARIS_SCHEMA.EVENTS ADD COLUMN IF NOT EXISTS otel_context TEXT;
39+
```
40+
3441
### Breaking changes
3542

43+
- The default request ID header name has changed from `Polaris-Request-Id` to `x-request-id`.
44+
3645
### New Features
3746

3847
- Support credential vending for federated catalogs. `ALLOW_FEDERATED_CATALOGS_CREDENTIAL_VENDING` (default: true) was added to toggle this feature.
@@ -43,6 +52,15 @@ request adding CHANGELOG notes for breaking (!) changes and possibly other secti
4352

4453
### Deprecations
4554

55+
* The configuration property `polaris.log.request-id-header-name` is deprecated and has been renamed
56+
to `polaris.tracing.request-id.header-name`; the old name is still supported for backwards
57+
compatibility, but will generate a warning. It will be removed in a future release.
58+
* Helm chart: the `tracing` section has been renamed to `tracing.otel`. The old name is still
59+
supported for backwards compatibility, but will be removed in a future release.
60+
* Helm chart: the `logging.requestIdHeaderName` property is deprecated and has been renamed to
61+
`tracing.requestId.headerName`. The old name is still supported for backwards compatibility, but
62+
will be removed in a future release.
63+
4664
### Fixes
4765

4866
### Commits

helm/polaris/README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ ct install --namespace polaris --charts ./helm/polaris
247247
| livenessProbe.successThreshold | int | `1` | Minimum consecutive successes for the probe to be considered successful after having failed. Minimum value is 1. |
248248
| livenessProbe.terminationGracePeriodSeconds | int | `30` | Optional duration in seconds the pod needs to terminate gracefully upon probe failure. Minimum value is 1. |
249249
| livenessProbe.timeoutSeconds | int | `10` | Number of seconds after which the probe times out. Minimum value is 1. |
250-
| 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. |
250+
| 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. |
251251
| logging.categories | object | `{"org.apache.iceberg.rest":"INFO","org.apache.polaris":"INFO"}` | Configuration for specific log categories. |
252252
| 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. |
253253
| logging.console.enabled | bool | `true` | Whether to enable the console appender. |
@@ -271,7 +271,6 @@ ct install --namespace polaris --charts ./helm/polaris
271271
| logging.file.threshold | string | `"ALL"` | The log level of the file appender. |
272272
| logging.level | string | `"INFO"` | The log level of the root category, which is used as the default log level for all categories. |
273273
| 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. |
274-
| logging.requestIdHeaderName | string | `"Polaris-Request-Id"` | The header name to use for the request ID. |
275274
| 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. |
276275
| managementService.annotations | object | `{}` | Annotations to add to the service. |
277276
| 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. |
@@ -368,7 +367,10 @@ ct install --namespace polaris --charts ./helm/polaris
368367
| tasks.maxConcurrentTasks | string | `nil` | The maximum number of concurrent tasks that can be executed at the same time. The default is the number of available cores. |
369368
| tasks.maxQueuedTasks | string | `nil` | The maximum number of tasks that can be queued up for execution. The default is Integer.MAX_VALUE. |
370369
| tolerations | list | `[]` | A list of tolerations to apply to polaris pods. See https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/. |
371-
| tracing.attributes | object | `{}` | Resource attributes to identify the polaris service among other tracing sources. See https://opentelemetry.io/docs/reference/specification/resource/semantic_conventions/#service. If left empty, traces will be attached to a service named "Apache Polaris"; to change this, provide a service.name attribute here. |
372-
| tracing.enabled | bool | `false` | Specifies whether tracing for the polaris server should be enabled. |
373-
| tracing.endpoint | string | `"http://otlp-collector:4317"` | The collector endpoint URL to connect to (required). The endpoint URL must have either the http:// or the https:// scheme. The collector must talk the OpenTelemetry protocol (OTLP) and the port must be its gRPC port (by default 4317). See https://quarkus.io/guides/opentelemetry for more information. |
374-
| tracing.sample | string | `"1.0d"` | Which requests should be sampled. Valid values are: "all", "none", or a ratio between 0.0 and "1.0d" (inclusive). E.g. "0.5d" means that 50% of the requests will be sampled. Note: avoid entering numbers here, always prefer a string representation of the ratio. |
370+
| tracing.otel | object | `{"attributes":{},"enabled":false,"endpoint":"http://otlp-collector:4317","sample":"1.0d"}` | OpenTelemetry configuration. |
371+
| tracing.otel.attributes | object | `{}` | Resource attributes to identify the polaris service among other tracing sources. See https://opentelemetry.io/docs/reference/specification/resource/semantic_conventions/#service. If left empty, traces will be attached to a service named "Apache Polaris"; to change this, provide a service.name attribute here. |
372+
| tracing.otel.enabled | bool | `false` | Specifies whether tracing for the Apache Polaris server should be enabled. When this is enabled, then an OpenTelemetry collector endpoint must be configured. |
373+
| tracing.otel.endpoint | string | `"http://otlp-collector:4317"` | The collector endpoint URL to connect to (required). The endpoint URL must have either the http:// or the https:// scheme. The collector must talk the OpenTelemetry protocol (OTLP) and the port must be its gRPC port (by default 4317). See https://quarkus.io/guides/opentelemetry for more information. |
374+
| tracing.otel.sample | string | `"1.0d"` | Which requests should be sampled. Valid values are: "all", "none", or a ratio between 0.0 and "1.0d" (inclusive). E.g. "0.5d" means that 50% of the requests will be sampled. Note: avoid entering numbers here, always prefer a string representation of the ratio. |
375+
| tracing.requestId | object | `{"headerName":"X-Request-ID"}` | Configuration for the request ID filter. |
376+
| tracing.requestId.headerName | string | `"X-Request-ID"` | The name of the header that contains the request ID. |

helm/polaris/templates/configmap.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,28 +165,31 @@ data:
165165
{{- range $k, $v := $categories -}}
166166
{{- $_ = set $map (printf "quarkus.log.category.\"%s\".level" $k) $v -}}
167167
{{- end -}}
168-
{{- $_ = set $map "polaris.log.request-id-header-name" .Values.logging.requestIdHeaderName -}}
169168
{{- $mdc := dict -}}
170169
{{- list .Values.logging.mdc "" $mdc | include "polaris.mergeConfigTree" -}}
171170
{{- range $k, $v := $mdc -}}
172171
{{- $_ = set $map (printf "polaris.log.mdc.\"%s\"" $k) $v -}}
173172
{{- end -}}
174173
175174
{{- /* Telemetry */ -}}
176-
{{- if .Values.tracing.enabled -}}
177-
{{- $_ = set $map "quarkus.otel.exporter.otlp.endpoint" .Values.tracing.endpoint -}}
178-
{{- if .Values.tracing.attributes -}}
175+
{{- /* TODO remove deprecated configs, keep only tracing.otel.* */ -}}
176+
{{- if (or .Values.tracing.enabled .Values.tracing.otel.enabled) -}}
177+
{{- $_ = set $map "quarkus.otel.exporter.otlp.endpoint" (coalesce .Values.tracing.endpoint .Values.tracing.otel.endpoint) -}}
179178
{{- $attributes := dict -}}
179+
{{- if .Values.tracing.otel.attributes -}}
180+
{{- list .Values.tracing.otel.attributes "" $attributes | include "polaris.mergeConfigTree" -}}
181+
{{- end -}}
182+
{{- if .Values.tracing.attributes -}}
180183
{{- list .Values.tracing.attributes "" $attributes | include "polaris.mergeConfigTree" -}}
184+
{{- end -}}
181185
{{- $i := 0 -}}
182186
{{- range $k, $v := $attributes -}}
183187
{{- $_ = set $map (printf "quarkus.otel.resource.attributes[%d]" $i) (printf "%s=%s" $k $v) -}}
184188
{{- $i = add1 $i -}}
185189
{{- end -}}
186-
{{- end -}}
187-
{{- if .Values.tracing.sample -}}
188-
{{- $sample := toString .Values.tracing.sample -}}
189-
{{ if eq $sample "all" -}}
190+
{{- if (or .Values.tracing.sample .Values.tracing.otel.sample) -}}
191+
{{- $sample := toString (coalesce .Values.tracing.sample .Values.tracing.otel.sample) -}}
192+
{{- if eq $sample "all" -}}
190193
{{- $_ = set $map "quarkus.otel.traces.sampler" "parentbased_always_on" -}}
191194
{{- else if eq $sample "none" -}}
192195
{{- $_ = set $map "quarkus.otel.traces.sampler" "always_off" -}}
@@ -198,6 +201,7 @@ data:
198201
{{- else -}}
199202
{{- $_ = set $map "quarkus.otel.sdk.disabled" true -}}
200203
{{- end -}}
204+
{{- $_ = set $map "polaris.tracing.request-id.header-name" (coalesce .Values.logging.requestIdHeaderName .Values.tracing.requestId.headerName) -}}
201205
202206
{{- /* Metrics */ -}}
203207
{{- if .Values.metrics.enabled -}}

helm/polaris/tests/configmap_test.yaml

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,43 +292,88 @@ tests:
292292
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.log.mdc.\"org.acme\"=foo" }
293293
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.log.mdc.\"org.acme.service\"=foo" }
294294

295-
- it: should include telemetry configuration
295+
- it: should include deprecated telemetry configuration
296296
set:
297297
tracing: { enabled: true, endpoint: http://custom:4317, attributes: { service.name: custom, foo: bar } }
298298
asserts:
299299
- matchRegex: { path: 'data["application.properties"]', pattern: "quarkus.otel.exporter.otlp.endpoint=http://custom:4317" }
300300
- matchRegex: { path: 'data["application.properties"]', pattern: "quarkus.otel.resource.attributes\\[\\d\\]=service.name=custom" }
301301
- matchRegex: { path: 'data["application.properties"]', pattern: "quarkus.otel.resource.attributes\\[\\d\\]=foo=bar" }
302302

303-
- it: should include set sample rate numeric
303+
- it: should include telemetry configuration
304+
set:
305+
tracing.otel: { enabled: true, endpoint: http://custom:4317, attributes: { service.name: custom, foo: bar } }
306+
asserts:
307+
- matchRegex: { path: 'data["application.properties"]', pattern: "quarkus.otel.exporter.otlp.endpoint=http://custom:4317" }
308+
- matchRegex: { path: 'data["application.properties"]', pattern: "quarkus.otel.resource.attributes\\[\\d\\]=service.name=custom" }
309+
- matchRegex: { path: 'data["application.properties"]', pattern: "quarkus.otel.resource.attributes\\[\\d\\]=foo=bar" }
310+
311+
- it: should set sample rate numeric (deprecated)
304312
set:
305313
tracing: { enabled: true, sample: "0.123" }
306314
asserts:
307315
- matchRegex: { path: 'data["application.properties"]', pattern: "quarkus.otel.traces.sampler=parentbased_traceidratio" }
308316
- matchRegex: { path: 'data["application.properties"]', pattern: "quarkus.otel.traces.sampler.arg=0.123" }
309317

310-
- it: should include set sample rate "all"
318+
- it: should set sample rate numeric
319+
set:
320+
tracing.otel: { enabled: true, sample: "0.123" }
321+
asserts:
322+
- matchRegex: { path: 'data["application.properties"]', pattern: "quarkus.otel.traces.sampler=parentbased_traceidratio" }
323+
- matchRegex: { path: 'data["application.properties"]', pattern: "quarkus.otel.traces.sampler.arg=0.123" }
324+
325+
- it: should set sample rate "all" (deprecated)
311326
set:
312327
tracing: { enabled: true, sample: "all" }
313328
asserts:
314329
- matchRegex: { path: 'data["application.properties"]', pattern: "quarkus.otel.traces.sampler=parentbased_always_on" }
315330

316-
- it: should include set sample rate "none"
331+
- it: should set sample rate "all"
332+
set:
333+
tracing.otel: { enabled: true, sample: "all" }
334+
asserts:
335+
- matchRegex: { path: 'data["application.properties"]', pattern: "quarkus.otel.traces.sampler=parentbased_always_on" }
336+
337+
- it: should set sample rate "none" (deprecated)
317338
set:
318339
tracing: { enabled: true, sample: "none" }
319340
asserts:
320341
- matchRegex: { path: 'data["application.properties"]', pattern: "quarkus.otel.traces.sampler=always_off" }
321342

343+
- it: should set sample rate "none"
344+
set:
345+
tracing.otel: { enabled: true, sample: "none" }
346+
asserts:
347+
- matchRegex: { path: 'data["application.properties"]', pattern: "quarkus.otel.traces.sampler=always_off" }
348+
322349
- it: should disable tracing by default
323350
asserts:
324351
- matchRegex: { path: 'data["application.properties"]', pattern: "quarkus.otel.sdk.disabled=true" }
325352

326-
- it: should disable tracing
353+
- it: should disable tracing (deprecated)
327354
set:
328355
tracing: { enabled: false }
329356
asserts:
330357
- matchRegex: { path: 'data["application.properties"]', pattern: "quarkus.otel.sdk.disabled=true" }
331358

359+
- it: should disable tracing
360+
set:
361+
tracing.otel: { enabled: false }
362+
asserts:
363+
- matchRegex: { path: 'data["application.properties"]', pattern: "quarkus.otel.sdk.disabled=true" }
364+
365+
- it: should including request ID header name (deprecated)
366+
set:
367+
logging.requestIdHeaderName: X-Custom-Request-ID
368+
asserts:
369+
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.tracing.request-id.header-name=X-Custom-Request-ID" }
370+
371+
- it: should including request ID header name
372+
set:
373+
tracing.requestId: { headerName: X-Custom-Request-ID }
374+
asserts:
375+
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.tracing.request-id.header-name=X-Custom-Request-ID" }
376+
332377
- it: should include custom metrics
333378
set:
334379
metrics: { enabled: true, tags: { app: custom, foo: bar } }

helm/polaris/values.yaml

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -392,25 +392,31 @@ extraInitContainers: []
392392
# command: ['sh', '-c', 'echo "hello world"']
393393

394394
tracing:
395-
# -- Specifies whether tracing for the polaris server should be enabled.
396-
enabled: false
397-
# -- The collector endpoint URL to connect to (required).
398-
# The endpoint URL must have either the http:// or the https:// scheme.
399-
# The collector must talk the OpenTelemetry protocol (OTLP) and the port must be its gRPC port (by default 4317).
400-
# See https://quarkus.io/guides/opentelemetry for more information.
401-
endpoint: "http://otlp-collector:4317"
402-
# -- Which requests should be sampled. Valid values are: "all", "none", or a ratio between 0.0 and
403-
# "1.0d" (inclusive). E.g. "0.5d" means that 50% of the requests will be sampled.
404-
# Note: avoid entering numbers here, always prefer a string representation of the ratio.
405-
sample: "1.0d"
406-
# -- Resource attributes to identify the polaris service among other tracing sources.
407-
# See https://opentelemetry.io/docs/reference/specification/resource/semantic_conventions/#service.
408-
# If left empty, traces will be attached to a service named "Apache Polaris"; to change this,
409-
# provide a service.name attribute here.
410-
attributes:
411-
{}
412-
# service.name: my-polaris
413-
395+
# -- OpenTelemetry configuration.
396+
otel:
397+
# -- Specifies whether tracing for the Apache Polaris server should be enabled. When this is enabled,
398+
# then an OpenTelemetry collector endpoint must be configured.
399+
enabled: false
400+
# -- The collector endpoint URL to connect to (required).
401+
# The endpoint URL must have either the http:// or the https:// scheme.
402+
# The collector must talk the OpenTelemetry protocol (OTLP) and the port must be its gRPC port (by default 4317).
403+
# See https://quarkus.io/guides/opentelemetry for more information.
404+
endpoint: "http://otlp-collector:4317"
405+
# -- Which requests should be sampled. Valid values are: "all", "none", or a ratio between 0.0 and
406+
# "1.0d" (inclusive). E.g. "0.5d" means that 50% of the requests will be sampled.
407+
# Note: avoid entering numbers here, always prefer a string representation of the ratio.
408+
sample: "1.0d"
409+
# -- Resource attributes to identify the polaris service among other tracing sources.
410+
# See https://opentelemetry.io/docs/reference/specification/resource/semantic_conventions/#service.
411+
# If left empty, traces will be attached to a service named "Apache Polaris"; to change this,
412+
# provide a service.name attribute here.
413+
attributes:
414+
{}
415+
# service.name: my-polaris
416+
# -- Configuration for the request ID filter.
417+
requestId:
418+
# -- The name of the header that contains the request ID.
419+
headerName: X-Request-ID
414420
metrics:
415421
# -- Specifies whether metrics for the polaris server should be enabled.
416422
enabled: true
@@ -442,8 +448,6 @@ serviceMonitor:
442448
logging:
443449
# -- The log level of the root category, which is used as the default log level for all categories.
444450
level: INFO
445-
# -- The header name to use for the request ID.
446-
requestIdHeaderName: Polaris-Request-Id
447451
# -- Configuration for the console appender.
448452
console:
449453
# -- Whether to enable the console appender.

0 commit comments

Comments
 (0)