agent-starter-pack icon indicating copy to clipboard operation
agent-starter-pack copied to clipboard

feat: example of sending metrics via `traceloop`

Open ptmminh opened this issue 9 months ago • 2 comments

Thank you so much for including examples for OpenTelemetry and OpenLLMetry via traceloop. I was wondering if you'd consider adding examples of adding metrics and sending it to Cloud Metrics via metrics_exporter as well? Similar to how it's done in the OpenLLMetry docs

# ...
from opentelemetry.exporter.cloud_trace import CloudTraceSpanExporter
from opentelemetry.exporter.cloud_monitoring import CloudMonitoringMetricsExporter
from traceloop.sdk import Traceloop

# ...
trace_exporter = CloudTraceSpanExporter()
metrics_exporter = CloudMonitoringMetricsExporter()
Traceloop.init(
    app_name='your-app-name',
    exporter=trace_exporter,
    metrics_exporter=metrics_exporter)

ptmminh avatar Mar 07 '25 17:03 ptmminh

Thanks a lot for raising this. Agreed, it's something we can definitely consider. We are in the process of defining an improved contribution guide in case you want to contribute!

eliasecchig avatar Mar 08 '25 14:03 eliasecchig

Sure, I mostly asked because I didn't manage to do it successfully so I wanted to see some working examples.

However, I'll see if I can get it working and would then of course happy to contribute!

ptmminh avatar Mar 10 '25 12:03 ptmminh