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

[Monitor OpenTelemetry Exporter] Support Client IP on Logs & Events #33366

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JacksonWeber
Copy link
Member

@JacksonWeber JacksonWeber commented Mar 12, 2025

Packages impacted by this PR

@azure/monitor-opentelemetry-exporter

Describe the problem that is addressed by this PR

We should support setting the AiLocationIp tag on logs and events in the same way as we do on spans.

Are there test cases added in this PR? (If not, why?)

Yes, updated log tests to include the different methods of setting the location IP.

Checklists

  • Added impacted package name to the issue description
  • Does this PR needs any fixes in the SDK Generator?** (If so, create an Issue in the Autorest/typescript repository and link it here)
  • Added a changelog (if necessary)

@Copilot Copilot bot review requested due to automatic review settings March 12, 2025 20:07

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for setting the AiLocationIp tag on logs and events, mirroring the behavior for spans in the OpenTelemetry exporter. Key changes include updating constant definitions in types.ts, enhancing tests in logUtils.spec.ts to cover client IP settings, and modifying utility functions in logUtils.ts to include the client IP.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
sdk/monitor/monitor-opentelemetry-exporter/src/types.ts Added new constant exports for exception details and HTTP client IP attributes
sdk/monitor/monitor-opentelemetry-exporter/test/internal/logUtils.spec.ts Updated log tests to verify that client IP tags are correctly applied in various log scenarios
sdk/monitor/monitor-opentelemetry-exporter/src/utils/logUtils.ts Updated the tag and property creation logic to incorporate the new client IP support
Comments suppressed due to low confidence (1)

sdk/monitor/monitor-opentelemetry-exporter/src/utils/logUtils.ts:163

  • [nitpick] Using 'as any' in the includes check for httpSemanticValues may obscure type issues; consider defining httpSemanticValues with a string array type so that explicit casting is not needed.
httpSemanticValues.includes(key as any) ||
@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants