MCPcopy
hub / github.com/Azure/aztfexport / initTelemetryClient

Function initTelemetryClient

flag.go:262–285  ·  view source on GitHub ↗
(subscriptionId string)

Source from the content-addressed store, hash-verified

260}
261
262func initTelemetryClient(subscriptionId string) telemetry.Client {
263 cfg, err := cfgfile.GetConfig()
264 if err != nil {
265 return telemetry.NewNullClient()
266 }
267 enabled, installId := cfg.TelemetryEnabled, cfg.InstallationId
268 if !enabled {
269 return telemetry.NewNullClient()
270 }
271 if installId == "" {
272 uuid, err := uuid.NewV4()
273 if err == nil {
274 installId = uuid.String()
275 } else {
276 installId = "undefined"
277 }
278 }
279
280 sessionId := "undefined"
281 if uuid, err := uuid.NewV4(); err == nil {
282 sessionId = uuid.String()
283 }
284 return telemetry.NewAppInsight(subscriptionId, installId, sessionId)
285}
286
287func (f FlagSet) buildAuthConfig() (*config.AuthConfig, error) {
288 clientId := f.flagClientId

Callers 1

BuildCommonConfigMethod · 0.85

Calls 4

GetConfigFunction · 0.92
NewNullClientFunction · 0.92
NewAppInsightFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected