Skip to content

EventListener - OpenTelemetry integration #25490

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jp-sivaprasad
Copy link
Contributor

@jp-sivaprasad jp-sivaprasad commented Jul 3, 2025

Description

Integrate EventListener and OpenTelemetry to provide query tracing through OTel

Motivation and Context

Integrate EventListener and OpenTelemetry to provide query tracing

Impact

Test Plan

Tested locally with a custom event listener which transforms event listener data to OTel traces

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

General Changes
*  Add support for integration of EventListener and OpenTelemetry to provide query tracing

@jp-sivaprasad jp-sivaprasad requested a review from a team as a code owner July 3, 2025 13:27
@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Jul 3, 2025
Copy link

linux-foundation-easycla bot commented Jul 3, 2025

CLA Missing ID CLA Not Signed

@prestodb-ci prestodb-ci requested review from a team, bibith4 and auden-woolfson and removed request for a team July 3, 2025 13:27
@jp-sivaprasad jp-sivaprasad self-assigned this Jul 3, 2025
@jp-sivaprasad jp-sivaprasad force-pushed the opentelemetry-event-listener branch from 94e4a7d to ebe86ed Compare July 3, 2025 13:37
Copy link
Contributor

@aaneja aaneja left a comment

Choose a reason for hiding this comment

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

LGTM % some small changes

@@ -26,6 +26,10 @@ scheduler.http-client.idle-timeout=1m
query.client.timeout=5m
query.min-expire-age=30m

tracing.tracer-type=otel
Copy link
Contributor

Choose a reason for hiding this comment

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

Please undo changes here, they are not needed for Presto to be useful OOTB

@@ -183,12 +183,12 @@ public void run()
}
injector.getInstance(PasswordAuthenticatorManager.class).loadPasswordAuthenticator();
injector.getInstance(PrestoAuthenticatorManager.class).loadPrestoAuthenticator();
injector.getInstance(TracerProviderManager.class).loadTracerProvider();
Copy link
Contributor

Choose a reason for hiding this comment

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

Please undo this since its a no-op change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change is needed as the Tracer provider needs to be loaded before the event listener

/**
* Add a new block starting at current time to the trace
* @param blockName the name for the added tracing block
* @param blockName the name for the parent tracing block
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* @param blockName the name for the parent tracing block
@param parentBlockName the name for the parent tracing block

@@ -155,6 +156,32 @@ public void startBlock(String blockName, String annotation)
}
}

/**
* Create new span with Open Telemetry tracer
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Create new span with Open Telemetry tracer
Creates a new span

we already are in the OpenTelemetryTracer class

Also add a

 * @throws PrestoException if a blockName already is already used in the existing span map

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we keep the javadocs only on the SPI Tracer class ?

public void startBlock(String blockName, String parentBlockName, String annotation)
{
if (spanMap.containsKey(blockName)) {
throw new PrestoException(DISTRIBUTED_TRACING_ERROR, "Duplicated block inserted: " + blockName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
throw new PrestoException(DISTRIBUTED_TRACING_ERROR, "Duplicated block inserted: " + blockName);
throw new PrestoException(DISTRIBUTED_TRACING_ERROR, String.format("Duplicate block inserted: %s ", blockName));

@jp-sivaprasad jp-sivaprasad requested a review from aaneja July 3, 2025 17:55
@jp-sivaprasad jp-sivaprasad force-pushed the opentelemetry-event-listener branch from 1bdf496 to 754f557 Compare July 3, 2025 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from:IBM PR from IBM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants