ApplicationInsights-dotnet icon indicating copy to clipboard operation
ApplicationInsights-dotnet copied to clipboard

PowerShell does not have overload method of TrackEvent() in Microsoft.ApplicationInsights.TelemetryClient

Open jsquire opened this issue 2 years ago • 3 comments

Issue Transfer

This issue has been transferred from the Azure SDK for .NET repository, #33904.

Please be aware that @MarsWangyang is the author of the original issue and include them for any questions or replies.

Details

Hi all,

I was trying to use Microsoft.ApplicationInsights.TelemetryClient to send custom event to Application Insights via PowerShell. I did find TrackEvent() has overload method which might could send custom measurements. However, it said Cannot find an overload for "TrackMetric" and the argument count: "3".

this is my code

$client = [Microsoft.ApplicationInsights.TelemetryClient]::new()
$p = [pscustomobject]@{
    Str = "String Test"
} | ConvertTo-Json 

$measurement = [pscustomobject]@{
    totalTime = 0.33
} | ConvertTo-Json 
$client.TrackEvent("Test Message", $p, $measurement);

Is there anyone know how to send the custom measurements data to the application insight?

Tks.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

jsquire avatar Feb 06 '23 13:02 jsquire

following the newest response

MarsWangyang avatar Feb 07 '23 19:02 MarsWangyang

This issue is stale because it has been open 300 days with no activity. Remove stale label or this will be closed in 7 days. Commenting will instruct the bot to automatically remove the label.

github-actions[bot] avatar Dec 05 '23 00:12 github-actions[bot]

Any update?

MarsWangyang avatar Dec 05 '23 04:12 MarsWangyang