/
contexttags.go
565 lines (478 loc) · 16.9 KB
/
contexttags.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
package contracts
// NOTE: This file was automatically generated.
type ContextTags map[string]string
// Helper type that provides access to context fields grouped under 'application'.
// This is returned by TelemetryContext.Tags.Application()
type ApplicationContextTags ContextTags
// Helper type that provides access to context fields grouped under 'device'.
// This is returned by TelemetryContext.Tags.Device()
type DeviceContextTags ContextTags
// Helper type that provides access to context fields grouped under 'location'.
// This is returned by TelemetryContext.Tags.Location()
type LocationContextTags ContextTags
// Helper type that provides access to context fields grouped under 'operation'.
// This is returned by TelemetryContext.Tags.Operation()
type OperationContextTags ContextTags
// Helper type that provides access to context fields grouped under 'session'.
// This is returned by TelemetryContext.Tags.Session()
type SessionContextTags ContextTags
// Helper type that provides access to context fields grouped under 'user'.
// This is returned by TelemetryContext.Tags.User()
type UserContextTags ContextTags
// Helper type that provides access to context fields grouped under 'cloud'.
// This is returned by TelemetryContext.Tags.Cloud()
type CloudContextTags ContextTags
// Helper type that provides access to context fields grouped under 'internal'.
// This is returned by TelemetryContext.Tags.Internal()
type InternalContextTags ContextTags
// Returns a helper to access context fields grouped under 'application'.
func (tags ContextTags) Application() ApplicationContextTags {
return ApplicationContextTags(tags)
}
// Returns a helper to access context fields grouped under 'device'.
func (tags ContextTags) Device() DeviceContextTags {
return DeviceContextTags(tags)
}
// Returns a helper to access context fields grouped under 'location'.
func (tags ContextTags) Location() LocationContextTags {
return LocationContextTags(tags)
}
// Returns a helper to access context fields grouped under 'operation'.
func (tags ContextTags) Operation() OperationContextTags {
return OperationContextTags(tags)
}
// Returns a helper to access context fields grouped under 'session'.
func (tags ContextTags) Session() SessionContextTags {
return SessionContextTags(tags)
}
// Returns a helper to access context fields grouped under 'user'.
func (tags ContextTags) User() UserContextTags {
return UserContextTags(tags)
}
// Returns a helper to access context fields grouped under 'cloud'.
func (tags ContextTags) Cloud() CloudContextTags {
return CloudContextTags(tags)
}
// Returns a helper to access context fields grouped under 'internal'.
func (tags ContextTags) Internal() InternalContextTags {
return InternalContextTags(tags)
}
// Application version. Information in the application context fields is
// always about the application that is sending the telemetry.
func (tags ApplicationContextTags) GetVer() string {
if result, ok := tags["ai.application.ver"]; ok {
return result
}
return ""
}
// Application version. Information in the application context fields is
// always about the application that is sending the telemetry.
func (tags ApplicationContextTags) SetVer(value string) {
if value != "" {
tags["ai.application.ver"] = value
} else {
delete(tags, "ai.application.ver")
}
}
// Unique client device id. Computer name in most cases.
func (tags DeviceContextTags) GetId() string {
if result, ok := tags["ai.device.id"]; ok {
return result
}
return ""
}
// Unique client device id. Computer name in most cases.
func (tags DeviceContextTags) SetId(value string) {
if value != "" {
tags["ai.device.id"] = value
} else {
delete(tags, "ai.device.id")
}
}
// Device locale using <language>-<REGION> pattern, following RFC 5646.
// Example 'en-US'.
func (tags DeviceContextTags) GetLocale() string {
if result, ok := tags["ai.device.locale"]; ok {
return result
}
return ""
}
// Device locale using <language>-<REGION> pattern, following RFC 5646.
// Example 'en-US'.
func (tags DeviceContextTags) SetLocale(value string) {
if value != "" {
tags["ai.device.locale"] = value
} else {
delete(tags, "ai.device.locale")
}
}
// Model of the device the end user of the application is using. Used for
// client scenarios. If this field is empty then it is derived from the user
// agent.
func (tags DeviceContextTags) GetModel() string {
if result, ok := tags["ai.device.model"]; ok {
return result
}
return ""
}
// Model of the device the end user of the application is using. Used for
// client scenarios. If this field is empty then it is derived from the user
// agent.
func (tags DeviceContextTags) SetModel(value string) {
if value != "" {
tags["ai.device.model"] = value
} else {
delete(tags, "ai.device.model")
}
}
// Client device OEM name taken from the browser.
func (tags DeviceContextTags) GetOemName() string {
if result, ok := tags["ai.device.oemName"]; ok {
return result
}
return ""
}
// Client device OEM name taken from the browser.
func (tags DeviceContextTags) SetOemName(value string) {
if value != "" {
tags["ai.device.oemName"] = value
} else {
delete(tags, "ai.device.oemName")
}
}
// Operating system name and version of the device the end user of the
// application is using. If this field is empty then it is derived from the
// user agent. Example 'Windows 10 Pro 10.0.10586.0'
func (tags DeviceContextTags) GetOsVersion() string {
if result, ok := tags["ai.device.osVersion"]; ok {
return result
}
return ""
}
// Operating system name and version of the device the end user of the
// application is using. If this field is empty then it is derived from the
// user agent. Example 'Windows 10 Pro 10.0.10586.0'
func (tags DeviceContextTags) SetOsVersion(value string) {
if value != "" {
tags["ai.device.osVersion"] = value
} else {
delete(tags, "ai.device.osVersion")
}
}
// The type of the device the end user of the application is using. Used
// primarily to distinguish JavaScript telemetry from server side telemetry.
// Examples: 'PC', 'Phone', 'Browser'. 'PC' is the default value.
func (tags DeviceContextTags) GetType() string {
if result, ok := tags["ai.device.type"]; ok {
return result
}
return ""
}
// The type of the device the end user of the application is using. Used
// primarily to distinguish JavaScript telemetry from server side telemetry.
// Examples: 'PC', 'Phone', 'Browser'. 'PC' is the default value.
func (tags DeviceContextTags) SetType(value string) {
if value != "" {
tags["ai.device.type"] = value
} else {
delete(tags, "ai.device.type")
}
}
// The IP address of the client device. IPv4 and IPv6 are supported.
// Information in the location context fields is always about the end user.
// When telemetry is sent from a service, the location context is about the
// user that initiated the operation in the service.
func (tags LocationContextTags) GetIp() string {
if result, ok := tags["ai.location.ip"]; ok {
return result
}
return ""
}
// The IP address of the client device. IPv4 and IPv6 are supported.
// Information in the location context fields is always about the end user.
// When telemetry is sent from a service, the location context is about the
// user that initiated the operation in the service.
func (tags LocationContextTags) SetIp(value string) {
if value != "" {
tags["ai.location.ip"] = value
} else {
delete(tags, "ai.location.ip")
}
}
// A unique identifier for the operation instance. The operation.id is created
// by either a request or a page view. All other telemetry sets this to the
// value for the containing request or page view. Operation.id is used for
// finding all the telemetry items for a specific operation instance.
func (tags OperationContextTags) GetId() string {
if result, ok := tags["ai.operation.id"]; ok {
return result
}
return ""
}
// A unique identifier for the operation instance. The operation.id is created
// by either a request or a page view. All other telemetry sets this to the
// value for the containing request or page view. Operation.id is used for
// finding all the telemetry items for a specific operation instance.
func (tags OperationContextTags) SetId(value string) {
if value != "" {
tags["ai.operation.id"] = value
} else {
delete(tags, "ai.operation.id")
}
}
// The name (group) of the operation. The operation.name is created by either
// a request or a page view. All other telemetry items set this to the value
// for the containing request or page view. Operation.name is used for finding
// all the telemetry items for a group of operations (i.e. 'GET Home/Index').
func (tags OperationContextTags) GetName() string {
if result, ok := tags["ai.operation.name"]; ok {
return result
}
return ""
}
// The name (group) of the operation. The operation.name is created by either
// a request or a page view. All other telemetry items set this to the value
// for the containing request or page view. Operation.name is used for finding
// all the telemetry items for a group of operations (i.e. 'GET Home/Index').
func (tags OperationContextTags) SetName(value string) {
if value != "" {
tags["ai.operation.name"] = value
} else {
delete(tags, "ai.operation.name")
}
}
// The unique identifier of the telemetry item's immediate parent.
func (tags OperationContextTags) GetParentId() string {
if result, ok := tags["ai.operation.parentId"]; ok {
return result
}
return ""
}
// The unique identifier of the telemetry item's immediate parent.
func (tags OperationContextTags) SetParentId(value string) {
if value != "" {
tags["ai.operation.parentId"] = value
} else {
delete(tags, "ai.operation.parentId")
}
}
// Name of synthetic source. Some telemetry from the application may represent
// a synthetic traffic. It may be web crawler indexing the web site, site
// availability tests or traces from diagnostic libraries like Application
// Insights SDK itself.
func (tags OperationContextTags) GetSyntheticSource() string {
if result, ok := tags["ai.operation.syntheticSource"]; ok {
return result
}
return ""
}
// Name of synthetic source. Some telemetry from the application may represent
// a synthetic traffic. It may be web crawler indexing the web site, site
// availability tests or traces from diagnostic libraries like Application
// Insights SDK itself.
func (tags OperationContextTags) SetSyntheticSource(value string) {
if value != "" {
tags["ai.operation.syntheticSource"] = value
} else {
delete(tags, "ai.operation.syntheticSource")
}
}
// The correlation vector is a light weight vector clock which can be used to
// identify and order related events across clients and services.
func (tags OperationContextTags) GetCorrelationVector() string {
if result, ok := tags["ai.operation.correlationVector"]; ok {
return result
}
return ""
}
// The correlation vector is a light weight vector clock which can be used to
// identify and order related events across clients and services.
func (tags OperationContextTags) SetCorrelationVector(value string) {
if value != "" {
tags["ai.operation.correlationVector"] = value
} else {
delete(tags, "ai.operation.correlationVector")
}
}
// Session ID - the instance of the user's interaction with the app.
// Information in the session context fields is always about the end user.
// When telemetry is sent from a service, the session context is about the
// user that initiated the operation in the service.
func (tags SessionContextTags) GetId() string {
if result, ok := tags["ai.session.id"]; ok {
return result
}
return ""
}
// Session ID - the instance of the user's interaction with the app.
// Information in the session context fields is always about the end user.
// When telemetry is sent from a service, the session context is about the
// user that initiated the operation in the service.
func (tags SessionContextTags) SetId(value string) {
if value != "" {
tags["ai.session.id"] = value
} else {
delete(tags, "ai.session.id")
}
}
// Boolean value indicating whether the session identified by ai.session.id is
// first for the user or not.
func (tags SessionContextTags) GetIsFirst() string {
if result, ok := tags["ai.session.isFirst"]; ok {
return result
}
return ""
}
// Boolean value indicating whether the session identified by ai.session.id is
// first for the user or not.
func (tags SessionContextTags) SetIsFirst(value string) {
if value != "" {
tags["ai.session.isFirst"] = value
} else {
delete(tags, "ai.session.isFirst")
}
}
// In multi-tenant applications this is the account ID or name which the user
// is acting with. Examples may be subscription ID for Azure portal or blog
// name blogging platform.
func (tags UserContextTags) GetAccountId() string {
if result, ok := tags["ai.user.accountId"]; ok {
return result
}
return ""
}
// In multi-tenant applications this is the account ID or name which the user
// is acting with. Examples may be subscription ID for Azure portal or blog
// name blogging platform.
func (tags UserContextTags) SetAccountId(value string) {
if value != "" {
tags["ai.user.accountId"] = value
} else {
delete(tags, "ai.user.accountId")
}
}
// Anonymous user id. Represents the end user of the application. When
// telemetry is sent from a service, the user context is about the user that
// initiated the operation in the service.
func (tags UserContextTags) GetId() string {
if result, ok := tags["ai.user.id"]; ok {
return result
}
return ""
}
// Anonymous user id. Represents the end user of the application. When
// telemetry is sent from a service, the user context is about the user that
// initiated the operation in the service.
func (tags UserContextTags) SetId(value string) {
if value != "" {
tags["ai.user.id"] = value
} else {
delete(tags, "ai.user.id")
}
}
// Authenticated user id. The opposite of ai.user.id, this represents the user
// with a friendly name. Since it's PII information it is not collected by
// default by most SDKs.
func (tags UserContextTags) GetAuthUserId() string {
if result, ok := tags["ai.user.authUserId"]; ok {
return result
}
return ""
}
// Authenticated user id. The opposite of ai.user.id, this represents the user
// with a friendly name. Since it's PII information it is not collected by
// default by most SDKs.
func (tags UserContextTags) SetAuthUserId(value string) {
if value != "" {
tags["ai.user.authUserId"] = value
} else {
delete(tags, "ai.user.authUserId")
}
}
// Name of the role the application is a part of. Maps directly to the role
// name in azure.
func (tags CloudContextTags) GetRole() string {
if result, ok := tags["ai.cloud.role"]; ok {
return result
}
return ""
}
// Name of the role the application is a part of. Maps directly to the role
// name in azure.
func (tags CloudContextTags) SetRole(value string) {
if value != "" {
tags["ai.cloud.role"] = value
} else {
delete(tags, "ai.cloud.role")
}
}
// Name of the instance where the application is running. Computer name for
// on-premisis, instance name for Azure.
func (tags CloudContextTags) GetRoleInstance() string {
if result, ok := tags["ai.cloud.roleInstance"]; ok {
return result
}
return ""
}
// Name of the instance where the application is running. Computer name for
// on-premisis, instance name for Azure.
func (tags CloudContextTags) SetRoleInstance(value string) {
if value != "" {
tags["ai.cloud.roleInstance"] = value
} else {
delete(tags, "ai.cloud.roleInstance")
}
}
// SDK version. See
// https://github.com/Microsoft/ApplicationInsights-Home/blob/master/SDK-AUTHORING.md#sdk-version-specification
// for information.
func (tags InternalContextTags) GetSdkVersion() string {
if result, ok := tags["ai.internal.sdkVersion"]; ok {
return result
}
return ""
}
// SDK version. See
// https://github.com/Microsoft/ApplicationInsights-Home/blob/master/SDK-AUTHORING.md#sdk-version-specification
// for information.
func (tags InternalContextTags) SetSdkVersion(value string) {
if value != "" {
tags["ai.internal.sdkVersion"] = value
} else {
delete(tags, "ai.internal.sdkVersion")
}
}
// Agent version. Used to indicate the version of StatusMonitor installed on
// the computer if it is used for data collection.
func (tags InternalContextTags) GetAgentVersion() string {
if result, ok := tags["ai.internal.agentVersion"]; ok {
return result
}
return ""
}
// Agent version. Used to indicate the version of StatusMonitor installed on
// the computer if it is used for data collection.
func (tags InternalContextTags) SetAgentVersion(value string) {
if value != "" {
tags["ai.internal.agentVersion"] = value
} else {
delete(tags, "ai.internal.agentVersion")
}
}
// This is the node name used for billing purposes. Use it to override the
// standard detection of nodes.
func (tags InternalContextTags) GetNodeName() string {
if result, ok := tags["ai.internal.nodeName"]; ok {
return result
}
return ""
}
// This is the node name used for billing purposes. Use it to override the
// standard detection of nodes.
func (tags InternalContextTags) SetNodeName(value string) {
if value != "" {
tags["ai.internal.nodeName"] = value
} else {
delete(tags, "ai.internal.nodeName")
}
}