/
attribute_group.go
1866 lines (1683 loc) · 72.2 KB
/
attribute_group.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
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
// Code generated from semantic convention specification. DO NOT EDIT.
package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0"
import "go.opentelemetry.io/otel/attribute"
// These attributes may be used to describe the client in a connection-based
// network interaction where there is one side that initiates the connection
// (the client is the side that initiates the connection). This covers all TCP
// network interactions since TCP is connection-based and one side initiates
// the connection (an exception is made for peer-to-peer communication over TCP
// where the "user-facing" surface of the protocol / API does not expose a
// clear notion of client and server). This also covers UDP network
// interactions where one side initiates the interaction, e.g. QUIC (HTTP/3)
// and DNS.
const (
// ClientAddressKey is the attribute Key conforming to the "client.address"
// semantic conventions. It represents the client address - unix domain
// socket name, IPv4 or IPv6 address.
//
// Type: string
// RequirementLevel: Optional
// Stability: stable
// Examples: '/tmp/my.sock', '10.1.2.80'
// Note: When observed from the server side, and when communicating through
// an intermediary, `client.address` SHOULD represent client address behind
// any intermediaries (e.g. proxies) if it's available.
ClientAddressKey = attribute.Key("client.address")
// ClientPortKey is the attribute Key conforming to the "client.port"
// semantic conventions. It represents the client port number
//
// Type: int
// RequirementLevel: Optional
// Stability: stable
// Examples: 65123
// Note: When observed from the server side, and when communicating through
// an intermediary, `client.port` SHOULD represent client port behind any
// intermediaries (e.g. proxies) if it's available.
ClientPortKey = attribute.Key("client.port")
// ClientSocketAddressKey is the attribute Key conforming to the
// "client.socket.address" semantic conventions. It represents the
// immediate client peer address - unix domain socket name, IPv4 or IPv6
// address.
//
// Type: string
// RequirementLevel: Recommended (If different than `client.address`.)
// Stability: stable
// Examples: '/tmp/my.sock', '127.0.0.1'
ClientSocketAddressKey = attribute.Key("client.socket.address")
// ClientSocketPortKey is the attribute Key conforming to the
// "client.socket.port" semantic conventions. It represents the immediate
// client peer port number
//
// Type: int
// RequirementLevel: Recommended (If different than `client.port`.)
// Stability: stable
// Examples: 35555
ClientSocketPortKey = attribute.Key("client.socket.port")
)
// ClientAddress returns an attribute KeyValue conforming to the
// "client.address" semantic conventions. It represents the client address -
// unix domain socket name, IPv4 or IPv6 address.
func ClientAddress(val string) attribute.KeyValue {
return ClientAddressKey.String(val)
}
// ClientPort returns an attribute KeyValue conforming to the "client.port"
// semantic conventions. It represents the client port number
func ClientPort(val int) attribute.KeyValue {
return ClientPortKey.Int(val)
}
// ClientSocketAddress returns an attribute KeyValue conforming to the
// "client.socket.address" semantic conventions. It represents the immediate
// client peer address - unix domain socket name, IPv4 or IPv6 address.
func ClientSocketAddress(val string) attribute.KeyValue {
return ClientSocketAddressKey.String(val)
}
// ClientSocketPort returns an attribute KeyValue conforming to the
// "client.socket.port" semantic conventions. It represents the immediate
// client peer port number
func ClientSocketPort(val int) attribute.KeyValue {
return ClientSocketPortKey.Int(val)
}
// Describes deprecated HTTP attributes.
const (
// HTTPMethodKey is the attribute Key conforming to the "http.method"
// semantic conventions. It represents the deprecated, use
// `http.request.method` instead.
//
// Type: string
// RequirementLevel: Optional
// Stability: deprecated
// Examples: 'GET', 'POST', 'HEAD'
HTTPMethodKey = attribute.Key("http.method")
// HTTPStatusCodeKey is the attribute Key conforming to the
// "http.status_code" semantic conventions. It represents the deprecated,
// use `http.response.status_code` instead.
//
// Type: int
// RequirementLevel: Optional
// Stability: deprecated
// Examples: 200
HTTPStatusCodeKey = attribute.Key("http.status_code")
// HTTPSchemeKey is the attribute Key conforming to the "http.scheme"
// semantic conventions. It represents the deprecated, use `url.scheme`
// instead.
//
// Type: string
// RequirementLevel: Optional
// Stability: deprecated
// Examples: 'http', 'https'
HTTPSchemeKey = attribute.Key("http.scheme")
// HTTPURLKey is the attribute Key conforming to the "http.url" semantic
// conventions. It represents the deprecated, use `url.full` instead.
//
// Type: string
// RequirementLevel: Optional
// Stability: deprecated
// Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv'
HTTPURLKey = attribute.Key("http.url")
// HTTPTargetKey is the attribute Key conforming to the "http.target"
// semantic conventions. It represents the deprecated, use `url.path` and
// `url.query` instead.
//
// Type: string
// RequirementLevel: Optional
// Stability: deprecated
// Examples: '/search?q=OpenTelemetry#SemConv'
HTTPTargetKey = attribute.Key("http.target")
// HTTPRequestContentLengthKey is the attribute Key conforming to the
// "http.request_content_length" semantic conventions. It represents the
// deprecated, use `http.request.body.size` instead.
//
// Type: int
// RequirementLevel: Optional
// Stability: deprecated
// Examples: 3495
HTTPRequestContentLengthKey = attribute.Key("http.request_content_length")
// HTTPResponseContentLengthKey is the attribute Key conforming to the
// "http.response_content_length" semantic conventions. It represents the
// deprecated, use `http.response.body.size` instead.
//
// Type: int
// RequirementLevel: Optional
// Stability: deprecated
// Examples: 3495
HTTPResponseContentLengthKey = attribute.Key("http.response_content_length")
)
// HTTPMethod returns an attribute KeyValue conforming to the "http.method"
// semantic conventions. It represents the deprecated, use
// `http.request.method` instead.
func HTTPMethod(val string) attribute.KeyValue {
return HTTPMethodKey.String(val)
}
// HTTPStatusCode returns an attribute KeyValue conforming to the
// "http.status_code" semantic conventions. It represents the deprecated, use
// `http.response.status_code` instead.
func HTTPStatusCode(val int) attribute.KeyValue {
return HTTPStatusCodeKey.Int(val)
}
// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme"
// semantic conventions. It represents the deprecated, use `url.scheme`
// instead.
func HTTPScheme(val string) attribute.KeyValue {
return HTTPSchemeKey.String(val)
}
// HTTPURL returns an attribute KeyValue conforming to the "http.url"
// semantic conventions. It represents the deprecated, use `url.full` instead.
func HTTPURL(val string) attribute.KeyValue {
return HTTPURLKey.String(val)
}
// HTTPTarget returns an attribute KeyValue conforming to the "http.target"
// semantic conventions. It represents the deprecated, use `url.path` and
// `url.query` instead.
func HTTPTarget(val string) attribute.KeyValue {
return HTTPTargetKey.String(val)
}
// HTTPRequestContentLength returns an attribute KeyValue conforming to the
// "http.request_content_length" semantic conventions. It represents the
// deprecated, use `http.request.body.size` instead.
func HTTPRequestContentLength(val int) attribute.KeyValue {
return HTTPRequestContentLengthKey.Int(val)
}
// HTTPResponseContentLength returns an attribute KeyValue conforming to the
// "http.response_content_length" semantic conventions. It represents the
// deprecated, use `http.response.body.size` instead.
func HTTPResponseContentLength(val int) attribute.KeyValue {
return HTTPResponseContentLengthKey.Int(val)
}
// These attributes may be used for any network related operation.
const (
// NetSockPeerNameKey is the attribute Key conforming to the
// "net.sock.peer.name" semantic conventions. It represents the deprecated,
// use `server.socket.domain` on client spans.
//
// Type: string
// RequirementLevel: Optional
// Stability: deprecated
// Examples: '/var/my.sock'
NetSockPeerNameKey = attribute.Key("net.sock.peer.name")
// NetSockPeerAddrKey is the attribute Key conforming to the
// "net.sock.peer.addr" semantic conventions. It represents the deprecated,
// use `server.socket.address` on client spans and `client.socket.address`
// on server spans.
//
// Type: string
// RequirementLevel: Optional
// Stability: deprecated
// Examples: '192.168.0.1'
NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr")
// NetSockPeerPortKey is the attribute Key conforming to the
// "net.sock.peer.port" semantic conventions. It represents the deprecated,
// use `server.socket.port` on client spans and `client.socket.port` on
// server spans.
//
// Type: int
// RequirementLevel: Optional
// Stability: deprecated
// Examples: 65531
NetSockPeerPortKey = attribute.Key("net.sock.peer.port")
// NetPeerNameKey is the attribute Key conforming to the "net.peer.name"
// semantic conventions. It represents the deprecated, use `server.address`
// on client spans and `client.address` on server spans.
//
// Type: string
// RequirementLevel: Optional
// Stability: deprecated
// Examples: 'example.com'
NetPeerNameKey = attribute.Key("net.peer.name")
// NetPeerPortKey is the attribute Key conforming to the "net.peer.port"
// semantic conventions. It represents the deprecated, use `server.port` on
// client spans and `client.port` on server spans.
//
// Type: int
// RequirementLevel: Optional
// Stability: deprecated
// Examples: 8080
NetPeerPortKey = attribute.Key("net.peer.port")
// NetHostNameKey is the attribute Key conforming to the "net.host.name"
// semantic conventions. It represents the deprecated, use
// `server.address`.
//
// Type: string
// RequirementLevel: Optional
// Stability: deprecated
// Examples: 'example.com'
NetHostNameKey = attribute.Key("net.host.name")
// NetHostPortKey is the attribute Key conforming to the "net.host.port"
// semantic conventions. It represents the deprecated, use `server.port`.
//
// Type: int
// RequirementLevel: Optional
// Stability: deprecated
// Examples: 8080
NetHostPortKey = attribute.Key("net.host.port")
// NetSockHostAddrKey is the attribute Key conforming to the
// "net.sock.host.addr" semantic conventions. It represents the deprecated,
// use `server.socket.address`.
//
// Type: string
// RequirementLevel: Optional
// Stability: deprecated
// Examples: '/var/my.sock'
NetSockHostAddrKey = attribute.Key("net.sock.host.addr")
// NetSockHostPortKey is the attribute Key conforming to the
// "net.sock.host.port" semantic conventions. It represents the deprecated,
// use `server.socket.port`.
//
// Type: int
// RequirementLevel: Optional
// Stability: deprecated
// Examples: 8080
NetSockHostPortKey = attribute.Key("net.sock.host.port")
// NetTransportKey is the attribute Key conforming to the "net.transport"
// semantic conventions. It represents the deprecated, use
// `network.transport`.
//
// Type: Enum
// RequirementLevel: Optional
// Stability: deprecated
NetTransportKey = attribute.Key("net.transport")
// NetProtocolNameKey is the attribute Key conforming to the
// "net.protocol.name" semantic conventions. It represents the deprecated,
// use `network.protocol.name`.
//
// Type: string
// RequirementLevel: Optional
// Stability: deprecated
// Examples: 'amqp', 'http', 'mqtt'
NetProtocolNameKey = attribute.Key("net.protocol.name")
// NetProtocolVersionKey is the attribute Key conforming to the
// "net.protocol.version" semantic conventions. It represents the
// deprecated, use `network.protocol.version`.
//
// Type: string
// RequirementLevel: Optional
// Stability: deprecated
// Examples: '3.1.1'
NetProtocolVersionKey = attribute.Key("net.protocol.version")
// NetSockFamilyKey is the attribute Key conforming to the
// "net.sock.family" semantic conventions. It represents the deprecated,
// use `network.transport` and `network.type`.
//
// Type: Enum
// RequirementLevel: Optional
// Stability: deprecated
NetSockFamilyKey = attribute.Key("net.sock.family")
)
var (
// ip_tcp
NetTransportTCP = NetTransportKey.String("ip_tcp")
// ip_udp
NetTransportUDP = NetTransportKey.String("ip_udp")
// Named or anonymous pipe
NetTransportPipe = NetTransportKey.String("pipe")
// In-process communication
NetTransportInProc = NetTransportKey.String("inproc")
// Something else (non IP-based)
NetTransportOther = NetTransportKey.String("other")
)
var (
// IPv4 address
NetSockFamilyInet = NetSockFamilyKey.String("inet")
// IPv6 address
NetSockFamilyInet6 = NetSockFamilyKey.String("inet6")
// Unix domain socket path
NetSockFamilyUnix = NetSockFamilyKey.String("unix")
)
// NetSockPeerName returns an attribute KeyValue conforming to the
// "net.sock.peer.name" semantic conventions. It represents the deprecated, use
// `server.socket.domain` on client spans.
func NetSockPeerName(val string) attribute.KeyValue {
return NetSockPeerNameKey.String(val)
}
// NetSockPeerAddr returns an attribute KeyValue conforming to the
// "net.sock.peer.addr" semantic conventions. It represents the deprecated, use
// `server.socket.address` on client spans and `client.socket.address` on
// server spans.
func NetSockPeerAddr(val string) attribute.KeyValue {
return NetSockPeerAddrKey.String(val)
}
// NetSockPeerPort returns an attribute KeyValue conforming to the
// "net.sock.peer.port" semantic conventions. It represents the deprecated, use
// `server.socket.port` on client spans and `client.socket.port` on server
// spans.
func NetSockPeerPort(val int) attribute.KeyValue {
return NetSockPeerPortKey.Int(val)
}
// NetPeerName returns an attribute KeyValue conforming to the
// "net.peer.name" semantic conventions. It represents the deprecated, use
// `server.address` on client spans and `client.address` on server spans.
func NetPeerName(val string) attribute.KeyValue {
return NetPeerNameKey.String(val)
}
// NetPeerPort returns an attribute KeyValue conforming to the
// "net.peer.port" semantic conventions. It represents the deprecated, use
// `server.port` on client spans and `client.port` on server spans.
func NetPeerPort(val int) attribute.KeyValue {
return NetPeerPortKey.Int(val)
}
// NetHostName returns an attribute KeyValue conforming to the
// "net.host.name" semantic conventions. It represents the deprecated, use
// `server.address`.
func NetHostName(val string) attribute.KeyValue {
return NetHostNameKey.String(val)
}
// NetHostPort returns an attribute KeyValue conforming to the
// "net.host.port" semantic conventions. It represents the deprecated, use
// `server.port`.
func NetHostPort(val int) attribute.KeyValue {
return NetHostPortKey.Int(val)
}
// NetSockHostAddr returns an attribute KeyValue conforming to the
// "net.sock.host.addr" semantic conventions. It represents the deprecated, use
// `server.socket.address`.
func NetSockHostAddr(val string) attribute.KeyValue {
return NetSockHostAddrKey.String(val)
}
// NetSockHostPort returns an attribute KeyValue conforming to the
// "net.sock.host.port" semantic conventions. It represents the deprecated, use
// `server.socket.port`.
func NetSockHostPort(val int) attribute.KeyValue {
return NetSockHostPortKey.Int(val)
}
// NetProtocolName returns an attribute KeyValue conforming to the
// "net.protocol.name" semantic conventions. It represents the deprecated, use
// `network.protocol.name`.
func NetProtocolName(val string) attribute.KeyValue {
return NetProtocolNameKey.String(val)
}
// NetProtocolVersion returns an attribute KeyValue conforming to the
// "net.protocol.version" semantic conventions. It represents the deprecated,
// use `network.protocol.version`.
func NetProtocolVersion(val string) attribute.KeyValue {
return NetProtocolVersionKey.String(val)
}
// These attributes may be used to describe the receiver of a network
// exchange/packet. These should be used when there is no client/server
// relationship between the two sides, or when that relationship is unknown.
// This covers low-level network interactions (e.g. packet tracing) where you
// don't know if there was a connection or which side initiated it. This also
// covers unidirectional UDP flows and peer-to-peer communication where the
// "user-facing" surface of the protocol / API does not expose a clear notion
// of client and server.
const (
// DestinationDomainKey is the attribute Key conforming to the
// "destination.domain" semantic conventions. It represents the domain name
// of the destination system.
//
// Type: string
// RequirementLevel: Optional
// Stability: stable
// Examples: 'foo.example.com'
// Note: This value may be a host name, a fully qualified domain name, or
// another host naming format.
DestinationDomainKey = attribute.Key("destination.domain")
// DestinationAddressKey is the attribute Key conforming to the
// "destination.address" semantic conventions. It represents the peer
// address, for example IP address or UNIX socket name.
//
// Type: string
// RequirementLevel: Optional
// Stability: stable
// Examples: '10.5.3.2'
DestinationAddressKey = attribute.Key("destination.address")
// DestinationPortKey is the attribute Key conforming to the
// "destination.port" semantic conventions. It represents the peer port
// number
//
// Type: int
// RequirementLevel: Optional
// Stability: stable
// Examples: 3389, 2888
DestinationPortKey = attribute.Key("destination.port")
)
// DestinationDomain returns an attribute KeyValue conforming to the
// "destination.domain" semantic conventions. It represents the domain name of
// the destination system.
func DestinationDomain(val string) attribute.KeyValue {
return DestinationDomainKey.String(val)
}
// DestinationAddress returns an attribute KeyValue conforming to the
// "destination.address" semantic conventions. It represents the peer address,
// for example IP address or UNIX socket name.
func DestinationAddress(val string) attribute.KeyValue {
return DestinationAddressKey.String(val)
}
// DestinationPort returns an attribute KeyValue conforming to the
// "destination.port" semantic conventions. It represents the peer port number
func DestinationPort(val int) attribute.KeyValue {
return DestinationPortKey.Int(val)
}
// Describes HTTP attributes.
const (
// HTTPRequestMethodKey is the attribute Key conforming to the
// "http.request.method" semantic conventions. It represents the hTTP
// request method.
//
// Type: Enum
// RequirementLevel: Required
// Stability: stable
// Examples: 'GET', 'POST', 'HEAD'
// Note: HTTP request method value SHOULD be "known" to the
// instrumentation.
// By default, this convention defines "known" methods as the ones listed
// in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods)
// and the PATCH method defined in
// [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html).
//
// If the HTTP request method is not known to instrumentation, it MUST set
// the `http.request.method` attribute to `_OTHER` and, except if reporting
// a metric, MUST
// set the exact method received in the request line as value of the
// `http.request.method_original` attribute.
//
// If the HTTP instrumentation could end up converting valid HTTP request
// methods to `_OTHER`, then it MUST provide a way to override
// the list of known HTTP methods. If this override is done via environment
// variable, then the environment variable MUST be named
// OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated
// list of case-sensitive known HTTP methods
// (this list MUST be a full override of the default known method, it is
// not a list of known methods in addition to the defaults).
//
// HTTP method names are case-sensitive and `http.request.method` attribute
// value MUST match a known HTTP method name exactly.
// Instrumentations for specific web frameworks that consider HTTP methods
// to be case insensitive, SHOULD populate a canonical equivalent.
// Tracing instrumentations that do so, MUST also set
// `http.request.method_original` to the original value.
HTTPRequestMethodKey = attribute.Key("http.request.method")
// HTTPResponseStatusCodeKey is the attribute Key conforming to the
// "http.response.status_code" semantic conventions. It represents the
// [HTTP response status
// code](https://tools.ietf.org/html/rfc7231#section-6).
//
// Type: int
// RequirementLevel: ConditionallyRequired (If and only if one was
// received/sent.)
// Stability: stable
// Examples: 200
HTTPResponseStatusCodeKey = attribute.Key("http.response.status_code")
)
var (
// CONNECT method
HTTPRequestMethodConnect = HTTPRequestMethodKey.String("CONNECT")
// DELETE method
HTTPRequestMethodDelete = HTTPRequestMethodKey.String("DELETE")
// GET method
HTTPRequestMethodGet = HTTPRequestMethodKey.String("GET")
// HEAD method
HTTPRequestMethodHead = HTTPRequestMethodKey.String("HEAD")
// OPTIONS method
HTTPRequestMethodOptions = HTTPRequestMethodKey.String("OPTIONS")
// PATCH method
HTTPRequestMethodPatch = HTTPRequestMethodKey.String("PATCH")
// POST method
HTTPRequestMethodPost = HTTPRequestMethodKey.String("POST")
// PUT method
HTTPRequestMethodPut = HTTPRequestMethodKey.String("PUT")
// TRACE method
HTTPRequestMethodTrace = HTTPRequestMethodKey.String("TRACE")
// Any HTTP method that the instrumentation has no prior knowledge of
HTTPRequestMethodOther = HTTPRequestMethodKey.String("_OTHER")
)
// HTTPResponseStatusCode returns an attribute KeyValue conforming to the
// "http.response.status_code" semantic conventions. It represents the [HTTP
// response status code](https://tools.ietf.org/html/rfc7231#section-6).
func HTTPResponseStatusCode(val int) attribute.KeyValue {
return HTTPResponseStatusCodeKey.Int(val)
}
// HTTP Server attributes
const (
// HTTPRouteKey is the attribute Key conforming to the "http.route"
// semantic conventions. It represents the matched route (path template in
// the format used by the respective server framework). See note below
//
// Type: string
// RequirementLevel: ConditionallyRequired (If and only if it's available)
// Stability: stable
// Examples: '/users/:userID?', '{controller}/{action}/{id?}'
// Note: MUST NOT be populated when this is not supported by the HTTP
// server framework as the route attribute should have low-cardinality and
// the URI path can NOT substitute it.
// SHOULD include the [application
// root](/docs/http/http-spans.md#http-server-definitions) if there is one.
HTTPRouteKey = attribute.Key("http.route")
)
// HTTPRoute returns an attribute KeyValue conforming to the "http.route"
// semantic conventions. It represents the matched route (path template in the
// format used by the respective server framework). See note below
func HTTPRoute(val string) attribute.KeyValue {
return HTTPRouteKey.String(val)
}
// Attributes for Events represented using Log Records.
const (
// EventNameKey is the attribute Key conforming to the "event.name"
// semantic conventions. It represents the name identifies the event.
//
// Type: string
// RequirementLevel: Required
// Stability: stable
// Examples: 'click', 'exception'
EventNameKey = attribute.Key("event.name")
// EventDomainKey is the attribute Key conforming to the "event.domain"
// semantic conventions. It represents the domain identifies the business
// context for the events.
//
// Type: Enum
// RequirementLevel: Required
// Stability: stable
// Note: Events across different domains may have same `event.name`, yet be
// unrelated events.
EventDomainKey = attribute.Key("event.domain")
)
var (
// Events from browser apps
EventDomainBrowser = EventDomainKey.String("browser")
// Events from mobile apps
EventDomainDevice = EventDomainKey.String("device")
// Events from Kubernetes
EventDomainK8S = EventDomainKey.String("k8s")
)
// EventName returns an attribute KeyValue conforming to the "event.name"
// semantic conventions. It represents the name identifies the event.
func EventName(val string) attribute.KeyValue {
return EventNameKey.String(val)
}
// The attributes described in this section are rather generic. They may be
// used in any Log Record they apply to.
const (
// LogRecordUIDKey is the attribute Key conforming to the "log.record.uid"
// semantic conventions. It represents a unique identifier for the Log
// Record.
//
// Type: string
// RequirementLevel: Optional
// Stability: stable
// Examples: '01ARZ3NDEKTSV4RRFFQ69G5FAV'
// Note: If an id is provided, other log records with the same id will be
// considered duplicates and can be removed safely. This means, that two
// distinguishable log records MUST have different values.
// The id MAY be an [Universally Unique Lexicographically Sortable
// Identifier (ULID)](https://github.com/ulid/spec), but other identifiers
// (e.g. UUID) may be used as needed.
LogRecordUIDKey = attribute.Key("log.record.uid")
)
// LogRecordUID returns an attribute KeyValue conforming to the
// "log.record.uid" semantic conventions. It represents a unique identifier for
// the Log Record.
func LogRecordUID(val string) attribute.KeyValue {
return LogRecordUIDKey.String(val)
}
// Describes Log attributes
const (
// LogIostreamKey is the attribute Key conforming to the "log.iostream"
// semantic conventions. It represents the stream associated with the log.
// See below for a list of well-known values.
//
// Type: Enum
// RequirementLevel: Optional
// Stability: stable
LogIostreamKey = attribute.Key("log.iostream")
)
var (
// Logs from stdout stream
LogIostreamStdout = LogIostreamKey.String("stdout")
// Events from stderr stream
LogIostreamStderr = LogIostreamKey.String("stderr")
)
// A file to which log was emitted.
const (
// LogFileNameKey is the attribute Key conforming to the "log.file.name"
// semantic conventions. It represents the basename of the file.
//
// Type: string
// RequirementLevel: Recommended
// Stability: stable
// Examples: 'audit.log'
LogFileNameKey = attribute.Key("log.file.name")
// LogFilePathKey is the attribute Key conforming to the "log.file.path"
// semantic conventions. It represents the full path to the file.
//
// Type: string
// RequirementLevel: Optional
// Stability: stable
// Examples: '/var/log/mysql/audit.log'
LogFilePathKey = attribute.Key("log.file.path")
// LogFileNameResolvedKey is the attribute Key conforming to the
// "log.file.name_resolved" semantic conventions. It represents the
// basename of the file, with symlinks resolved.
//
// Type: string
// RequirementLevel: Optional
// Stability: stable
// Examples: 'uuid.log'
LogFileNameResolvedKey = attribute.Key("log.file.name_resolved")
// LogFilePathResolvedKey is the attribute Key conforming to the
// "log.file.path_resolved" semantic conventions. It represents the full
// path to the file, with symlinks resolved.
//
// Type: string
// RequirementLevel: Optional
// Stability: stable
// Examples: '/var/lib/docker/uuid.log'
LogFilePathResolvedKey = attribute.Key("log.file.path_resolved")
)
// LogFileName returns an attribute KeyValue conforming to the
// "log.file.name" semantic conventions. It represents the basename of the
// file.
func LogFileName(val string) attribute.KeyValue {
return LogFileNameKey.String(val)
}
// LogFilePath returns an attribute KeyValue conforming to the
// "log.file.path" semantic conventions. It represents the full path to the
// file.
func LogFilePath(val string) attribute.KeyValue {
return LogFilePathKey.String(val)
}
// LogFileNameResolved returns an attribute KeyValue conforming to the
// "log.file.name_resolved" semantic conventions. It represents the basename of
// the file, with symlinks resolved.
func LogFileNameResolved(val string) attribute.KeyValue {
return LogFileNameResolvedKey.String(val)
}
// LogFilePathResolved returns an attribute KeyValue conforming to the
// "log.file.path_resolved" semantic conventions. It represents the full path
// to the file, with symlinks resolved.
func LogFilePathResolved(val string) attribute.KeyValue {
return LogFilePathResolvedKey.String(val)
}
// Describes JVM memory metric attributes.
const (
// TypeKey is the attribute Key conforming to the "type" semantic
// conventions. It represents the type of memory.
//
// Type: Enum
// RequirementLevel: Recommended
// Stability: stable
// Examples: 'heap', 'non_heap'
TypeKey = attribute.Key("type")
// PoolKey is the attribute Key conforming to the "pool" semantic
// conventions. It represents the name of the memory pool.
//
// Type: string
// RequirementLevel: Recommended
// Stability: stable
// Examples: 'G1 Old Gen', 'G1 Eden space', 'G1 Survivor Space'
// Note: Pool names are generally obtained via
// [MemoryPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html#getName()).
PoolKey = attribute.Key("pool")
)
var (
// Heap memory
TypeHeap = TypeKey.String("heap")
// Non-heap memory
TypeNonHeap = TypeKey.String("non_heap")
)
// Pool returns an attribute KeyValue conforming to the "pool" semantic
// conventions. It represents the name of the memory pool.
func Pool(val string) attribute.KeyValue {
return PoolKey.String(val)
}
// These attributes may be used to describe the server in a connection-based
// network interaction where there is one side that initiates the connection
// (the client is the side that initiates the connection). This covers all TCP
// network interactions since TCP is connection-based and one side initiates
// the connection (an exception is made for peer-to-peer communication over TCP
// where the "user-facing" surface of the protocol / API does not expose a
// clear notion of client and server). This also covers UDP network
// interactions where one side initiates the interaction, e.g. QUIC (HTTP/3)
// and DNS.
const (
// ServerAddressKey is the attribute Key conforming to the "server.address"
// semantic conventions. It represents the logical server hostname, matches
// server FQDN if available, and IP or socket address if FQDN is not known.
//
// Type: string
// RequirementLevel: Optional
// Stability: stable
// Examples: 'example.com'
ServerAddressKey = attribute.Key("server.address")
// ServerPortKey is the attribute Key conforming to the "server.port"
// semantic conventions. It represents the logical server port number
//
// Type: int
// RequirementLevel: Optional
// Stability: stable
// Examples: 80, 8080, 443
ServerPortKey = attribute.Key("server.port")
// ServerSocketDomainKey is the attribute Key conforming to the
// "server.socket.domain" semantic conventions. It represents the domain
// name of an immediate peer.
//
// Type: string
// RequirementLevel: Recommended (If different than `server.address`.)
// Stability: stable
// Examples: 'proxy.example.com'
// Note: Typically observed from the client side, and represents a proxy or
// other intermediary domain name.
ServerSocketDomainKey = attribute.Key("server.socket.domain")
// ServerSocketAddressKey is the attribute Key conforming to the
// "server.socket.address" semantic conventions. It represents the physical
// server IP address or Unix socket address. If set from the client, should
// simply use the socket's peer address, and not attempt to find any actual
// server IP (i.e., if set from client, this may represent some proxy
// server instead of the logical server).
//
// Type: string
// RequirementLevel: Recommended (If different than `server.address`.)
// Stability: stable
// Examples: '10.5.3.2'
ServerSocketAddressKey = attribute.Key("server.socket.address")
// ServerSocketPortKey is the attribute Key conforming to the
// "server.socket.port" semantic conventions. It represents the physical
// server port.
//
// Type: int
// RequirementLevel: Recommended (If different than `server.port`.)
// Stability: stable
// Examples: 16456
ServerSocketPortKey = attribute.Key("server.socket.port")
)
// ServerAddress returns an attribute KeyValue conforming to the
// "server.address" semantic conventions. It represents the logical server
// hostname, matches server FQDN if available, and IP or socket address if FQDN
// is not known.
func ServerAddress(val string) attribute.KeyValue {
return ServerAddressKey.String(val)
}
// ServerPort returns an attribute KeyValue conforming to the "server.port"
// semantic conventions. It represents the logical server port number
func ServerPort(val int) attribute.KeyValue {
return ServerPortKey.Int(val)
}
// ServerSocketDomain returns an attribute KeyValue conforming to the
// "server.socket.domain" semantic conventions. It represents the domain name
// of an immediate peer.
func ServerSocketDomain(val string) attribute.KeyValue {
return ServerSocketDomainKey.String(val)
}
// ServerSocketAddress returns an attribute KeyValue conforming to the
// "server.socket.address" semantic conventions. It represents the physical
// server IP address or Unix socket address. If set from the client, should
// simply use the socket's peer address, and not attempt to find any actual
// server IP (i.e., if set from client, this may represent some proxy server
// instead of the logical server).
func ServerSocketAddress(val string) attribute.KeyValue {
return ServerSocketAddressKey.String(val)
}
// ServerSocketPort returns an attribute KeyValue conforming to the
// "server.socket.port" semantic conventions. It represents the physical server
// port.
func ServerSocketPort(val int) attribute.KeyValue {
return ServerSocketPortKey.Int(val)
}
// These attributes may be used to describe the sender of a network
// exchange/packet. These should be used when there is no client/server
// relationship between the two sides, or when that relationship is unknown.
// This covers low-level network interactions (e.g. packet tracing) where you
// don't know if there was a connection or which side initiated it. This also
// covers unidirectional UDP flows and peer-to-peer communication where the
// "user-facing" surface of the protocol / API does not expose a clear notion
// of client and server.
const (
// SourceDomainKey is the attribute Key conforming to the "source.domain"
// semantic conventions. It represents the domain name of the source
// system.
//
// Type: string
// RequirementLevel: Optional
// Stability: stable
// Examples: 'foo.example.com'
// Note: This value may be a host name, a fully qualified domain name, or
// another host naming format.
SourceDomainKey = attribute.Key("source.domain")
// SourceAddressKey is the attribute Key conforming to the "source.address"
// semantic conventions. It represents the source address, for example IP
// address or Unix socket name.
//
// Type: string
// RequirementLevel: Optional
// Stability: stable
// Examples: '10.5.3.2'
SourceAddressKey = attribute.Key("source.address")
// SourcePortKey is the attribute Key conforming to the "source.port"
// semantic conventions. It represents the source port number
//
// Type: int
// RequirementLevel: Optional
// Stability: stable
// Examples: 3389, 2888
SourcePortKey = attribute.Key("source.port")
)
// SourceDomain returns an attribute KeyValue conforming to the
// "source.domain" semantic conventions. It represents the domain name of the
// source system.
func SourceDomain(val string) attribute.KeyValue {
return SourceDomainKey.String(val)
}
// SourceAddress returns an attribute KeyValue conforming to the
// "source.address" semantic conventions. It represents the source address, for
// example IP address or Unix socket name.
func SourceAddress(val string) attribute.KeyValue {
return SourceAddressKey.String(val)
}
// SourcePort returns an attribute KeyValue conforming to the "source.port"
// semantic conventions. It represents the source port number
func SourcePort(val int) attribute.KeyValue {
return SourcePortKey.Int(val)
}
// These attributes may be used for any network related operation.
const (
// NetworkTransportKey is the attribute Key conforming to the
// "network.transport" semantic conventions. It represents the [OSI
// Transport Layer](https://osi-model.com/transport-layer/) or
// [Inter-process Communication
// method](https://en.wikipedia.org/wiki/Inter-process_communication). The
// value SHOULD be normalized to lowercase.
//
// Type: Enum
// RequirementLevel: Optional
// Stability: stable
// Examples: 'tcp', 'udp'
NetworkTransportKey = attribute.Key("network.transport")
// NetworkTypeKey is the attribute Key conforming to the "network.type"
// semantic conventions. It represents the [OSI Network
// Layer](https://osi-model.com/network-layer/) or non-OSI equivalent. The
// value SHOULD be normalized to lowercase.
//
// Type: Enum
// RequirementLevel: Optional
// Stability: stable
// Examples: 'ipv4', 'ipv6'
NetworkTypeKey = attribute.Key("network.type")
// NetworkProtocolNameKey is the attribute Key conforming to the
// "network.protocol.name" semantic conventions. It represents the [OSI
// Application Layer](https://osi-model.com/application-layer/) or non-OSI
// equivalent. The value SHOULD be normalized to lowercase.
//