Skip to content

[Monitor] Generate LiveMetrics from TypeSpec#44696

Merged
hectorhdzg merged 9 commits intoAzure:mainfrom
pvaneck:monitor-exporter-quickpulse-typespec
Mar 4, 2026
Merged

[Monitor] Generate LiveMetrics from TypeSpec#44696
hectorhdzg merged 9 commits intoAzure:mainfrom
pvaneck:monitor-exporter-quickpulse-typespec

Conversation

@pvaneck
Copy link
Copy Markdown
Member

@pvaneck pvaneck commented Jan 16, 2026

Using SHA from Azure/azure-rest-api-specs#39699

  • Updated some of the filter tests as they mocked out much of the actual behavior validation.

@github-actions github-actions bot added the Monitor - Exporter Monitor OpenTelemetry Exporter label Jan 16, 2026
Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
@pvaneck pvaneck force-pushed the monitor-exporter-quickpulse-typespec branch from 0bb349e to 515bb0a Compare January 17, 2026 00:06
@hectorhdzg hectorhdzg marked this pull request as ready for review February 24, 2026 23:49
Copilot AI review requested due to automatic review settings February 24, 2026 23:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 migrates Quickpulse/LiveMetrics support in azure-monitor-opentelemetry-exporter to newly generated TypeSpec-based LiveMetrics client code, and updates Quickpulse internals/tests to use the new generated API surface.

Changes:

  • Adds TypeSpec generation configuration (tsp-location.yaml) and commits new generated livemetrics client/models under _quickpulse/_generated.
  • Updates Quickpulse implementation to use LiveMetricsClient and new model types (mapping-based model initialization, discriminator-based DocumentType).
  • Refactors Quickpulse filter tests to validate more real parsing/validation behavior and updates imports for new generated paths.

Reviewed changes

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

Show a summary per file
File Description
sdk/monitor/azure-monitor-opentelemetry-exporter/tsp-location.yaml Adds package-level TypeSpec batch generation path for Quickpulse generated output.
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_utils.py Updates model imports and uses UTC-aware timestamps in tests.
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_projection.py Updates imports to new generated livemetrics model namespace.
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_manager.py Updates imports to new generated livemetrics model namespace.
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_filter.py Reworks filter parsing tests to validate behavior more directly; updates imports.
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_exporter.py Updates client/model imports and patch targets for the new LiveMetrics client.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_validate.py Updates imports for validation helpers to new livemetrics model namespace.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_utils.py Switches to new livemetrics models and adjusts document construction/type handling.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_state.py Updates imports to new livemetrics models.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_projection.py Updates imports to new livemetrics models.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_policy.py Updates redirect policy typing/imports to reference LiveMetricsClient.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_manager.py Updates imports to new livemetrics models.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/tsp-location.yaml Records source spec/repo/commit used for generated LiveMetrics code.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/models/_patch.py Removes legacy AutoRest-generated models patch hook.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/models/_models.py Removes legacy AutoRest-generated models.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/models/init.py Removes legacy AutoRest models package exports/init.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/py.typed Adds PEP 561 marker for generated livemetrics package typing.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/models/_patch.py Adds new generated patch hook for livemetrics models package.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/models/_models.py Adds new TypeSpec-generated livemetrics model implementations.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/models/_enums.py Adds new generated enums and adjusts docstrings/headers.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/models/init.py Adds new models package exports/init for livemetrics.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/aio/_patch.py Updates async generated patch hook to new generator style.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/aio/_operations/_patch.py Updates async operations patch hook to new generator style.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/aio/_operations/_operations.py Adds new TypeSpec-generated async operations implementation.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/aio/_operations/init.py Adds async operations init/patch export wiring for livemetrics.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/aio/_configuration.py Adds new async client configuration type for livemetrics.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/aio/_client.py Adds new async LiveMetricsClient implementation.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/aio/init.py Adds async package init/export wiring for livemetrics.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/_version.py Adds generated livemetrics package version constant.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/_utils/utils.py Replaces old vendor mixin typing with generic ClientMixinABC.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/_utils/model_base.py Adds generated model base/utilities used for new models/serialization.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/_utils/init.py Adds generated utilities package init.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/_patch.py Updates sync package patch hook to new generator style.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/_operations/_patch.py Updates sync operations patch hook to new generator style.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/_operations/_operations.py Adds new TypeSpec-generated sync operations implementation.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/_operations/init.py Adds sync operations init/patch export wiring for livemetrics.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/_configuration.py Adds new sync client configuration type for livemetrics.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/_client.py Adds new sync LiveMetricsClient implementation.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/init.py Adds sync package init/export wiring for livemetrics.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/apiview-properties.json Adds APIView metadata mappings for the generated livemetrics package.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/aio/_vendor.py Removes legacy AutoRest vendor mixin typing file for aio.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/_metadata.json Adds generation metadata (API version).
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/init.py Removes legacy generated package exports (QuickpulseClient).
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_filter.py Updates parsing to use mapping-based model initialization from new generated models.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_exporter.py Switches exporter to use LiveMetricsClient and updated request signatures.
Comments suppressed due to low confidence (1)

sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/livemetrics/_operations/_operations.py:38

  • This generated code uses PEP 585 built-in generics (e.g., dict[str, Any]). That will raise at import time on Python 3.8, but this package currently declares python_requires=">=3.8" in setup.py. Either adjust generation to be 3.8-compatible (e.g., via from __future__ import annotations and/or typing.Dict/typing.List in generated output), or bump the package minimum Python version to 3.9+ consistently (setup.py/classifiers/docs).

@rads-1996
Copy link
Copy Markdown
Member

We should probably add a changelog entry for this PR and the exporter one under breaking changes

@hectorhdzg
Copy link
Copy Markdown
Member

@rads-1996 can you ellaborate in particular breaking changes you are seeing? these should be minimal to none ideally

@rads-1996
Copy link
Copy Markdown
Member

@rads-1996 can you ellaborate in particular breaking changes you are seeing? these should be minimal to none ideally

I was thinking in terms of classes being renamed and import paths being different now. But since we are already taking care of it in the code, we should be fine. However, in cases where the user's are importing classes or objects, whose paths have been changed, might result in import errors during startup -

image

In such cases, they will have to update the import paths.

@hectorhdzg
Copy link
Copy Markdown
Member

@rads-1996 people should not be referencing any internal classes in our code, that is why we have init files to have public APIs that customers should be using, I will expect API review to trigger if we change any public API

Copy link
Copy Markdown
Member

@rads-1996 rads-1996 left a comment

Choose a reason for hiding this comment

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

LGTM

@hectorhdzg hectorhdzg merged commit 2ec38cf into Azure:main Mar 4, 2026
20 checks passed
singankit pushed a commit that referenced this pull request Mar 16, 2026
* [Monitor] Generate LiveMetrics from TypeSpec

Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>

* Mypy and black updates

Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>

* Updating autogenerated code to latest

* Update tests

---------

Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
Co-authored-by: Hector Hernandez <39923391+hectorhdzg@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Monitor - Exporter Monitor OpenTelemetry Exporter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants