frigus02 / opentelemetry-application-insights

OpenTelemetry exporter for Azure Application Insights
MIT License
22 stars 12 forks source link

Log exporter #81

Closed frigus02 closed 1 month ago

frigus02 commented 1 month ago

Closes #80

I think this roughly matches the current JS exporter. It still needs:

frigus02 commented 1 month ago

If I see that correctly, neither opentelemetry-appender-log nor opentelemetry-appender-tracing have special error/exception logging logic.

I copied the exception logic from https://github.com/Azure/azure-sdk-for-js/blob/f65ab7aee5dd255231d189b28ceb05087cbf0cc3/sdk/monitor/monitor-opentelemetry-exporter/src/utils/logUtils.ts#L55-L72. But now I wonder if I should hold off on that until the opentelemetry-appenders log errors with special attributes. Only then can I see how to detect them properly. Or is this particular behavior specced (i.e. an exception log must have a exception.type field)?

TODO for myself: file feature request on https://github.com/open-telemetry/opentelemetry-rust. I think opentelemetry-appender-tracing could likely support a similar logic for errors than https://github.com/tokio-rs/tracing-opentelemetry/blob/9462de6481321704912f54d3f61c080eb732ca62/src/layer.rs#L253-L358

frigus02 commented 1 month ago

Ah, according to https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-logs/#attributes either exception.type or exception.message is required and the other one is recommended. We should then probably check for existance of either.

frigus02 commented 1 month ago

Alright. I think this is complete and working correctly. I'm going to give me a bit of time to think this through once more and then merge & release.