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

Connecting Alternate Backend to GCP Metrics/Traces #652

Open
sandeep540 opened this issue Dec 6, 2024 · 6 comments
Open

Connecting Alternate Backend to GCP Metrics/Traces #652

sandeep540 opened this issue Dec 6, 2024 · 6 comments
Labels
Question Further information is requested

Comments

@sandeep540
Copy link

Question

In the below documentation
https://logfire.pydantic.dev/docs/guides/advanced/alternative-backends/#other-environment-variables

it is mentioned if OTEL_TRACES_EXPORTER and/or OTEL_METRICS_EXPORTER is configured, it can work with alternate Backends

Can I connect the same to GCP Cloud Monitoring (Metrics & Traces)

Can you provide an Example?

@sandeep540 sandeep540 added the Question Further information is requested label Dec 6, 2024
@alexmojaki
Copy link
Contributor

@hramezani @adriangb have either of you configured this?

@adriangb
Copy link
Member

adriangb commented Dec 6, 2024

You'd do something like this:

import logfire

from opentelemetry.exporter.cloud_trace import CloudTraceSpanExporter
from opentelemetry.sdk.trace.export import BatchSpanProcessor


logfire.configure(
    send_to_logfire=False,
    additional_span_processors=[
        BatchSpanProcessor(CloudTraceSpanExporter())
    ]
)

You'll need to make sure that wherever this is running has IAM permissions properly configured, or your passing in credentials, etc.

More info: https://github.com/GoogleCloudPlatform/opentelemetry-operations-python

@alexmojaki do we have a way to pass in additional metrics sinks?

@alexmojaki
Copy link
Contributor

Yes, logfire.configure(metrics=logfire.MetricsOptions(additional_readers=[...]))

@sandeep540
Copy link
Author

Hi @adriangb @alexmojaki
This worked, few IAM permissions were needed.

Thanks, this will help a lot in debugging our app issues

@Kludex
Copy link
Member

Kludex commented Dec 24, 2024

Does someone wants to document this, or can we close it? @adriangb @alexmojaki

@alexmojaki
Copy link
Contributor

I don't want to document it, but someone should. More generally we need some docs about processors and exporters, see e.g. #486

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants