Skip to content
This repository was archived by the owner on Feb 2, 2022. It is now read-only.

Commit 97ffc79

Browse files
stishkinstas
andauthored
Distinguish between Azure and Local RAFT RESTler runs (#187)
Co-authored-by: stas <statis@microsoft.com>
1 parent b37edaf commit 97ffc79

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/Agent/RESTlerAgent/AgentMain.fs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,13 @@ let main argv =
581581
match agentConfiguration.SiteHash with
582582
| None -> "NotSet"
583583
| Some h -> h
584-
use telemetryClient = new Restler.Telemetry.TelemetryClient(siteHash, if agentConfiguration.TelemetryOptOut then "" else Restler.Telemetry.InstrumentationKey)
584+
585+
586+
let telemetryTag =
587+
match System.Environment.GetEnvironmentVariable("RAFT_LOCAL") |> Option.ofObj with
588+
| None -> "RAFT"
589+
| Some _ -> "RAFT-LOCAL"
590+
use telemetryClient = new Restler.Telemetry.TelemetryClient(siteHash, (if agentConfiguration.TelemetryOptOut then "" else Restler.Telemetry.InstrumentationKey), telemetryTag)
585591

586592
if not <| IO.Directory.Exists workDirectory then
587593
appInsights.TrackTrace((sprintf "Workd directory does not exist: %s" workDirectory),

src/Agent/RESTlerAgent/Telemetry.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ module Restler.Telemetry
99
//Instrumentation key is from app insights resource in Azure Portal
1010
let [<Literal>] InstrumentationKey = "6a4d265f-98cd-432f-bfb9-18ced4cd43a9"
1111

12-
type TelemetryClient(machineId: string, instrumentationKey: string) =
12+
type TelemetryClient(machineId: string, instrumentationKey: string, tag: string) =
1313
let client =
1414
let c = Microsoft.ApplicationInsights.TelemetryClient(
1515
new Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration(instrumentationKey))
1616
// Make sure to not send any instance names or IP addresses
1717
// These must be non-empty strings to override sending the values obtained by the framework
1818
c.Context.Cloud.RoleName <- "none"
19-
c.Context.Cloud.RoleInstance <- "RAFT"
19+
c.Context.Cloud.RoleInstance <- tag
2020
c.Context.Location.Ip <- "0.0.0.0"
2121
c
2222

0 commit comments

Comments
 (0)