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 2
2
// Licensed under the MIT License. See License.txt in the project root for license information.
3
3
4
4
using System ;
5
+ using System . Collections . Generic ;
5
6
using Microsoft . ApplicationInsights . Channel ;
6
7
using Microsoft . ApplicationInsights . Extensibility ;
7
8
using Microsoft . Extensions . Options ;
@@ -29,7 +30,14 @@ public ScriptTelemetryInitializer(IOptions<ScriptJobHostOptions> hostOptions)
29
30
30
31
public void Initialize ( ITelemetry telemetry )
31
32
{
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 ;
33
41
}
34
42
}
35
43
}
You can’t perform that action at this time.
0 commit comments