microsoft / vscode-extension-telemetry

Node module to help VS Code extensions send telemetry using application insights
https://www.npmjs.com/package/@vscode/extension-telemetry
Other
125 stars 46 forks source link

Why am I not apparently getting any telemetry sent? #190

Closed tomqwpl closed 8 months ago

tomqwpl commented 10 months ago

This is "how to get going" question.

I've taken the example code in the README, but I can't see any evidence of any telemetry being sent.

Code is as follows:

// telemetry reporter
let reporter : TelemetryReporter;

export function activate(context: vscode.ExtensionContext) {
   // create telemetry reporter on extension activation
   reporter = new TelemetryReporter(key);
   // ensure it gets properly disposed. Upon disposal the events will be flushed
   context.subscriptions.push(reporter);
}

export function sendEvent(eventName: string, properties?: TelemetryEventProperties | undefined, measures?: TelemetryEventMeasurements | undefined) {
    reporter.sendTelemetryEvent(eventName, properties, measures);
}

Then in my extension.ts file:

export function activate(context: vscode.ExtensionContext) {
    telemetry.activate(context);
    telemetry.sendEvent("activate");

I'm running this in "development mode" i.e F5 in vscode. Don't know whether that makes a difference.

My "telemetry" settings in vscode are set to "all". I have verified that the telemetryLogger.isUsageEnabled and telemetryLogger.isErrorsEnabled fields are both true.

My indication that nothing is getting sent is that nothing comes out in the "telemetry" output window. I get lots of logging in there for other telemetry, but nothing apparently that I've initiated. I have the "Developer: Set Log Level..." setting set to "trace". I'm assuming I'm expecting there to be messages in there logging that a telemetry event has been sent?

It makes no difference if I set an obviously incorrect application insights key, I get no errors either way.

I can't see any evidence of telemetry at the other end (Azure App Insights), but then I don't know what I'm looking for yet, I don't know what I'm expecting to be able to see.

I'm sure I must be doing something wrong, but I can't find anything in the examples that I'm looking at (vscode-jupyter extension is the only one I can find) that does anything different to what I'm doing. Equally though, when using the jupyter extension, I can't see any obvious trace entries in the telemetry output window saying it has sent telemetry messages from that extension.

What is it I'm missing?

lramos15 commented 10 months ago

So you set log level to trace and look in the Extension Telemetryoutput channel?

tomqwpl commented 10 months ago

Yes. Example of what I'm seeing in that channel output window: image

tomqwpl commented 10 months ago

Trace level setting: image

lramos15 commented 10 months ago

Yes. Example of what I'm seeing in that channel output window: image

That's the wrong channel, you want the one that says "Extension Telemetry"

image
tomqwpl commented 10 months ago

That's not what the doco says :-) image

tomqwpl commented 10 months ago

So there are two output channels, one for the events that "internal" things produce and one for events that "extensions" produce?

lramos15 commented 10 months ago

That's not what the doco says :-) image

Thanks for the call out we will work on updating this to include the extension channel cc @gregvanl

The difference between the two channels is what the core VS Code product sends vs what extensions send

tomqwpl commented 10 months ago

So for me, if the point of that channel is to have visibility of the events that are being sent by vscode, for reasons of concerns of privacy and what data is being sent, having two channels is confusing. Not sure I understand why there are are two. Surely I would just want one place where I can see all the telemetry data that VScode is sending on my behalf?

lramos15 commented 10 months ago

The reason for there being two is because extensions are installed at your own risk and we want to make it clear to users what something that is an external addon is collecting vs VS Code itself.

tomqwpl commented 10 months ago

Where do I find any information about what I'm looking for at the other end as it were? If I go to the Application Insights website, where do I go to see the telemetry events that have been logged? Am I just being impatient? Does is just take more than some hours for the data to be ingested? I'm not familiar with Application Insights, but a lot of the documentation seems to be around "requests" and the like (i.e web based applications), so I'm unclear how these telemetry events will manifest.

lramos15 commented 9 months ago

You should be able to query App insights after just an hour, I've tested a sample extension to ensure the module is working as expected