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

Update typespec for ApplicationInsights LiveMetrics #28320

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

TimothyMothra
Copy link

@TimothyMothra TimothyMothra commented Mar 19, 2024

This PR is a follow up to #27430

Data Plane API - Pull Request

Trying to onboard my .NET SDK to the new typespec api. Azure/azure-sdk-for-net#42714
I found a few issues that needed to be changed:

  • edit tspconfig.yaml to support .NET SDK
    • change package-dir to use fully qualified package name: "Azure.Monitor.OpenTelemetry.LiveMetrics".
    • change model-namespace to true.
  • edit models.tsp
    • update Request document class. change URL type from Uri to string.
      This value is recorded after an application receives a request. The url is being recorded to store in telemetry. Using the Uri class here is adding unnecessary allocations and validations.
    • update KeyValuePairString class. make value property optional.
      This change makes the value property settable, which is needed as part of implementing filtering.
  • regenerated Swagger using cmd npx tsp compile link

API Info: The Basics

Most of the information about your service should be captured in the issue that serves as your API Spec engagement record.

  • Link to API Spec engagement record issue:

Is this review for (select one):

  • a private preview
  • a public preview
  • GA release

Change Scope

This section will help us focus on the specific parts of your API that are new or have been modified.
Please share a link to the design document for the new APIs, a link to the previous API Spec document (if applicable), and the root paths that have been updated.

  • Design Document:
  • Previous API Spec Doc:
  • Updated paths:

Viewing API changes

For convenient view of the API changes made by this PR, refer to the URLs provided in the table
in the Generated ApiView comment added to this PR. You can use ApiView to show API versions diff.

Suppressing failures

If one or multiple validation error/warning suppression(s) is detected in your PR, please follow the
Swagger-Suppression-Process
to get approval.

❔Got questions? Need additional info?? We are here to help!

Contact us!

The Azure API Review Board is dedicated to helping you create amazing APIs. You can read about our mission and learn more about our process on our wiki.

Click here for links to tools, specs, guidelines & other good stuff

Tooling

Guidelines & Specifications

Helpful Links

Checks stuck in `queued` state? If the PR CI checks appear to be stuck in `queued` state, please add a comment with contents `/azp run`. This should result in a new comment denoting a `PR validation pipeline` has started and the checks should be updated after few minutes.

Copy link

openapi-pipeline-app bot commented Mar 19, 2024

Next Steps to Merge

✅ All automated merging requirements have been met! To get your PR merged, see aka.ms/azsdk/specreview/merge.

Copy link

openapi-pipeline-app bot commented Mar 19, 2024

Swagger Validation Report

️❌BreakingChange: 3 Errors, 0 Warnings failed [Detail]
Compared specs (v0.10.8) new version base version
livemetrics.json 2024-04-01-preview(5e0da64) 2024-04-01-preview(main)
Rule Message
1023 - TypeFormatChanged The new version has a different format '' than the previous one 'uri'.
New: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L892:9
Old: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L893:9
1025 - RequiredStatusChange The 'required' status changed from the old version('True') to the new version('False').
New: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L59:9
Old: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L59:9
1025 - RequiredStatusChange The 'required' status changed from the old version('True') to the new version('False').
New: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L618:7
Old: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L618:7
️️✔️Breaking Change(Cross-Version) succeeded [Detail] [Expand]
There are no breaking changes.
️️✔️CredScan succeeded [Detail] [Expand]
There is no credential detected.
️⚠️LintDiff: 0 Warnings warning [Detail]
Compared specs (v2.2.2) new version base version
2024-04-01-preview 2024-04-01-preview(5e0da64) 2024-04-01-preview(main)

The following errors/warnings exist before current PR submission:

