frigus02 / opentelemetry-application-insights

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

How to send customEvents? #53

Closed reillysiemens closed 1 year ago

reillysiemens commented 2 years ago

If I understand the documentation correctly all events without exception.{type,message,stacktrace} as the name end up in the traces table in Application Insights. Is there any support for sending events to the customEvents table? Most of the examples (understandably) focus on the requests, dependencies, and exceptions tables, but those aren't relevant to every application.

If it's possible to send customEvents I would be happy to submit a PR documenting how to do so in an example.

frigus02 commented 2 years ago

Thanks for reporting. I wasn't aware of customEvents. It's not possible at the moment to send those. Events are reported either as traces or exceptions. This used to mimic Microsoft's JavaScript and Python OpenTelemetry exporters. I'm not sure if that's still the case.

That said, supporting customEvents sounds like a good idea.

I wonder how we could differentiate customEvents from traces, i.e. when do we report what? Maybe an special attribute on the event?

I'm on mobile right now. It may take a few days until I can take a proper look.

mirdaki commented 2 years ago

From what I understand, Application Insight's official SDKs only support the "traces" standard for Open Telemetry at this time. That is in part, because the logs API for Open Telemetry is still not considered stable

Just speculating, but I suspect that once they adopt the logs standard, they'll use the the customEvents table for that (and metrics will go to the customMetrics table)

reillysiemens commented 2 years ago

I think that makes some sense, @mirdaki. Meanwhile, if it's not too much trouble, @frigus02, would it be possible to support customEvents in a fashion similar to "exception" with a special event name (perhaps "custom")? Or would you rather delay that to wait for stabilization?

frigus02 commented 2 years ago

Thanks for the links, @mirdaki.

Meanwhile, if it's not too much trouble, @frigus02, would it be possible to support customEvents in a fashion similar to "exception" with a special event name (perhaps "custom")?

Yeah, that sounds fine to me.

I'm still out and don't have access to my laptop. I'll have a closer look next week.

reillysiemens commented 2 years ago

That's fine, @frigus02. No worries and no rush. I'm not yet in a position to take advantage of this, so don't let my questions push you towards an implementation sooner than you want. 🙂

frigus02 commented 1 year ago

Sorry for the long delay. I finally got to this: #55. The implementation was easy, but I'm not 10% happy with it, yet.

I'm going to think about the event name thing for another day or 2. If I can't come up with anything better, I'm just going to merge and release as is. If you have any thoughts, please let me know.

frigus02 commented 1 year ago

Sorry for the delay again. I didn't find much time after work lately. Anyway, I just published version 0.23.0, which supports custom events.