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: add opentelemetry usage example #47

Merged
merged 7 commits into from
Sep 26, 2024

Conversation

daviderli614
Copy link
Member

@daviderli614 daviderli614 commented Sep 19, 2024

What's changed and what's your intention?

When after #39 merge, we can provide some example to user.

Checklist

  • I have added the necessary unit tests and integration tests.

Refer to a related PR or issue link (optional)

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.24%. Comparing base (d3f1530) to head (1399b2d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #47   +/-   ##
=======================================
  Coverage   74.24%   74.24%           
=======================================
  Files           7        7           
  Lines         466      466           
=======================================
  Hits          346      346           
  Misses         97       97           
  Partials       23       23           

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

@sunng87
Copy link
Member

sunng87 commented Sep 20, 2024

by the way, is there any concept like feature gate or optional dependency in go? I would suggest to make otel deps optional so we keep the core sdk compact.

@daviderli614
Copy link
Member Author

daviderli614 commented Sep 20, 2024

by the way, is there any concept like feature gate or optional dependency in go? I would suggest to make otel deps optional so we keep the core sdk compact.

Yes, a switch option has been added to the configuration. The default value is false, which means it is closed. If the user needs to turn it on, it can be set to true. Here users need to install tracing and metrics backends such as jaeger and prometheus.

cfg := greptime.NewConfig(host).WithDatabase(database).
  WithTraceProvider(tracerProvider).WithTracesEnabled(true).
  WithMeterProvider(meterProvider).WithMetricsEnabled(true)

Also, the deps go.mod is set here so as not to affect the project's main go.mod and not to pollute the contents of the main go.mod.

examples/opentelemetry/main.go Outdated Show resolved Hide resolved
examples/opentelemetry/main.go Outdated Show resolved Hide resolved
examples/opentelemetry/main.go Outdated Show resolved Hide resolved
examples/opentelemetry/main.go Outdated Show resolved Hide resolved
examples/opentelemetry/main.go Show resolved Hide resolved
examples/opentelemetry/main.go Outdated Show resolved Hide resolved
@daviderli614
Copy link
Member Author

Modify are complete and ready for review @zyy17

examples/opentelemetry/main.go Outdated Show resolved Hide resolved
examples/opentelemetry/main.go Outdated Show resolved Hide resolved
examples/opentelemetry/main.go Outdated Show resolved Hide resolved
examples/opentelemetry/main.go Outdated Show resolved Hide resolved
examples/opentelemetry/main.go Outdated Show resolved Hide resolved
examples/opentelemetry/main.go Outdated Show resolved Hide resolved
@zyy17 zyy17 merged commit fa4d6c0 into GreptimeTeam:main Sep 26, 2024
6 checks passed
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.

4 participants