Rule Message
⚠️ SecurityDefinitionDescription Security definition should have a description.
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L44
⚠️ OperationId OperationId should be of the form 'Noun_Verb'
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L57
⚠️ RequestBodyOptional The body parameter is not marked as required.
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L87
⚠️ ErrorResponse Error response should contain a x-ms-error-code header.
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L116
⚠️ ErrorResponse Error response schema should contain an object property named error.
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L118
⚠️ OperationId OperationId should be of the form 'Noun_Verb'
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L132
⚠️ RequestBodyOptional The body parameter is not marked as required.
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L147
⚠️ ErrorResponse Error response should contain a x-ms-error-code header.
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L168
⚠️ ErrorResponse Error response schema should contain an object property named error.
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L170
⚠️ EnumInsteadOfBoolean Booleans properties are not descriptive in all cases and can make them to use, evaluate whether is makes sense to keep the property as boolean or turn it into an enum.
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L696
⚠️ EnumInsteadOfBoolean Booleans properties are not descriptive in all cases and can make them to use, evaluate whether is makes sense to keep the property as boolean or turn it into an enum.
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L700
️️✔️Avocado succeeded [Detail] [Expand]
Validation passes for Avocado.
️️✔️SwaggerAPIView succeeded [Detail] [Expand]
️️✔️TypeSpecAPIView succeeded [Detail] [Expand]
️️✔️ModelValidation succeeded [Detail] [Expand]
Validation passes for ModelValidation.
️️✔️SemanticValidation succeeded [Detail] [Expand]
Validation passes for SemanticValidation.
️️✔️PoliCheck succeeded [Detail] [Expand]
Validation passed for PoliCheck.
️️✔️SpellCheck succeeded [Detail] [Expand]
Validation passes for SpellCheck.
️️✔️Lint(RPaaS) succeeded [Detail] [Expand]
Validation passes for Lint(RPaaS).
️️✔️PR Summary succeeded [Detail] [Expand]
Validation passes for Summary.
️️✔️Automated merging requirements met succeeded [Detail] [Expand]
Posted by Swagger Pipeline | How to fix these errors?

Copy link

openapi-pipeline-app bot commented Mar 19, 2024

Swagger Generation Artifacts

️️✔️ApiDocPreview succeeded [Detail] [Expand]
 Please click here to preview with your @microsoft account. 
️⚠️ azure-sdk-for-python warning [Detail]
  • ⚠️Warning in generating from 8ae0a28971aecd4b37d1f10b233c44a78d4d9fa1. SDK Automation 14.0.0
    command	sh scripts/automation_init.sh ../azure-sdk-for-python_tmp/initInput.json ../azure-sdk-for-python_tmp/initOutput.json
    cmderr	[automation_init.sh] WARNING: Skipping azure-nspkg as it is not installed.
    cmderr	[automation_init.sh]  notice
    cmderr	[automation_init.sh] npm notice New minor version of npm available! 10.5.0 -> 10.7.0
    cmderr	[automation_init.sh] npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.7.0>
    cmderr	[automation_init.sh] npm notice Run `npm install -g [email protected]` to update!
    cmderr	[automation_init.sh] npm notice
    warn		specification/applicationinsights/data-plane/LiveMetrics/readme.md skipped due to azure-sdk-for-python not found in swagger-to-sdk
    command	sh scripts/automation_generate.sh ../azure-sdk-for-python_tmp/generateInput.json ../azure-sdk-for-python_tmp/generateOutput.json
  • ️✔️livemetrics [Preview SDK Changes]
    error	breakingChangeTracking is enabled, but version or changelogItem is not found in output.
️❌ azure-sdk-for-net-track2 failed [Detail]
  • Pipeline Framework Failed in generating from 8ae0a28971aecd4b37d1f10b233c44a78d4d9fa1. SDK Automation 14.0.0
    command	pwsh ./eng/scripts/Automation-Sdk-Init.ps1 ../azure-sdk-for-net_tmp/initInput.json ../azure-sdk-for-net_tmp/initOutput.json
    warn		specification/applicationinsights/data-plane/LiveMetrics/readme.md skipped due to azure-sdk-for-net-track2 not found in swagger-to-sdk
    command	pwsh ./eng/scripts/Invoke-GenerateAndBuildV2.ps1 ../azure-sdk-for-net_tmp/generateInput.json ../azure-sdk-for-net_tmp/generateOutput.json
    cmderr	[Invoke-GenerateAndBuildV2.ps1]
    cmderr	[Invoke-GenerateAndBuildV2.ps1] npm notice New minor version of npm available! 10.5.0 -> 10.7.0
    cmderr	[Invoke-GenerateAndBuildV2.ps1] npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.7.0>
    cmderr	[Invoke-GenerateAndBuildV2.ps1] npm notice Run `npm install -g [email protected]` to update!
    cmderr	[Invoke-GenerateAndBuildV2.ps1] npm notice
    cmderr	[Invoke-GenerateAndBuildV2.ps1] Write-Error: /mnt/vss/_work/1/s/azure-sdk-for-net/eng/scripts/Invoke-GenerateAndBuildV2.ps1:120
    cmderr	[Invoke-GenerateAndBuildV2.ps1] Line |
    cmderr	[Invoke-GenerateAndBuildV2.ps1]  120 |  … ectFolder = & $processScript $typespecFolder $commitid $repoHttpsUrl  …
    cmderr	[Invoke-GenerateAndBuildV2.ps1]      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cmderr	[Invoke-GenerateAndBuildV2.ps1]      | Failed to generate sdk project at
    cmderr	[Invoke-GenerateAndBuildV2.ps1]      | /mnt/vss/_work/1/s/azure-sdk-for-net/sdk/applicationinsights.livemetrics/Azure.Monitor.OpenTelemetry.LiveMetrics
    fatal: 'sdkAuto/28320/' is not a valid branch name
  • error	Fatal error: fatal: 'sdkAuto/28320/' is not a valid branch name
    error	Fatal error: Error: fatal: 'sdkAuto/28320/' is not a valid branch name    at Object.action (/mnt/vss/_work/1/a/unified-pipeline-runtime/common/temp/node_modules/.pnpm/[email protected]/node_modules/simple-git/dist/cjs/index.js:1332:25)    at PluginStore.exec (/mnt/vss/_work/1/a/unified-pipeline-runtime/common/temp/node_modules/.pnpm/[email protected]/node_modules/simple-git/dist/cjs/index.js:1367:29)    at /mnt/vss/_work/1/a/unified-pipeline-runtime/common/temp/node_modules/.pnpm/[email protected]/node_modules/simple-git/dist/cjs/index.js:1766:43    at new Promise (<anonymous>)    at GitExecutorChain.handleTaskData (/mnt/vss/_work/1/a/unified-pipeline-runtime/common/temp/node_modules/.pnpm/[email protected]/node_modules/simple-git/dist/cjs/index.js:1764:16)    at GitExecutorChain.<anonymous> (/mnt/vss/_work/1/a/unified-pipeline-runtime/common/temp/node_modules/.pnpm/[email protected]/node_modules/simple-git/dist/cjs/index.js:1748:44)    at Generator.next (<anonymous>)    at fulfilled (/mnt/vss/_work/1/a/unified-pipeline-runtime/common/temp/node_modules/.pnpm/[email protected]/node_modules/simple-git/dist/cjs/index.js:55:24)    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    error	The following packages are still pending:
    error
️🔄 azure-sdk-for-js inProgress [Detail]
️❌ azure-sdk-for-java failed [Detail]
  • Pipeline Framework Failed in generating from 8ae0a28971aecd4b37d1f10b233c44a78d4d9fa1. SDK Automation 14.0.0
    command	./eng/mgmt/automation/init.sh ../azure-sdk-for-java_tmp/initInput.json ../azure-sdk-for-java_tmp/initOutput.json
    warn		specification/applicationinsights/data-plane/LiveMetrics/readme.md skipped due to azure-sdk-for-java not found in swagger-to-sdk
    command	./eng/mgmt/automation/generate.py ../azure-sdk-for-java_tmp/generateInput.json ../azure-sdk-for-java_tmp/generateOutput.json
    cmderr	[generate.py] [VALIDATE][tspconfig.yaml] parameters.service-dir.default SHOULD be "sdk/<service>". See https://azure.github.io/azure-sdk/policies_repostructure.html. Current value: sdk/applicationinsights.livemetrics
    cmderr	[generate.py] [VALIDATE][tspconfig.yaml] options.@azure-tools/typespec-java.package-dir SHOULD start with "azure-". E.g. "azure-ai-openai". Current value: livemetrics
    cmderr	[generate.py] [VALIDATE][tspconfig.yaml] options.@azure-tools/typespec-java.namespace SHOULD start with "com.azure.". E.g. "com.azure.ai.openai". Current value: com.livemetrics
    error	Fatal error: The "path" argument must be of type string. Received undefined
    The "path" argument must be of type string. Received undefined
    error	Fatal error: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined    at new NodeError (node:internal/errors:405:5)    at validateString (node:internal/validators:162:11)    at Object.basename (node:path:1308:5)    at getPackageData (/mnt/vss/_work/1/a/unified-pipeline-runtime/private/openapi-sdk-automation/lib/types/PackageData.js:47:82)    at /mnt/vss/_work/1/a/unified-pipeline-runtime/private/openapi-sdk-automation/lib/automation/workflow.js:242:191    at Array.map (<anonymous>)    at workflowHandleReadmeMdOrTypeSpecProject (/mnt/vss/_work/1/a/unified-pipeline-runtime/private/openapi-sdk-automation/lib/automation/workflow.js:242:142)    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)    at async workflowMain (/mnt/vss/_work/1/a/unified-pipeline-runtime/private/openapi-sdk-automation/lib/automation/workflow.js:111:13)    at async sdkAutoMain (/mnt/vss/_work/1/a/unified-pipeline-runtime/private/openapi-sdk-automation/lib/automation/entrypoint.js:215:13)    at async /mnt/vss/_work/1/a/unified-pipeline-runtime/private/openapi-sdk-automation/lib/cli/cli.js:20:18
Posted by Swagger Pipeline | How to fix these errors?

Copy link

openapi-pipeline-app bot commented Mar 19, 2024

@AzureRestAPISpecReview AzureRestAPISpecReview added BreakingChangeReviewRequired <valid label in PR review process>add this label when breaking change review is required data-plane labels Mar 27, 2024
@TimothyMothra TimothyMothra changed the title Update LiveMetrics tspconfig.yaml - testing csharp Update typespec for ApplicationInsights LiveMetrics Mar 27, 2024
@TimothyMothra TimothyMothra marked this pull request as ready for review March 27, 2024 01:13
@msyyc
Copy link
Member

msyyc commented Mar 28, 2024

/azp run

Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@msyyc
Copy link
Member

msyyc commented Mar 28, 2024

/azp run

Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@mikekistler mikekistler added the BreakingChange-Approved-BugFix Changes are to correct the REST API definition to correctly describe service behavior label Apr 14, 2024
@@ -390,7 +390,7 @@ model KeyValuePairStringString {
key: string;

@doc("Value of the key-value pair.")
value: string;
value?: string;
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this change. I saw your explanation in the PR description (BTW thank you for this -- I see many PRs that lack this kind of explanation):

This change makes the value property settable

But this should not be dependent on whether the property is required or optional. Making the value property optional means that a key-value-pair that only contains a key is valid -- which makes no sense to me.

Copy link
Author

@TimothyMothra TimothyMothra May 2, 2024

Choose a reason for hiding this comment

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

Discussed with my team, we'll remove this change.

@microsoft-github-policy-service microsoft-github-policy-service bot removed no-recent-activity There has been no recent activity on this issue. labels May 2, 2024
@TimothyMothra TimothyMothra marked this pull request as draft May 2, 2024 19:59
@TimothyMothra
Copy link
Author

changing this PR to Draft.

  • We changed the package we're shipping this feature from, so the namespace will change. I'll make this change at a later date.
  • The change to Request URL will likely come in a new PR with some other changes. I'll coordinate with Benke.
  • The change to KVP isn't needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BreakingChange-Approved-BugFix Changes are to correct the REST API definition to correctly describe service behavior BreakingChangeReviewRequired <valid label in PR review process>add this label when breaking change review is required data-plane TypeSpec Authored with TypeSpec
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants