yomorun / yomo

🦖 Stateful Serverless Framework for Geo-distributed Edge AI Infra. with function calling support, write once, run on any model.
https://yomo.run
Apache License 2.0
1.65k stars 128 forks source link

refactor: separate the logic of distributed tracing #736

Closed woorui closed 6 months ago

woorui commented 6 months ago

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.

vercel[bot] commented 6 months ago

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

1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **yomo** | ⬜️ Ignored ([Inspect](https://vercel.com/yomorun/yomo/HkXmjUkbyT3aCpCCWCR1YFryzpj9)) | [Visit Preview](https://yomo-git-refactor-trace-yomorun.vercel.app) | | Mar 1, 2024 9:01am |
fanweixiao commented 6 months ago

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.

codecov[bot] commented 6 months ago

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 :warning:
pkg/trace/trace.go 82.25% 8 Missing and 3 partials :warning:
core/client.go 75.00% 0 Missing and 1 partial :warning:
zipper_notwindows.go 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.