Skip to content

Conversation

@agehrke
Copy link

@agehrke agehrke commented Nov 16, 2025

Currently the NDJsonWriter class is used for serializing TelemetryItem objects when exporting to Azure Monitor via ApplicationInsightsRestClient. The NDJsonWriter writes to a MemoryStream, and copies bytes from the stream via a ToArray() call when returning to consumer. This is unneeded. This PR changes NDJsonWriter class to use Azure.Core's copy of ArrayBufferWriter and just returns WrittenMemory to the consumer and avoids the mem copy.

Also, when exporting OpenTelemetry logs in AzureMonitorLogExporter we use the size of Batch<LogRecord> when converting them to a List<TelemetryItem> in LogsHelper.OtelToAzureMonitorLogs()

@github-actions github-actions bot added Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor - Exporter Monitor OpenTelemetry Exporter labels Nov 16, 2025
@github-actions
Copy link

Thank you for your contribution @agehrke! We will review the pull request and get back to you soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor - Exporter Monitor OpenTelemetry Exporter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant