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

Separate sending to logfire from using standard OTEL env vars #351

Merged
merged 16 commits into from
Aug 6, 2024

Conversation

alexmojaki
Copy link
Contributor

@alexmojaki alexmojaki commented Aug 2, 2024

Closes #298, based on #350 (comment)

Notable changes:

  • OTEL_EXPORTER_OTLP_ENDPOINT is no longer just an alternative to LOGFIRE_BASE_URL. Setting OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, and/or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT will set up appropriate exporters in addition to sending to logfire, which must be turned off separately if desired. These are basic exporters relying on OTEL defaults. In particular they don't use our custom retrying logic.
  • Setting OTEL_TRACES_EXPORTER to an unsupported value will silently disable the extra OTEL exporter rather than raising an error. The idea is that it's a standard variable which (1) may be set by something other than the user without them knowing, and (2) may be consumed by something other than logfire.
  • OTEL_METRICS_EXPORTER is similarly checked, it wasn't used at all before.
  • Pending spans are only produced for logfire exporters (sending to the backend, the console, or the test exporters)

Copy link

cloudflare-workers-and-pages bot commented Aug 2, 2024

Deploying logfire-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8d9d2c5
Status: ✅  Deploy successful!
Preview URL: https://5de418db.logfire-docs.pages.dev
Branch Preview URL: https://alex-otlp-env-vars.logfire-docs.pages.dev

View logs

Copy link

codecov bot commented Aug 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (24b95f1) to head (e56a99f).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #351   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          123       123           
  Lines         9085      9177   +92     
  Branches      1185      1195   +10     
=========================================
+ Hits          9085      9177   +92     

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

Comment on lines -206 to -207
Ensure that `preferred_temporality=logfire.METRICS_PREFERRED_TEMPORALITY`
is passed to the constructor of metric readers/exporters that accept the `preferred_temporality` argument.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thinking about exporting to other backends, I realize that this is somewhat opinionated, and we shouldn't recommend it for all alternative metric readers.

@alexmojaki alexmojaki marked this pull request as ready for review August 5, 2024 16:07

Alternatively, you can use the `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` and `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` environment variables to specify the URLs for traces and metrics separately. These URLs should include the full path, including `/v1/traces` and `/v1/metrics`.

The data will be encoded using Protobuf (not JSON) and sent over HTTP (not gRPC), so make sure that your backend supports this.
Copy link
Member

Choose a reason for hiding this comment

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

I would add an info admonition or something to catch attention here.

@Kludex Kludex enabled auto-merge (squash) August 6, 2024 10:51
@Kludex Kludex merged commit be319da into main Aug 6, 2024
11 checks passed
@Kludex Kludex deleted the alex/otlp-env-vars branch August 6, 2024 10:53
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.

Do not require auth if using custom exporters
2 participants