Skip to content

Conversation

@ebyhr
Copy link
Contributor

@ebyhr ebyhr commented Oct 17, 2025

I propose adding OpenTelemetry support to the HTTP client to improve traceability.
The screenshot shows the result of testing this PR with the Apache Polaris (incubating) and Trino.

Screenshot 2025-10-17 at 20 22 21

implementation libs.jackson.core
implementation libs.jackson.databind
implementation libs.caffeine
implementation libs.opentelemetry.httpclient
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to update and LICENCE ?

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 think we update the LICENSE file only when we copy code from another library. Am I wrong?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not fully aware but i think if we ship a dependency : https://github.com/apache/iceberg/blob/main/aws-bundle/LICENSE we just include it i think, not an expert in this though, just thought to bring since we are introducing a new dependency in the project

Copy link
Contributor Author

@ebyhr ebyhr Oct 17, 2025

Choose a reason for hiding this comment

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

Ah, sorry I was only looking at LICENSE file in the root directory. Let me check other LICENSE files.

Comment on lines +536 to +539
public Builder withOpenTelemetry(OpenTelemetry openTelemetry) {
this.telemetry = openTelemetry;
return this;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

how is the openTelemetry configuration provided, via ENV ?

Copy link
Contributor Author

@ebyhr ebyhr Oct 17, 2025

Choose a reason for hiding this comment

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

Just passing OpenTelemetry instance is sufficient in this repository.

In Trino, we have 2 config properties to enable tracing:

tracing.enabled=true
tracing.exporter.endpoint=http://observe.example.com:4317

https://trino.io/docs/current/admin/opentelemetry.html

private final boolean isRootClient;
private final ConcurrentMap<Class<?>, ObjectReader> objectReaderCache = Maps.newConcurrentMap();

private HTTPClient(
Copy link
Contributor

Choose a reason for hiding this comment

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

how does the E2E flows works does the Trino works, does it creates its own HTTPClient and in the builder sets its won OpenTelemetry client ?

Copy link
Contributor Author

@ebyhr ebyhr Oct 17, 2025

Choose a reason for hiding this comment

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

Right, Trino provides RESTClient builder in TrinoIcebergRestCatalogFactory.

https://github.com/trinodb/trino/blob/4da16d9597ecc4750f3d499f3975c4f1337c76c7/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/catalog/rest/TrinoIcebergRestCatalogFactory.java#L135-L138

The new code will be like this:

                    config -> HTTPClient.builder(config)
                            .uri(config.get(CatalogProperties.URI))
                            .withHeaders(RESTUtil.configHeaders(config))
                            .withOpenTelemetry(openTelemetry)
                            .build(),

(openTelemetry will be injected in the constructor)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants