Skip to content

Add OpenTelemetry tracing#16950

Merged
electrum merged 11 commits intotrinodb:masterfrom
electrum:tracing
Apr 18, 2023
Merged

Add OpenTelemetry tracing#16950
electrum merged 11 commits intotrinodb:masterfrom
electrum:tracing

Conversation

@electrum
Copy link
Member

@electrum electrum commented Apr 10, 2023

Description

Add initial, experimental support for distributed tracing using OpenTelemetry. This adds traces for queries with spans for analysis, planning, optimization, split generation, tasks, remote tasks, local planning, metadata, HTTP client requests, JAX-RS endpoints, etc.

Connectors can participate in tracing using the OpenTelemetry API. As a proof-of-concept, TrinoFileSystem and the S3 file system code are instrumented for the Hive, Iceberg, Delta Lake and Hudi connectors.

Usage

Enable tracing in Trino and configure the OLTP/gRPC endpoint:

tracing.enabled=true
tracing.exporter.endpoint=http://localhost:4317

For easy testing on a single machine, such as when running IcebergMinioQueryRunnerMain, you can run Jaeger in Docker:

docker run -e COLLECTOR_OTLP_ENABLED=true -p 16686:16686 -p 4317:4317 jaegertracing/all-in-one:latest

Open http://localhost:16686 in your browser to view the Jaeger UI.

Additional context and related issues

Release notes

(x) Release notes are required, with the following suggested text:

# General
* Add experimental support for tracing using [OpenTelemetry](https://opentelemetry.io/).
  Enable tracing by setting `tracing.enabled=true` and configure the 
  [OLTP/gRPC endpoint](https://opentelemetry.io/docs/reference/specification/protocol/otlp/)
  endpoint by setting `tracing.exporter.endpoint` to override
  the default of `http://localhost:4317` if needed. The functionality, span names, attributes, etc.,
  are experimental and subject to change. ({issue}`16950`)

@cla-bot cla-bot bot added the cla-signed label Apr 10, 2023
@github-actions github-actions bot added bigquery BigQuery connector delta-lake Delta Lake connector hive Hive connector hudi Hudi connector iceberg Iceberg connector mongodb MongoDB connector tests:hive labels Apr 10, 2023
@electrum electrum force-pushed the tracing branch 3 times, most recently from 328f823 to d271183 Compare April 11, 2023 00:11
@sajjoseph
Copy link
Contributor

Long overdue feature. Thanks @electrum for making it happen.

@electrum electrum force-pushed the tracing branch 4 times, most recently from 0360099 to 47a64a8 Compare April 12, 2023 03:15
@electrum electrum force-pushed the tracing branch 2 times, most recently from dd0a399 to 96a45ec Compare April 13, 2023 06:02
@wendigo
Copy link
Contributor

wendigo commented Apr 13, 2023

Is there a kill switch to disable tracing? What's the added overhead?

@electrum
Copy link
Member Author

electrum commented Apr 13, 2023

@wendigo It is only enabled if you do tracing.enabled. When not enabled, it will use the OpenTelemetry no-op implementation. We shouldn't be tracing at the granularity where the overhead would be significant when not enabled.

@electrum electrum force-pushed the tracing branch 3 times, most recently from af79749 to 4f81372 Compare April 15, 2023 20:11
@electrum electrum mentioned this pull request Apr 15, 2023
@electrum electrum force-pushed the tracing branch 2 times, most recently from a71fceb to e0eabed Compare April 17, 2023 07:06
@electrum electrum merged commit a790c1d into trinodb:master Apr 18, 2023
@electrum electrum deleted the tracing branch April 18, 2023 01:22
@github-actions github-actions bot added this to the 414 milestone Apr 18, 2023
@bitsondatadev
Copy link
Member

This is incredible!!!!

@colebow
Copy link
Member

colebow commented Apr 19, 2023

@electrum - do we want to document this, do you have that covered, or should we wait until it's not experimental?

@lambrospetrou
Copy link

I looked through the code, but cannot find anything.
Is there a way we can specify the tracing.exporter.endpoint override using an environment variable instead of the config file?
In our case, we use k8s, and we need to dynamically retrieve the host IP of the OTLP exporter endpoint and then pass it to Trino as environment variable.

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

Labels

bigquery BigQuery connector cla-signed delta-lake Delta Lake connector hive Hive connector hudi Hudi connector iceberg Iceberg connector mongodb MongoDB connector

Development

Successfully merging this pull request may close these issues.

Add hooks to call an open tracing api to feed telemetry data to various tracing systems Add more granular query tracing events

7 participants