Skip to content

{Telemetry} Add telemetry log for local debugging#27004

Closed
evelyn-ys wants to merge 1 commit intoAzure:devfrom
evelyn-ys:telemetry_log
Closed

{Telemetry} Add telemetry log for local debugging#27004
evelyn-ys wants to merge 1 commit intoAzure:devfrom
evelyn-ys:telemetry_log

Conversation

@evelyn-ys
Copy link
Member

@evelyn-ys evelyn-ys commented Jul 26, 2023

Description

We have dropped telemetry local cache strategy in #26854. So there won't be cache file under $HOMEDIR/.azure/telemetry folder anymore. This brings some trouble for CLI developers when they add/modify some telemetry properties.

So this PR adds telemetry log with full property values which was used to be stored in cache file. Developers can now check $HOMEDIR/.azure/logs/telemetry.log for local debugging

Testing Guide

Run any CLI command then check $HOMEDIR/.azure/logs/telemetry.log, there should be log like this:

2023-07-26 17:31:21,127 : INFO : telemetry.client : Add 1 record(s) to client c4395b75-49cc-422c-bc95-xxxxxxxxxxxx for uploading: [{'name': 'azurecli/command', 'properties': {'Reserved.DataModel.EntityType': 'UserTask', 'Reserved.DataModel.Action.Type': 'Atomic', 'Reserved.DataModel.Action.Result': 'Success', 'Reserved.ChannelUsed': 'AI', 'Reserved.EventId': '0d614f42-5628-4036-87ce-bad4a9c55f74', 'Reserved.SequenceNumber': 1, 'Reserved.SessionId': '63dec10d2df75bcb47db2cfcc3a5795d01f32d6633b6635c9dddeb19cb7d6a8b', 'Reserved.TimeSinceSessionStart': 0, 'Reserved.DataModel.Source': 'DataModelAPI', 'Reserved.DataModel.EntitySchemaVersion': 4, 'Reserved.DataModel.Severity': 0, 'Reserved.DataModel.ProductName': 'azurecli', 'Reserved.DataModel.FeatureName': 'command', 'Reserved.DataModel.EntityName': 'keyvault-show', 'Reserved.DataModel.CorrelationId': 'ca6afc7b-4386-43d7-bbf1-1eca4f61ee9f', 'Context.Default.VS.Core.ExeName': 'azurecli', 'Context.Default.VS.Core.ExeVersion': '2.50.0@none', ...... 'Context.Default.AzureCLI.ShowSurveyMessage': 'False', 'Context.Default.AzureCLI.AllowBroker': 'False'}}]
2023-07-26 17:31:21,127 : INFO : telemetry.client : Accumulated 1 events. Flush the clients.

This checklist is used to make sure that common guidelines for a pull request are followed.

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jul 26, 2023

❌AzureCLI-FullTest
️✔️acr
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️acs
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️advisor
️✔️latest
️✔️3.10
️✔️3.9
️✔️ams
️✔️latest
️✔️3.10
️✔️3.9
️✔️apim
️✔️latest
️✔️3.10
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.10
️✔️3.9
️✔️appservice
️✔️latest
️✔️3.10
️✔️3.9
️✔️aro
️✔️latest
️✔️3.10
️✔️3.9
️✔️backup
️✔️latest
️✔️3.10
️✔️3.9
️✔️batch
️✔️latest
️✔️3.10
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.10
️✔️3.9
️✔️billing
️✔️latest
️✔️3.10
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.10
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.10
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.10
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.10
️✔️3.9
️✔️config
️✔️latest
️✔️3.10
️✔️3.9
️✔️configure
️✔️latest
️✔️3.10
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.10
️✔️3.9
️✔️container
️✔️latest
️✔️3.10
️✔️3.9
️✔️core
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.10
️✔️3.9
️✔️databoxedge
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️dla
️✔️latest
️✔️3.10
️✔️3.9
️✔️dls
️✔️latest
️✔️3.10
️✔️3.9
️✔️dms
️✔️latest
️✔️3.10
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.10
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.10
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.10
️✔️3.9
️✔️find
️✔️latest
️✔️3.10
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.10
️✔️3.9
️✔️identity
️✔️latest
️✔️3.10
️✔️3.9
️✔️iot
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
❌keyvault
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
❌latest
❌3.10
Type Test Case Error Message Line
Failed test_keyvault_certificate_soft_delete E azure.cli.testsdk.exceptions.CliExecutionError: The CLI throws exception CLIError during execution and fails the command.

During handling of the above exception, another exception occurred:
E knack.util.CLIError: Can't overwrite existing cassette ('/mnt/vss/_work/1/s/src/azure-cli/azure/cli/command_modules/keyvault/tests/latest/recordings/test_keyvault_certificate_soft_delete.yaml') in your current record mode ('once').
No match for the request (<Request (GET) https://cli-test-kv-ct-sd-000002.vault.azure.net/certificates/cert1/pending?api-version=7.4>) was found.
Found 2 similar requests with 0 different matcher(s) :

1 - (<Request (GET) https://cli-test-kv-ct-sd-000002.vault.azure.net/certificates/cert1/pending?api-version=7.4>).
Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path', '_custom_request_query_matcher']
Matchers failed :

2 - (<Request (GET) https://cli-test-kv-ct-sd-000002.vault.azure.net/certificates/cert1/pending?api-version=7.4>).
Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path', '_custom_request_query_matcher']
Matchers failed :
azure/cli/command_modules/keyvault/tests/latest/test_keyvault_commands.py:1873
️✔️3.9
️✔️kusto
️✔️latest
️✔️3.10
️✔️3.9
️✔️lab
️✔️latest
️✔️3.10
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.10
️✔️3.9
️✔️maps
️✔️latest
️✔️3.10
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.10
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.10
️✔️3.9
️✔️mysql
️✔️latest
️✔️3.10
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.10
️✔️3.9
️✔️network
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.10
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.10
️✔️3.9
️✔️profile
️✔️latest
️✔️3.10
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.10
️✔️3.9
️✔️redis
️✔️latest
️✔️3.10
️✔️3.9
️✔️relay
️✔️latest
️✔️3.10
️✔️3.9
️✔️resource
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️role
️✔️latest
️✔️3.10
️✔️3.9
️✔️search
️✔️latest
️✔️3.10
️✔️3.9
️✔️security
️✔️latest
️✔️3.10
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.10
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.10
️✔️3.9
️✔️servicefabric
️✔️latest
️✔️3.10
️✔️3.9
️✔️signalr
️✔️latest
️✔️3.10
️✔️3.9
️✔️sql
️✔️latest
️✔️3.10
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.10
️✔️3.9
️✔️storage
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.10
️✔️3.9
️✔️telemetry
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️util
️✔️latest
️✔️3.10
️✔️3.9
️✔️vm
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jul 26, 2023

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan
Copy link
Collaborator

yonzhan commented Jul 26, 2023

Telemetry

@evelyn-ys evelyn-ys self-assigned this Jul 26, 2023
@evelyn-ys evelyn-ys marked this pull request as draft July 26, 2023 09:46
if not client:
continue

self._logger.info('Add %d record(s) to client %s for uploading: %s', len(records), instrumentation_key, records)
Copy link
Member

Choose a reason for hiding this comment

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

Will $HOMEDIR/.azure/logs/telemetry.log be rotated? We certainly don't want it to grow indefinitely as time passes.

if not client:
continue

self._logger.info('Add %d record(s) to client %s for uploading: %s', len(records), instrumentation_key, records)
Copy link
Member

Choose a reason for hiding this comment

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

Under what circumstances will records be greater than 1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants