Azure / Azure/azure-functions-powershell-worker
Access Telemetry Client to add customDimensions for App Insights
- Dominant language
- C#
- Stars
- 215
- Forks
- 61
- Avg merge
- 21h 4m
- Merged PRs (30d)
- 6
Description
Question. Is it possible to access and add customDimensions / properties to the existing telemetry client within the function app? Specifically for a request. I'm able to do so only when creating a new client and invoking trackRequest, like so:
```
class MyInitializer3 : Extensibility.ITelemetryInitializer {
<# Define the class. Try constructors, properties, or methods. #>
[void]Initialize([Channel.ITelemetry]$Telemetry){
#$requestTelemetry = [DataContracts.RequestTelemetry]::new()
$requestTelemetry = [DataContracts.RequestTelemetry]$Telemetry
$requestTelemetry.Properties["test"] = "test value"
}
}
$requestTelemetry = [DataContracts.RequestTelemetry]::new()
######################
$telemetryConfig = [Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration]::CreateDefault()
$telemetryConfig.ConnectionString = "XXXXXXXX"
$telemetryConfig.TelemetryInitializers.Add( [MyInitializer3]::new() )
$client = [Microsoft.ApplicationInsights.TelemetryClient]::new($telemetryConfig)
$client.TrackRequest("requestTest",$(get-date),100,201,$true)
```
But of course the function app already logs a request anyway, and I'd like to add to that.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.