[Monitor] Generate exporter with TypeSpec #44442
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Generation from TypeSpec from the branch in this PR: Azure/azure-rest-api-specs#38795
Noteable changes
timefield inTelemetryItemseems to have always been typed asdatetime.datetime, but was being set as a ISO8601 date string. I have adjusted the tests and the_create_telemetry_itemmethod to set thetimeto adatetimeobject and have adjusted the tests accordingly. The datetime objects will be serialized to the ISO8601 formatted strings (e.g.2025-12-15T13:45:30.0000000Zwhen sent in a request anyway, so this should be fine.dictfield in a generated model (e.g.TelemetryItem.tags), modifying it using attribute access doesn't currently work. For example:Notes:
tsp-clientwhere the Exporter project will be emitted intoazure/monitor/opentelemetry/exporter/_generated. LiveMetrics will be emitted toazure/monitor/opentelemetry/exporter/_quickpulse/_generatedin the future.blackbeing automatically be run upon generation. If we want to reduce the diff, we can runblackon the existing codebase first in a separate PR.tests/trace/test_trace.py::TestAzureTraceExporter::test_get_otel_resource_envelopewas left as is, but is currently failing. It is comparing OTelResourceattributes withMetricsData.properties, but thepropertiesfield is type and serialized asDict[str, str]. Thus, all values end up as strings when checking the values ofproperties. Should the test be modified or is the typing inaccurate?