File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/WebJobs.Script/Config Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 22// Licensed under the MIT License. See License.txt in the project root for license information.
33
44using System ;
5+ using System . Collections . Generic ;
56using Microsoft . ApplicationInsights . Channel ;
67using Microsoft . ApplicationInsights . Extensibility ;
78using Microsoft . Extensions . Options ;
@@ -29,7 +30,14 @@ public ScriptTelemetryInitializer(IOptions<ScriptJobHostOptions> hostOptions)
2930
3031 public void Initialize ( ITelemetry telemetry )
3132 {
32- telemetry ? . Context ? . Properties ? . Add ( ScriptConstants . LogPropertyHostInstanceIdKey , _hostOptions . InstanceId ) ;
33+ IDictionary < string , string > telemetryProps = telemetry ? . Context ? . Properties ;
34+
35+ if ( telemetryProps == null )
36+ {
37+ return ;
38+ }
39+
40+ telemetryProps [ ScriptConstants . LogPropertyHostInstanceIdKey ] = _hostOptions . InstanceId ;
3341 }
3442 }
3543}
You can’t perform that action at this time.
0 commit comments