Skip to content

[azmetrics] add fake support #24309

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

Merged
merged 2 commits into from
Mar 25, 2025
Merged

Conversation

gracewilcox
Copy link
Member

Closes #24307

  • Add fake support for the azmetrics package
  • Regenerated with latest autorest codegen version

@gracewilcox gracewilcox added Monitor Monitor, Monitor Ingestion, Monitor Query Client This issue points to a problem in the data-plane of the library. labels Mar 24, 2025
@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

sdk/monitor/query/azmetrics

@gracewilcox gracewilcox marked this pull request as ready for review March 24, 2025 21:48
@Copilot Copilot AI review requested due to automatic review settings March 24, 2025 21:48
Copy link
Contributor

@Copilot 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 adds fake support for the azmetrics package by introducing fake server transport implementations and updating generated code. Key changes include:

  • Adding fake implementations for time formatting and querying through new files in the fake package.
  • Updating and reordering query parameter assignments in the client request creation.
  • Upgrading autorest configuration with the new codegen version and enabling the generation of fakes.

Reviewed Changes

Copilot reviewed 20 out of 22 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sdk/monitor/query/azmetrics/fake/time_rfc3339.go Adds fake time parsing support with updated regex/layouts.
sdk/monitor/query/azmetrics/fake/server_test.go Adds tests to validate the behavior of the fake server.
sdk/monitor/query/azmetrics/fake/server.go Implements fake server transport and dispatch for queries.
sdk/monitor/query/azmetrics/time_rfc3339.go Updates time parsing logic and removes build constraint tags.
sdk/monitor/query/azmetrics/autorest.md Updates module version, autorest codegen version, and enables fake generation.
Other generated files Removes go:build tags to streamline build configuration.
Files not reviewed (2)
  • eng/config.json: Language not supported
  • sdk/monitor/query/azmetrics/go.mod: Language not supported
Comments suppressed due to low confidence (2)

sdk/monitor/query/azmetrics/fake/time_rfc3339.go:43

  • Ensure tests cover a variety of date-time string formats (with or without 'T', timezone offsets, etc.) to verify the regex and layout selection logic in UnmarshalJSON.
func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error {

sdk/monitor/query/azmetrics/client.go:39

  • Verify that the reordering of query parameter assignments in queryResourcesCreateRequest maintains the intended behavior of the API call, ensuring that all required parameters are set appropriately.
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)

@gracewilcox gracewilcox merged commit 66eca06 into Azure:main Mar 25, 2025
70 checks passed
@gracewilcox gracewilcox deleted the metrics-fakes branch March 25, 2025 17:55
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. Monitor Monitor, Monitor Ingestion, Monitor Query
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fake support in azmetrics
3 participants