dev-proxy icon indicating copy to clipboard operation
dev-proxy copied to clipboard

Make OpenAITelemetryPlugin record report metrics only if 'recording' is on

Open bartizan opened this issue 2 months ago • 4 comments

The OpenAITelemetryPlugin should only record some report metrics when the 'recording' state is active. Currently, all records are collected and compiled into a report after recoding is stopped.

bartizan avatar Nov 11 '25 11:11 bartizan

We chose to send metrics without recording because we're sending them live, as we're intercepting requests. Is there a reason why you'd want to capture metrics only while recording?

waldekmastykarz avatar Nov 13 '25 07:11 waldekmastykarz

@waldekmastykarz

We chose to send metrics without recording because we're sending them live, as we're intercepting requests. Is there a reason why you'd want to capture metrics only while recording?

This concern is unrelated to OTel metrics exporting.

The plugin generates reports using data collected over the entire period between its startup and the moment the recording is stopped. If a user generates a metrics report after the plugin has been running for a substantial period, they may be surprised by the unexpectedly large amount of historical data. This behavior is confusing.

Alternatively, we could implement a fix assuming the goal is to continuously collect all metrics data while the plugin is running. This approach would require removing the step that resets the collected data when a recording session is stopped. The generated report would then reflect the entire history of collected metrics.

bartizan avatar Nov 13 '25 08:11 bartizan

Ah, understood. Yeah, that makes sense. Rather than recording the usage for the report as we're intercepting requests, we could do it only based on the requests we recorded. You're right. Thanks for pointing it out.

waldekmastykarz avatar Nov 14 '25 12:11 waldekmastykarz

I'm on it

bartizan avatar Nov 14 '25 13:11 bartizan