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

refactor: separate the logic of distributed tracing #736

Merged
merged 10 commits into from
Mar 5, 2024
Merged

Conversation

woorui
Copy link
Collaborator

@woorui woorui commented Feb 28, 2024

Description

Omit the WithTracerProvider() options as manual injection of the tracer provider in the code is unnecessary. The tracing functionality will be activated upon setting the 'OTEL_EXPORTER_OTLP_ENDPOINT' environment variable.

Changes

Before:

// create trace provider manully
tp, shutdown, e := trace.NewTracerProvider("yomo-sfn")
if e == nil {
  log.Println("[sfn] 🛰 trace enabled")
}
defer shutdown(context.Background())

sfn := yomo.NewStreamFunction(
  name,
  addr,
  yomo.WithCredential(credential),
  yomo.WithTracerProvider(tp),  // add trace provider to opts
)

After:

sfn := yomo.NewStreamFunction(
  name,
  addr,
  yomo.WithCredential(credential),
)

run:

OTEL_EXPORTER_OTLP_ENDPOINT=https://opentracing.acme.com:7234 yomo run sfn.go

TODO

update related docs.

@woorui woorui self-assigned this Feb 28, 2024
Copy link

vercel bot commented Feb 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
yomo ⬜️ Ignored (Inspect) Visit Preview Mar 1, 2024 9:01am

@woorui woorui changed the title Refactor/trace refactor: separate the logic of tracing and metadata. Feb 28, 2024
@fanweixiao
Copy link
Member

This is really great.
This implementation approach reduces the complexity for developers.
Distributed tracing is complex, but we should keep developers away from it as much as possible so that they can focus on app iteration.

Copy link

codecov bot commented Feb 29, 2024

Codecov Report

Attention: Patch coverage is 81.06061% with 25 lines in your changes are missing coverage. Please review.

Project coverage is 61.45%. Comparing base (3a44b2d) to head (b8f03e0).
Report is 8 commits behind head on master.

Files Patch % Lines
sfn.go 60.00% 12 Missing ⚠️
pkg/trace/trace.go 82.25% 8 Missing and 3 partials ⚠️
core/client.go 75.00% 0 Missing and 1 partial ⚠️
zipper_notwindows.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #736      +/-   ##
==========================================
+ Coverage   59.46%   61.45%   +1.99%     
==========================================
  Files          37       40       +3     
  Lines        2810     2937     +127     
==========================================
+ Hits         1671     1805     +134     
+ Misses       1034     1020      -14     
- Partials      105      112       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@venjiang venjiang left a comment

Choose a reason for hiding this comment

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

👍

@fanweixiao fanweixiao changed the title refactor: separate the logic of tracing and metadata. refactor: separate the logic of distributed tracing Mar 1, 2024
@woorui woorui merged commit b5317dc into master Mar 5, 2024
7 checks passed
@woorui woorui deleted the refactor/trace branch March 5, 2024 07:32
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

3 participants