Skip to content
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

[Enhancement] Support OTLP spans from FE #50903

Merged
merged 4 commits into from
Sep 20, 2024

Conversation

digitalpoetry
Copy link
Contributor

@digitalpoetry digitalpoetry commented Sep 10, 2024

Why I'm doing:

What I'm doing:

Addresses #50835

  • Add OTLP span export support for FE component
  • OTLP span export for BE component and changes to SR tracing documentation will be added in another PR

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.3
    • 3.2
    • 3.1
    • 3.0
    • 2.5

OpenTelemetry openTelemetry = builder.buildAndRegisterGlobal();
instance = openTelemetry.getTracer(SERVICE_NAME);
} else {
instance = GlobalOpenTelemetry.get().getTracer(SERVICE_NAME);
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 find any usages of the global OpenTelemetry instance and I don't expect any use cases within FE components where a Tracer instance is required which cannot be obtained through the TraceManager::getTracer interface. For this reason, the new code constructs a shared Tracer instance and adds span exporters as requested by the config.

Copy link
Contributor

Choose a reason for hiding this comment

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

[Enhancement] Use noop tracer if endpoint not configured (#7724) Use noop tracer if jaeger endpoint not configured
If nothing is configed(the most common case), this will be used. If I remember correct, this is more efficient. Not an expert here, but Id like to not change things causing uneccessary instability. unless you are absolutely certern.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha. Thank you @decster
I've pushed an update to this PR to explicitly use the NoOp tracer when tracing endpoints are not configured.

import org.junit.Before;
import org.junit.Test;

public class TraceManagerTest {
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 tried setting up WireMock to spin up a mock server with which we could verify if the OpenTelemetry instance is configured correctly to hit tracing endpoints, but I didn't get far with this when I ran into issues with Jetty library resolution. Such an approach would also involve adding dependencies on Jaeger and OpenTelemetry proto files to set up a mock gRPC server, which may be overkill.

Copy link
Contributor

Choose a reason for hiding this comment

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

understand this code is hard to cover indeed, skip it for now.

@digitalpoetry digitalpoetry changed the title Support OTLP spans from FE [Enhancement] Support OTLP spans from FE Sep 10, 2024
Copy link

sonarcloud bot commented Sep 15, 2024

Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[FE Incremental Coverage Report]

pass : 35 / 35 (100.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/common/Config.java 1 1 100.00% []
🔵 com/starrocks/common/TraceManager.java 34 34 100.00% []

Copy link

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

@decster decster merged commit b63e016 into StarRocks:main Sep 20, 2024
47 checks passed
renzhimin7 pushed a commit to renzhimin7/starrocks that referenced this pull request Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants