Add support for exporting Custom Events to Azure App Insights.#814
Add support for exporting Custom Events to Azure App Insights.#814ivaramme wants to merge 1 commit intocensus-instrumentation:masterfrom
Conversation
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
7de9485 to
8ba8125
Compare
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
8ba8125 to
be61bfc
Compare
| time=utils.timestamp_to_iso_str(record.created), | ||
| ) | ||
|
|
||
| envelope.name = "Microsoft.ApplicationInsights.Event" |
There was a problem hiding this comment.
I thought we decided to use Logs as the actual telemetry type? This would be Message data.
There was a problem hiding this comment.
But wouldn't that log the data as "searchable text" in the logs table (https://github.com/microsoft/ApplicationInsights-Home/blob/master/EndpointSpecs/Schemas/Bond/MessageData.bond#L6)?
The event definition is different (and this link might be outdated) and more resonant to what we are trying to accomplish here (custom events): https://github.com/microsoft/ApplicationInsights-Home/blob/master/EndpointSpecs/Schemas/Bond/EventData.bond#L5
Maybe I'm missing something, please let me know.
| from opencensus.ext.azure.log_exporter import AzureLogHandler | ||
|
|
||
|
|
||
| class AzureEventHandler(AzureLogHandler): |
There was a problem hiding this comment.
I don't think we need another handler type if we are going to be using Message telemetry type. We can leverage the already existing AzureLogHandler and place the new "properties" logic in there.
| def __init__(self, **options): | ||
| super(AzureEventHandler, self).__init__(**options) | ||
|
|
||
| def log_record_to_envelope(self, record): |
There was a problem hiding this comment.
I think adding an example of how this works in examples.logs will help. As well, updating the example in the README and adding an excerpt of this feature will be good.
Enable exporter for custom events using the same logging pipeline available in OC.
be61bfc to
cc517ea
Compare
|
Closed due to [#822 ] |
This PR enables sending Custom Events to Application Insights (Azure) from an application by creating a new logging exporter with the expected data structure used by App Insights for this feature.
Custom Events in App Insights are a special type of structured, searchable data points reflecting an event or action. An event must contain an event name and optionally a set of properties (in the form of dictionaries) that are attached to that entry.