Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for exporting Custom Events to Azure App Insights. #814

Closed

Conversation

ivaramme
Copy link
Contributor

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.

@googlebot
Copy link

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.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

time=utils.timestamp_to_iso_str(record.created),
)

envelope.name = "Microsoft.ApplicationInsights.Event"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we decided to use Logs as the actual telemetry type? This would be Message data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

@lzchen lzchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comments.

Enable exporter for custom  events using the same logging pipeline available in OC.
@lzchen
Copy link
Contributor

lzchen commented Dec 6, 2019

Closed due to [#822 ]

@lzchen lzchen closed this Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants