azure-rest-api-specs icon indicating copy to clipboard operation
azure-rest-api-specs copied to clipboard

Update typespec for ApplicationInsights LiveMetrics

Open TimothyMothra opened this issue 1 year ago • 9 comments

This PR is a follow up to https://github.com/Azure/azure-rest-api-specs/pull/27430

Data Plane API - Pull Request

Trying to onboard my .NET SDK to the new typespec api. https://github.com/Azure/azure-sdk-for-net/pull/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
  • [x] 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.

TimothyMothra avatar Mar 19 '24 16:03 TimothyMothra

Next Steps to Merge

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

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
:warning: SecurityDefinitionDescription Security definition should have a description.
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L44
:warning: OperationId OperationId should be of the form 'Noun_Verb'
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L57
:warning: RequestBodyOptional The body parameter is not marked as required.
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L87
:warning: ErrorResponse Error response should contain a x-ms-error-code header.
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L116
:warning: ErrorResponse Error response schema should contain an object property named error.
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L118
:warning: OperationId OperationId should be of the form 'Noun_Verb'
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L132
:warning: RequestBodyOptional The body parameter is not marked as required.
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L147
:warning: ErrorResponse Error response should contain a x-ms-error-code header.
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L168
:warning: ErrorResponse Error response schema should contain an object property named error.
Location: LiveMetrics/preview/2024-04-01-preview/livemetrics.json#L170
:warning: 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
:warning: 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?

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?

/azp run

msyyc avatar Mar 28 '24 02:03 msyyc

Azure Pipelines successfully started running 4 pipeline(s).

azure-pipelines[bot] avatar Mar 28 '24 02:03 azure-pipelines[bot]

/azp run

msyyc avatar Mar 28 '24 02:03 msyyc

Azure Pipelines successfully started running 4 pipeline(s).

azure-pipelines[bot] avatar Mar 28 '24 02:03 azure-pipelines[bot]

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.

TimothyMothra avatar May 02 '24 20:05 TimothyMothra