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

feat: Implement OpenTelemetry tracing #1741

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

iamKunalGupta
Copy link
Contributor

@iamKunalGupta iamKunalGupta commented May 21, 2024

  • Add basic telemetry and examples
  • Integrate with temporal's opentelemetry interceptor

To run/test:

  1. Run jaeger (it supports otlp format ingestion with a nice UI):
    docker run --rm --name jaeger -p 16686:16686 -p 4317:4317 -e JAEGER_REPORTER_LOG_SPANS=true -e JAEGER_SAMPLER_TYPE=const -e JAEGER_SAMPLER_PARAM=1 -e COLLECTOR_OTLP_ENABLED=true jaegertracing/all-in-one:1.57
    Open jaeger ui at http://localhost:16686/
  2. Run flow worker with the following env:
    ENABLE_OTEL_TRACING=true
    OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc
    OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4317

Start any activity etc and we should start seeing traces like below:
image

TODOS:

  • add tracing to grpc+gateway

- Add basic telemetry and examples
- Integrate with temporal's opentelemetry interceptor
@@ -0,0 +1,17 @@
package common
Copy link
Member

Choose a reason for hiding this comment

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

avoid creating many small packages, it doesn't really matter until intersubpackage dependencies get involved. go's naming also makes having common names like util, utils, common, etc a pain

Already had to resolve util/utils split

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the call graph is like setup -> tracing/metrics/logging -> common, so had to create a separate one this time.
I'll also change it to otel_common for better visibility

Comment on lines +271 to +272
ctx, span := trace.StartSpan(ctx, "connectors.GetCDCPullConnector")
defer span.End()
Copy link
Member

Choose a reason for hiding this comment

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

can move this into GetAs, using reflect.TypeFor[T] to put T in span label

@CLAassistant
Copy link

CLAassistant commented May 21, 2024

CLA assistant check
All committers have signed the CLA.

@@ -112,12 +117,11 @@ require (
github.com/prometheus/common v0.53.0 // indirect
github.com/prometheus/procfs v0.15.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect; indirectianian
Copy link
Contributor

Choose a reason for hiding this comment

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

is this tool generated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

weird

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.

None yet

4 participants