Skip to content

utils: Add a fail-safe that will add the last reported Azure sub ID to properties #1977

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

Closed
wants to merge 1 commit into from

Conversation

nturinski
Copy link
Member

This adds a property to the internal telemetry reporter that will save the last reported Azure sub ID. I think it's safe to do this, even for commands that don't directly interact with Azure, because we're more interested in users that are engaged/signed in Azure even if they happened to do a local command (such as create a new project).

@nturinski nturinski requested a review from a team as a code owner April 22, 2025 21:07
Comment on lines +240 to +246
if (context.telemetry.properties.subscriptionId) {
// set the lastReported subscription id to the current one if it exists
ext._internalReporter.lastReportedAzureSubscriptionId = context.telemetry.properties.subscriptionId;
} else {
// use the last reported subscription id if no subscription id was set on the telemetry properties
context.telemetry.properties.subscriptionId = ext._internalReporter.lastReportedAzureSubscriptionId;
}
Copy link
Contributor

@bwateratmsft bwateratmsft Apr 22, 2025

Choose a reason for hiding this comment

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

This seems like something that is better solved at the time of Kusto querying, rather than this. Failing that, I'd try to create a telemetry handler to do this if possible:

export function registerTelemetryHandler(handler: types.TelemetryHandler): Disposable {
return registerHandler(handler, telemetryHandlers);
}

@nturinski
Copy link
Member Author

Talked about this with Brandon offline and am closing it.

@nturinski nturinski closed this Apr 23, 2025
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.

2 participants