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

[@azure/monitor-opentelemetry-exporter] Send Custom Event to AI #29196

Open
gunzip opened this issue Apr 6, 2024 · 4 comments
Open

[@azure/monitor-opentelemetry-exporter] Send Custom Event to AI #29196

gunzip opened this issue Apr 6, 2024 · 4 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor - Exporter Monitor OpenTelemetry Exporter needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@gunzip
Copy link

gunzip commented Apr 6, 2024

Is your feature request related to a problem? Please describe.

We are interested in utilizing OpenTelemetry with Azure Monitor and also want to send Custom Events to Application Insights.

As per the documentation, currently, this capability is not supported, requiring us to fall back on the classic Application Insights SDK.

At the moment, all types of span events are categorized as "Traces" in Application Insights, which is a significant barrier for us in adopting OpenTelemetry.

Describe the solution you'd like

According to the documentation here, the ability to send Custom Events via OpenTelemetry Azure Monitor is supposed to be "available as a public preview", but I haven't been able to find any further information on this. Could you provide an estimated time of arrival for this feature?

Is there any known workaround? At the very least, we're interested in the possibility of sharing configurations (e.g., sampling rate) between Azure Monitor and the default Application Insights client, just in case.

Thank you for your work!

Describe alternatives you've considered

Reverting to the classic Application Insights SDK.

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor - Exporter Monitor OpenTelemetry Exporter needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. labels Apr 6, 2024
Copy link

github-actions bot commented Apr 6, 2024

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @hectorhdzg @JacksonWeber @ramthi.

@gunzip
Copy link
Author

gunzip commented Apr 8, 2024

Update. I've found this workaround, but it depends on some internals. Maybe we can automatically route traces to customEvents in case they've got custom properties?

const trackCustomEvent = (
  name: string,
  properties: Record<string, string>,
  loggerName = "default",
) => {
  const data /* TelemetryEventData */ = {
    // event name
    name,
    // required
    version: 2,
  };
  logs.getLogger(loggerName).emit({
    severityNumber: SeverityNumber.INFO,
    severityText: "INFO",
    body: JSON.stringify(data),
    attributes: { ...properties, "_MS.baseType": "EventData" },
  });
};

@JacksonWeber
Copy link
Member

JacksonWeber commented Apr 8, 2024

Hi @gunzip, it is correct that custom events are in public preview. That's referring to the beta for ApplicationInsights Version 3, which is built on OpenTelemetry, but provides an API that should be familiar to those using the current version of ApplicationInsights.

We're currently tracking custom events to GA in the next six months.

As for the workaround, this appears to be similar to what's achieved by the beta mentioned above, so you may want to simply use that project if it meets your needs with its limitations.

@JacksonWeber JacksonWeber removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Apr 12, 2024
@JacksonWeber JacksonWeber self-assigned this Apr 12, 2024
@github-actions github-actions bot added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Apr 12, 2024
@eric-gonzalez-tfs
Copy link

eric-gonzalez-tfs commented Sep 16, 2024

Hi @gunzip - thank you for the sample. I too had a requirement to track custom events, but needed to use some of the OTel functionality that the Azure Monitor package provides.

For anyone landing on this and wanting to know how to send custom events using Azure Monitor, you can follow what the Application Insights package does to send Custom Events via OTel here. The data flows from trackEvent to _eventToLogRecord to _telemetryToLogRecord and ultimately gets emitted via OTel logger as your example suggests.

It's pretty easy to follow and I was able to get it working by slightly modifying this helper function to my needs.

BTW - @JacksonWeber - who can we reach out to to get on the Public Preview for custom events?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor - Exporter Monitor OpenTelemetry Exporter needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

3 participants