Compare commits
1410 Commits
stable/v1.
...
main
Author | SHA1 | Date |
---|---|---|
|
48538b46ad | |
|
8de88737ff | |
|
d63dfaef09 | |
|
cb42f7d511 | |
|
99dde7786f | |
|
287d46353d | |
|
8e1fc80d1a | |
|
1537d405fe | |
|
06330cebbb | |
|
41ba7f57cb | |
|
a0618ad0c7 | |
|
2c7037662c | |
|
93187f0224 | |
|
ca6ae61783 | |
|
407c98a09f | |
|
27d5171890 | |
|
7a32f86055 | |
|
5c4057bb8d | |
|
553db87117 | |
|
74d434eecd | |
|
a59d707c42 | |
|
491ed96aca | |
|
e18a6c8456 | |
|
8505a6147e | |
|
04a8150d37 | |
|
ec17ce48d0 | |
|
f2cfd1327a | |
|
62fbfd3d0d | |
|
995d708729 | |
|
86bab66f32 | |
|
5b3c6b4e83 | |
|
a4e9645829 | |
|
7e30af4c15 | |
|
3578f68c74 | |
|
56df3c0346 | |
|
55f8c20b19 | |
|
c04536857e | |
|
b1dc46473c | |
|
22bc5bac9b | |
|
5736c49842 | |
|
c1935022c1 | |
|
4919fd1711 | |
|
a9fc600f2b | |
|
08afa47f6a | |
|
a2e0f2c6ac | |
|
019cb2c149 | |
|
7a9b04904c | |
|
6d0d33b3df | |
|
280cd5012b | |
|
1c8ec3b291 | |
|
85f1bcc256 | |
|
f0ba942c04 | |
|
af9c024c04 | |
|
9dbd1e446b | |
|
4e2703c3e0 | |
|
072d8a8b2b | |
|
04545fa4ab | |
|
baec0a3e65 | |
|
4ce5bd1651 | |
|
6803723f69 | |
|
d4d373217a | |
|
56610a0c6f | |
|
697e1d31bd | |
|
373edd9bc1 | |
|
0c21db4621 | |
|
0665c854c8 | |
|
d07d630cea | |
|
bc8c94e22c | |
|
4d3f899532 | |
|
6f72fb9646 | |
|
ba50c08e12 | |
|
c2c9399740 | |
|
b50f088f8a | |
|
039b6b4df1 | |
|
b76281a32c | |
|
6033e66530 | |
|
5954fdeb90 | |
|
e1ec4026ed | |
|
eb4ce206b7 | |
|
67ba9e3084 | |
|
db0616fb37 | |
|
eeec126479 | |
|
60d3115390 | |
|
b0e4e4f1d8 | |
|
7749d0a011 | |
|
aca743b499 | |
|
cfc33f7741 | |
|
0c452201aa | |
|
2ac15af496 | |
|
826c2d90d4 | |
|
4061f81de7 | |
|
a2fab71bae | |
|
6f753cca7e | |
|
0b5736d4e1 | |
|
0bbb966729 | |
|
9f5ae79b1e | |
|
8efceed28c | |
|
dbbd03233e | |
|
fb2fdd293f | |
|
cf6dffeebc | |
|
de3a89b1f6 | |
|
e26ecd8eda | |
|
c89cb38d0f | |
|
37fe1e495b | |
|
6e15d69cb8 | |
|
dac72912b3 | |
|
b0b721ae3e | |
|
a59448fe27 | |
|
4f9b31b78a | |
|
28ddef3868 | |
|
78f9260bd5 | |
|
e46bd39e8d | |
|
141c054d2d | |
|
58468728e8 | |
|
0f6619e0cc | |
|
b018f15a00 | |
|
0808373465 | |
|
54e039c9e0 | |
|
77cad06f40 | |
|
3c452f4b20 | |
|
efc640eefa | |
|
2c60ac030a | |
|
dd4b39c850 | |
|
050aafbea5 | |
|
27eb7f12cf | |
|
a8583b82d3 | |
|
390243e308 | |
|
c3260a4dba | |
|
b322a24b4a | |
|
c6ab2ba488 | |
|
790dbb986c | |
|
378344a740 | |
|
019671e140 | |
|
0590a5c08a | |
|
f4dd2a1062 | |
|
7fde94081e | |
|
ecd67debdb | |
|
eaebf765d8 | |
|
e947bd93ae | |
|
5e20647ffe | |
|
78fc472c17 | |
|
693b09d9ac | |
|
92fde6aa77 | |
|
04b32102f0 | |
|
cb4826635a | |
|
8e5049877a | |
|
d240d37ec4 | |
|
455a352b6a | |
|
d9eae58155 | |
|
544c409847 | |
|
537eaf9fc0 | |
|
7d6e11e02f | |
|
2053f0d3a4 | |
|
de5f1dab8c | |
|
f2d4e54975 | |
|
492ed355cb | |
|
5ccf3809b9 | |
|
faeae98653 | |
|
d004d41b5a | |
|
0cdf9eea80 | |
|
1afa8ba514 | |
|
14d55d8641 | |
|
e9d3c71918 | |
|
e4381fcb18 | |
|
1a5b57b7f3 | |
|
cc7aa3c724 | |
|
52d033171a | |
|
5c90aec9af | |
|
5b988c892d | |
|
c27fbc6d49 | |
|
7a1e1b274f | |
|
60f2ce9b73 | |
|
3c65b56d6f | |
|
b526ec99d7 | |
|
4b8ae0c2bf | |
|
7438735af7 | |
|
2d5671aeec | |
|
e7865c67d8 | |
|
bc6c4ebb7f | |
|
afcc71158b | |
|
fcd96deb78 | |
|
1ed613c248 | |
|
9feaee3ff5 | |
|
b6fa2b9e4d | |
|
4fb9c5aba9 | |
|
4f91c1d590 | |
|
824814f783 | |
|
abf31e17f8 | |
|
94059f7cf7 | |
|
99091be9d4 | |
|
3b65dee7bd | |
|
b9d5aeeb22 | |
|
e744798957 | |
|
6508845fa6 | |
|
9030b3e7bd | |
|
a6bb7a321d | |
|
4001f626d9 | |
|
41beed70a3 | |
|
e9f84cbeef | |
|
241c046ccd | |
|
2d4e1cac7c | |
|
d803022ba3 | |
|
57f37eeb31 | |
|
e25de957f4 | |
|
34a2dd574c | |
|
39e9a09694 | |
|
b5885e90e6 | |
|
595d0e9c0d | |
|
f9fda8baef | |
|
7332f3a863 | |
|
15ba2d7da3 | |
|
05c2869ada | |
|
29d0da559b | |
|
c513965062 | |
|
5903906d10 | |
|
bb212334c7 | |
|
e265e47e98 | |
|
a04284ccdc | |
|
27bdf71519 | |
|
3c040c4ef0 | |
|
1c6c39b454 | |
|
a686b88bf5 | |
|
22569aca32 | |
|
2759d73ed5 | |
|
23adb2bdc5 | |
|
682ab65f7c | |
|
d2812d2810 | |
|
e966dc535b | |
|
e42fbb985f | |
|
199fd8ddd3 | |
|
321c31f442 | |
|
c43f17238c | |
|
bdc0e3a34c | |
|
2a26d08b2e | |
|
3e013cfd8f | |
|
f927e82b1d | |
|
0ae25f191e | |
|
b4ae9ca61d | |
|
df49fb1893 | |
|
34475825e8 | |
|
c00f36ee43 | |
|
6c04a41443 | |
|
56c7522693 | |
|
bb22068a27 | |
|
fc0edd82f6 | |
|
95a190a5ac | |
|
6d83f80c13 | |
|
13e951a001 | |
|
6f18ec24d2 | |
|
cb88833234 | |
|
6864c2f785 | |
|
ebdc3144f2 | |
|
70755a6a80 | |
|
37015ee9de | |
|
513ef0d7fb | |
|
ec638dc193 | |
|
a37692abc7 | |
|
d35fbab151 | |
|
52af860553 | |
|
12bde40fb6 | |
|
ec9429711e | |
|
4a6021af7a | |
|
c408d21bb6 | |
|
fddcd199a0 | |
|
643f2bbfc4 | |
|
3b56060c51 | |
|
04e74d7846 | |
|
42eb824f2f | |
|
f44bf10459 | |
|
b2d02d2cc0 | |
|
369d85adbf | |
|
fa5edc639c | |
|
9c46e8f87d | |
|
90afa2850c | |
|
8dc74e609a | |
|
347dd5f692 | |
|
107637ea28 | |
|
2610521b16 | |
|
b8d7966b86 | |
|
4179ddb26c | |
|
616d27a0a1 | |
|
e524148b48 | |
|
67a0e9cb0c | |
|
0c11fc6325 | |
|
8ab52d5479 | |
|
a8befa6814 | |
|
6d7a73aa85 | |
|
84cce75361 | |
|
6d31a18c34 | |
|
e03b6e7caa | |
|
e4d9c213f6 | |
|
bdee949b8a | |
|
61d5a0e291 | |
|
887ff1cd6e | |
|
79e28759f0 | |
|
5387343986 | |
|
9328790c54 | |
|
484af40805 | |
|
0bc4af6cd8 | |
|
eb81e286c0 | |
|
a761a8c4cf | |
|
47212bb4e1 | |
|
a8b4cd2b9d | |
|
569346ba7b | |
|
97dff5b375 | |
|
85dcbc7c55 | |
|
b0f73ea11d | |
|
c9b5bb0bfe | |
|
fc94e4669a | |
|
810b6183dc | |
|
fd7f2d951b | |
|
17bf0d9a34 | |
|
1249e34591 | |
|
5ad0aa544b | |
|
3bf12847d1 | |
|
561f8ad3a3 | |
|
e80879e093 | |
|
c9fa209bf9 | |
|
e35f3d659e | |
|
556eecf0f9 | |
|
e250a0f30b | |
|
3a20ed60b0 | |
|
c28abacee5 | |
|
1e312c2088 | |
|
ef80821f94 | |
|
f3a6310733 | |
|
e97cc2ee8e | |
|
d8bc6b283b | |
|
ef30dbc94d | |
|
dd5b5fbd11 | |
|
a834861418 | |
|
91b9abdf21 | |
|
b7c03d29a4 | |
|
0ee9a27694 | |
|
8ad1304098 | |
|
2a5e0d8224 | |
|
7e98761bc6 | |
|
1370810663 | |
|
4b1ad3fda0 | |
|
9e4d36cb3e | |
|
d3630afb35 | |
|
09a630d304 | |
|
473bb5edcd | |
|
23a47d3fed | |
|
6096f7238d | |
|
1aa158bf98 | |
|
363c003a95 | |
|
0c268e7127 | |
|
44465081c8 | |
|
5bf7e8957e | |
|
d51fa95a6f | |
|
b7343ef3e0 | |
|
c78a02fe74 | |
|
56a0308297 | |
|
4afc190d90 | |
|
a833d9c443 | |
|
699b9194ba | |
|
4a394cc8d7 | |
|
db14633cc4 | |
|
f1ef5960ae | |
|
8483b68f2d | |
|
012dc9e742 | |
|
4b5c21cede | |
|
87bd98edd2 | |
|
030aff30f7 | |
|
72c9af9198 | |
|
fe4d368900 | |
|
6f4f3fcefd | |
|
33dbde1ede | |
|
67d771869b | |
|
ce5bbfb05c | |
|
4c0921ee64 | |
|
2b73d37c9c | |
|
eb3ca4fb07 | |
|
6fee82d868 | |
|
50d59ca938 | |
|
4497ee3831 | |
|
006fe44e56 | |
|
330172c1d8 | |
|
55a1fc88d8 | |
|
508946c853 | |
|
5e1736130e | |
|
be1737fc46 | |
|
c208991123 | |
|
7ed67f98c2 | |
|
a1442fec01 | |
|
7293e69c1e | |
|
dcc1a874d3 | |
|
6be903a902 | |
|
cc8c54ae40 | |
|
039db0b3fc | |
|
859c0ef5a0 | |
|
b057c93c15 | |
|
8fed1b1b66 | |
|
6ccd4df33a | |
|
4947c2d6a4 | |
|
776993f0fc | |
|
7baa493f50 | |
|
e0e2b4ad81 | |
|
3007d3e749 | |
|
77f12c57bf | |
|
98143af5db | |
|
d1cd7f23d0 | |
|
466140bdf8 | |
|
2f919a43fd | |
|
a5dade5462 | |
|
91c67ba470 | |
|
e15d5b3bcd | |
|
9de31518e7 | |
|
2a4919c1cf | |
|
395010f96b | |
|
ee40d5d9b7 | |
|
1ce52050bd | |
|
5627d8451e | |
|
4574bf51c0 | |
|
42be951958 | |
|
8900cfdbba | |
|
1804925c53 | |
|
32564adbb0 | |
|
f4d0dcf45d | |
|
4ef739580f | |
|
6515ed8098 | |
|
0571e429b6 | |
|
cdfefb8294 | |
|
32e25c31c2 | |
|
92b0c368e8 | |
|
af0ecacf72 | |
|
e9eb92476e | |
|
9c30124e76 | |
|
f8ab5592dd | |
|
61c37441f5 | |
|
f7dc8ff5fa | |
|
016c240613 | |
|
b78fec3406 | |
|
3d43356782 | |
|
a3983faa44 | |
|
9d474e3b96 | |
|
1fc304c1e9 | |
|
a00a429b2c | |
|
e311672daf | |
|
7b800e124d | |
|
d7f4288919 | |
|
41c0d88710 | |
|
720bc8c70d | |
|
65cedf71bd | |
|
bd25230eae | |
|
948496dcbf | |
|
966ac176af | |
|
2ca2459414 | |
|
c398601cc1 | |
|
3cf1c5215f | |
|
5578a11dfd | |
|
5c1ae0aa5b | |
|
0b8d310cf5 | |
|
0ee398d1e3 | |
|
f7dccbf0a0 | |
|
7aff06d793 | |
|
00683ff515 | |
|
f2a6bcc204 | |
|
cd4e2bf8c0 | |
|
583154c919 | |
|
14d086a234 | |
|
e1522f0f39 | |
|
39ab59d9ad | |
|
fb4619bfc8 | |
|
bb67268e17 | |
|
f047db9da2 | |
|
15e6534451 | |
|
af1efea55c | |
|
fbd28f0332 | |
|
c0e25aaaf5 | |
|
f947278cb3 | |
|
30d1e13876 | |
|
d4b75c3f0c | |
|
3c307994fa | |
|
ae25ae3319 | |
|
cf8edbed43 | |
|
5cc3dc28d7 | |
|
01cea7caeb | |
|
38f6689480 | |
|
b2778e1b2f | |
|
30a46ae547 | |
|
bb9caaf1ef | |
|
eee78fa2e7 | |
|
154155f7d9 | |
|
08942ba126 | |
|
1cf1939641 | |
|
3d66bcbb9c | |
|
3f2c707ade | |
|
d91dbe1b1d | |
|
3460a8c264 | |
|
f2039e856b | |
|
34003c9b7e | |
|
d4035eb973 | |
|
a6020fb113 | |
|
8d88c36dcb | |
|
54b14fbbe3 | |
|
539d94265b | |
|
0f6363ae35 | |
|
a037f84b67 | |
|
fbb1b360eb | |
|
01a2c35a69 | |
|
f99e7d9c2c | |
|
3fdadd516e | |
|
73fad98428 | |
|
08628bce82 | |
|
86019e0ff6 | |
|
0608f40557 | |
|
cdd5284dc3 | |
|
81f78a6e42 | |
|
1041ed4fdb | |
|
c07aa537cb | |
|
55f15e90d6 | |
|
3cbc9c72e9 | |
|
9e421f6a84 | |
|
dd83751f19 | |
|
4fa7c1358e | |
|
812c774998 | |
|
48854685d3 | |
|
b5409d7acd | |
|
c280a08027 | |
|
05e2699089 | |
|
c9ea5f2428 | |
|
01664ddf87 | |
|
2e42181ff0 | |
|
fd911fb3a4 | |
|
bd053932b7 | |
|
6481396a6b | |
|
6bb2f16d85 | |
|
c4d3351b6b | |
|
26974c4d07 | |
|
957fa3b5e4 | |
|
97d0ec5a1b | |
|
929e345454 | |
|
97f372b475 | |
|
9cd2021119 | |
|
de503497b9 | |
|
7c808e3117 | |
|
9d3bc18f7d | |
|
106fa9bfdd | |
|
315239da67 | |
|
be9d11c045 | |
|
1ef6027457 | |
|
c66b65f610 | |
|
0ce7d94e3e | |
|
20074d8cd3 | |
|
95edbd9992 | |
|
55c6c014cf | |
|
04dc781a84 | |
|
81b847484e | |
|
7e72f1cccf | |
|
ba7bdf5465 | |
|
ecc88a38d8 | |
|
634277f460 | |
|
82b7526b02 | |
|
7238852445 | |
|
4f6d7a4ade | |
|
969a16f911 | |
|
095003da3e | |
|
860e5d5746 | |
|
182cbb530d | |
|
195e5efb4e | |
|
d545521580 | |
|
c97f21f221 | |
|
4e778b1257 | |
|
2d867172b4 | |
|
e49c4c7f42 | |
|
bac68fc7d4 | |
|
d7fcc77d55 | |
|
20182d8804 | |
|
4c01b33826 | |
|
806fa97ebd | |
|
a479ddce4b | |
|
3c8c29ac8f | |
|
50bd46061e | |
|
1c6e8b2531 | |
|
15b35260df | |
|
3ca2f5ba8d | |
|
3cfa78303a | |
|
4777631b13 | |
|
ca027b5eed | |
|
5608bba359 | |
|
46d79f9a5e | |
|
a82d875863 | |
|
c503ff1394 | |
|
1c5de7ac2f | |
|
75d88f7126 | |
|
b518e16ef8 | |
|
9400e726d0 | |
|
157c811274 | |
|
753f0a63a2 | |
|
5c84971528 | |
|
e86470a53b | |
|
4d6cf080c7 | |
|
d99e211a31 | |
|
e44895fdac | |
|
8c12dd5c42 | |
|
141b457b85 | |
|
8079fd6880 | |
|
3ab4f765d8 | |
|
31eb60dc99 | |
|
99431df2e2 | |
|
73fddf9b5e | |
|
0d6c45697f | |
|
26101229ae | |
|
629bb8398b | |
|
0a750eb90b | |
|
7f82b80f3c | |
|
87e25c5e01 | |
|
3b5eb239cc | |
|
da02c8d6b1 | |
|
fab27d578a | |
|
583cc7c23d | |
|
34387774ca | |
|
b067aed8ba | |
|
7a5db08f75 | |
|
19660dbc96 | |
|
7fb673cc59 | |
|
0b6463e491 | |
|
c0468673cb | |
|
b78d4432d8 | |
|
e01f493a24 | |
|
5231aa2550 | |
|
928796d853 | |
|
d66e1d75d4 | |
|
f3aedb76ff | |
|
b418d36609 | |
|
9a5688e61f | |
|
1a0fb4fd5f | |
|
900b7d8bfc | |
|
f6a075be32 | |
|
97af8e6d4d | |
|
fec6286127 | |
|
5fb65b4145 | |
|
f9a0d3ec33 | |
|
6547440432 | |
|
5489797344 | |
|
aabd1a9b00 | |
|
3a426e8c32 | |
|
1b4999f386 | |
|
a30989f420 | |
|
7fa2c84e6f | |
|
680406654e | |
|
c379326d92 | |
|
63d74cdc36 | |
|
5a033e50b3 | |
|
75bd7233ea | |
|
3920b158d0 | |
|
8e1996ef0d | |
|
7be35c7845 | |
|
05720ccc41 | |
|
f1b2c6d212 | |
|
5637e2a91c | |
|
aff48a1f00 | |
|
12dec9b9cd | |
|
89caef9bb9 | |
|
356ef8af4a | |
|
5bc8cedbd3 | |
|
8bbebfd191 | |
|
44b0b29dea | |
|
7e709a6fd9 | |
|
83becc71bf | |
|
01348e6fbc | |
|
25548fd9a5 | |
|
19b433e137 | |
|
b7c53827d4 | |
|
f86251d40f | |
|
63845ec2e7 | |
|
f6712fd450 | |
|
6d276f4d87 | |
|
588d8ad14d | |
|
0229434cb5 | |
|
72c60f17ef | |
|
2df6310351 | |
|
efa6307319 | |
|
ac75b70dde | |
|
c98a5d31ea | |
|
4655895ba1 | |
|
828f2ed730 | |
|
37119908d6 | |
|
5afbcdbe0a | |
|
bf4d553ef8 | |
|
df63272408 | |
|
8648313ed8 | |
|
0635ab1c6c | |
|
a9af247259 | |
|
0f6518dd63 | |
|
0aba75ceef | |
|
97276869cd | |
|
43e598e7c1 | |
|
2a3c26437f | |
|
7f613e0491 | |
|
bf8714edcb | |
|
71ef1b1f2c | |
|
6898a34512 | |
|
fac6d147a1 | |
|
57008533ab | |
|
b7e3d44fd1 | |
|
ae0a3c522d | |
|
b36ab12d16 | |
|
0206181c49 | |
|
f4b681d4f3 | |
|
a512494ba2 | |
|
42aaae0270 | |
|
3cf2cf60c5 | |
|
37add77095 | |
|
3e59291321 | |
|
d828041a52 | |
|
d3c311aec2 | |
|
02de4ab720 | |
|
d286bf6498 | |
|
1cbaaf08b2 | |
|
ba00147a77 | |
|
ea8bfa283a | |
|
4fe1ae8aaf | |
|
af4f7a9daf | |
|
dddab06aa4 | |
|
6be10fbd8d | |
|
237c757242 | |
|
9349c68c2f | |
|
4e77c1dee6 | |
|
09bdeba200 | |
|
5b0fb7b40d | |
|
4daa2640d2 | |
|
104a5e8867 | |
|
dcf93e8506 | |
|
9e9453649d | |
|
6dd075cdf6 | |
|
1447ad5223 | |
|
a81e0eaa14 | |
|
c4e75fb953 | |
|
0b7dc46f56 | |
|
317c93dec8 | |
|
3e2fcdaebb | |
|
c0034ce3e5 | |
|
d0d95816b9 | |
|
593d220465 | |
|
0a52166bbd | |
|
cc4ff2d158 | |
|
3f96f1ff83 | |
|
1dda06a803 | |
|
470a2bf79b | |
|
bf8ee62a1e | |
|
f654636502 | |
|
762a65a6e4 | |
|
38db748685 | |
|
8067d97210 | |
|
35be022db1 | |
|
543f0b470c | |
|
b3a539d301 | |
|
3b8f0aff95 | |
|
dc10b81ee9 | |
|
5be08f47f0 | |
|
26fcb884fd | |
|
079c1f547a | |
|
21da78f76c | |
|
4cbb6351f8 | |
|
bf30779119 | |
|
343ca78015 | |
|
d229b3ad31 | |
|
7cf46c794b | |
|
9d62673d2c | |
|
ab52a8420a | |
|
6031bb4ddc | |
|
ba4de42a4b | |
|
e0efd7aa3d | |
|
51be418b3d | |
|
4eddf51eb9 | |
|
2c7d5c427f | |
|
0f8aa7924f | |
|
5ed54c8a09 | |
|
10f6c46057 | |
|
b0c0ace8fc | |
|
b41cada2d2 | |
|
f5ef8de1cc | |
|
40fde0f69f | |
|
f2b447dad5 | |
|
654638a430 | |
|
c478c11975 | |
|
f665499096 | |
|
c7c1867c82 | |
|
73b446688f | |
|
9fd1948e0d | |
|
d434f84253 | |
|
cd232cde14 | |
|
9db6352d30 | |
|
586def466b | |
|
95471d1cce | |
|
e9328abb68 | |
|
1c7d7a3542 | |
|
7f52f70d22 | |
|
00e78efd84 | |
|
b6e532bf52 | |
|
f8e187b473 | |
|
4eb10f7c9d | |
|
c320c981c5 | |
|
5fd3737aa3 | |
|
84861cd827 | |
|
912256184c | |
|
5ce32c0fe5 | |
|
5af865386a | |
|
868f75e448 | |
|
c84698d4a1 | |
|
52f428a9f1 | |
|
f0ceabc57c | |
|
513d0679a5 | |
|
6bf1b78653 | |
|
24997089da | |
|
2b9832ecb5 | |
|
f2fc0d8787 | |
|
1a8652aa54 | |
|
cbc5c52085 | |
|
be1627267f | |
|
ed27a37678 | |
|
f038b44fe9 | |
|
30d1fcac78 | |
|
4a4059bc85 | |
|
937cfaa64b | |
|
5615b1c185 | |
|
4f28f90fd9 | |
|
f6ebf0e1d6 | |
|
faf939c775 | |
|
27897d6c34 | |
|
5fcd8cf136 | |
|
5d94185e2e | |
|
ba38804c05 | |
|
415b198c03 | |
|
4d662cf84d | |
|
9452607a7f | |
|
6d174e2a06 | |
|
cacb8259ef | |
|
5b7f619130 | |
|
1da2b1bb11 | |
|
cd4998a4b5 | |
|
c84637f264 | |
|
432d43942e | |
|
d8a14ea5b2 | |
|
6e7df295bf | |
|
a793321c62 | |
|
0cc9a0b10b | |
|
8ac369f87e | |
|
c230076c69 | |
|
dfe9bdd32c | |
|
863c4d4028 | |
|
92050b55ad | |
|
f263ab7134 | |
|
cd539dd2d0 | |
|
34660b5372 | |
|
b400c2e5d9 | |
|
5259a0b928 | |
|
853a7b6ede | |
|
902229afd8 | |
|
d3436bfac5 | |
|
48fb15862e | |
|
ffe641c08c | |
|
a4213183b0 | |
|
3732256f02 | |
|
5fd656bb08 | |
|
b4cda7a9db | |
|
4cffe5dfef | |
|
87fff2ece4 | |
|
1a7488ecdd | |
|
0755a5c076 | |
|
c021b10b14 | |
|
2b20565d10 | |
|
9f71800fdc | |
|
0f20b2a974 | |
|
87f21ef8ae | |
|
65483a4fe9 | |
|
5352cc78b6 | |
|
013695d45d | |
|
552abc8221 | |
|
fc28665d09 | |
|
6d13eb4379 | |
|
cab31aadb1 | |
|
68039c55ec | |
|
b34c39bf32 | |
|
02c1d95608 | |
|
06e919d6c9 | |
|
a675ae817b | |
|
ea160d9c5c | |
|
dccd90603b | |
|
c51c9eb954 | |
|
de5cd0f409 | |
|
1ce8a899cf | |
|
070b6852a5 | |
|
bb8a4f7ab7 | |
|
b3d57bb295 | |
|
e2e291c583 | |
|
10c3e934cc | |
|
15ede4700b | |
|
4dc8416f9e | |
|
a30952cc50 | |
|
655e373c53 | |
|
9977de7924 | |
|
19fb033900 | |
|
5dc0f6974a | |
|
74393ac639 | |
|
196b6442b9 | |
|
f40e3de178 | |
|
67d4b80665 | |
|
5bee444ab6 | |
|
d76f34eef2 | |
|
dfe6fe8272 | |
|
e8f3432bde | |
|
4b2d887cd5 | |
|
c981558b50 | |
|
51fb576c16 | |
|
661b2831e4 | |
|
5912501043 | |
|
b7d2fac77d | |
|
fbb7d72feb | |
|
5288753c21 | |
|
4bed3c92ff | |
|
4f440aa342 | |
|
863c8a4081 | |
|
65fa45fdef | |
|
5a1cd99bae | |
|
95a5e0cada | |
|
75691c92cd | |
|
f606404cd7 | |
|
2f472adb93 | |
|
7fc17e5c45 | |
|
630e0da2dc | |
|
3b387d8f37 | |
|
e8540c5016 | |
|
4a7091f2b4 | |
|
228e67b941 | |
|
51dd6f2ddd | |
|
a2ff4b677d | |
|
3d7015121c | |
|
69da5d548e | |
|
edebbcc757 | |
|
1fc4ac652f | |
|
05bcd822a9 | |
|
8eb9bf30a3 | |
|
a4f0b42f1e | |
|
622955a95d | |
|
a8ac8baa51 | |
|
2fb1b3064e | |
|
0c12777c98 | |
|
73d7b6735b | |
|
fe82d7b005 | |
|
c6635fa496 | |
|
a6635428a9 | |
|
5fb44c0447 | |
|
58dbbb4b89 | |
|
0471c54a4c | |
|
de22983c50 | |
|
9fe1f7d8d5 | |
|
d4a41bd815 | |
|
fcd75dfda8 | |
|
17eca4c792 | |
|
18ea3df2b7 | |
|
c3feabe4e7 | |
|
81ee1df218 | |
|
6a876a053f | |
|
68eba71191 | |
|
2531263948 | |
|
758c7af0c1 | |
|
422a36ae12 | |
|
bba09c0e5a | |
|
29c46ef5ce | |
|
8fc7689659 | |
|
32632bd303 | |
|
b8b6308386 | |
|
7255da994f | |
|
32ae641ad1 | |
|
2f1e316484 | |
|
abfb1bb68e | |
|
a96116db88 | |
|
98e4e821bc | |
|
9347ca6a3e | |
|
6676414505 | |
|
cd0d8806e0 | |
|
de354dbbdd | |
|
61aae103f3 | |
|
3e99e13a4e | |
|
1b50f91850 | |
|
5b9534bd47 | |
|
053acb604c | |
|
a04090010e | |
|
a31b38a845 | |
|
26dfc70841 | |
|
9945c4bb14 | |
|
93285585ce | |
|
65b2b79b13 | |
|
73da976982 | |
|
4b04407ba3 | |
|
b8923d5165 | |
|
1328ee04ae | |
|
9a79db3e18 | |
|
dc94696d5a | |
|
8c788590f7 | |
|
dbe005f548 | |
|
0c37daa0b1 | |
|
ca700c4eef | |
|
823f846ebf | |
|
80c53a9637 | |
|
c4a8387cb4 | |
|
25bb985342 | |
|
c5c54acc0f | |
|
18ad56fedc | |
|
52facfa5b1 | |
|
89a984a182 | |
|
7e9ff249ac | |
|
a96e429b31 | |
|
9a37fafb4c | |
|
3653f5cbf3 | |
|
2276977218 | |
|
d82a0983c1 | |
|
56e6b1bb89 | |
|
ecb5ebe86e | |
|
48ecf229eb | |
|
95bf6fc7cc | |
|
3a2ca58075 | |
|
ebc8575a0c | |
|
2f715bd78d | |
|
cbbdfd3798 | |
|
4a4484a910 | |
|
494efffcf4 | |
|
0fb78797ed | |
|
6f3e96fd77 | |
|
31dd7b7258 | |
|
a457d941c2 | |
|
74ca04f7b2 | |
|
0d373bd8b0 | |
|
79b06a470a | |
|
abfe059d72 | |
|
708afd0e9e | |
|
7f63a6fa5e | |
|
1fbc828607 | |
|
99524a10fb | |
|
b73ba9c398 | |
|
9b4f2a516d | |
|
86973eb79b | |
|
47444f2a4c | |
|
3bc080731d | |
|
2c51cc26d1 | |
|
326fd557cb | |
|
d1aa906889 | |
|
e0d6e14bfd | |
|
65e83d4f0a | |
|
c32a845726 | |
|
cb88e4ea11 | |
|
dd2af92054 | |
|
92fbec99ec | |
|
ae3b4282f8 | |
|
461dc4ba9e | |
|
2b59c2820c | |
|
2a76d881e4 | |
|
279458e7dd | |
|
49787433b6 | |
|
d1f9594d0c | |
|
e0abcc0b3f | |
|
a90c558772 | |
|
5b070b80a4 | |
|
dcb09b76d1 | |
|
3bc93a9fa6 | |
|
3670071468 | |
|
b5ef0e4625 | |
|
77f7753392 | |
|
bcfb1b63d5 | |
|
9589d541ce | |
|
652d167531 | |
|
51273714ef | |
|
a42e4edef4 | |
|
c87a304898 | |
|
49c75b8c6d | |
|
07b14384a7 | |
|
08f597f3a3 | |
|
969bb62696 | |
|
2dcc898514 | |
|
475e4016d3 | |
|
126ae93d1f | |
|
c93ab9e84e | |
|
3fd6fb8a8f | |
|
93222fc65a | |
|
eecb8009a3 | |
|
1c3af6ce28 | |
|
faa0a33b62 | |
|
2fb80ebe19 | |
|
263ee6196f | |
|
6410ca1e19 | |
|
e3a81d2d18 | |
|
e70cdebad4 | |
|
e4927f8d9a | |
|
c24227e08d | |
|
fb87ee9484 | |
|
6ea4b41d8e | |
|
285f282c62 | |
|
91f94a81bc | |
|
369b07e1c7 | |
|
b152497e5f | |
|
db0ecc3768 | |
|
897c1365e4 | |
|
ed98c6feba | |
|
3290b25d0a | |
|
c9a3494dc2 | |
|
b9f5561d19 | |
|
b29deeed50 | |
|
e315f53263 | |
|
e133f3f5c3 | |
|
bd565475a9 | |
|
125f11e721 | |
|
1b7246abb4 | |
|
c032493d09 | |
|
b4f04ae01d | |
|
76073eeb20 | |
|
d1621d2c8b | |
|
258b677dbc | |
|
74e39c7788 | |
|
7972edf665 | |
|
27c4f76294 | |
|
baf0feea26 | |
|
c6ff50ee18 | |
|
85c62ef617 | |
|
d154066354 | |
|
1536a7cbb2 | |
|
bdc603cc76 | |
|
2cee814ea8 | |
|
a3e40da38a | |
|
f31448ed5c | |
|
e9347e4671 | |
|
d808e2957f | |
|
4420402e16 | |
|
30a81bdcd7 | |
|
292a53df66 | |
|
bbc1811b02 | |
|
0d4c71fc50 | |
|
6ede1ee179 | |
|
ec8ff16370 | |
|
3ab8bfcedb | |
|
92f235964d | |
|
a7d053ae5a | |
|
07a16b7c90 | |
|
efb0275ffe | |
|
aa263e5c27 | |
|
ef6fcdcd1a | |
|
40ee3825a4 | |
|
b934cbc486 | |
|
1864a9a50c | |
|
e91cac503c | |
|
6b8bb15ab5 | |
|
afe0657723 | |
|
c268832689 | |
|
6111ae0181 | |
|
d8dabf1be3 | |
|
0074ee2ccd | |
|
7870438d1f | |
|
6fadc6e9a2 | |
|
ad88c3d9aa | |
|
4422d8ce21 | |
|
ec56837f22 | |
|
9c102b765d | |
|
fade3c989b | |
|
bd0a77f8ba | |
|
032f68f27d | |
|
0f178d1e2e | |
|
c1ef97de3e | |
|
f9f7fedb77 | |
|
b73c29dcff | |
|
be24d698f9 | |
|
5818129631 | |
|
32cb123690 | |
|
cdbf67d1c2 | |
|
5005b0be18 | |
|
597ea98e58 | |
|
a8047ba9cd | |
|
c926e3d76b | |
|
d3adc22c47 | |
|
4e123b5372 | |
|
a669f9c5e2 | |
|
dd22372a09 | |
|
bd9159a353 | |
|
d4ab03fc56 | |
|
a5abee6911 | |
|
506f40b421 | |
|
c73d782588 | |
|
b8bcc1abbe | |
|
fbbc2773c5 | |
|
cc40f1e18a | |
|
9b5149cb0c | |
|
406a059198 | |
|
34c5bdba67 | |
|
43f4e5a332 | |
|
6807deff5a | |
|
3cca2cec8f | |
|
2e23d7480c | |
|
038df3fa77 | |
|
f882b71c68 | |
|
dc2d093809 | |
|
7b3eab6e47 | |
|
d995b801b9 | |
|
0c13343150 | |
|
ddd0c6b0a7 | |
|
c6c01b127f | |
|
dcc9f860be | |
|
dc67f4e11b | |
|
b1c00629c9 | |
|
e76cb8b6d8 | |
|
fc4dcba9b6 | |
|
492a3e8825 | |
|
df58facdde | |
|
3db10568be | |
|
776656b6e0 | |
|
37ecb596ab | |
|
79cb83d1b0 | |
|
5ae0a37ddb | |
|
1d0eaefe09 | |
|
d5cf120d72 | |
|
1a0e0c44d2 | |
|
18dce78c47 | |
|
69cf899090 | |
|
1e8b896d68 | |
|
9ac9976b38 | |
|
4ee8fe38c4 | |
|
bec6c3c085 | |
|
db32860bb4 | |
|
747c404fb1 | |
|
b4707e4c2f | |
|
e39ab883b1 | |
|
474ec864ec | |
|
6dd6af33c3 | |
|
6eca6d4e4c | |
|
43783038cc | |
|
0727ed74e8 | |
|
d2de661de0 | |
|
fa295a3298 | |
|
b8915092bc | |
|
cb642d7c28 | |
|
fcb9565067 | |
|
3cc40d78b4 | |
|
5f9ef511dd | |
|
c8c4ec6041 | |
|
922e963eca | |
|
0ed21bc99c | |
|
1f742e489c | |
|
48e960a4e6 | |
|
9c9789af0b | |
|
51afd54bd6 | |
|
094f016ac6 | |
|
bf0783a7bf | |
|
d10b25471f | |
|
7649cf1736 | |
|
fcef5e21af | |
|
fd95d42c19 | |
|
e44f6d1a10 | |
|
edf6157900 | |
|
eda0b092db | |
|
7196b7f9e7 | |
|
7149f6cdb3 | |
|
bfd04b0b40 | |
|
ba3e3207ed | |
|
610808d3b6 | |
|
69cced26a2 | |
|
a9c59da516 | |
|
22085fc711 | |
|
aabc5f6b89 | |
|
65fbb2f65b | |
|
269a495945 | |
|
479321cdcc | |
|
ac578e9a8d | |
|
97bc6321c0 | |
|
4c995416e2 | |
|
1ee1b287ed | |
|
858f6ce5f8 | |
|
772e6595b3 | |
|
d98548b424 | |
|
1343d16aa2 | |
|
65aeff0dd3 | |
|
ddb0775234 | |
|
df77c624e7 | |
|
dc44b8611b | |
|
6436d858b3 | |
|
60a17ee8e3 | |
|
ce7e98fd98 | |
|
6710cddaa4 | |
|
a5135e20de | |
|
28a177ffe3 | |
|
4584c36026 | |
|
a0a670a03f | |
|
e5031bdf65 | |
|
0f3e4dea3c | |
|
75cbf5d491 | |
|
96465c535a | |
|
cfda625e83 | |
|
f92466980c | |
|
2ba6dd5681 | |
|
ed2f033815 | |
|
7086d5aa71 | |
|
322dabe86f | |
|
83355af499 | |
|
14bd6f93ed | |
|
0213d829dc | |
|
eac583e9d8 | |
|
9890767c98 | |
|
5d9ed3faa5 | |
|
b6cb40ffd0 | |
|
7870e9529f | |
|
b749b0daa7 | |
|
da22673d10 | |
|
1ff9688cfb | |
|
16eaeb6f0e | |
|
549bd5b9f8 | |
|
b0f8a2d36e | |
|
1f0f6d9bf4 | |
|
8182dab513 | |
|
2cb620d9c9 | |
|
68b93c5f50 | |
|
3fd1b1ea91 | |
|
70dc60b479 | |
|
e71a5ee6e0 | |
|
f384303ac4 | |
|
7268daa3db | |
|
acb03454bd | |
|
038bbdb67a | |
|
4ca2d89b84 | |
|
c6dab2a6e7 | |
|
82192b54e6 | |
|
043834db0c | |
|
a0c1236df4 | |
|
13a0e7e46a | |
|
5b83c1828d | |
|
a901732aca | |
|
ef03d02a8e | |
|
df0cee9b7f | |
|
9579106a9d | |
|
def9ba3ea5 | |
|
b8df001379 | |
|
144e11ab70 | |
|
630a26182a | |
|
b756b7c36d | |
|
eb19f3dc5c | |
|
2da67548ce | |
|
fd62fa4712 | |
|
e4aa9eb257 | |
|
ba177fab33 | |
|
4fa3270270 | |
|
1dd8a89f8a | |
|
4f8849fc77 | |
|
ed043be4cf | |
|
31380acd08 | |
|
0dc4c3d8eb | |
|
94a0747fa0 | |
|
958c064f92 | |
|
bdb61f7e56 | |
|
e9e4567647 | |
|
ee2342bdb0 | |
|
ce5f7f7ec3 | |
|
a824578c98 | |
|
3231cdcfd8 | |
|
754d96d36e | |
|
e1c32b2daa | |
|
8daaddc6a4 | |
|
63cff1cbc5 | |
|
04f9edd12f | |
|
e32879abbc | |
|
8bda25ca9e | |
|
1577f3536f | |
|
395fb0428b | |
|
206a1c3c1a | |
|
21fc8b5280 | |
|
d315b0a75e | |
|
82e39c470a | |
|
4909cf122a | |
|
6b94e26022 | |
|
354c002283 | |
|
d61f7bee0f | |
|
5f3cbc2c2d | |
|
fb2031be6b | |
|
dce6eb7abc | |
|
9a727f8b21 | |
|
3d5447defa | |
|
af377fa4e0 | |
|
eba315b6a2 | |
|
0e9f8af8cc | |
|
bef840b55b | |
|
ddede49309 | |
|
315abae2fb | |
|
f010fa302a | |
|
5d22abacae | |
|
50252a90bc | |
|
d9e12e24b2 | |
|
7578e50028 | |
|
89f862b284 | |
|
8b9935b937 | |
|
2c8601fe9d | |
|
27bbb11cde | |
|
10cd9163a0 | |
|
f59c5b268b | |
|
b804d9bff7 | |
|
dded3f8c0f | |
|
a35f09362a | |
|
f51f8531b9 | |
|
09d3f6887a | |
|
6724a1bfe5 | |
|
f95debab3a | |
|
b9e7835716 | |
|
3959386463 | |
|
14afcc1f7b | |
|
5e9c7e1cb6 | |
|
9b5feb2f21 | |
|
13acbd3675 | |
|
a58f510ed0 | |
|
58bfe2563b | |
|
d128f0ff4e | |
|
b9dffcafd3 | |
|
6b77b679ca | |
|
7d67bf3e3e |
|
@ -1,25 +0,0 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
labels: bug
|
||||
---
|
||||
|
||||
Please answer these questions before submitting a bug report.
|
||||
|
||||
### What version of OpenTelemetry are you using?
|
||||
|
||||
### What version of Node are you using?
|
||||
|
||||
### Please provide the code you used to setup the OpenTelemetry SDK
|
||||
|
||||
### What did you do?
|
||||
|
||||
If possible, provide a recipe for reproducing the error.
|
||||
|
||||
### What did you expect to see?
|
||||
|
||||
### What did you see instead?
|
||||
|
||||
### Additional context
|
||||
|
||||
Add any other context about the problem here.
|
|
@ -0,0 +1,139 @@
|
|||
name: Bug Report
|
||||
description: File a bug report
|
||||
labels: ["bug", "triage"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
> [!IMPORTANT]
|
||||
> **Please read all parts of this form carefully.** By following the instructions carefully, you ensure that we
|
||||
> can get started fixing your bug, instead of being stuck at trying to reproduce your issue. Please provide
|
||||
> all requested information, even if you think it does not apply to your problem.
|
||||
>
|
||||
> **If you use a third-party package that re-distributes OpenTelemetry, open the bug ticket with that third party unless you can provide steps to reproduce this with pure OpenTelemetry.**
|
||||
> Digging into third-party distributions of OpenTelemetry is not in scope for this project.
|
||||
|
||||
Before filing a bug, please be sure you have searched through [existing open bugs](https://github.com/open-telemetry/opentelemetry-js/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Abug)
|
||||
to see if this bug has already been filed.
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
## Bug Reproduction
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: What happened?
|
||||
description: |
|
||||
> [!IMPORTANT]
|
||||
> **Please provide as much detail as you reasonably can.**
|
||||
> We all know the complexities of developing with JavaScript/TypeScript. **Be specific** about your setup and **DO NOT** assume that the person handling your bug report knows how to use your specific combination of tooling. Always provide build instructions and config files.
|
||||
value: |
|
||||
## Steps to Reproduce
|
||||
<!--
|
||||
The most effective way to solve a bug is to provide a link to a reproducer repository. It is extremely difficult to exactly reproduce problems
|
||||
and doing so can take multiple hours for us. You know your tooling and setup and we know OpenTelemetry JavaScript internals.
|
||||
Let's help each other! :)
|
||||
-->
|
||||
## Expected Result
|
||||
|
||||
## Actual Result
|
||||
|
||||
## Additional Details
|
||||
<!--
|
||||
Anything you can think of that will help us reproduce and understand your problem:
|
||||
- details about the behavior of the bug
|
||||
- code to reproduce, if not provided via a repository above (including setting up any frameworks you may be using, we likely don't use the same tech-stack that you're using on the daily)
|
||||
- which tooling you use and how you're using it
|
||||
- config files for your tooling (typescript, bundlers, ...)
|
||||
- how you run your code (example: `node -r otel.js ./index.js`).
|
||||
- which module type you are you using (`module` or `commonjs`)
|
||||
-->
|
||||
|
||||
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: OpenTelemetry Setup Code
|
||||
description: |
|
||||
Please provide the code you use to set up OpenTelemetry.
|
||||
If you use `@opentelemetry/auto-instrumentations-node/register`, please state so here.
|
||||
You may omit this step if you have provided a reproducer repository.
|
||||
placeholder: | # This comes from our README.md
|
||||
// otel.js
|
||||
|
||||
'use strict'
|
||||
|
||||
const process = require('process');
|
||||
const opentelemetry = require('@opentelemetry/sdk-node');
|
||||
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
||||
const { ConsoleSpanExporter } = require('@opentelemetry/sdk-trace-base');
|
||||
const { resourceFromAttributes } = require('@opentelemetry/resources');
|
||||
const { ATTR_SERVICE_NAME } = require('@opentelemetry/semantic-conventions');
|
||||
|
||||
// configure the SDK to export telemetry data to the console
|
||||
// enable all auto-instrumentations from the meta package
|
||||
const traceExporter = new ConsoleSpanExporter();
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
resource: resourceFromAttributes({
|
||||
[ATTR_SERVICE_NAME]: 'my-service',
|
||||
}),
|
||||
traceExporter,
|
||||
instrumentations: [getNodeAutoInstrumentations()]
|
||||
});
|
||||
|
||||
// initialize the SDK and register with the OpenTelemetry API
|
||||
// this enables the API to record telemetry
|
||||
sdk.start()
|
||||
.then(() => console.log('Tracing initialized'))
|
||||
.catch((error) => console.log('Error initializing tracing', error));
|
||||
|
||||
// gracefully shut down the SDK on process exit
|
||||
process.on('SIGTERM', () => {
|
||||
sdk.shutdown()
|
||||
.then(() => console.log('Tracing terminated'))
|
||||
.catch((error) => console.log('Error terminating tracing', error))
|
||||
.finally(() => process.exit(0));
|
||||
});
|
||||
render: "JavaScript"
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: package.json
|
||||
description: |
|
||||
Please provide your the full package.json needed to reproduce the issue.
|
||||
You may omit this step if you provided a reproducer repository.
|
||||
render: "JSON"
|
||||
placeholder: |
|
||||
{
|
||||
"name": "my-app",
|
||||
"scripts": {
|
||||
"start": "node -r otel.js app.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/api": "^1.3.0",
|
||||
"@opentelemetry/sdk-trace-base": "~1.3.1",
|
||||
...
|
||||
}
|
||||
}
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Relevant log output
|
||||
description: |
|
||||
Please copy and paste any relevant log output.
|
||||
render: shell
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
## System Details
|
||||
System Details help us when we cannot reproduce your problem with the information provided above. Sometimes bugs only surface on specific platforms and runtime versions.
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Operating System and Version
|
||||
placeholder: Ubuntu 24.04, Windows 11 Build 26100.2033, macOS 15.0.1
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Runtime and Version
|
||||
placeholder: Node.js v20.12.1, Node.js v18.18.2, Firefox 130, Chrome 132, ...
|
||||
validations:
|
||||
required: false
|
|
@ -7,7 +7,7 @@ Before creating a pull request, please make sure:
|
|||
- You have read the guide for contributing
|
||||
- See https://github.com/open-telemetry/opentelemetry-js/blob/main/CONTRIBUTING.md
|
||||
- You signed all your commits (otherwise we won't be able to merge the PR)
|
||||
- See https://github.com/open-telemetry/community/blob/master/CONTRIBUTING.md#sign-the-cla
|
||||
- See https://github.com/open-telemetry/community/blob/main/guides/contributor#sign-the-cla
|
||||
- You added unit tests for the new functionality
|
||||
- You mention in the PR description which issue it is addressing, e.g. "Fixes #xxx". This will auto-close
|
||||
the issue that your PR fixes (if such)
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
# Repository settings
|
||||
|
||||
This document describes any changes that have been made to the
|
||||
settings for this repository beyond the [OpenTelemetry default repository
|
||||
settings](https://github.com/open-telemetry/community/blob/main/docs/how-to-configure-new-repository.md#repository-settings).
|
||||
|
||||
## General
|
||||
|
||||
No changes
|
||||
|
||||
## Collaborators and Teams
|
||||
|
||||
- There is currently no `javascript-triagers` role
|
||||
- `javascript-maintainers` has `Admin` permission
|
||||
|
||||
## Branches
|
||||
|
||||
## Branch protection rules
|
||||
|
||||
### `main`
|
||||
|
||||
- Uncheck "Restrict who can push to matching branches"
|
||||
- Check "Require merge queue"
|
||||
- Build concurrency: 5
|
||||
- Minimum pull requests to merge: 1 or after 5 minutes
|
||||
- Maximum pull requests to merge: 5
|
||||
- Check "Only merge non-failing pull requests"
|
||||
- Status check timeout: 60 minutes
|
||||
|
||||
### `dependabot/**/**`
|
||||
|
||||
There is currently not an explicit rule for this branch pattern.
|
||||
Our dependencies are managed by a bot which creates PRs from a fork.
|
||||
|
||||
### `gh-pages`
|
||||
|
||||
This is a special branch which we use to publish the automatically generated docs.
|
||||
It is exempt from most protections.
|
||||
|
||||
- "Allow force pushes from everyone" (requires write permission)
|
||||
|
||||
## Pages
|
||||
|
||||
- Source: Deploy from a branch
|
||||
- Branch: `gh-pages` `/ (root)`
|
|
@ -0,0 +1,55 @@
|
|||
name: Benchmark Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
benchmark-tests:
|
||||
permissions:
|
||||
contents: write # required for pushing benchmark results to gh-pages
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node_version:
|
||||
- "22"
|
||||
runs-on: equinix-bare-metal
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
NPM_CONFIG_UNSAFE_PERM: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
cache: 'npm'
|
||||
cache-dependency-path: |
|
||||
package-lock.json
|
||||
node-version: ${{ matrix.node_version }}
|
||||
|
||||
- run: npm install -g npm@latest
|
||||
|
||||
- name: Bootstrap
|
||||
run: npm ci
|
||||
|
||||
- name: Build 🔧
|
||||
run: npm run compile
|
||||
|
||||
- name: Benchmark tests
|
||||
run: |
|
||||
npm run test:bench
|
||||
find . -name .benchmark-results.txt -exec cat {} + > combined_benchmarks.txt
|
||||
|
||||
- name: Store benchmark results
|
||||
uses: benchmark-action/github-action-benchmark@v1
|
||||
with:
|
||||
tool: 'benchmarkjs'
|
||||
output-file-path: combined_benchmarks.txt
|
||||
gh-pages-branch: gh-pages
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
benchmark-data-dir-path: "benchmarks"
|
||||
auto-push: true
|
|
@ -0,0 +1,36 @@
|
|||
# This action requires that any PR targeting the main and next branch should touch at
|
||||
# least one CHANGELOG file. If a CHANGELOG entry is not required, add the "Skip
|
||||
# Changelog" label to disable this action.
|
||||
|
||||
name: changelog
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, labeled, unlabeled]
|
||||
branches:
|
||||
- main
|
||||
- next
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
changelog:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'Skip Changelog')}}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Check for CHANGELOG changes
|
||||
run: |
|
||||
# Only the latest commit of the feature branch is available
|
||||
# automatically. To diff with the base branch, we need to
|
||||
# fetch that too (and we only need its latest commit).
|
||||
git fetch origin ${{ github.base_ref }} --depth=1
|
||||
if [[ $(git diff --name-only FETCH_HEAD | grep CHANGELOG) ]]
|
||||
then
|
||||
echo "A CHANGELOG was modified. Looks good!"
|
||||
else
|
||||
echo "No CHANGELOG was modified."
|
||||
echo "Please add a CHANGELOG entry, or add the \"Skip Changelog\" label if not required."
|
||||
false
|
||||
fi
|
|
@ -3,11 +3,17 @@ on:
|
|||
schedule:
|
||||
- cron: '30 6 * * 1'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
permissions:
|
||||
issues: write # required for closing stale issues
|
||||
pull-requests: write # required for closing stale PRs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v4
|
||||
- uses: actions/stale@v9
|
||||
with:
|
||||
days-before-stale: 60
|
||||
days-before-close: 14
|
||||
|
@ -17,5 +23,5 @@ jobs:
|
|||
close-pr-message: 'This PR was closed because it has been stale for 14 days with no activity.'
|
||||
stale-issue-label: stale
|
||||
stale-pr-label: stale
|
||||
exempt-issue-labels: never-stale
|
||||
exempt-pr-labels: never-stale
|
||||
exempt-issue-labels: never-stale,bug
|
||||
exempt-pr-labels: never-stale,bug
|
||||
|
|
|
@ -2,34 +2,31 @@ name: "CodeQL Analysis"
|
|||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
# ┌───────────── minute (0 - 59)
|
||||
# │ ┌───────────── hour (0 - 23)
|
||||
# │ │ ┌───────────── day of the month (1 - 31)
|
||||
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
|
||||
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
|
||||
# │ │ │ │ │
|
||||
# │ │ │ │ │
|
||||
# │ │ │ │ │
|
||||
# * * * * *
|
||||
- cron: '30 1 * * *'
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
CodeQL-Build:
|
||||
permissions:
|
||||
security-events: write
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: javascript
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
uses: github/codeql-action/analyze@v3
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
name: Create or Update Release PR
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_type:
|
||||
type: choice
|
||||
description: Release type
|
||||
options:
|
||||
- patch
|
||||
- minor
|
||||
release_scope:
|
||||
type: choice
|
||||
description: Release Scope
|
||||
options:
|
||||
- experimental # all packages in experimental/packages
|
||||
- sdk # all SDK packages, experimental and stable, excluding semantic conventions
|
||||
- all # all release packages, including API, excluding semconv
|
||||
- semconv # only semantic convention package
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
create-or-update-release-pr:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fork
|
||||
run: gh repo fork open-telemetry/opentelemetry-js
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: opentelemetrybot/opentelemetry-js
|
||||
ref: main
|
||||
token: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
|
||||
- name: Sync with upstream
|
||||
run: |
|
||||
git remote show origin
|
||||
git remote add upstream https://github.com/open-telemetry/opentelemetry-js.git
|
||||
git fetch upstream
|
||||
git reset --hard upstream/main
|
||||
git push origin main --force
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
cache: 'npm'
|
||||
cache-dependency-path: package-lock.json
|
||||
node-version: 22
|
||||
- run: npm install -g npm@latest
|
||||
|
||||
- run: npm ci
|
||||
|
||||
- name: Create/Update Release PR
|
||||
run: |
|
||||
git config user.name opentelemetrybot
|
||||
git config user.email 107717825+opentelemetrybot@users.noreply.github.com
|
||||
npm run github:create_or_update_release_pr
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
|
||||
RELEASE_SCOPE: ${{ github.event.inputs.release_scope }}
|
||||
RELEASE_KIND: ${{ github.event.inputs.release_scope }}:${{ github.event.inputs.release_type }}
|
||||
RELEASE_PR_REMOTE: origin
|
||||
RELEASE_PR_OWNER: opentelemetrybot
|
|
@ -4,51 +4,40 @@ on:
|
|||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
permissions:
|
||||
contents: write # required for deploying documentation to gh-pages
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '14'
|
||||
|
||||
- name: restore lock files
|
||||
uses: actions/cache@master # must use unreleased master to cache multiple paths
|
||||
id: cache
|
||||
with:
|
||||
# must be done before bootstrap to not include node_modules files in the cache paths
|
||||
path: |
|
||||
cache: 'npm'
|
||||
cache-dependency-path: |
|
||||
package-lock.json
|
||||
packages/*/package-lock.json
|
||||
benchmark/*/package-lock.json
|
||||
backwards-compatability/*/package-lock.json
|
||||
metapackages/*/package-lock.json
|
||||
packages/*/package-lock.json
|
||||
integration-tests/*/package-lock.json
|
||||
key: ${{ runner.os }}-unit_test-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }}
|
||||
- name: Install and Build (cache miss) 🔧
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
npm install --ignore-scripts
|
||||
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js'
|
||||
npm run compile
|
||||
node-version: '22'
|
||||
|
||||
- name: Install and Build (cache hit) 🔧
|
||||
if: steps.cache.outputs.cache-hit == 'true'
|
||||
- name: Install and Build 🔧
|
||||
run: |
|
||||
npm ci --ignore-scripts
|
||||
npx lerna bootstrap --hoist --nohoist='zone.js'
|
||||
npm ci
|
||||
npm run compile
|
||||
|
||||
- name: Build Docs
|
||||
run: npm run docs
|
||||
env:
|
||||
NODE_OPTIONS: --max-old-space-size=6144
|
||||
|
||||
- name: Deploy Documentation 🚀
|
||||
uses: JamesIves/github-pages-deploy-action@releases/v3
|
||||
uses: JamesIves/github-pages-deploy-action@releases/v4
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
BRANCH: gh-pages # The branch the action should deploy to.
|
||||
FOLDER: docs # The folder the action should deploy.
|
||||
branch: gh-pages # The branch the action should deploy to.
|
||||
folder: docs # The folder the action should deploy.
|
||||
# ensure we don't override benchmark data
|
||||
clean-exclude: |
|
||||
benchmarks/**
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
name: E2E Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
e2e-tests:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node_version:
|
||||
- "18.19.0"
|
||||
- "18"
|
||||
- "20.6.0"
|
||||
- "20"
|
||||
- "22"
|
||||
- "23"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
cache: 'npm'
|
||||
cache-dependency-path: |
|
||||
package-lock.json
|
||||
node-version: ${{ matrix.node_version }}
|
||||
|
||||
# npm@11.0.0 drops support for Node.js v18
|
||||
# Install the latest npm compatible with this version of Node.js
|
||||
# - npm@11.1.0 supports: {"node":"^20.17.0 || >=22.9.0"}
|
||||
- run: npm install -g npm@"<11.0.0"
|
||||
if: ${{
|
||||
matrix.node_version == '18.19.0' ||
|
||||
matrix.node_version == '18' ||
|
||||
matrix.node_version == '20.6.0'
|
||||
}}
|
||||
- run: npm install -g npm@latest
|
||||
if: ${{
|
||||
matrix.node_version == '20' ||
|
||||
matrix.node_version == '22' ||
|
||||
matrix.node_version == '23'
|
||||
}}
|
||||
|
||||
- name: Bootstrap
|
||||
run: npm ci
|
||||
|
||||
- name: Build 🔧
|
||||
run: npm run compile
|
||||
|
||||
- name: Install collector
|
||||
run: |
|
||||
curl -sSL -o otelcol-contrib.tar.gz https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.126.0/otelcol-contrib_0.126.0_linux_amd64.tar.gz
|
||||
tar -xzf otelcol-contrib.tar.gz
|
||||
working-directory: e2e-tests
|
||||
- name: run collector in background
|
||||
run: |
|
||||
./otelcol-contrib --config collector-config.yaml &
|
||||
working-directory: e2e-tests
|
||||
- name: Export telemetry to collector
|
||||
run: npm run export-telemetry
|
||||
working-directory: e2e-tests
|
||||
- name: stop collector
|
||||
run: pkill -f otelcol-contrib
|
||||
working-directory: e2e-tests
|
||||
- name: Print output
|
||||
run: cat collector-output.json
|
||||
working-directory: e2e-tests
|
||||
- name: verify exported telemetry
|
||||
run: npm run verify
|
||||
working-directory: e2e-tests
|
|
@ -0,0 +1,20 @@
|
|||
name: FOSSA scanning
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
fossa:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
|
||||
- uses: fossas/fossa-action@93a52ecf7c3ac7eb40f5de77fd69b1a19524de94 # v1.5.0
|
||||
with:
|
||||
api-key: ${{secrets.FOSSA_API_KEY}}
|
||||
team: OpenTelemetry
|
|
@ -5,58 +5,35 @@ on:
|
|||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
package-group: [".", "experimental"]
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:14
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Lint changelog file
|
||||
if: ${{ matrix.package-group == '.' }}
|
||||
uses: avto-dev/markdown-lint@v1
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
# Commenting due to
|
||||
# https://github.com/avto-dev/markdown-lint/blob/aab9be9823fcd706f6da3e6ad6c64874c23fbd4c/lint/rules/changelog.js#L51-L71
|
||||
# TODO: adhere to, or overwrite above rule and uncomment rules
|
||||
# rules: "/lint/rules/changelog.js"
|
||||
config: "/lint/config/changelog.yml"
|
||||
args: "./CHANGELOG.md"
|
||||
cache: 'npm'
|
||||
cache-dependency-path: |
|
||||
package-lock.json
|
||||
node-version: '22'
|
||||
|
||||
- name: Lint markdown files
|
||||
if: ${{ matrix.package-group == '.' }}
|
||||
uses: avto-dev/markdown-lint@v1
|
||||
with:
|
||||
args: "./**/*.md -i ./CHANGELOG.md"
|
||||
|
||||
- name: restore lerna
|
||||
id: cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
node_modules
|
||||
experimental/node_modules
|
||||
*/*/node_modules
|
||||
experimental/*/*/node_modules
|
||||
key: lint-${{ matrix.package-group }}-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }}-20211009.2
|
||||
|
||||
# On a cache miss, install dependencies
|
||||
- name: Bootstrap
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
working-directory: ${{ matrix.package-group }}
|
||||
run: |
|
||||
npm install --ignore-scripts
|
||||
npx lerna bootstrap --no-ci --ignore-scripts --hoist --nohoist='zone.js' -- --only=dev
|
||||
run: npm ci
|
||||
|
||||
- name: Lint
|
||||
working-directory: ${{ matrix.package-group }}
|
||||
run: |
|
||||
npm run lint
|
||||
npm run lint:examples
|
||||
|
||||
- name: Lint doc files
|
||||
run: |
|
||||
npm run compile
|
||||
NODE_OPTIONS=--max-old-space-size=6144 npm run docs
|
||||
npm run docs:test
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
name: OSSF Scorecard
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
- cron: "44 18 * * 6" # once a week
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
analysis:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
# Needed for Code scanning upload
|
||||
security-events: write
|
||||
# Needed for GitHub OIDC token if publish_results is true
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
publish_results: true
|
||||
|
||||
# Upload the results as artifacts (optional). Commenting out will disable
|
||||
# uploads of run results in SARIF format to the repository Actions tab.
|
||||
# https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
retention-days: 5
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard (optional).
|
||||
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
|
||||
with:
|
||||
sarif_file: results.sarif
|
|
@ -1,30 +0,0 @@
|
|||
name: Ensure API Peer Dependency
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
peer-api-check:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:14
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install lerna
|
||||
run: npm install -g lerna
|
||||
|
||||
- name: Install semver
|
||||
run: npm install semver
|
||||
|
||||
- name: Check API dependency semantics (stable)
|
||||
working-directory: packages
|
||||
run: lerna exec --ignore propagation-validation-server --ignore propagation-validation-server --ignore @opentelemetry/selenium-tests "node ../../scripts/peer-api-check.js"
|
||||
|
||||
- name: Check API dependency semantics (experimental)
|
||||
working-directory: experimental
|
||||
run: lerna exec --ignore propagation-validation-server --ignore @opentelemetry/selenium-tests "node ../../../scripts/peer-api-check.js"
|
|
@ -0,0 +1,30 @@
|
|||
name: Ensure API Peer Dependency
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
peer-api-check:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:22
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install lerna
|
||||
run: npm install -g lerna@6.6.2
|
||||
|
||||
- name: Install semver
|
||||
run: npm install -g semver
|
||||
|
||||
- name: Check API dependency semantics
|
||||
working-directory: packages
|
||||
run: lerna run peer-api-check
|
|
@ -0,0 +1,44 @@
|
|||
name: Publish packages to NPM
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
release-to-npm:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
# needed for NPM provenance
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- run: npm ci
|
||||
|
||||
# NOTE: in the past, we've had situations where the compiled files were missing as the `prepublishOnly` script was
|
||||
# missing in some packages. `npx lerna publish` *should* also run compile, but this is intended as a safeguard
|
||||
# when that does not happen for whatever reason.
|
||||
- run: npm run compile
|
||||
|
||||
- name: Publish to npm
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
||||
NPM_CONFIG_PROVENANCE: true
|
||||
# NOTE: using --concurrency 1 to reduce the likelihood of a race when publishing,
|
||||
# which happens when the npm registry is not fully consistent yet. This can cause the publishing of a package to be
|
||||
# rejected because dependencies are not available yet. `lerna` does ensure that this is not the case locally
|
||||
# (packages are in-fact published in the correct order), but the race on the registry still applies.
|
||||
# If this happens, run the workflow again - there should be enough time for everything to settle until this workflow
|
||||
# attempts to publish again.
|
||||
run: npx lerna publish --concurrency 1 from-package --no-push --no-private --no-git-tag-version --no-verify-access --dist-tag=latest --yes
|
|
@ -0,0 +1,79 @@
|
|||
name: SBOM
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
generate-sboms:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
NPM_CONFIG_UNSAFE_PERM: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- run: npm install -g npm@latest
|
||||
|
||||
- name: Bootstrap
|
||||
run: npm ci
|
||||
|
||||
- name: Generate SBOM for core packages
|
||||
if: ${{ ! startsWith(github.ref, 'refs/tags/experimental') && ! startsWith(github.ref, 'refs/tags/api') }}
|
||||
run: |
|
||||
for dir in $(find packages -mindepth 1 -maxdepth 1 -type d)
|
||||
do
|
||||
dir_name=$(basename "$dir")
|
||||
echo "Generating SBOM for $dir_name"
|
||||
npm sbom --sbom-format=spdx --legacy-peer-deps --workspace ${dir} > "opentelemetry-js_${dir_name}.spdx.json"
|
||||
done
|
||||
|
||||
- name: Generate SBOM for the API package
|
||||
if: startsWith(github.ref, 'refs/tags/api/')
|
||||
run: |
|
||||
npm sbom --sbom-format=spdx --legacy-peer-deps --workspace api > opentelemetry-js_api.spdx.json
|
||||
|
||||
- name: Generate SBOMs for experimental packages
|
||||
if: startsWith(github.ref, 'refs/tags/experimental/')
|
||||
run: |
|
||||
for dir in $(find experimental/packages -mindepth 1 -maxdepth 1 -type d)
|
||||
do
|
||||
dir_name=$(basename "$dir")
|
||||
echo "Generating SBOM for $dir_name"
|
||||
npm sbom --sbom-format=spdx --legacy-peer-deps --workspace ${dir} > "opentelemetry-js_${dir_name}.spdx.json"
|
||||
done
|
||||
|
||||
- name: Zip all SBOM files
|
||||
run: |
|
||||
zip sbom.zip *.spdx.json
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: SBOM.zip
|
||||
path: ./sbom.zip
|
||||
|
||||
add-release-artifact:
|
||||
needs: generate-sboms
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Download artifact from generate-sboms
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: SBOM.zip
|
||||
- name: Upload release asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: ./sbom.zip
|
||||
asset_name: SBOM.zip
|
||||
asset_content_type: application/zip
|
|
@ -0,0 +1,44 @@
|
|||
name: Survey on Merged PR by Non-Member
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [closed]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
PR_NUM: ${{ github.event.pull_request.number }}
|
||||
SURVEY_URL: https://docs.google.com/forms/d/e/1FAIpQLSf2FfCsW-DimeWzdQgfl0KDzT2UEAqu69_f7F2BVPSxVae1cQ/viewform?entry.1540511742=open-telemetry/opentelemetry-js
|
||||
|
||||
jobs:
|
||||
comment-on-pr:
|
||||
name: Add survey to PR if author is not a member
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
if: github.event.pull_request.merged == true
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Check if user is a member of the org
|
||||
id: check-membership
|
||||
run: |
|
||||
USERNAME=$(jq -r '.pull_request.user.login' "$GITHUB_EVENT_PATH")
|
||||
ORG="${{ github.repository_owner }}"
|
||||
STATUS=$(gh api "orgs/$ORG/members/$USERNAME" --silent && echo "true" || echo "false")
|
||||
if [[ "$STATUS" == "true" ]]; then
|
||||
echo "MEMBER_FOUND=true" >> $GITHUB_ENV
|
||||
else
|
||||
echo "MEMBER_FOUND=false" >> $GITHUB_ENV
|
||||
fi
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
|
||||
|
||||
- name: Add comment to PR if author is not a member
|
||||
if: env.MEMBER_FOUND == 'false'
|
||||
run: |
|
||||
USERNAME=$(jq -r '.pull_request.user.login' "$GITHUB_EVENT_PATH")
|
||||
gh pr comment ${PR_NUM} --repo open-telemetry/opentelemetry-js --body "Thank you for your contribution @${USERNAME}! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this [survey](${SURVEY_URL})."
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
|
|
@ -4,163 +4,157 @@ on:
|
|||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
node-tests-stable:
|
||||
node-tests:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node_version: ["8", "10", "12", "14", "16"]
|
||||
node_version:
|
||||
- "18.19.0"
|
||||
- "18"
|
||||
- "20.6.0"
|
||||
- "20"
|
||||
- "22"
|
||||
- "23"
|
||||
- "24"
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
NPM_CONFIG_UNSAFE_PERM: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
cache: 'npm'
|
||||
cache-dependency-path: |
|
||||
package-lock.json
|
||||
node-version: ${{ matrix.node_version }}
|
||||
|
||||
- name: restore lerna
|
||||
id: cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
node_modules
|
||||
*/*/node_modules
|
||||
key: node-tests-stable-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }}
|
||||
# npm@11.0.0 drops support for Node.js v18
|
||||
# Install the latest npm compatible with this version of Node.js
|
||||
# - npm@11.1.0 supports: {"node":"^20.17.0 || >=22.9.0"}
|
||||
- run: npm install -g npm@"<11.0.0"
|
||||
if: ${{
|
||||
matrix.node_version == '18.19.0' ||
|
||||
matrix.node_version == '18' ||
|
||||
matrix.node_version == '20.6.0'
|
||||
}}
|
||||
- run: npm install -g npm@latest
|
||||
if: ${{
|
||||
matrix.node_version == '20' ||
|
||||
matrix.node_version == '22' ||
|
||||
matrix.node_version == '23' ||
|
||||
matrix.node_version == '24'
|
||||
}}
|
||||
|
||||
- name: Bootstrap
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
npm install --ignore-scripts
|
||||
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --ignore @opentelemetry/selenium-tests
|
||||
run: npm ci
|
||||
|
||||
- name: Build 🔧
|
||||
run: npm run compile
|
||||
|
||||
- run: npm test
|
||||
if: ${{ matrix.node_version != '23' && matrix.node_version != '24' }}
|
||||
# Node.js >= 23 type stripping conflicts with mocha usage of ts-node.
|
||||
# See https://github.com/open-telemetry/opentelemetry-js/issues/5415
|
||||
- run: npm test
|
||||
env:
|
||||
NODE_OPTIONS: '--no-experimental-strip-types'
|
||||
if: ${{ matrix.node_version == '23' || matrix.node_version == '24' }}
|
||||
|
||||
- name: Report Coverage
|
||||
uses: codecov/codecov-action@v5
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
with:
|
||||
verbose: true
|
||||
node-windows-tests:
|
||||
runs-on: windows-latest
|
||||
env:
|
||||
NPM_CONFIG_UNSAFE_PERM: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
cache: 'npm'
|
||||
cache-dependency-path: |
|
||||
package-lock.json
|
||||
node-version: '22'
|
||||
|
||||
- run: npm install -g npm@latest
|
||||
|
||||
- name: Bootstrap
|
||||
run: npm ci
|
||||
|
||||
- name: Build 🔧
|
||||
run: |
|
||||
npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
|
||||
npm run compile
|
||||
|
||||
- name: Unit tests
|
||||
run: npm run test
|
||||
- name: Report Coverage
|
||||
run: npm run codecov
|
||||
if: ${{ matrix.node_version == '14' }}
|
||||
browser-tests-stable:
|
||||
browser-tests:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: circleci/node:14-browsers
|
||||
env:
|
||||
NPM_CONFIG_UNSAFE_PERM: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Permission Setup
|
||||
run: sudo chmod -R 777 /github /__w
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: restore lerna
|
||||
uses: actions/cache@v2
|
||||
id: cache
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
path: |
|
||||
node_modules
|
||||
*/*/node_modules
|
||||
key: browser-tests-stable-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }}
|
||||
cache: 'npm'
|
||||
cache-dependency-path: |
|
||||
package-lock.json
|
||||
node-version: 22
|
||||
|
||||
- name: Bootstrap
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
npm install --ignore-scripts
|
||||
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js'
|
||||
run: npm ci
|
||||
|
||||
- name: Build 🔧
|
||||
run: |
|
||||
npm run compile
|
||||
run: npm run compile
|
||||
|
||||
- name: Unit tests
|
||||
run: npm run test:browser
|
||||
- name: Report Coverage
|
||||
run: npm run codecov:browser
|
||||
node-tests-experimental:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node_version: ["8", "10", "12", "14", "16"]
|
||||
uses: codecov/codecov-action@v5
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
with:
|
||||
verbose: true
|
||||
webworker-tests:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
NPM_CONFIG_UNSAFE_PERM: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node_version }}
|
||||
|
||||
- name: restore lerna
|
||||
id: cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
experimental/node_modules
|
||||
experimental/*/*/node_modules
|
||||
key: node-tests-experimental-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('experimental/**/package.json') }}
|
||||
cache: 'npm'
|
||||
cache-dependency-path: |
|
||||
package-lock.json
|
||||
node-version: 22
|
||||
|
||||
- name: Bootstrap
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
working-directory: experimental
|
||||
run: |
|
||||
npm install --ignore-scripts
|
||||
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --ignore @opentelemetry/selenium-tests
|
||||
run: npm ci
|
||||
|
||||
- name: Build 🔧
|
||||
working-directory: experimental
|
||||
run: |
|
||||
npm run compile
|
||||
run: npm run compile
|
||||
|
||||
- name: Unit tests
|
||||
working-directory: experimental
|
||||
run: npm run test
|
||||
run: npm run test:webworker
|
||||
- name: Report Coverage
|
||||
working-directory: experimental
|
||||
run: npm run codecov
|
||||
if: ${{ matrix.node_version == '14' }}
|
||||
browser-tests-experimental:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: circleci/node:14-browsers
|
||||
env:
|
||||
NPM_CONFIG_UNSAFE_PERM: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Permission Setup
|
||||
run: sudo chmod -R 777 /github /__w
|
||||
|
||||
- name: restore lerna
|
||||
uses: actions/cache@v2
|
||||
id: cache
|
||||
uses: codecov/codecov-action@v5
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
with:
|
||||
path: |
|
||||
experimental/node_modules
|
||||
experimental/*/*/node_modules
|
||||
key: browser-tests-experimental-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }}
|
||||
|
||||
- name: Bootstrap
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
working-directory: experimental
|
||||
run: |
|
||||
npm install --ignore-scripts
|
||||
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js'
|
||||
|
||||
- name: Build 🔧
|
||||
working-directory: experimental
|
||||
run: |
|
||||
npm run compile
|
||||
|
||||
- name: Unit tests
|
||||
working-directory: experimental
|
||||
run: npm run test:browser
|
||||
- name: Report Coverage
|
||||
working-directory: experimental
|
||||
run: npm run codecov:browser
|
||||
verbose: true
|
||||
|
|
|
@ -5,42 +5,30 @@ on:
|
|||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout 🛎️
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: restore lock files
|
||||
uses: actions/cache@master # must use unreleased master to cache multiple paths
|
||||
id: cache
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
# must be done before bootstrap to not include node_modules files in the cache paths
|
||||
path: |
|
||||
cache: 'npm'
|
||||
cache-dependency-path: |
|
||||
package-lock.json
|
||||
packages/*/package-lock.json
|
||||
benchmark/*/package-lock.json
|
||||
metapackages/*/package-lock.json
|
||||
packages/*/package-lock.json
|
||||
integration-tests/*/package-lock.json
|
||||
key: ${{ runner.os }}-w3c_integration-${{ hashFiles('**/package.json') }}
|
||||
node-version: 18
|
||||
|
||||
- name: Install and Bootstrap (cache miss) 🔧
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
npm install --ignore-scripts
|
||||
npx lerna bootstrap --no-ci --scope=propagation-validation-server --include-dependencies
|
||||
|
||||
- name: Install and Bootstrap (cache hit) 🔧
|
||||
if: steps.cache.outputs.cache-hit == 'true'
|
||||
run: |
|
||||
npm ci --ignore-scripts
|
||||
npx lerna bootstrap --scope=propagation-validation-server --include-dependencies
|
||||
- name: Install and Bootstrap 🔧
|
||||
run: npm ci
|
||||
|
||||
- name: Generate version.ts files
|
||||
run: lerna run version
|
||||
run: npm run version:update
|
||||
|
||||
- name: Build 🔧
|
||||
run: npm run compile
|
||||
|
|
|
@ -8,6 +8,8 @@ logs
|
|||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
# Filter Logs singal files
|
||||
!experimental/examples/logs
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
|
@ -64,7 +66,6 @@ typings/
|
|||
|
||||
# lock files
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
|
||||
# docs files
|
||||
docs
|
||||
|
@ -87,3 +88,9 @@ package.json.lerna_backup
|
|||
#IDEA
|
||||
.idea
|
||||
*.iml
|
||||
|
||||
# non-aggregated benchmark results
|
||||
.benchmark-results.txt
|
||||
|
||||
# release notes for release creation
|
||||
.tmp/
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
[submodule "experimental/packages/opentelemetry-exporter-trace-otlp-proto/protos"]
|
||||
path = experimental/packages/opentelemetry-exporter-trace-otlp-proto/protos
|
||||
url = https://github.com/open-telemetry/opentelemetry-proto.git
|
||||
[submodule "experimental/packages/opentelemetry-exporter-trace-otlp-grpc/protos"]
|
||||
path = experimental/packages/opentelemetry-exporter-trace-otlp-grpc/protos
|
||||
url = https://github.com/open-telemetry/opentelemetry-proto.git
|
||||
[submodule "experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/protos"]
|
||||
path = experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/protos
|
||||
url = https://github.com/open-telemetry/opentelemetry-proto.git
|
||||
[submodule "experimental/packages/opentelemetry-exporter-metrics-otlp-proto/protos"]
|
||||
path = experimental/packages/opentelemetry-exporter-metrics-otlp-proto/protos
|
||||
[submodule "experimental/packages/otlp-transformer/protos"]
|
||||
path = experimental/packages/otlp-transformer/protos
|
||||
url = https://github.com/open-telemetry/opentelemetry-proto.git
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
// https://github.com/DavidAnson/markdownlint-cli2#markdownlint-cli2jsonc
|
||||
{
|
||||
"config": {
|
||||
// https://github.com/DavidAnson/markdownlint/blob/main/README.md#rules--aliases
|
||||
"MD013": false,
|
||||
"MD024": false,
|
||||
"MD033": false,
|
||||
"MD041": false,
|
||||
"MD026": false,
|
||||
"MD004": { "style": "dash" } // ul-style
|
||||
},
|
||||
"gitignore": true,
|
||||
"noBanner": true,
|
||||
"noProgress": true
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"MD013": false,
|
||||
"MD024": false,
|
||||
"MD033": false,
|
||||
"MD041": false,
|
||||
"MD026": false
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
require: 'ts-node/register'
|
6
.nycrc
6
.nycrc
|
@ -1,18 +1,20 @@
|
|||
{
|
||||
"produceSourceMap": false,
|
||||
"extension": [
|
||||
".ts"
|
||||
],
|
||||
"reporter": ["text", "json"],
|
||||
"exclude": [
|
||||
"**/*.d.ts",
|
||||
"build/**/*.*",
|
||||
"src/index.ts",
|
||||
"src/platform/**/index.ts",
|
||||
"src/platform/browser/*.ts",
|
||||
"src/version.ts",
|
||||
"test/**/*.*",
|
||||
".eslintrc.js",
|
||||
"karma.conf.js",
|
||||
"webpack/*.js"
|
||||
"webpack/*.js",
|
||||
"src/generated/**"
|
||||
],
|
||||
"all": true
|
||||
}
|
||||
|
|
955
CHANGELOG.md
955
CHANGELOG.md
|
@ -1,9 +1,958 @@
|
|||
<!-- markdownlint-disable MD004 -->
|
||||
# CHANGELOG
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
For API changes, see the [API CHANGELOG](api/CHANGELOG.md).
|
||||
For experimental package changes, see the [experimental CHANGELOG](experimental/CHANGELOG.md).
|
||||
For semantic convention package changes, see the [semconv CHANGELOG](semantic-conventions/CHANGELOG.md).
|
||||
For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2.x.md).
|
||||
|
||||
## Unreleased
|
||||
|
||||
* feat(instrumentation-http): Added support for redacting specific url query string values and url credentials in instrumentations [#5743](https://github.com/open-telemetry/opentelemetry-js/pull/5743) @rads-1996
|
||||
|
||||
### :boom: Breaking Changes
|
||||
|
||||
### :rocket: Features
|
||||
|
||||
### :bug: Bug Fixes
|
||||
|
||||
* fix(sdk-metrics): Remove invalid default value for `startTime` param to ExponentialHistogramAccumulation. This only impacted the closurescript compiler. [#5763](https://github.com/open-telemetry/opentelemetry-js/pull/5763) @trentm
|
||||
|
||||
### :books: Documentation
|
||||
|
||||
### :house: Internal
|
||||
|
||||
* chore: enable tsconfig isolatedModules [#5697](https://github.com/open-telemetry/opentelemetry-js/pull/5697) @legendecas
|
||||
|
||||
## 2.0.1
|
||||
|
||||
### :bug: Bug Fixes
|
||||
|
||||
* fix(resources): guard asynchronous resource attribute rejections from causing unhandled promise rejection [#5544](https://github.com/open-telemetry/opentelemetry-js/pull/5544) @dyladan
|
||||
* fix(resource): do not trigger `Accessing resource attributes before async attributes settled` warning when detecting resources [#5546](https://github.com/open-telemetry/opentelemetry-js/pull/5546) @dyladan
|
||||
* verbose logging of detected resource removed
|
||||
* fix(resource): use dynamic import over require to improve ESM compliance [#5298](https://github.com/open-telemetry/opentelemetry-js/pull/5298) @xiaoxiangmoe
|
||||
|
||||
### :books: Documentation
|
||||
|
||||
* refactor(metrics): Updated metrics samples to no longer treat `sdk.start()` as async [#5617](https://github.com/open-telemetry/opentelemetry-js/pull/5617) @JacksonWeber
|
||||
|
||||
### :house: Internal
|
||||
|
||||
* refactor(sdk-trace-base): update semconv usage to ATTR_ exports [#5669](https://github.com/open-telemetry/opentelemetry-js/pull/5669) @trentm
|
||||
* refactor(sdk-trace-web): update semconv usage to ATTR_ exports [#5672](https://github.com/open-telemetry/opentelemetry-js/pull/5672) @trentm
|
||||
* refactor(resources): update semconv usage to ATTR_ exports [#5666](https://github.com/open-telemetry/opentelemetry-js/pull/5666) @trentm
|
||||
* test(sdk-metrics): fix multiple problematic assertRejects() calls [#5611](https://github.com/open-telemetry/opentelemetry-js/pull/5611) @cjihrig
|
||||
* refactor: replace assertRejects() with assert.rejects() [#5614](https://github.com/open-telemetry/opentelemetry-js/pull/5614) @cjihrig
|
||||
* refactor(core): migrate from deprecated semconv constants [#5575](https://github.com/open-telemetry/opentelemetry-js/pull/5575) @alumni55748
|
||||
* refactor(opentelemetry-core): simplify `parseKeyPairsIntoRecord()` [#5610](https://github.com/open-telemetry/opentelemetry-js/pull/5610) @cjihrig
|
||||
|
||||
## 2.0.0
|
||||
|
||||
### Summary
|
||||
|
||||
- The **minimum supported Node.js has been raised to `^18.19.0 || >=20.6.0`**. This means that support for Node.js 14 and 16 has been dropped.
|
||||
- The **minimum supported TypeScript version has been raised to 5.0.4**.
|
||||
- The **compilation target for transpiled TypeScript has been raised to ES2022** (from ES2017).
|
||||
- The **public interface has changed**
|
||||
- for notes on migrating to 2.x / 0.200.x see [the upgrade guide](https://github.com/open-telemetry/opentelemetry-js/tree/main/doc/upgrade-to-2.x.md)
|
||||
- Only experimental versions `0.200.0` are compatible with this release
|
||||
|
||||
### :boom: Breaking Change
|
||||
|
||||
* feat(sdk-trace-base)!: Add `parentSpanContext` and remove `parentSpanId` from `Span` and `ReadableSpan` [#5450](https://github.com/open-telemetry/opentelemetry-js/pull/5450) @JacksonWeber
|
||||
* (user-facing): the SDK's `Span`s `parentSpanId` was replaced by `parentSpanContext`, to migrate to the new property, please replace `span.parentSpanId` -> `span.parentSpanContext?.spanId`
|
||||
* feat(sdk-metrics)!: drop deprecated `type` field on `MetricDescriptor` [#5291](https://github.com/open-telemetry/opentelemetry-js/pull/5291) @chancancode
|
||||
* feat(sdk-metrics)!: drop deprecated `InstrumentDescriptor` type; use `MetricDescriptor` instead [#5277](https://github.com/open-telemetry/opentelemetry-js/pull/5266) @chancancode
|
||||
* feat(sdk-metrics)!: bump minimum version of `@opentelemetry/api` peer dependency to 1.9.0 [#5254](https://github.com/open-telemetry/opentelemetry-js/pull/5254) @chancancode
|
||||
* chore(shim-opentracing): replace deprecated SpanAttributes [#4430](https://github.com/open-telemetry/opentelemetry-js/pull/4430) @JamieDanielson
|
||||
* chore(otel-core): replace deprecated SpanAttributes [#4408](https://github.com/open-telemetry/opentelemetry-js/pull/4408) @JamieDanielson
|
||||
* feat(sdk-metrics)!: remove MeterProvider.addMetricReader() in favor of constructor option [#4419](https://github.com/open-telemetry/opentelemetry-js/pull/4419) @pichlermarc
|
||||
* chore(otel-resources): replace deprecated SpanAttributes [#4428](https://github.com/open-telemetry/opentelemetry-js/pull/4428) @JamieDanielson
|
||||
* feat(sdk-metrics)!: remove MeterProvider.addMetricReader() in favor of constructor option [#4419](https://github.com/open-telemetry/opentelemetry-js/pull/4419) @pichlermarc
|
||||
* feat(sdk-metrics)!: replace attributeKeys with custom processors option [#4532](https://github.com/open-telemetry/opentelemetry-js/pull/4532) @pichlermarc
|
||||
* refactor(sdk-trace-base)!: replace `SpanAttributes` with `Attributes` [#5009](https://github.com/open-telemetry/opentelemetry-js/pull/5009) @david-luna
|
||||
* refactor(resources)!: replace `ResourceAttributes` with `Attributes` [#5016](https://github.com/open-telemetry/opentelemetry-js/pull/5016) @david-luna
|
||||
* feat(sdk-metrics)!: drop `View` and `Aggregation` in favor of `ViewOptions` and `AggregationOption` [#4931](https://github.com/open-telemetry/opentelemetry-js/pull/4931) @pichlermarc
|
||||
* refactor(sdk-trace-base)!: remove `new Span` constructor in favor of `Tracer.startSpan` API [#5048](https://github.com/open-telemetry/opentelemetry-js/pull/5048) @david-luna
|
||||
* refactor(sdk-trace-base)!: remove `BasicTracerProvider.addSpanProcessor` API in favor of constructor options. [#5134](https://github.com/open-telemetry/opentelemetry-js/pull/5134) @david-luna
|
||||
* refactor(sdk-trace-base)!: make `resource` property private in `BasicTracerProvider` and remove `getActiveSpanProcessor` API. [#5192](https://github.com/open-telemetry/opentelemetry-js/pull/5192) @david-luna
|
||||
* feat(sdk-metrics)!: extract `IMetricReader` interface and use it over abstract class [#5311](https://github.com/open-telemetry/opentelemetry-js/pull/5311)
|
||||
* (user-facing): `MeterProviderOptions` now provides the more general `IMetricReader` type over `MetricReader`
|
||||
* If you accept `MetricReader` in your public interface, consider accepting the more general `IMetricReader` instead to avoid unintentional breaking changes
|
||||
* feat(sdk-trace)!: remove ability to have BasicTracerProvider instantiate exporters [#5239](https://github.com/open-telemetry/opentelemetry-js/pull/5239) @pichlermarc
|
||||
* When extending `BasicTracerProvider`, the class offered multiple methods to facilitate the creation of exporters and auto-pairing with `SpanProcessor`s.
|
||||
* This functionality has been removed - users may now pass `SpanProcessor`s to the base class constructor when extending
|
||||
* (user-facing): `_registeredExporters` has been removed
|
||||
* (user-facing): `_getSpanExporter` has been removed
|
||||
* (user-facing): `_buildExporterFromEnv` has been removed
|
||||
* feat(core)!: remove deprecated `IdGenerator` and `RandomIdGenerator` [#5309](https://github.com/open-telemetry/opentelemetry-js/pull/5309) @pichlermarc
|
||||
* feat(core)!: remove deprecated type `InstrumentationLibrary` [#5308](https://github.com/open-telemetry/opentelemetry-js/pull/5308) @pichlermarc
|
||||
* (user-facing): please use equivalent type `InstrumentationScope` instead
|
||||
* feat(sdk-trace-base)!: replace usages fo `InstrumentationLibrary` with `InstrumentationScope` [#5308](https://github.com/open-telemetry/opentelemetry-js/pull/5308) @pichlermarc
|
||||
* (user-facing) rename `Tracer.instrumentationLibrary` -> `Tracer.instrumentationScope`
|
||||
* (user-facing) rename `ReadableSpan.instrumentationLibrary` -> `ReadableSpan.instrumentationScope`
|
||||
* also renames the property in implementations of `ReadableSpan`
|
||||
* feat(exporter-jaeger): use `ReadableSpan.instrumentationScope` over `ReadableSpan.instrumentationLibrary` [#5308](https://github.com/open-telemetry/opentelemetry-js/pull/5308) @pichlermarc
|
||||
* feat(exporter-zipkin): use `ReadableSpan.instrumentationScope` over `ReadableSpan.instrumentationLibrary` [#5308](https://github.com/open-telemetry/opentelemetry-js/pull/5308) @pichlermarc
|
||||
* chore!: update typescript to version `5.0.4` [#5145](https://github.com/open-telemetry/opentelemetry-js/pull/5145) @david-luna
|
||||
* (user-facing) dropped support for `typescript@<5.0.4`
|
||||
* (user-facing) all packages published from this repository will from now on drop support for old versions of `typescript` in minor releases. We will only drop support for versions that are older than 2 years.
|
||||
* feat(core)!: remove deprecated samplers [#5316](https://github.com/open-telemetry/opentelemetry-js/pull/5316) @pichlermarc
|
||||
* (user-facing): deprecated `AlwaysOnSampler` has moved to `@opentelemetry/sdk-trace-base`
|
||||
* (user-facing): deprecated `AlwaysOffSampler` has moved to `@opentelemetry/sdk-trace-base`
|
||||
* (user-facing): deprecated `ParentBasedSampler` has moved to `@opentelemetry/sdk-trace-base`
|
||||
* (user-facing): deprecated `TraceIdRatioSampler` has moved to `@opentelemetry/sdk-trace-base`
|
||||
* feat(resource): Merge sync and async resource interfaces into a single interface [#5350](https://github.com/open-telemetry/opentelemetry-js/pull/5350) @dyladan
|
||||
* Resource constructor now takes a single argument which contains an optional `attributes` object
|
||||
* Detected resource attribute values may be a promise or a synchronous value
|
||||
* Resources are now merged by the order in which their detectors are configured instead of async attributes being last
|
||||
* Resource detectors now return `DetectedResource` plain objects instead of `new Resource()`
|
||||
* feat(sdk-trace-base)!: drop ability to instantiate propagators beyond defaults [#5355](https://github.com/open-telemetry/opentelemetry-js/pull/5355) @pichlermarc
|
||||
* (user-facing): only a non-env-var based default is now used on `BasicTracerProvider#register()`.
|
||||
* propagators can now not be configured via `OTEL_PROPAGATORS` or `window.OTEL_PROPAGATORS` anymore, please pass the propagator to `NodeTracerProvider#register()` instead.
|
||||
* if not configured directly via code, `BasicTracerProvider#register()` will now fall back to defaults (`tracecontext` and `baggage`)
|
||||
* feat(sdk-trace-node)!: drop ability to instantiate propagators beyond defaults [#5355](https://github.com/open-telemetry/opentelemetry-js/pull/5355) @pichlermarc
|
||||
* (user-facing): only a non-env-var based default is now used on `NodeTracerProvider#register()`.
|
||||
* propagators can now not be configured via `OTEL_PROPAGATORS` anymore, please pass the propagator to `NodeTracerProvider#register()` instead.
|
||||
* if not configured via code, `NodeTracerProvider#register()` will now fall back to the defaults (`tracecontext` and `baggage`)
|
||||
* if autoconfiguration based on enviornment variables is needed, please use `NodeSDK` from `@opentelemetry/sdk-node`.
|
||||
* feat(sdk-trace-web)!: drop ability to instantiate propagators beyond defaults [#5355](https://github.com/open-telemetry/opentelemetry-js/pull/5355) @pichlermarc
|
||||
* (user-facing): only a non-env-var based default is now used on `WebTracerProvider#register()`.
|
||||
* propagators can now not be configured via `window.OTEL_PROPAGATORS` anymore, please pass the propagator to `WebTracerProvider#register()` instead.
|
||||
* if not configured via code, `WebTracerProvider#register()` will now fall back to defaults (`tracecontext` and `baggage`)
|
||||
* feat(sdk-trace)!: drop unnecessary exports [#5405](https://github.com/open-telemetry/opentelemetry-js/pull/5405) @pichlermarc
|
||||
* (user-facing): `EXPORTER_FACTORY` is not used anymore and has been removed
|
||||
* (user-facing): `PROPAGATOR_FACTORY` is not used anymore and has been removed
|
||||
* (user-facing): `ForceFlushState` was intended for internal use and has been removed
|
||||
* (user-facing): the `Tracer` class was unintentionally exported and has been removed
|
||||
* to obtain a `Tracer`, please use `BasicTracerProvider#getTracer()`, `NodeTracerProvider#getTracer()` or `WebTracerProvider#getTracer()`
|
||||
* to reference a `Tracer`, please use the `Tracer` type from `@opentelemetry/api`
|
||||
* chore!: Raise the minimum supported Node.js version to `^18.19.0 || >=20.6.0`. Support for Node.js 14, 16, and early minor versions of 18 and 20 have been dropped. This applies to all packages except the 'api' and 'semantic-conventions' packages. [#5395](https://github.com/open-telemetry/opentelemetry-js/issues/5395) @trentm
|
||||
* feat(core)!: remove TracesSamplerValues from exports [#5406](https://github.com/open-telemetry/opentelemetry-js/pull/5406) @pichlermarc
|
||||
* (user-facing): TracesSamplerValues was only consumed internally and has been removed from exports without replacement
|
||||
* chore(resources)!: Remove deprecated duplicate browser detector from `@opentelemetry/resource` in favor of `@opentelemetry/opentelemetry-browser-detector` [#5420](https://github.com/open-telemetry/opentelemetry-js/pull/5420)
|
||||
* feat(core)!: remove unused and obsolete functions and types [#5444](https://github.com/open-telemetry/opentelemetry-js/pull/5444) @pichlermarc
|
||||
* (user-facing): `VERSION` was an internal constant that was unintentionally exported. It has been removed without replacement.
|
||||
* (user-facing): `isWrapped` has been removed in favor of `isWrapped` from `@opentelemetry/instrumentation`
|
||||
* (user-facing): `ShimWrapped` has been removed in favor of `ShimWrapped` from `@opentelemetry/instrumentation`
|
||||
* (user-facing): `hexToBase64` was a utility function that is not used by the SDK anymore. It has been removed without replacement.
|
||||
* (user-facing): `hexToBinary` was a utility function that now internal to `@opentelemetry/otlp-tranformer`. It has been removed without replacement.
|
||||
* (user-facing): `baggageUtils.getKeyParis` was an internal utility function that was unintentionally exported. It has been removed without replacement.
|
||||
* (user-facing): `baggageUtils.serializeKeyPairs` was an internal utility function that was unintentionally exported. It has been removed without replacement.
|
||||
* (user-facing): `baggageUtils.parseKeyPairsIntoRecord,` has been removed in favor of `parseKeyPairsIntoRecord`
|
||||
* (user-facing): `baggageUtils.parsePairKeyValue` was an internal utility function that was unintentionally exported. It has been removed without replacement.
|
||||
* (user-facing): `TimeOriginLegacy` has been removed without replacement.
|
||||
* (user-facing): `isAttributeKey` was an internal utility function that was unintentionally exported. It has been removed without replacement.
|
||||
* feat(sdk-trace-base)!: do not read environment variables from window in browsers [#5445](https://github.com/open-telemetry/opentelemetry-js/pull/5455) @pichlermarc
|
||||
* (user-facing): all configuration previously possible via `window.OTEL_*` is now not supported anymore, please pass configuration options to constructors instead.
|
||||
* Note: Node.js environment variable configuration continues to work as-is.
|
||||
* feat(exporter-zipkin)!: do not read environment variables from window in browsers [#5465](https://github.com/open-telemetry/opentelemetry-js/pull/5465) @pichlermarc
|
||||
* (user-facing): all configuration previously possible via `window.OTEL_*` is now not supported anymore, please pass configuration options to constructors instead.
|
||||
* Note: Node.js environment variable configuration continues to work as-is.
|
||||
* feat(resource)!: Remove resource class export in favor of functions and types only to aid in cross-version compatibility [#5421](https://github.com/open-telemetry/opentelemetry-js/pull/5421)
|
||||
* Renames `Resource` class to `ResourceImpl` and makes it package-private
|
||||
* Renames `IResource` interface to `Resource`
|
||||
* Export function `resourceFromAttributes` to create a `Resource` from a `DetectedAttributes` object
|
||||
* Export function `defaultResource` to create a default resource [#5467](https://github.com/open-telemetry/opentelemetry-js/pull/5467) @pichlermarc
|
||||
* Export function `emptyResource` to create an empty resource [#5467](https://github.com/open-telemetry/opentelemetry-js/pull/5467) @pichlermarc
|
||||
* Only export types and functions. This aids in cross-version compatibility and makes it more easily extensible in the future.
|
||||
* feat(resources)!: do not read environment variables from window in browsers [#5466](https://github.com/open-telemetry/opentelemetry-js/pull/5466) @pichlermarc
|
||||
* (user-facing): all configuration previously possible via `window.OTEL_*` is now not supported anymore
|
||||
* If you have been using the `envDetector` in browser environments, please migrate to manually creating a resource.
|
||||
* Note: Node.js environment variable configuration continues to work as-is.
|
||||
* fix(sdk-trace-base)!: use `ParentBasedAlwaysOnSampler` over `AlwaysOnSampler` when bogus data is supplied to `OTEL_TRACES_SAMPLER`
|
||||
* this aligns the SDK implementation with the specification
|
||||
* feat(core)!: drop `getEnv()`, `getEnvWithoutDefaults()` [#5481](https://github.com/open-telemetry/opentelemetry-js/pull/5481) @pichlermarc
|
||||
* (user-facing): `getEnv()` has been replaced by `getStringFromEnv()`, `getNumberFromEnv()`, `getBooleanFromEnv()`, `getStringListFromEnv()`
|
||||
* these new functions do not include defaults, please inline any defaults if necessary (example: `getStringFromEnv("OTEL_FOO") ?? "my-default"`)
|
||||
* to find the previously used defaults, please see [here](https://github.com/open-telemetry/opentelemetry-js/blob/e9d3c71918635d490b6a9ac9f8259265b38394d0/packages/opentelemetry-core/src/utils/environment.ts#L154-L239)
|
||||
* (user-facing): `getEnvWithoutDefaults()` has been replaced by `getStringFromEnv()`, `getNumberFromEnv()`, `getBooleanFromEnv()`, `getStringListFromEnv()`
|
||||
* (user-facing): `DEFAULT_ENVIRONMENT` has been removed, please inline any defaults from now on
|
||||
* to find the previously used defaults, please see [here](https://github.com/open-telemetry/opentelemetry-js/blob/e9d3c71918635d490b6a9ac9f8259265b38394d0/packages/opentelemetry-core/src/utils/environment.ts#L154-L239)
|
||||
* (user-facing): `ENVIRONMENT` has been removed without replacement
|
||||
* (user-facing): `RAW_ENVIRONMENT` has been removed without replacement
|
||||
* (user-facing): `parseEnvironment` has been removed without replacement
|
||||
* feat(sdk-trace-base): remove `BasicTracerProvider#register()` to improve tree-shaking [#5503](https://github.com/open-telemetry/opentelemetry-js/pull/5503) @pichlermarc
|
||||
* (user-facing): `BasicTracerProvider#register()` has been removed
|
||||
* to register a global propagator, please use `propagation.setGlobalPropagator()` from `@opentelemetry/api`
|
||||
* to register a global context manager, please use `context.setGlobalContextManager()` from `@opentelemetry/api`
|
||||
* feat!: set compilation target to ES2022 for all packages except `@opentelemetry/api`, `@opentelemetry/api-logs`, `@opentelemetry/api-events`, and `@opentelemetry/semantic-conventions` [#5456](https://github.com/open-telemetry/opentelemetry-js/pull/5456) @david-luna
|
||||
* (user-facing): drops browser runtimes which do not support ES2022 features
|
||||
* feat(core)! drop unused constants [#5504](https://github.com/open-telemetry/opentelemetry-js/pull/5504) @pichlermarc
|
||||
* (user-facing): `DEFAULT_ATTRIBUTE_VALUE_LENTGHT_LIMIT` has been removed, please use `Infinity` instead
|
||||
* (user-facing): `DEFAULT_ATTRIBUTE_VALUE_COUNT_LIMIT` has been removed, please use `128` instead
|
||||
* (user-facing): `DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT` has been removed, please use `128` instead
|
||||
* (user-facing): `DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT` has been removed, please use `128` instead
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(sdk-trace-web): do not throw when passing extra options [#5357](https://github.com/open-telemetry/opentelemetry-js/pull/5357) @pichlermarc
|
||||
* `WebTracerProvider` constructor now does not throw anymore when `contextManager` or `propagator` are passed as extra options to the constructor
|
||||
* feat(sdk-trace-base): add stack trace warning to debug instrumentation [#5363](https://github.com/open-telemetry/opentelemetry-js/pull/5363) @neilfordyce
|
||||
* feat(core): add more scalable replacements for getEnv(), getEnvWithoutDefaults() [#5443](https://github.com/open-telemetry/opentelemetry-js/pull/5443) @pichlermarc
|
||||
* refactor(exporter-jaeger): migrate away from getEnv() [#5464](https://github.com/open-telemetry/opentelemetry-js/pull/5464) @pichlermarc
|
||||
* feat(core): add `diagLogLevelFromString` utility [#5475](https://github.com/open-telemetry/opentelemetry-js/pull/5475) @pichlermarc
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(exporter-zipkin): remove usages of deprecated `url.parse` from `node:url` [#5390](https://github.com/open-telemetry/opentelemetry-js/pull/5390) @chancancode
|
||||
* fix(sdk-metrics): do not export from `PeriodicExportingMetricReader` when there are no metrics to export. [#5288](https://github.com/open-telemetry/opentelemetry-js/pull/5288) @jacksonweber
|
||||
* fix(sdk-trace-base): always wait on pending export in SimpleSpanProcessor. [#5303](https://github.com/open-telemetry/opentelemetry-js/pull/5303) @anuraaga
|
||||
* fix(core): avoid using util in configuration.ts for browser compatibility [#5524](https://github.com/open-telemetry/opentelemetry-js/pull/5524) @sriraamas
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* refactor(sdk-metrics): the internal `InstrumentDescriptor` type now extends `MetricDescriptor`; moved public `InstrumentType` type enum into `./src/export/MetricData.ts` [#5277](https://github.com/open-telemetry/opentelemetry-js/pull/5266)
|
||||
* refactor(sdk-metrics): remove `Gauge` and `MetricAdvice` workaround types in favor of the upstream `@opentelemetry/api` types [#5254](https://github.com/open-telemetry/opentelemetry-js/pull/5254) @chancancode
|
||||
* chore: remove checks for unsupported node versions [#4341](https://github.com/open-telemetry/opentelemetry-js/pull/4341) @dyladan
|
||||
* refactor(sdk-trace-base): remove `BasicTracerProvider._registeredSpanProcessors` private property. [#5134](https://github.com/open-telemetry/opentelemetry-js/pull/5134) @david-luna
|
||||
* refactor(sdk-trace-base): rename `BasicTracerProvider.activeSpanProcessor` private property. [#5211](https://github.com/open-telemetry/opentelemetry-js/pull/5211) @david-luna
|
||||
* chore(selenium-tests): remove internal selenium-tests/ package, it wasn't being used @trentm
|
||||
* chore: update typescript `module` compiler option to `node16`. [#5347](https://github.com/open-telemetry/opentelemetry-js/pull/5347) @david-luna
|
||||
* feat(opentelemetry-instrumentation): replace `semver` package with internal semantic versioning check implementation to get rid of `semver` package initialization overhead especially in the AWS Lambda environment during coldstart [#5305](https://github.com/open-telemetry/opentelemetry-js/pull/5305) @serkan-ozal
|
||||
* chore: unpin `@opentelemetry/semantic-conventions` dep to allow better de-duplication in installs [#5439](https://github.com/open-telemetry/opentelemetry-js/pull/5439) @trentm
|
||||
|
||||
## 1.30.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(sdk-metrics): PeriodicExportingMetricReader now flushes pending tasks at shutdown [#5242](https://github.com/open-telemetry/opentelemetry-js/pull/5242)
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(sdk-trace-base): do not load OTEL_ env vars on module load, but when needed [#5233](https://github.com/open-telemetry/opentelemetry-js/pull/5233)
|
||||
* fix(instrumentation-xhr, instrumentation-fetch): content length attributes no longer get removed with `ignoreNetworkEvents: true` being set [#5229](https://github.com/open-telemetry/opentelemetry-js/issues/5229)
|
||||
|
||||
## 1.29.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(sdk-metrics): Add support for aggregation cardinality limit with a default limit of 2000. This limit can be customized via views [#5128](https://github.com/open-telemetry/opentelemetry-js/pull/5128)
|
||||
|
||||
## 1.28.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(sdk-metrics, sdk-trace): add `mergeResourceWithDefaults` flag, which allows opting-out of resources getting merged with the default resource [#4617](https://github.com/open-telemetry/opentelemetry-js/pull/4617)
|
||||
* default: `true` (no change in behavior)
|
||||
* note: `false` will become the default behavior in the next major version in order to comply with [specification requirements](https://github.com/open-telemetry/opentelemetry-specification/blob/f3511a5ccda376dfd1de76dfa086fc9b35b54757/specification/resource/sdk.md?plain=1#L31-L36)
|
||||
|
||||
* feat(sdk-trace-base): add `spanProcessors` property in `TracerConfig` interface. [#5138](https://github.com/open-telemetry/opentelemetry-js/pull/5138) @david-luna
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(sdk-metrics): await exports in `PeriodicExportingMetricReader` when async resource attributes have not yet settled [#5119](https://github.com/open-telemetry/opentelemetry-js/pull/5119/) @pichlermarc
|
||||
* fix(sdk-trace): performance.now() may return the same value for consecutive calls [#5150](https://github.com/open-telemetry/opentelemetry-js/pull/5150) @dyladan
|
||||
* fix(sdk-trace-base): pass BatchSpanProcessor#forceFlush() errors on visibilitychange/pagehide to globalErrorHandler [#5143](https://github.com/open-telemetry/opentelemetry-js/pull/5143) @pichlermarc
|
||||
* fixes a bug where switching browser tabs with a failing exporter would cause an unhandled error
|
||||
|
||||
## 1.27.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat: add processors for adding session.id attribute to spans and logs [#4972](https://github.com/open-telemetry/opentelemetry-js/pull/4972)
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(sdk-trace-base): avoid keeping non-string `status.message` on `Span#setStatus()` [#4999](https://github.com/open-telemetry/opentelemetry-js/pull/4999) @pichlermarc
|
||||
* fix(sdk-metrics): Add missing catch and handle error in promise of `PeriodicExportingMetricReader` [#5006](https://github.com/open-telemetry/opentelemetry-js/pull/5006) @jj22ee
|
||||
* fix(opentelemetry-core): confusing log extract of composite propagator [#5017](https://github.com/open-telemetry/opentelemetry-js/pull/5017) @rv2673
|
||||
* fix(propagator-aws-xray-*): move propagators back to contrib repository [#4966](https://github.com/open-telemetry/opentelemetry-js/pull/4966) @pichlermarc
|
||||
* The [specification](https://github.com/open-telemetry/opentelemetry-specification/blob/6672dbc97ddeb34f36c020a0f0a30323c8bc4d95/specification/context/api-propagators.md?plain=1#L354-L356) prohibits hosting these packages in the core repository
|
||||
* `@opentelemetry/propagator-aws-xray` is now located in [open-telemetry/opentelemetry-js-contrib](https://github.com/open-telemetry/opentelemetry-js-contrib)
|
||||
* `@opentelemetry/propagator-aws-xray-lambda` is now located in [open-telemetry/opentelemetry-js-contrib](https://github.com/open-telemetry/opentelemetry-js-contrib)
|
||||
|
||||
* docs: [Browser] Define the supported browser runtimes [Issue #4168](https://github.com/open-telemetry/opentelemetry-js/issues/4168) PR:[#5059](https://github.com/open-telemetry/opentelemetry-js/pull/5059) @MSNev
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* deps: set `@opentelemetry/api` dependency min version to 1.3.0 in `examples`, `experimental/packages`, `integration-tests` and `selenium-tests`
|
||||
[#4992](https://github.com/open-telemetry/opentelemetry-js/pull/4992)
|
||||
* refactor(sdk-metrics): replace `MetricsAttributes` with `Attributes` [#5021](https://github.com/open-telemetry/opentelemetry-js/pull/5021) @david-luna
|
||||
* refactor(instrumentation-http): replace `SpanAttributes` and `MetricsAttributes` with `Attributes` [#5023](https://github.com/open-telemetry/opentelemetry-js/pull/5023) @david-luna
|
||||
* chore(exporter-zipkin): remove usages of Span constructor [#5030](https://github.com/open-telemetry/opentelemetry-js/pull/5030) @david-luna
|
||||
* test(instrumentation-http): remove usages of `new Span` in tests [#5035](https://github.com/open-telemetry/opentelemetry-js/pull/5035) @david-luna
|
||||
|
||||
## 1.26.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat: include instrumentation scope info in console span and log record exporters [#4848](https://github.com/open-telemetry/opentelemetry-js/pull/4848) @blumamir
|
||||
* feat(semconv): update semantic conventions to 1.27 (from 1.7.0) [#4690](https://github.com/open-telemetry/opentelemetry-js/pull/4690) @dyladan
|
||||
* Exported names have changed to `ATTR_{name}` for attributes (e.g. `ATTR_HTTP_REQUEST_METHOD`), `{name}_VALUE_{value}` for enumeration values (e.g. `HTTP_REQUEST_METHOD_VALUE_POST`), and `METRIC_{name}` for metrics. Exported names from previous versions are deprecated.
|
||||
* Import `@opentelemetry/semantic-conventions` for *stable* semantic conventions. Import `@opentelemetry/semantic-conventions/incubating` for all semantic conventions, stable and unstable.
|
||||
* Note: Semantic conventions are now versioned separately from other stable artifacts, to correspond to the version of semantic conventions they provide. Changes will be in a separate changelog.
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(sdk-node): avoid spurious diag errors for unknown OTEL_NODE_RESOURCE_DETECTORS values [#4879](https://github.com/open-telemetry/opentelemetry-js/pull/4879) @trentm
|
||||
* deps(opentelemetry-instrumentation): Bump `shimmer` types to 1.2.0 [#4865](https://github.com/open-telemetry/opentelemetry-js/pull/4865) @lforst
|
||||
* fix(instrumentation): Fix optional property types [#4833](https://github.com/open-telemetry/opentelemetry-js/pull/4833) @alecmev
|
||||
* fix(sdk-metrics): fix(sdk-metrics): use inclusive upper bounds in histogram [#4829](https://github.com/open-telemetry/opentelemetry-js/pull/4829)
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* refactor: Simplify the code for the `getEnv` function [#4799](https://github.com/open-telemetry/opentelemetry-js/pull/4799) @danstarns
|
||||
* refactor: remove "export *" in favor of explicit named exports [#4880](https://github.com/open-telemetry/opentelemetry-js/pull/4880) @robbkidd
|
||||
* Packages updated:
|
||||
* opentelemetry-context-zone
|
||||
* opentelemetry-core
|
||||
* opentelemetry-exporter-jaeger
|
||||
* opentelemetry-exporter-zipkin
|
||||
* opentelemetry-propagator-b3
|
||||
* opentelemetry-propagator-jaeger
|
||||
* opentelemetry-sdk-trace-base
|
||||
* opentelemetry-sdk-trace-node
|
||||
* opentelemetry-sdk-trace-web
|
||||
* propagator-aws-xray
|
||||
* sdk-metrics
|
||||
* deps(sdk-metrics): remove unused lodash.merge dependency [#4905](https://github.com/open-telemetry/opentelemetry-js/pull/4905) @pichlermarc
|
||||
|
||||
## 1.25.1
|
||||
|
||||
### :books: (Refine Doc)
|
||||
|
||||
* refactor(examples): added usage of @opentelemetry/semantic-conventions and @opentelemetry/resources to the examples in examples/opentelemetry-web for maintaining consistency across all examples. [#4764](https://github.com/open-telemetry/opentelemetry-js/pull/4764) @Zen-cronic
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* refactor(context-zone-peer-dep): use explicit exports [#4785](https://github.com/open-telemetry/opentelemetry-js/pull/4787) @pichlermarc
|
||||
* refactor(context-async-hooks): use explicit exports [#4785](https://github.com/open-telemetry/opentelemetry-js/pull/4786) @pichlermarc
|
||||
|
||||
## 1.25.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat: support node 22 [#4666](https://github.com/open-telemetry/opentelemetry-js/pull/4666) @dyladan
|
||||
* feat(context-zone*): support zone.js 0.12.x [#4376](https://github.com/open-telemetry/opentelemetry-js/pull/4736) @maldago
|
||||
* refactor(core): Use tree-shakeable string constants for semconv [#4739](https://github.com/open-telemetry/opentelemetry-js/pull/4739) @JohannesHuster
|
||||
* refactor(shim-opentracing): Use tree-shakeable string constants for semconv [#4746](https://github.com/open-telemetry/opentelemetry-js/pull/4746) @JohannesHuster
|
||||
* refactor(sdk-trace-web): Use tree-shakeable string constants for semconv [#4747](https://github.com/open-telemetry/opentelemetry-js/pull/4747) @JohannesHuster
|
||||
* refactor(sdk-trace-node): Use tree-shakeable string constants for semconv [#4748](https://github.com/open-telemetry/opentelemetry-js/pull/4748) @JohannesHuster
|
||||
* refactor(sdk-trace-base): Use tree-shakeable string constants for semconv [#4749](https://github.com/open-telemetry/opentelemetry-js/pull/4749) @JohannesHuster
|
||||
* refactor(resources): update deprecated semconv to use exported strings [#4755](https://github.com/open-telemetry/opentelemetry-js/pull/#4755) @JamieDanielson
|
||||
* refactor(exporters): update deprecated semconv to use exported strings [#4756](https://github.com/open-telemetry/opentelemetry-js/pull/#4756) @JamieDanielson
|
||||
|
||||
### :books: (Refine Doc)
|
||||
|
||||
* refactor(examples): use new exported string constants for semconv in examples/esm-http-ts [#4758](https://github.com/open-telemetry/opentelemetry-js/pull/4758) @Zen-cronic
|
||||
* refactor(examples): use new exported string constants for semconv in examples/basic-tracer-node [#4759](https://github.com/open-telemetry/opentelemetry-js/pull/4759#pull) @Zen-cronic
|
||||
* refactor(examples): use new exported string constants for semconv in examples/http [#4750](https://github.com/open-telemetry/opentelemetry-js/pull/4750) @Zen-cronic
|
||||
* refactor(examples): use new exported string constants for semconv in examples/grpc-js [#4760](https://github.com/open-telemetry/opentelemetry-js/pull/4760#pull) @Zen-cronic
|
||||
* refactor(examples): use new exported string constants for semconv in examples/otlp-exporter-node [#4762](https://github.com/open-telemetry/opentelemetry-js/pull/4762) @Zen-cronic
|
||||
* refactor(examples): use new exported string constants for semconv in examples/opentracing-shim [#4761](https://github.com/open-telemetry/opentelemetry-js/pull/4761) @Zen-cronic
|
||||
|
||||
## 1.24.1
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(core): align inconsistent behavior of `getEnv()` and `getEnvWithoutDefaults()` when a `process` polyfill is used [#4648](https://github.com/open-telemetry/opentelemetry-js/pull/4648) @pichlermarc
|
||||
* `getEnvWithoutDefaults()` would use `process.env` if it was defined when running in a browser, while `getEnv()` would always use `_globalThis`. Now both use `_globalThis` when running in a browser.
|
||||
* fix(resources): prevent circular import (resource -> detector -> resource -> ...) [#4653](https://github.com/open-telemetry/opentelemetry-js/pull/4653) @pichlermarc
|
||||
* fixes a circular import warning which would appear in rollup when bundling `@opentelemetry/resources`
|
||||
* fix(exporter-metrics-otlp-grpc): add explicit otlp-exporter-base dependency to exporter-metrics-otlp-grpc [#4678](https://github.com/open-telemetry/opentelemetry-js/pull/4678) @AkselAllas
|
||||
* fix(resources) wait for async attributes for detecting resources [#4687](https://github.com/open-telemetry/opentelemetry-js/pull/4687) @ziolekjj
|
||||
|
||||
## 1.24.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(sdk-trace-base): log resource attributes in ConsoleSpanExporter [#4605](https://github.com/open-telemetry/opentelemetry-js/pull/4605) @pichlermarc
|
||||
* feat(propagator-aws-xray): moved AWS Xray propagator from contrib [4603](https://github.com/open-telemetry/opentelemetry-js/pull/4603) @martinkuba
|
||||
* feat(resources): new experimental detector ServiceInstanceIdDetectorSync that sets the value for `service.instance.id` as random UUID. [#4608](https://github.com/open-telemetry/opentelemetry-js/pull/4608) @maryliag
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(sdk-trace-web): fix invalid timings in span events [#4486](https://github.com/open-telemetry/opentelemetry-js/pull/4486) @Abinet18
|
||||
* fix(resources): ensure BrowserDetector does not think Node.js v21 is a browser [#4561](https://github.com/open-telemetry/opentelemetry-js/issues/4561) @trentm
|
||||
* fix(core): align inconsistent behavior of `getEnv()` and `getEnvWithoutDefaults()` when a `process` polyfill is used [#4648](https://github.com/open-telemetry/opentelemetry-js/pull/4648) @pichlermarc
|
||||
* `getEnvWithoutDefaults()` would use `process.env` if it was defined when running in a browser, while `getEnv()` would always use `_globalThis`. Now both use `_globalThis` when running in a browser.
|
||||
|
||||
## 1.23.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* perf(sdk-trace-base): do not allocate arrays if resource has no pending async attributes [#4576](https://github.com/open-telemetry/opentelemetry-js/pull/4576) @Samuron
|
||||
* feat(sdk-metrics): added experimental synchronous gauge to SDK [#4565](https://github.com/open-telemetry/opentelemetry-js/pull/4565) @clintonb
|
||||
* this change will become user-facing in an upcoming release
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(sdk-metrics): increase the depth of the output to the console such that objects in the metric are printed fully to the console [#4522](https://github.com/open-telemetry/opentelemetry-js/pull/4522) @JacksonWeber
|
||||
|
||||
## 1.22.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(sdk-metrics): allow single bucket histograms [#4456](https://github.com/open-telemetry/opentelemetry-js/pull/4456) @pichlermarc
|
||||
* feat(instrumentation): Make `init()` method public [#4418](https://github.com/open-telemetry/opentelemetry-js/pull/4418)
|
||||
* feat(context-zone-peer-dep, context-zone): support zone.js 0.13.x, 0.14.x [#4469](https://github.com/open-telemetry/opentelemetry-js/pull/4469) @pichlermarc
|
||||
* chore: Semantic Conventions export individual strings [4185](https://github.com/open-telemetry/opentelemetry-js/issues/4185)
|
||||
* feat(sdk-trace-base): allow adding span links after span creation [#4536](https://github.com/open-telemetry/opentelemetry-js/pull/4536) @seemk
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(sdk-metrics): handle zero bucket counts in exponential histogram merge [#4459](https://github.com/open-telemetry/opentelemetry-js/pull/4459) @mwear
|
||||
* fix(sdk-metrics): ignore `NaN` value recordings in Histograms [#4455](https://github.com/open-telemetry/opentelemetry-js/pull/4455) @pichlermarc
|
||||
* fixes a bug where recording `NaN` on a histogram would result in the sum of bucket count values not matching the overall count
|
||||
* fix(sdk-metrics): allow single bucket histograms [#4456](https://github.com/open-telemetry/opentelemetry-js/pull/4456) @pichlermarc
|
||||
* fixes a bug where `Meter.createHistogram()` with the advice `explicitBucketBoundaries: []` would throw
|
||||
* fix(context-zone-peer-dep, context-zone): support zone.js 0.13.x, 0.14.x [#4469](https://github.com/open-telemetry/opentelemetry-js/pull/4469) @pichlermarc
|
||||
* fixes a bug where old versions of `zone.js` affected by <https://github.com/angular/angular/issues/53507> would be pulled in
|
||||
|
||||
### :books: (Refine Doc)
|
||||
|
||||
* docs: shorten readme sections [#4460](https://github.com/open-telemetry/opentelemetry-js/pull/4460) @legendecas
|
||||
|
||||
## 1.21.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(sdk-metrics): add constructor option to add metric readers [#4427](https://github.com/open-telemetry/opentelemetry-js/pull/4427) @pichlermarc
|
||||
* deprecates `MeterProvider.addMetricReader()` please use the constructor option `readers` instead.
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(sdk-trace-base): ensure attribute value length limit is enforced on span creation [#4417](https://github.com/open-telemetry/opentelemetry-js/pull/4417) @pichlermarc
|
||||
* fix(sdk-trace-base): Export processed spans while exporter failed [#4287](https://github.com/open-telemetry/opentelemetry-js/pull/4287) @Zirak
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* chore(opentelemetry-context-zone-peer-dep): support zone.js ^v0.13.0 [#4320](https://github.com/open-telemetry/opentelemetry-js/pull/4320)
|
||||
* refactor(core): drop unnecessary assignment of HOSTNAME [#4421](https://github.com/open-telemetry/opentelemetry-js/pull/4421) @pichlermarc
|
||||
* test(opentelemetry-context-zone-peer-dep): transpile zone.js in tests [#4423](https://github.com/open-telemetry/opentelemetry-js/pull/4423) @legendecas
|
||||
|
||||
## 1.20.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* perf(otlp-transformer): skip unnecessary base64 encode of span contexts [#4343](https://github.com/open-telemetry/opentelemetry-js/pull/4343) @seemk
|
||||
* feat(sdk-trace-base): improve log messages when dropping span events [#4223](https://github.com/open-telemetry/opentelemetry-js/pull/4223) @mkubliniak
|
||||
|
||||
## 1.19.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat: add node 20 support [#4336](https://github.com/open-telemetry/opentelemetry-js/pull/4336) @dyladan
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* chore: type reference on zone.js [#4257](https://github.com/open-telemetry/opentelemetry-js/pull/4257) @legendecas
|
||||
* chore: no need for 'packages' in lerna.json [#4264](https://github.com/open-telemetry/opentelemetry-js/pull/4264) @trentm
|
||||
* test: add node 20 to test matrix [#4336](https://github.com/open-telemetry/opentelemetry-js/pull/4336) @dyladan
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(api-logs): allow for TimeInput type for LogRecord timestamps [#4345](https://github.com/open-telemetry/opentelemetry-js/pull/4345)
|
||||
* fix(sdk-trace-web): only access location if it is defined [#4063](https://github.com/open-telemetry/opentelemetry-js/pull/4063)
|
||||
* fix(sdk-trace-base): processor onStart called with a span having empty attributes
|
||||
|
||||
## 1.18.1
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(sdk-metrics): hand-roll MetricAdvice type as older API versions do not include it #4260
|
||||
|
||||
## 1.18.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(metrics): prototype experimental advice support [#3876](https://github.com/open-telemetry/opentelemetry-js/pull/3876) @legendecas
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(core): remove re-export of `version.ts` [#4225](https://github.com/open-telemetry/opentelemetry-js/pull/4225) @david-luna
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* chore: track package-lock.json [#4238](https://github.com/open-telemetry/opentelemetry-js/pull/4238) @legendecas
|
||||
* Switched to npm workspaces to bootstrap dependencies.
|
||||
|
||||
## 1.17.1
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(sdk-trace-base): BatchSpanProcessor flushes when `maxExportBatchSize` is reached [#3958](https://github.com/open-telemetry/opentelemetry-js/pull/3958) @nordfjord
|
||||
* fix(sdk-metrics): allow instrument names to contain '/' [#4155](https://github.com/open-telemetry/opentelemetry-js/pull/4155)
|
||||
* fix(sdk-metrics): prevent per-reader storages from keeping unreported accumulations in memory [#4163](https://github.com/open-telemetry/opentelemetry-js/pull/4163) @pichlermarc
|
||||
* fixes a memory leak which occurred when two or more `MetricReader` instances are registered to a `MeterProvider`
|
||||
* fix(sdk-metrics): do not report empty scopes and metrics [#4135](https://github.com/open-telemetry/opentelemetry-js/pull/4135) @pichlermarc
|
||||
* Instruments that were created, but did not have measurements will not be exported anymore
|
||||
* Meters (Scopes) that were created, but did not have any instruments with measurements under them will not be exported anymore.
|
||||
* fix(exporter-zipkin): round duration to the nearest int in annotations to be compliant with zipkin protocol [#4167](https://github.com/open-telemetry/opentelemetry-js/pull/4167) @FelipeEmerim
|
||||
|
||||
### :books: (Refine Doc)
|
||||
|
||||
* docs(contributing): added guidelines for adding benchmark tests [#4169](https://github.com/open-telemetry/opentelemetry-js/pull/4169)
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* test: added a performance benchmark test for span creation [#4105](https://github.com/open-telemetry/opentelemetry-js/pull/4105)
|
||||
* test: added a workflow to run performance benchmark tests automatically [#4144](https://github.com/open-telemetry/opentelemetry-js/pull/4144)
|
||||
|
||||
## 1.17.0
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* Revert "feat(api): add attributes argument to recordException API [#4071](https://github.com/open-telemetry/opentelemetry-js/pull/4071)"
|
||||
* This feature was an unintentional breaking change introduced with API 1.5.0
|
||||
* This PR updates all SDK packages to allow API 1.6.0, where this change has been reverted.
|
||||
|
||||
## 1.16.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(sdk-metrics): implement MetricProducer specification [#4007](https://github.com/open-telemetry/opentelemetry-js/pull/4007)
|
||||
* feat: update PeriodicExportingMetricReader and PrometheusExporter to accept optional metric producers [#4077](https://github.com/open-telemetry/opentelemetry-js/pull/4077) @aabmass
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(exporter-zipkin): rounding duration to the nearest int to be compliant with zipkin protocol [#4064](https://github.com/open-telemetry/opentelemetry-js/pull/4064) @n0cloud
|
||||
* fix(sdk-metrics): metric names should be case-insensitive
|
||||
|
||||
### :books: (Refine Doc)
|
||||
|
||||
* docs(guidelines): add dependencies guidelines [#4040](https://github.com/open-telemetry/opentelemetry-js/pull/4040)
|
||||
|
||||
## 1.15.2
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(core): stop rounding to nearest int in hrTimeTo*seconds() functions [#4014](https://github.com/open-telemetry/opentelemetry-js/pull/4014/) @aabmass
|
||||
* fix(sdk-metrics): ignore invalid metric values [#3988](https://github.com/open-telemetry/opentelemetry-js/pull/3988) @legendecas
|
||||
* fix(core): add baggage support for values containing an equals sign [#3975](https://github.com/open-telemetry/opentelemetry-js/pull/3975) @krosenk729
|
||||
|
||||
## 1.15.1
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* Revert "feat(minification): Add noEmitHelpers, importHelpers and tslib as a dependency (#3914)"
|
||||
[#4011](https://github.com/open-telemetry/opentelemetry-js/pull/4011) @dyladan
|
||||
|
||||
## 1.15.0
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(opentelemetry-exporter-prometheus): Update default PrometheusExporter to not append a timestamp to match the text based exposition format [#3961](https://github.com/open-telemetry/opentelemetry-js/pull/3961) @JacksonWeber
|
||||
* fix(sdk-metrics): Update default Histogram's boundary to match OTEL's spec [#3893](https://github.com/open-telemetry/opentelemetry-js/pull/3893/) @chigia001
|
||||
* fix(sdk-metrics): preserve startTime for cumulative ExponentialHistograms [#3934](https://github.com/open-telemetry/opentelemetry-js/pull/3934/) @aabmass
|
||||
* fix(sdk-trace-web): add secureConnectionStart to https only [#3879](https://github.com/open-telemetry/opentelemetry-js/pull/3879) @Abinet18
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* feat(minification): [Minification] Add noEmitHelpers, importHelpers and tslib as a dependency [#3913](https://github.com/open-telemetry/opentelemetry-js/issues/3913) @MSNev
|
||||
|
||||
## 1.14.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(SpanExporter): Add optional forceFlush to SpanExporter interface [#3753](https://github.com/open-telemetry/opentelemetry-js/pull/3753/) @sgracias1 @JacksonWeber
|
||||
|
||||
## 1.13.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(core): add environment variables for OTLP log exporters. [#3712](https://github.com/open-telemetry/opentelemetry-js/pull/3712/) @llc1123
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(http-instrumentation): stop listening to `request`'s `close` event once it has emitted `response` [#3625](https://github.com/open-telemetry/opentelemetry-js/pull/3625) @SimenB
|
||||
* fix(sdk-node): fix initialization in bundled environments by not loading @opentelemetry/exporter-jaeger [#3739](https://github.com/open-telemetry/opentelemetry-js/pull/3739) @pichlermarc
|
||||
|
||||
## 1.12.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(tracing): log span name and IDs when span end is called multiple times [#3716](https://github.com/open-telemetry/opentelemetry-js/pull/3716)
|
||||
* feat(core): add logs environment variables; add timeout utils method. [#3549](https://github.com/open-telemetry/opentelemetry-js/pull/3549/) @fuaiyi
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(instrumentation-http): fixed description for http.server.duration metric [#3710](https://github.com/open-telemetry/opentelemetry-js/pull/3710)
|
||||
* fix(opentelemetry-sdk-trace-web): don't crash in runtimes where location isn't defined [#3715](https://github.com/open-telemetry/opentelemetry-js/pull/3715)
|
||||
|
||||
## 1.11.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(sdk-metrics): add exponential histogram support [#3505](https://github.com/open-telemetry/opentelemetry-js/pull/3505), [#3506](https://github.com/open-telemetry/opentelemetry-js/pull/3506) @mwear
|
||||
* feat(resources): collect additional process attributes [#3605](https://github.com/open-telemetry/opentelemetry-js/pull/3605) @mwear
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(sdk-metrics): merge uncollected delta accumulations [#3667](https://github.com/open-telemetry/opentelemetry-js/pull/3667) @legendecas
|
||||
* fix(sdk-trace-web): make `parseUrl()` respect document.baseURI [#3670](https://github.com/open-telemetry/opentelemetry-js/pull/3670) @domasx2
|
||||
|
||||
### :books: (Refine Doc)
|
||||
|
||||
* doc(sdk): update NodeSDK example [#3684](https://github.com/open-telemetry/opentelemetry-js/pull/3684) @martinkuba
|
||||
* docs: change vmarchaud status from maintainer to emeritus [#3710](https://github.com/open-telemetry/opentelemetry-js/pull/3710) @vmarchaud
|
||||
* docs: change rauno56 status from maintainer to emeritus [#3706](https://github.com/open-telemetry/opentelemetry-js/pull/3706) @rauno56
|
||||
|
||||
## 1.10.1
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(resource): make properties for async resource resolution optional [#3677](https://github.com/open-telemetry/opentelemetry-js/pull/3677) @pichlermarc
|
||||
* fix(resource): change fs/promises import to be node 12 compatible [#3681](https://github.com/open-telemetry/opentelemetry-js/pull/3681) @pichlermarc
|
||||
|
||||
## 1.10.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(resource): create sync resource with some attributes that resolve asynchronously [#3460](https://github.com/open-telemetry/opentelemetry-js/pull/3460) @samimusallam
|
||||
* feat: collect host id for non-cloud environments [#3575](https://github.com/open-telemetry/opentelemetry-js/pull/3575) @mwear
|
||||
* feat (api-logs): separate Events API into its own package [3550](https://github.com/open-telemetry/opentelemetry-js/pull/3550) @martinkuba
|
||||
* feat(sdk-metrics): apply binary search in histogram recording [#3539](https://github.com/open-telemetry/opentelemetry-js/pull/3539) @legendecas
|
||||
* perf(propagator-jaeger): improve deserializeSpanContext performance [#3541](https://github.com/open-telemetry/opentelemetry-js/pull/3541) @doochik
|
||||
* feat: support TraceState in SamplingResult [#3530](https://github.com/open-telemetry/opentelemetry-js/pull/3530) @raphael-theriault-swi
|
||||
* feat(sdk-trace-base): add diagnostic logging when spans are dropped [#3610](https://github.com/open-telemetry/opentelemetry-js/pull/3610) @neoeinstein
|
||||
* feat: add unit to view instrument selection criteria [#3647](https://github.com/open-telemetry/opentelemetry-js/pull/3647) @jlabatut
|
||||
* feat(tracing): expose dropped counts for attributes, events and links on span [#3576](https://github.com/open-telemetry/opentelemetry-js/pull/3576) @mohitk05
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(core): added falsy check to make otel core work with browser where webpack config had process as false or null [#3613](https://github.com/open-telemetry/opentelemetry-js/issues/3613) @ravindra-dyte
|
||||
* fix(instrumentation-http): include query params in http.target [#3646](https://github.com/open-telemetry/opentelemetry-js/pull/3646) @kobi-co
|
||||
|
||||
### :books: (Refine Doc)
|
||||
|
||||
* chore: update http example [#3651](https://github.com/open-telemetry/opentelemetry-js/pull/3651) @JamieDanielson
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* chore(exporter-jaeger): deprecate jaeger exporter [#3585](https://github.com/open-telemetry/opentelemetry-js/pull/3585) @pichlermarc
|
||||
* fix(sdk-metrics): fix flaky LastValueAggregator test by using fake timer [#3587](https://github.com/open-telemetry/opentelemetry-js/pull/3587) @pichlermarc
|
||||
* fix(test): fix failing tests by preventing source-map generation [#3642](https://github.com/open-telemetry/opentelemetry-js/pull/3642) @pichlermarc
|
||||
|
||||
## 1.9.1
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix: avoid grpc types dependency [#3551](https://github.com/open-telemetry/opentelemetry-js/pull/3551) @flarna
|
||||
* fix(otlp-proto-exporter-base): Match Accept header with Content-Type in the proto exporter
|
||||
[#3562](https://github.com/open-telemetry/opentelemetry-js/pull/3562) @scheler
|
||||
* fix: include tracestate in export [#3569](https://github.com/open-telemetry/opentelemetry-js/pull/3569) @flarna
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* chore: fix cross project links and missing implicitly exported types [#3533](https://github.com/open-telemetry/opentelemetry-js/pull/3533) @legendecas
|
||||
* feat(sdk-metrics): add exponential histogram mapping functions [#3504](https://github.com/open-telemetry/opentelemetry-js/pull/3504) @mwear
|
||||
|
||||
## 1.9.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(instrumentation-grpc): set net.peer.name and net.peer.port on client spans [#3430](https://github.com/open-telemetry/opentelemetry-js/pull/3430)
|
||||
* feat(exporter-trace-otlp-proto): Add protobuf otlp trace exporter support for browser [#3208](https://github.com/open-telemetry/opentelemetry-js/pull/3208) @pkanal
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(sdk-metrics): use default Resource to comply with semantic conventions [#3411](https://github.com/open-telemetry/opentelemetry-js/pull/3411) @pichlermarc
|
||||
* Metrics exported by the SDK now contain the following resource attributes by default:
|
||||
* `service.name`
|
||||
* `telemetry.sdk.name`
|
||||
* `telemetry.sdk.language`
|
||||
* `telemetry.sdk.version`
|
||||
* fix(sdk-metrics): use Date.now() for instrument recording timestamps [#3514](https://github.com/open-telemetry/opentelemetry-js/pull/3514) @MisterSquishy
|
||||
* fix(sdk-trace): make spans resilient to clock drift [#3434](https://github.com/open-telemetry/opentelemetry-js/pull/3434) @dyladan
|
||||
* fix(selenium-tests): updated webpack version for selenium test issue [#3456](https://github.com/open-telemetry/opentelemetry-js/issues/3456) @SaumyaBhushan
|
||||
* fix(sdk-metrics): collect metrics when periodic exporting metric reader flushes [#3517](https://github.com/open-telemetry/opentelemetry-js/pull/3517) @legendecas
|
||||
* fix(sdk-metrics): fix duplicated registration of metrics for collectors [#3488](https://github.com/open-telemetry/opentelemetry-js/pull/3488) @legendecas
|
||||
* fix(core): fix precision loss in numberToHrtime [#3480](https://github.com/open-telemetry/opentelemetry-js/pull/3480) @legendecas
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* chore: automatically generate tsconfigs [#3432](https://github.com/open-telemetry/opentelemetry-js/pull/3432) @legendecas
|
||||
* chore: enforce format with prettier [#3444](https://github.com/open-telemetry/opentelemetry-js/pull/3444) @legendecas
|
||||
|
||||
## 1.8.0
|
||||
|
||||
* `@opentelemetry/sdk-metrics` has been promoted to stable
|
||||
* `@opentelemetry/api-metrics` has been merged into `@opentelemetry/api` and deprecated
|
||||
|
||||
### :boom: Breaking Change
|
||||
|
||||
* feat(api): merge api-metrics into api [#3374](https://github.com/open-telemetry/opentelemetry-js/pull/3374) @legendecas
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(sdk-trace): re-export sdk-trace-base in sdk-trace-node and web [#3319](https://github.com/open-telemetry/opentelemetry-js/pull/3319) @legendecas
|
||||
* feat: enable tree shaking [#3329](https://github.com/open-telemetry/opentelemetry-js/pull/3329) @pkanal
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(sdk-trace): enforce consistent span durations
|
||||
[#3327](https://github.com/open-telemetry/opentelemetry-js/pull/3327) @dyladan
|
||||
* fix(resources): fix EnvDetector throwing errors when attribute values contain spaces
|
||||
[#3295](https://github.com/open-telemetry/opentelemetry-js/issues/3295)
|
||||
* fix(trace): fix an issue which caused negative span durations in web based spans
|
||||
[#3359](https://github.com/open-telemetry/opentelemetry-js/pull/3359) @dyladan
|
||||
* fix(resources): strict OTEL_RESOURCE_ATTRIBUTES baggage octet decoding
|
||||
[#3341](https://github.com/open-telemetry/opentelemetry-js/pull/3341) @legendecas
|
||||
|
||||
### :books: (Refine Doc)
|
||||
|
||||
* doc: Added Metrics documentation [#3360](https://github.com/open-telemetry/opentelemetry-js/pull/3360) @weyert
|
||||
* docs(api): fix counter negative value wording [#3396](https://github.com/open-telemetry/opentelemetry-js/pull/3396) @legendecas
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* ci: run browser tests without circle [#3328](https://github.com/open-telemetry/opentelemetry-js/pull/3328) @dyladan
|
||||
|
||||
## Metrics API 1.0.0
|
||||
|
||||
Metrics API is now stable and generally available.
|
||||
There are no changes between 1.0.0 and the previous 0.33.0 version.
|
||||
|
||||
### :boom: Breaking Change
|
||||
|
||||
* Add semver check to metrics API [#3357](https://github.com/open-telemetry/opentelemetry-js/pull/3357) @dyladan
|
||||
* Previously API versions were only considered compatible if the API was exactly the same
|
||||
|
||||
## 1.7.0
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(sdk-trace-base): make span start times resistant to hrtime clock drift
|
||||
[#3129](https://github.com/open-telemetry/opentelemetry-js/issues/3129)
|
||||
|
||||
* fix(sdk-trace-base): validate maxExportBatchSize in BatchSpanProcessorBase
|
||||
[#3232](https://github.com/open-telemetry/opentelemetry-js/issues/3232)
|
||||
|
||||
### :books: (Refine Doc)
|
||||
|
||||
* docs(metrics): add missing metrics packages to SDK reference documentation [#3239](https://github.com/open-telemetry/opentelemetry-js/pull/3239) @dyladan
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* deps: update markdownlint-cli to 0.32.2 [#3253](https://github.com/open-telemetry/opentelemetry-js/pull/3253) @pichlermarc
|
||||
|
||||
## 1.6.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* perf(opentelemetry-core): improve hexToBase64 performance [#3178](https://github.com/open-telemetry/opentelemetry-js/pull/3178) @seemk
|
||||
* feat(sdk-trace-base): move Sampler declaration into sdk-trace-base [#3088](https://github.com/open-telemetry/opentelemetry-js/pull/3088) @legendecas
|
||||
* fix(grpc-instrumentation): added grpc attributes in instrumentation [#3127](https://github.com/open-telemetry/opentelemetry-js/pull/3127) @andrewzenkov
|
||||
* feat: support latest `@opentelemetry/api` [#3177](https://github.com/open-telemetry/opentelemetry-js/pull/3177) @dyladan
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(context-async-hooks): Ensure listeners added using `once` can be removed using `removeListener`
|
||||
[#3133](https://github.com/open-telemetry/opentelemetry-js/pull/3133)
|
||||
|
||||
### :books: (Refine Doc)
|
||||
|
||||
* chore: update trace-web example and rename it to opentelemetry-web [#3145](https://github.com/open-telemetry/opentelemetry-js/pull/3145) @pichlermarc
|
||||
* chore: update https example [#3152](https://github.com/open-telemetry/opentelemetry-js/pull/3152) @pichlermarc
|
||||
|
||||
## 1.5.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(sdk-trace-base): Improve extensibility of BasicTracerProvider [#3023](https://github.com/open-telemetry/opentelemetry-js/pull/3023) @Rauno56
|
||||
|
||||
## 1.4.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* fix(resources): fix browser compatibility for host and os detectors [#3004](https://github.com/open-telemetry/opentelemetry-js/pull/3004) @legendecas
|
||||
* fix(sdk-trace-base): fix crash on environments without global document [#3000](https://github.com/open-telemetry/opentelemetry-js/pull/3000) @legendecas
|
||||
* fix(sdk-trace-base): fix spanLimits attribute length/count to consider env values [#3068](https://github.com/open-telemetry/opentelemetry-js/pull/3068) @svetlanabrennan
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* test: add node 18 and remove EoL node versions [#3048](https://github.com/open-telemetry/opentelemetry-js/pull/3048) @dyladan
|
||||
|
||||
## 1.3.1
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(resources): fix browser compatibility for host and os detectors [#3004](https://github.com/open-telemetry/opentelemetry-js/pull/3004) @legendecas
|
||||
|
||||
## 1.3.0
|
||||
|
||||
### :boom: Breaking Change
|
||||
|
||||
* chore: remove unused InstrumentationConfig#path [#2944](https://github.com/open-telemetry/opentelemetry-js/pull/2944) @flarna
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(ConsoleSpanExporter): export span links [#2917](https://github.com/open-telemetry/opentelemetry-js/pull/2917) @trentm
|
||||
* feat: warn when hooked module is already loaded [#2926](https://github.com/open-telemetry/opentelemetry-js/pull/2926) @nozik
|
||||
* feat: implement OSDetector [#2927](https://github.com/open-telemetry/opentelemetry-js/pull/2927) @rauno56
|
||||
* feat: implement HostDetector [#2921](https://github.com/open-telemetry/opentelemetry-js/pull/2921) @rauno56
|
||||
* feat(opentelemetry-core): add InstrumentationScope [#2959](https://github.com/open-telemetry/opentelemetry-js/pull/2959) @pichlermarc
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(sdk-web): parse url with relative url string [#2972](https://github.com/open-telemetry/opentelemetry-js/pull/2972) @legendecas
|
||||
|
||||
## 1.2.0
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix: sanitize attributes inputs [#2881](https://github.com/open-telemetry/opentelemetry-js/pull/2881) @legendecas
|
||||
* fix: support earlier API versions [#2892](https://github.com/open-telemetry/opentelemetry-js/pull/2892) @dyladan
|
||||
* fix: support extract one digit '0' in jaeger traceFlag [#2905](https://github.com/open-telemetry/opentelemetry-js/issues/2905) @shmilyoo
|
||||
* fix(resources): extend ResourceAttributes interface to comply with spec [#2924](https://github.com/open-telemetry/opentelemetry-js/pull/2924) @blumamir
|
||||
|
||||
### :books: (Refine Doc)
|
||||
|
||||
* docs(sdk): update earliest support node version [#2860](https://github.com/open-telemetry/opentelemetry-js/pull/2860) @svetlanabrennan
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* chore: require changelog entry to merge PR [#2847](https://github.com/open-telemetry/opentelemetry-js/pull/2847) @dyladan
|
||||
* chore: remove peer API check [#2892](https://github.com/open-telemetry/opentelemetry-js/pull/2892) @dyladan
|
||||
* chore: merge lerna subdirectories into a single monorepo [#2892](https://github.com/open-telemetry/opentelemetry-js/pull/2892) @dyladan
|
||||
* chore: indent the code with eslint [#2923](https://github.com/open-telemetry/opentelemetry-js/pull/2923) @blumamir
|
||||
* `opentelemetry-propagator-jaeger`
|
||||
* [#2906](https://github.com/open-telemetry/opentelemetry-js/pull/2906) fix: support extract one digit '0' in jaeger traceFlag ([@shmilyoo](https://github.com/shmilyoo))
|
||||
|
||||
## 1.1.1
|
||||
|
||||
* [#2849](https://github.com/open-telemetry/opentelemetry-js/pull/2849) fix: correct changelog and compat matrix for 1.1 release ([@Flarna](https://github.com/Flarna))
|
||||
* [#2823](https://github.com/open-telemetry/opentelemetry-js/pull/2823) fix: enable downlevelIteration for es5 targets ([@legendecas](https://github.com/legendecas))
|
||||
* [#2844](https://github.com/open-telemetry/opentelemetry-js/pull/2844) chore: add prepublishOnly to ensure a full build ([@legendecas](https://github.com/legendecas))
|
||||
|
||||
## 1.1.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* `opentelemetry-resources`
|
||||
* [#2727](https://github.com/open-telemetry/opentelemetry-js/pull/2727) feat(opentelemetry-resources): add runtime version information ([@cuichenli](https://github.com/cuichenli))
|
||||
* `exporter-trace-otlp-http`, `opentelemetry-core`
|
||||
* [#2796](https://github.com/open-telemetry/opentelemetry-js/pull/2796) feat(trace-otlp-http-exporter): add compression env vars ([@svetlanabrennan](https://github.com/svetlanabrennan))
|
||||
* `instrumentation-http`
|
||||
* [#2704](https://github.com/open-telemetry/opentelemetry-js/pull/2704) feat(instrumentation-http): add options to ignore requests ([@legendecas](https://github.com/legendecas))
|
||||
* `opentelemetry-core`, `opentelemetry-exporter-jaeger`
|
||||
* [#2754](https://github.com/open-telemetry/opentelemetry-js/pull/2754) fix(exporter-jaeger): add env variable for agent port ([@blumamir](https://github.com/blumamir))
|
||||
* `exporter-trace-otlp-grpc`, `exporter-trace-otlp-http`, `exporter-trace-otlp-proto`, `opentelemetry-context-async-hooks`, `opentelemetry-context-zone-peer-dep`, `opentelemetry-core`, `opentelemetry-exporter-jaeger`, `opentelemetry-exporter-zipkin`, `opentelemetry-propagator-b3`, `opentelemetry-propagator-jaeger`, `opentelemetry-resources`, `opentelemetry-sdk-trace-base`, `opentelemetry-sdk-trace-node`, `opentelemetry-sdk-trace-web`, `opentelemetry-shim-opentracing`
|
||||
* [#2737](https://github.com/open-telemetry/opentelemetry-js/pull/2737) feat: add support for API 1.1.x ([@dyladan](https://github.com/dyladan))
|
||||
* `opentelemetry-sdk-trace-web`
|
||||
* [#2719](https://github.com/open-telemetry/opentelemetry-js/pull/2719) feat(sdk-trace-web): web worker support ([@legendecas](https://github.com/legendecas))
|
||||
* `exporter-trace-otlp-http`, `exporter-trace-otlp-proto`
|
||||
* [#2557](https://github.com/open-telemetry/opentelemetry-js/pull/2557) feat(otlp-exporter-http): change otlp-http port to canonical 4318 ([@secustor](https://github.com/secustor))
|
||||
* `exporter-trace-otlp-grpc`, `exporter-trace-otlp-http`, `exporter-trace-otlp-proto`, `opentelemetry-core`, `opentelemetry-exporter-jaeger`, `opentelemetry-sdk-trace-base`
|
||||
* [#2695](https://github.com/open-telemetry/opentelemetry-js/pull/2695) refactor: unifying shutdown once with BindOnceFuture ([@legendecas](https://github.com/legendecas))
|
||||
* `opentelemetry-propagator-jaeger`
|
||||
* [#2673](https://github.com/open-telemetry/opentelemetry-js/pull/2673) feat(@opentelemetry/propagator-jaeger): support custom baggage prefix ([@sschegolev](https://github.com/sschegolev))
|
||||
* `exporter-trace-otlp-grpc`, `exporter-trace-otlp-http`, `exporter-trace-otlp-proto`
|
||||
* [#2626](https://github.com/open-telemetry/opentelemetry-js/pull/2626) chore: bump otlp trace exporters to v1 ([@Rauno56](https://github.com/Rauno56))
|
||||
* `opentelemetry-context-zone-peer-dep`, `opentelemetry-context-zone`, `opentelemetry-core`, `opentelemetry-exporter-zipkin`, `opentelemetry-propagator-b3`, `opentelemetry-resources`, `opentelemetry-sdk-trace-base`, `opentelemetry-sdk-trace-web`, `opentelemetry-semantic-conventions`
|
||||
* [#2556](https://github.com/open-telemetry/opentelemetry-js/pull/2556) chore: add esm2015 entry for web apps aiming at modern browsers ([@echoontheway](https://github.com/echoontheway))
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* `exporter-trace-otlp-grpc`, `exporter-trace-otlp-http`, `exporter-trace-otlp-proto`
|
||||
* [#2788](https://github.com/open-telemetry/opentelemetry-js/pull/2788) fix(deps): use 1.x trace otlp http exporter ([@dyladan](https://github.com/dyladan))
|
||||
* `opentelemetry-sdk-trace-base`
|
||||
* [#2790](https://github.com/open-telemetry/opentelemetry-js/pull/2790) fix: pass same context to Sampler and SpanProcessor in root span case ([@Flarna](https://github.com/Flarna))
|
||||
* [#2757](https://github.com/open-telemetry/opentelemetry-js/pull/2757) fix: add parentContext to onStart ([@Flarna](https://github.com/Flarna))
|
||||
* [#2678](https://github.com/open-telemetry/opentelemetry-js/pull/2678) fix: span attribute count and value limits (#2671) ([@Bataran](https://github.com/Bataran))
|
||||
* [#2679](https://github.com/open-telemetry/opentelemetry-js/pull/2679) fix: span events count limit when set to 0 ([@Bataran](https://github.com/Bataran))
|
||||
* `opentelemetry-core`
|
||||
* [#2766](https://github.com/open-telemetry/opentelemetry-js/pull/2766) fix(baggage): include baggage metadata when propagating baggage entries ([@chrskrchr](https://github.com/chrskrchr))
|
||||
* `opentelemetry-exporter-jaeger`
|
||||
* [#2731](https://github.com/open-telemetry/opentelemetry-js/pull/2731) fix(exporter-jaeger): transform all links to jaeger reference ([@blumamir](https://github.com/blumamir))
|
||||
* `opentelemetry-resources`
|
||||
* [#2739](https://github.com/open-telemetry/opentelemetry-js/pull/2739) fix(resources): align exported names in different environments ([@legendecas](https://github.com/legendecas))
|
||||
* Other
|
||||
* [#2680](https://github.com/open-telemetry/opentelemetry-js/pull/2680) fix: tracer typo in fetchxhr examples ([@MSNev](https://github.com/MSNev))
|
||||
* [#2650](https://github.com/open-telemetry/opentelemetry-js/pull/2650) fix: clientMethodTrace missing original properties ([@bgpo](https://github.com/bgpo))
|
||||
* `opentelemetry-propagator-jaeger`
|
||||
* [#2694](https://github.com/open-telemetry/opentelemetry-js/pull/2694) fix(propagator-jaeger): 0-pad span-id to match 16-symbol validation ([@nikolaylagutko](https://github.com/nikolaylagutko))
|
||||
* `opentelemetry-exporter-zipkin`, `opentelemetry-sdk-trace-web`
|
||||
* [#2689](https://github.com/open-telemetry/opentelemetry-js/pull/2689) fix: remove window and document dependencies in web packages ([@legendecas](https://github.com/legendecas))
|
||||
|
||||
### :books: (Refine Doc)
|
||||
|
||||
* Other
|
||||
* [#2830](https://github.com/open-telemetry/opentelemetry-js/pull/2830) Cleanup removed documentation for missing benchmarks ([@dmathieu](https://github.com/dmathieu))
|
||||
* [#2807](https://github.com/open-telemetry/opentelemetry-js/pull/2807) docs: document removal of shutdown flag in OTLPExporterBase ([@legendecas](https://github.com/legendecas))
|
||||
* [#2814](https://github.com/open-telemetry/opentelemetry-js/pull/2814) docs: simplify contrib part in readme ([@Flarna](https://github.com/Flarna))
|
||||
* [#2802](https://github.com/open-telemetry/opentelemetry-js/pull/2802) docs(prom-example): remove deprecated startServer option ([@naseemkullah](https://github.com/naseemkullah))
|
||||
* [#2728](https://github.com/open-telemetry/opentelemetry-js/pull/2728) docs: specify minimun version of npm to run command in subproject ([@cuichenli](https://github.com/cuichenli))
|
||||
* [#2720](https://github.com/open-telemetry/opentelemetry-js/pull/2720) docs: document node v10 EOL ([@YanivD](https://github.com/YanivD))
|
||||
* [#2688](https://github.com/open-telemetry/opentelemetry-js/pull/2688) docs: update typedoc config ([@dyladan](https://github.com/dyladan))
|
||||
* [#2685](https://github.com/open-telemetry/opentelemetry-js/pull/2685) docs: remove circle-ci from development guide, update link, and fix typo. ([@pichlermarc](https://github.com/pichlermarc))
|
||||
* [#2661](https://github.com/open-telemetry/opentelemetry-js/pull/2661) chore: update and fix tracer-web examples ([@MSNev](https://github.com/MSNev))
|
||||
* [#2647](https://github.com/open-telemetry/opentelemetry-js/pull/2647) chore: update opentelemetry dependencies to latest versions ([@svetlanabrennan](https://github.com/svetlanabrennan))
|
||||
* `exporter-trace-otlp-grpc`
|
||||
* [#2726](https://github.com/open-telemetry/opentelemetry-js/pull/2726) docs(otlp-grpc-exporter): update default url ([@svetlanabrennan](https://github.com/svetlanabrennan))
|
||||
* `opentelemetry-context-async-hooks`
|
||||
* [#2619](https://github.com/open-telemetry/opentelemetry-js/pull/2619) docs(context): Fix links, edit prose ([@spencerwilson](https://github.com/spencerwilson))
|
||||
* `opentelemetry-context-async-hooks`, `opentelemetry-sdk-trace-node`
|
||||
* [#2651](https://github.com/open-telemetry/opentelemetry-js/pull/2651) docs: fix links to the context document ([@legendecas](https://github.com/legendecas))
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* `opentelemetry-sdk-trace-base`
|
||||
* [#2768](https://github.com/open-telemetry/opentelemetry-js/pull/2768) test(sdk-trace-base): pin core.hrtime dependencies on timeOrigin ([@legendecas](https://github.com/legendecas))
|
||||
* `exporter-trace-otlp-http`, `opentelemetry-context-zone-peer-dep`, `opentelemetry-context-zone`, `opentelemetry-core`, `opentelemetry-exporter-zipkin`, `opentelemetry-propagator-b3`, `opentelemetry-resources`, `opentelemetry-sdk-trace-base`, `opentelemetry-sdk-trace-web`, `opentelemetry-semantic-conventions`
|
||||
* [#2765](https://github.com/open-telemetry/opentelemetry-js/pull/2765) chore: target to es2017 in the no-polyfill target ([@legendecas](https://github.com/legendecas))
|
||||
* Other
|
||||
* [#2743](https://github.com/open-telemetry/opentelemetry-js/pull/2743) test(sdk-metrics-base): test metric instrument interfaces ([@legendecas](https://github.com/legendecas))
|
||||
* [#2752](https://github.com/open-telemetry/opentelemetry-js/pull/2752) test(integration-w3c): fix inconsistent api versions loaded ([@legendecas](https://github.com/legendecas))
|
||||
* [#2715](https://github.com/open-telemetry/opentelemetry-js/pull/2715) chore: update actions/checkout to v2 ([@legendecas](https://github.com/legendecas))
|
||||
* [#2702](https://github.com/open-telemetry/opentelemetry-js/pull/2702) chore: add Chengzhong Wu as maintainer ([@dyladan](https://github.com/dyladan))
|
||||
* [#2703](https://github.com/open-telemetry/opentelemetry-js/pull/2703) chore: add Amir Blum as maintainer ([@dyladan](https://github.com/dyladan))
|
||||
* [#2701](https://github.com/open-telemetry/opentelemetry-js/pull/2701) chore: add Rauno Viskus as maintainer ([@dyladan](https://github.com/dyladan))
|
||||
* [#2693](https://github.com/open-telemetry/opentelemetry-js/pull/2693) chore: retry link checks on code 429 with 'retry-after' header ([@legendecas](https://github.com/legendecas))
|
||||
* [#2669](https://github.com/open-telemetry/opentelemetry-js/pull/2669) chore: checks links in typedoc html ([@legendecas](https://github.com/legendecas))
|
||||
* [#2683](https://github.com/open-telemetry/opentelemetry-js/pull/2683) chore: start a style guide ([@dyladan](https://github.com/dyladan))
|
||||
* [#2684](https://github.com/open-telemetry/opentelemetry-js/pull/2684) chore: remove @obecny as maintainer ([@dyladan](https://github.com/dyladan))
|
||||
* [#2663](https://github.com/open-telemetry/opentelemetry-js/pull/2663) chore: fix nojekyll in docs command ([@dyladan](https://github.com/dyladan))
|
||||
* [#2648](https://github.com/open-telemetry/opentelemetry-js/pull/2648) refactor(opentelemetry-sdk-node): remove redundant judgments for metric ([@rickyes](https://github.com/rickyes))
|
||||
* [#2638](https://github.com/open-telemetry/opentelemetry-js/pull/2638) chore: Update wip metrics references ([@dyladan](https://github.com/dyladan))
|
||||
* [#2629](https://github.com/open-telemetry/opentelemetry-js/pull/2629) chore: rename metrics packages to prevent lerna linking ([@dyladan](https://github.com/dyladan))
|
||||
* [#2623](https://github.com/open-telemetry/opentelemetry-js/pull/2623) chore: fix the compilation for typescript 4.4 ([@dyladan](https://github.com/dyladan))
|
||||
* [#2598](https://github.com/open-telemetry/opentelemetry-js/pull/2598) chore: Remove old metrics SDK ([@dyladan](https://github.com/dyladan))
|
||||
* `opentelemetry-core`
|
||||
* [#2709](https://github.com/open-telemetry/opentelemetry-js/pull/2709) test(sdk-metrics): browser compatibility tests ([@legendecas](https://github.com/legendecas))
|
||||
* `exporter-trace-otlp-grpc`, `exporter-trace-otlp-http`, `exporter-trace-otlp-proto`, `opentelemetry-exporter-jaeger`, `opentelemetry-exporter-zipkin`, `opentelemetry-propagator-b3`, `opentelemetry-resources`, `opentelemetry-sdk-trace-base`, `opentelemetry-sdk-trace-web`, `opentelemetry-semantic-conventions`
|
||||
* [#2710](https://github.com/open-telemetry/opentelemetry-js/pull/2710) chore: apply eslint rule semi ([@legendecas](https://github.com/legendecas))
|
||||
* `exporter-trace-otlp-grpc`, `exporter-trace-otlp-http`, `exporter-trace-otlp-proto`, `opentelemetry-context-async-hooks`, `opentelemetry-context-zone-peer-dep`, `opentelemetry-context-zone`, `opentelemetry-core`, `opentelemetry-exporter-jaeger`, `opentelemetry-exporter-zipkin`, `opentelemetry-propagator-b3`, `opentelemetry-propagator-jaeger`, `opentelemetry-resources`, `opentelemetry-sdk-trace-base`, `opentelemetry-sdk-trace-node`, `opentelemetry-sdk-trace-web`, `opentelemetry-semantic-conventions`, `opentelemetry-shim-opentracing`, `template`
|
||||
* [#2699](https://github.com/open-telemetry/opentelemetry-js/pull/2699) chore: rename `--include-filtered-dependencies` ([@Rauno56](https://github.com/Rauno56))
|
||||
* `opentelemetry-context-async-hooks`, `opentelemetry-context-zone-peer-dep`, `opentelemetry-context-zone`, `opentelemetry-core`, `opentelemetry-exporter-jaeger`, `opentelemetry-exporter-zipkin`, `opentelemetry-propagator-b3`, `opentelemetry-propagator-jaeger`, `opentelemetry-resources`, `opentelemetry-sdk-trace-base`, `opentelemetry-sdk-trace-node`, `opentelemetry-sdk-trace-web`, `opentelemetry-semantic-conventions`, `opentelemetry-shim-opentracing`
|
||||
* [#2657](https://github.com/open-telemetry/opentelemetry-js/pull/2657) chore: add markdown link checks ([@legendecas](https://github.com/legendecas))
|
||||
* `opentelemetry-exporter-jaeger`, `opentelemetry-exporter-zipkin`, `opentelemetry-resources`, `opentelemetry-semantic-conventions`
|
||||
* [#2652](https://github.com/open-telemetry/opentelemetry-js/pull/2652) Update nock ([@dyladan](https://github.com/dyladan))
|
||||
* `opentelemetry-sdk-trace-web`
|
||||
* [#2451](https://github.com/open-telemetry/opentelemetry-js/pull/2451) chore(sdk-trace-web): fix lint warnings ([@alisabzevari](https://github.com/alisabzevari))
|
||||
|
||||
### Committers: 24
|
||||
|
||||
* Ali Sabzevari ([@alisabzevari](https://github.com/alisabzevari))
|
||||
* Amir Blum ([@blumamir](https://github.com/blumamir))
|
||||
* Chris Karcher ([@chrskrchr](https://github.com/chrskrchr))
|
||||
* Damien Mathieu ([@dmathieu](https://github.com/dmathieu))
|
||||
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
|
||||
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna))
|
||||
* Marc Pichler ([@pichlermarc](https://github.com/pichlermarc))
|
||||
* Mitar Milanovic ([@Bataran](https://github.com/Bataran))
|
||||
* Nev ([@MSNev](https://github.com/MSNev))
|
||||
* Nikolay Lagutko ([@nikolaylagutko](https://github.com/nikolaylagutko))
|
||||
* Rauno Viskus ([@Rauno56](https://github.com/Rauno56))
|
||||
* Ricky Zhou ([@rickyes](https://github.com/rickyes))
|
||||
* Sebastian Poxhofer ([@secustor](https://github.com/secustor))
|
||||
* Siim Kallas ([@seemk](https://github.com/seemk))
|
||||
* Spencer Wilson ([@spencerwilson](https://github.com/spencerwilson))
|
||||
* Srikanth Chekuri ([@srikanthccv](https://github.com/srikanthccv))
|
||||
* Svetlana Brennan ([@svetlanabrennan](https://github.com/svetlanabrennan))
|
||||
* Will Li ([@cuichenli](https://github.com/cuichenli))
|
||||
* Yaniv Davidi ([@YanivD](https://github.com/YanivD))
|
||||
* [@bgpo](https://github.com/bgpo)
|
||||
* [@echoontheway](https://github.com/echoontheway)
|
||||
* [@naseemkullah](https://github.com/naseemkullah)
|
||||
* [@sschegolev](https://github.com/sschegolev)
|
||||
* legendecas ([@legendecas](https://github.com/legendecas))
|
||||
|
||||
## 1.0.1 / Experimental 0.27.0
|
||||
|
||||
### :boom: Breaking Change
|
||||
|
@ -1294,7 +2243,7 @@ No changes
|
|||
* `opentelemetry-api`, `opentelemetry-exporter-prometheus`, `opentelemetry-metrics`
|
||||
* [#1137](https://github.com/open-telemetry/opentelemetry-js/pull/1137) Batch observer ([@obecny](https://github.com/obecny))
|
||||
* `opentelemetry-exporter-collector`
|
||||
* [#1256](https://github.com/open-telemetry/opentelemetry-js/pull/1256) feat: [Collector Metric Exporter][1/x] Rename CollectorExporter to CollectorTraceExporter ([@davidwitten](https://github.com/davidwitten))
|
||||
* [#1256](https://github.com/open-telemetry/opentelemetry-js/pull/1256) feat: Collector Metric Exporter [1/x] Rename CollectorExporter to CollectorTraceExporter ([@davidwitten](https://github.com/davidwitten))
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
|
@ -1760,7 +2709,9 @@ Released 2020-03-19
|
|||
|
||||
Released 2020-03-16
|
||||
|
||||
### This is a first official beta release, which provides almost fully complete metrics, tracing, and context propagation functionality but makes no promises around breaking changes
|
||||
### First official beta release
|
||||
|
||||
* provides almost fully complete metrics, tracing, and context propagation functionality but makes **no promises** around breaking changes
|
||||
|
||||
### :boom: Breaking Change
|
||||
|
||||
|
|
214
CONTRIBUTING.md
214
CONTRIBUTING.md
|
@ -2,6 +2,25 @@
|
|||
|
||||
We'd love your help!
|
||||
|
||||
- [Development Quick Start](#development-quick-start)
|
||||
- [Pull Request Merge Guidelines](#pull-request-merge-guidelines)
|
||||
- [General Merge Requirements](#general-merge-requirements)
|
||||
- [Report a bug or requesting feature](#report-a-bug-or-requesting-feature)
|
||||
- [How to contribute](#how-to-contribute)
|
||||
- [Before you start](#before-you-start)
|
||||
- [Conventional commit](#conventional-commit)
|
||||
- [Changelog](#changelog)
|
||||
- [Fork](#fork)
|
||||
- [Development](#development)
|
||||
- [Tools used](#tools-used)
|
||||
- [Install dependencies](#install-dependencies)
|
||||
- [Compile modules](#compile-modules)
|
||||
- [Running tests](#running-tests)
|
||||
- [Linting](#linting)
|
||||
- [Generating docs](#generating-docs)
|
||||
- [Adding a package](#adding-a-package)
|
||||
- [Platform conditional exports](#platform-conditional-exports)
|
||||
|
||||
## Development Quick Start
|
||||
|
||||
To get the project started quickly, you can follow these steps. For more
|
||||
|
@ -10,11 +29,42 @@ detailed instructions, see [development](#development) below.
|
|||
```sh
|
||||
git clone https://github.com/open-telemetry/opentelemetry-js.git
|
||||
cd opentelemetry-js
|
||||
npm install
|
||||
npm ci
|
||||
npm run compile
|
||||
npm test
|
||||
npm run test
|
||||
```
|
||||
|
||||
## Pull Request Merge Guidelines
|
||||
|
||||
Most pull requests MAY be merged by an approver OR a maintainer provided they meet the following [General Merge Requirements](#general-merge-requirements).
|
||||
All requirements are at the discretion of the maintainers.
|
||||
Maintainers MAY merge pull requests which have not strictly met these requirements.
|
||||
Maintainers MAY close, block, or put on hold pull requests even if they have strictly met these requirements.
|
||||
|
||||
It is generally expected that a maintainer ([@open-telemetry/javascript-maintainers](https://github.com/orgs/open-telemetry/teams/javascript-maintainers)) should review and merge major changes.
|
||||
Some examples include, but are not limited to:
|
||||
|
||||
- API changes
|
||||
- Breaking changes
|
||||
- New modules
|
||||
- Changes which affect runtime support
|
||||
- New features which are not required by the specification
|
||||
|
||||
If a PR has not been interacted with by a reviewer within one week, please ping the approvers ([@open-telemetry/javascript-approvers](https://github.com/orgs/open-telemetry/teams/javascript-approvers)).
|
||||
|
||||
### General Merge Requirements
|
||||
|
||||
- No “changes requested” reviews by approvers, maintainers, technical committee members, or subject matter experts
|
||||
- No unresolved conversations
|
||||
- Approved by at least one maintainer OR by at least one approver who is not the approver merging the pull request
|
||||
- A pull request for small (simple typo, URL, update docs, or grammatical fix) changes may be approved and merged by the same approver
|
||||
- For plugins, exporters, and propagators approval of the original code module author, or a contributor who has done extensive work on the module, is preferred but not required
|
||||
- New or changed functionality is tested by unit tests
|
||||
- New or changed functionality is documented if appropriate
|
||||
- Substantial changes should not be merged within 24 hours of opening in order to allow reviewers from all time zones to have a chance to review
|
||||
|
||||
If all of the above requirements are met and there are no unresolved discussions, a pull request may be merged by either a maintainer or an approver.
|
||||
|
||||
## Report a bug or requesting feature
|
||||
|
||||
Reporting bugs is an important contribution. Please make sure to include:
|
||||
|
@ -29,21 +79,41 @@ Reporting bugs is an important contribution. Please make sure to include:
|
|||
### Before you start
|
||||
|
||||
Please read project contribution
|
||||
[guide](https://github.com/open-telemetry/community/blob/master/CONTRIBUTING.md)
|
||||
[guide](https://github.com/open-telemetry/community/blob/main/guides/contributor)
|
||||
for general practices for OpenTelemetry project.
|
||||
|
||||
#### Conventional commit
|
||||
|
||||
The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages. You can see examples [here](https://www.conventionalcommits.org/en/v1.0.0-beta.4/#examples).
|
||||
We use [commitlint](https://github.com/conventional-changelog/commitlint) and [husky](https://github.com/typicode/husky) to prevent bad commit message.
|
||||
For example, you want to submit the following commit message `git commit -s -am "my bad commit"`.
|
||||
You will receive the following error :
|
||||
|
||||
```text
|
||||
✖ type must be one of [ci, feat, fix, docs, style, refactor, perf, test, revert, chore] [type-enum]
|
||||
It is recommended to have your commit messages follow the Conventional Commits specification, with possible types listed in [.commitlint.rc.yml](.commitlintrc.yml). Here an example that uses the recommended format: `git commit -s -am "chore(opentelemetry-core): update deps"`
|
||||
|
||||
### Changelog
|
||||
|
||||
An entry into `CHANGELOG.md` or `experimental/CHANGELOG.md` is required for the following reasons:
|
||||
|
||||
- Changes made to the behaviour of the component
|
||||
- Changes to the configuration
|
||||
- Changes to default settings
|
||||
- New components being added
|
||||
|
||||
It is reasonable to omit an entry to the changelog under these circumstances:
|
||||
|
||||
- Updating test to remove flakiness or improve coverage
|
||||
- Updates to the CI/CD process
|
||||
|
||||
If there is some uncertainty with regards to if a changelog entry is needed, the recommendation is to create an entry to in the event that the change is important to the project consumers.
|
||||
If a change does not require a changelog entry, the label `"Skip Changelog"` may be applied.
|
||||
Pull requests with the `dependencies` label will be skipped by the changelog CI check.
|
||||
If the change affects the overall project and not any individual package, it should usually go in the main changelog.
|
||||
Changelog entries should be in the following format:
|
||||
|
||||
```md
|
||||
* feat(subject): pull request title here #{pull request number} @{author github handle}
|
||||
```
|
||||
|
||||
Here an exemple that will pass the verification: `git commit -s -am "chore(opentelemetry-core): update deps"`
|
||||
Subject should describe the area of the project that was changed as descriptively as is possible in a short space.
|
||||
For example, this may be the package name if a single package was updated or just `metrics` if both the metrics API and SDK are affected.
|
||||
|
||||
### Fork
|
||||
|
||||
|
@ -68,7 +138,7 @@ git merge upstream/main
|
|||
|
||||
Remember to always work in a branch of your local copy, as you might otherwise have to contend with conflicts in main.
|
||||
|
||||
Please also see [GitHub workflow](https://github.com/open-telemetry/community/blob/master/CONTRIBUTING.md#github-workflow) section of general project contributing guide.
|
||||
Please also see [GitHub workflow](https://github.com/open-telemetry/community/blob/main/guides/contributor/processes.md#github-workflow) section of general project contributing guide.
|
||||
|
||||
## Development
|
||||
|
||||
|
@ -78,17 +148,16 @@ Please also see [GitHub workflow](https://github.com/open-telemetry/community/bl
|
|||
- [TypeScript](https://www.typescriptlang.org/)
|
||||
- [lerna](https://github.com/lerna/lerna) to manage dependencies, compilations, and links between packages. Most lerna commands should be run by calling the provided npm scripts.
|
||||
- [MochaJS](https://mochajs.org/) for tests
|
||||
- [gts](https://github.com/google/gts)
|
||||
- [eslint](https://eslint.org/)
|
||||
|
||||
Most of the commands needed for development are accessed as [npm scripts](https://docs.npmjs.com/cli/v6/using-npm/scripts). It is recommended that you use the provided npm scripts instead of using `lerna run` in most cases.
|
||||
|
||||
### Install dependencies
|
||||
|
||||
This will install all dependencies for the root project and all modules managed by `lerna`. By default, a `postinstall` script will run `lerna bootstrap` automatically after an install. This can be avoided using the `--ignore-scripts` option if desired.
|
||||
This will install all dependencies for the root project and all modules managed by `npm workspaces`.
|
||||
|
||||
```sh
|
||||
npm install
|
||||
npm ci
|
||||
```
|
||||
|
||||
### Compile modules
|
||||
|
@ -107,6 +176,9 @@ npm run clean
|
|||
|
||||
These commands can also be run for specific packages instead of the whole project, which can speed up compilations while developing.
|
||||
|
||||
**NOTE**: To run commands in specific packages (compile, lint, etc), please ensure you are using at least `7.x`
|
||||
version of `npm`.
|
||||
|
||||
```sh
|
||||
# Build a single module and all of its dependencies
|
||||
cd packages/opentelemetry-module-name
|
||||
|
@ -124,6 +196,15 @@ cd packages/opentelemetry-module-name
|
|||
npm run watch
|
||||
```
|
||||
|
||||
#### TypeScript version & update policy
|
||||
|
||||
TypeScript version used to compile the pacakges is `v5.0.4`. If you plan to use any of the packages from this
|
||||
repository to make your own application or package instrumentation make sure to use same version or higher.
|
||||
|
||||
<!-- Ref: https://github.com/open-telemetry/opentelemetry-js/pull/5145#issuecomment-2518263890 -->
|
||||
As update policy OpenTelemetry JS will follow DefinitelyType's [support policy for TypeScript](https://github.com/DefinitelyTyped/DefinitelyTyped#support-window)
|
||||
which sets a support window of 2 years.
|
||||
|
||||
### Running tests
|
||||
|
||||
Similar to compilations, tests can be run from the root to run all tests or from a single module to run only the tests for that module.
|
||||
|
@ -137,9 +218,26 @@ cd packages/opentelemetry-module-name
|
|||
npm test
|
||||
```
|
||||
|
||||
To run the unit tests continuously in watch mode while developing, use:
|
||||
|
||||
```sh
|
||||
# Run test in watch mode
|
||||
npm run tdd
|
||||
```
|
||||
|
||||
Packages that are expected to run in the browser have browser specific tests:
|
||||
|
||||
```sh
|
||||
# Run browser-specific test
|
||||
npm run test:browser
|
||||
|
||||
# Run web worker test
|
||||
npm run test:webworker
|
||||
```
|
||||
|
||||
### Linting
|
||||
|
||||
This project uses a combination of `gts` and `eslint`. Just like tests and compilation, linting can be done for all packages or only a single package.
|
||||
This project uses `eslint` to lint source code. Just like tests and compilation, linting can be done for all packages or only a single package.
|
||||
|
||||
```sh
|
||||
# Lint all modules
|
||||
|
@ -161,52 +259,66 @@ cd packages/opentelemetry-module-name
|
|||
npm run lint:fix
|
||||
```
|
||||
|
||||
The default lint command will check majority of files, including Markdown files (such as README.md files), but you
|
||||
also have the option to check just the Markdown files with:
|
||||
|
||||
```sh
|
||||
npm run lint:markdown
|
||||
npm run lint:markdown:fix # can automatically fix some Markdown rules
|
||||
```
|
||||
|
||||
The default command doesn't check the examples folder. To lint just the examples, use the script:
|
||||
|
||||
```sh
|
||||
npm run lint:examples
|
||||
npm run lint:examples:fix # can automatically fix some errors
|
||||
```
|
||||
|
||||
### Generating docs
|
||||
|
||||
We use [typedoc](https://www.npmjs.com/package/typedoc) to generate the api documentation.
|
||||
|
||||
To generate the docs, use:
|
||||
|
||||
```sh
|
||||
# Generate docs in the root 'docs' directory
|
||||
npm run docs
|
||||
```
|
||||
|
||||
The document will be available under `docs` path.
|
||||
|
||||
### Adding a package
|
||||
|
||||
To add a new package, copy `packages/template` to your new package directory and modify the `package.json` file to reflect your desired package settings. If the package will not support browser, the `karma.conf` and `tsconifg.esm.json` files may be deleted. If the package will support es5 targets, the reference to `tsconfig.base.json` in `tsconfig.json` should be changed to `tsconfig.es5.json`.
|
||||
|
||||
After adding the package, run `npm install` from the root of the project. This will update the `tsconfig.json` project references automatically and install all dependencies in your new package. For packages supporting browser, file `tsconfig.esm.json` needs to be manually updated to include reference to ES modules build.
|
||||
|
||||
### Guidelines for Pull Requests
|
||||
### Platform conditional exports
|
||||
|
||||
- Typically we try to turn around reviews within one to two business days.
|
||||
- It is generally expected that a maintainer ([@open-telemetry/javascript-maintainers](https://github.com/orgs/open-telemetry/teams/javascript-maintainers)) should review and merge every PR.
|
||||
- If a change has met the requirements listed below, an approver may also merge the pull request.
|
||||
- Most PRs should be merged in one to two weeks.
|
||||
- If a PR is taking longer than 30 days, please ping the approvers ([@open-telemetry/javascript-approvers](https://github.com/orgs/open-telemetry/teams/javascript-approvers)) as it may have been lost
|
||||
- Dependency upgrades and Security fixes: This PR is small and/or low-risk and can be merged with only maintainer reviews.
|
||||
- If your patch is not getting reviewed or you need a specific person to review it, you can @username or @open-telemetry/javascript-approvers a reviewer asking for a review in the pull request.
|
||||
- API changes, breaking changes, or large changes will be subject to more scrutiny and may require more reviewers. These PRs should only be merged by maintainers.
|
||||
- Changes to existing plugins and exporters will typically require the approval of the original plugin/exporter author.
|
||||
Universal packages are packages that can be used in both web browsers and
|
||||
Node.js environment. These packages may be implemented on top of different
|
||||
platform APIs to achieve the same goal. Like accessing the _global_ reference,
|
||||
we have different preferred ways to do it:
|
||||
|
||||
### General Merge Requirements
|
||||
- In Node.js, we access the _global_ reference with `globalThis` or `global`:
|
||||
|
||||
- All requirements are at the discretion of the maintainers.
|
||||
- Maintainers may merge pull requests which have not strictly met these requirements.
|
||||
- Maintainers may close, block, or put on hold pull requests even if they have strictly met these requirements.
|
||||
- No “changes requested” reviews.
|
||||
- No unresolved conversations.
|
||||
- 3 approvals, including the approvals of at least 2 maintainers
|
||||
- A pull request opened by an approver may be merged with only the 2 maintainer reviews.
|
||||
- Small (simple typo, URL, update docs, or grammatical fix) or high-priority changes may be merged more quickly or with fewer reviewers at the discretion of the maintainers. This is typically indicated with the express label.
|
||||
- For plugins, exporters, and propagators approval of the original code module author is preferred but not required.
|
||||
- New or changed functionality is tested by unit tests.
|
||||
- New or changed functionality is documented.
|
||||
- Substantial changes should not be merged within 24 hours of opening in order to allow reviewers from all time zones to have a chance to review.
|
||||
```js
|
||||
/// packages/opentelemetry-core/src/platform/node/globalThis.ts
|
||||
export const _globalThis = typeof globalThis === 'object' ? globalThis : global;
|
||||
```
|
||||
|
||||
If all of the above requirements are met and there are no unresolved discussions, a pull request may be merged by either a maintainer or an approver.
|
||||
- In web browser, we access the _global_ reference with the following definition:
|
||||
|
||||
### Generating API documentation
|
||||
```js
|
||||
/// packages/opentelemetry-core/src/platform/browser/globalThis.ts
|
||||
export const _globalThis: typeof globalThis =
|
||||
typeof globalThis === 'object' ? globalThis :
|
||||
typeof self === 'object' ? self :
|
||||
typeof window === 'object' ? window :
|
||||
typeof global === 'object' ? global :
|
||||
{} as typeof globalThis;
|
||||
```
|
||||
|
||||
- `npm run docs` to generate API documentation. Generates the documentation in `packages/opentelemetry-api/docs/out`
|
||||
|
||||
### Generating CHANGELOG documentation
|
||||
|
||||
- Generate and export your [Github access token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token): `export GITHUB_AUTH=<your_token>`
|
||||
- `npm run changelog` to generate CHANGELOG documentation in your terminal (see [RELEASING.md](RELEASING.md) for more details).
|
||||
|
||||
### Benchmarks
|
||||
|
||||
When two or more approaches must be compared, please write a benchmark in the benchmark/index.js module so that we can keep track of the most efficient algorithm.
|
||||
|
||||
- `npm run bench` to run your benchmark.
|
||||
Even though the implementation may differ, the exported names must be aligned.
|
||||
It can be confusing if exported names present in one environment but not in the
|
||||
others.
|
||||
|
|
580
README.md
580
README.md
|
@ -2,11 +2,9 @@
|
|||
---
|
||||
<p align="center">
|
||||
<strong>
|
||||
<a href="https://opentelemetry.io/docs/js/getting-started/">Getting Started</a>
|
||||
<a href="https://opentelemetry.io/docs/languages/js/getting-started/">Getting Started</a>
|
||||
•
|
||||
<a href="https://open-telemetry.github.io/opentelemetry-js-api">API Reference</a>
|
||||
•
|
||||
<a href="https://open-telemetry.github.io/opentelemetry-js">SDK Reference</a>
|
||||
<a href="https://open-telemetry.github.io/opentelemetry-js">API and SDK Reference</a>
|
||||
</strong>
|
||||
</p>
|
||||
|
||||
|
@ -21,8 +19,8 @@
|
|||
<img alt="license" src="https://img.shields.io/badge/license-Apache_2.0-green.svg?style=for-the-badge">
|
||||
</a>
|
||||
<br/>
|
||||
<a href="https://circleci.com/gh/open-telemetry/opentelemetry-js">
|
||||
<img alt="Build Status" src="https://circleci.com/gh/open-telemetry/opentelemetry-js.svg?style=shield">
|
||||
<a href="https://github.com/open-telemetry/opentelemetry-js/actions">
|
||||
<img alt="Build Status" src="https://github.com/open-telemetry/opentelemetry-js/actions/workflows/unit-test.yml/badge.svg?style=shield">
|
||||
</a>
|
||||
<img alt="Beta" src="https://img.shields.io/badge/status-beta-informational?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAACQAAAAAQAAAJAAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAABigAwAEAAAAAQAAABgAAAAA8A2UOAAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAABK5JREFUSA2dVm1sFEUYfmd2b/f2Pkqghn5eEQWKrRgjpkYgpoRCLC0oxV5apAiGUDEpJvwxEQ2raWPU+Kf8INU/RtEedwTCR9tYPloxGNJYTTQUwYqJ1aNpaLH3sXu3t7vjvFevpSqt7eSyM+/czvM8877PzB3APBoLgoDLsNePF56LBwqa07EKlDGg84CcWsI4CEbhNnDpAd951lXE2NkiNknCCTLv4HtzZuvPm1C/IKv4oDNXqNDHragety2XVzjECZsJARuBMyRzJrh1O0gQwLXuxofxsPSj4hG8fMLQo7bl9JJD8XZfC1E5yWFOMtd07dvX5kDwg6+2++Chq8txHGtfPoAp0gOFmhYoNFkHjn2TNUmrwRdna7W1QSkU8hvbGk4uThLrapaiLA2E6QY4u/lS9ItHfvJkxYsTMVtnAJLipYIWtVrcdX+8+b8IVnPl/R81prbuPZ1jpYw+0aEUGSkdFsgyBIaFTXCm6nyaxMtJ4n+TeDhJzGqZtQZcuYDgqDwDbqb0JF9oRpIG1Oea3bC1Y6N3x/WV8Zh83emhCs++hlaghDw+8w5UlYKq2lU7Pl8IkvS9KDqXmKmEwdMppVPKwGSEilmyAwJhRwWcq7wYC6z4wZ1rrEoMWxecdOjZWXeAQClBcYDN3NwVwD9pGwqUSyQgclcmxpNJqCuwLmDh3WtvPqXdlt+6Oz70HPGDNSNBee/EOen+rGbEFqDENBPDbtdCp0ukPANmzO0QQJYUpyS5IJJI3Hqt4maS+EB3199ozm8EDU/6fVNU2dQpdx3ZnKzeFXyaUTiasEV/gZMzJMjr3Z+WvAdQ+hs/zw9savimxUntDSaBdZ2f+Idbm1rlNY8esFffBit9HtK5/MejsrJVxikOXlb1Ukir2X+Rbdkd1KG2Ixfn2Ql4JRmELnYK9mEM8G36fAA3xEQ89fxXihC8q+sAKi9jhHxNqagY2hiaYgRCm0f0QP7H4Fp11LSXiuBY2aYFlh0DeDIVVFUJQn5rCnpiNI2gvLxHnASn9DIVHJJlm5rXvQAGEo4zvKq2w5G1NxENN7jrft1oxMdekETjxdH2Z3x+VTVYsPb+O0C/9/auN6v2hNZw5b2UOmSbG5/rkC3LBA+1PdxFxORjxpQ81GcxKc+ybVjEBvUJvaGJ7p7n5A5KSwe4AzkasA+crmzFtowoIVTiLjANm8GDsrWW35ScI3JY8Urv83tnkF8JR0yLvEt2hO/0qNyy3Jb3YKeHeHeLeOuVLRpNF+pkf85OW7/zJxWdXsbsKBUk2TC0BCPwMq5Q/CPvaJFkNS/1l1qUPe+uH3oD59erYGI/Y4sce6KaXYElAIOLt+0O3t2+/xJDF1XvOlWGC1W1B8VMszbGfOvT5qaRRAIFK3BCO164nZ0uYLH2YjNN8thXS2v2BK9gTfD7jHVxzHr4roOlEvYYz9QIz+Vl/sLDXInsctFsXjqIRnO2ZO387lxmIboLDZCJ59KLFliNIgh9ipt6tLg9SihpRPDO1ia5byw7de1aCQmF5geOQtK509rzfdwxaKOIq+73AvwCC5/5fcV4vo3+3LpMdtWHh0ywsJC/ZGoCb8/9D8F/ifgLLl8S8QWfU8cAAAAASUVORK5CYII=">
|
||||
</p>
|
||||
|
@ -31,10 +29,6 @@
|
|||
<strong>
|
||||
<a href="https://github.com/open-telemetry/opentelemetry-js/blob/main/CONTRIBUTING.md">Contributing</a>
|
||||
•
|
||||
<a href="https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/development-guide.md">Development Guide</a>
|
||||
•
|
||||
<a href="https://github.com/open-telemetry/opentelemetry-js/blob/main/benchmark/README.md">Benchmarks</a>
|
||||
•
|
||||
<a href="https://github.com/open-telemetry/opentelemetry-js/tree/main/examples">Examples</a>
|
||||
</strong>
|
||||
</p>
|
||||
|
@ -43,39 +37,20 @@
|
|||
|
||||
## About this project
|
||||
|
||||
This is the JavaScript version of [OpenTelemetry](https://opentelemetry.io/), a framework for collecting traces and metrics from applications.
|
||||
This is the JavaScript version of [OpenTelemetry](https://opentelemetry.io/), a framework for collecting traces, metrics, and logs from applications.
|
||||
|
||||
## Compatibility Matrix
|
||||
## Quick Start
|
||||
|
||||
| API Version | Core version | Experimental Packages | Contrib Version |
|
||||
| ----------- |--------------| --------------------- |-------------------------|
|
||||
| 1.0.x | 1.x | 0.26.x | 0.26.x |
|
||||
| 1.0.x | 0.26.x | ----- | ------ |
|
||||
| 1.0.x | 0.25.x | ----- | ------ |
|
||||
| 1.0.x | 0.24.x | ----- | 0.24.x |
|
||||
| 1.0.x | 0.23.x | ----- | 0.23.x |
|
||||
| 1.0.x | 0.22.x | ----- | 0.22.x |
|
||||
| 0.21.x | 0.21.x | ----- | 0.21.x |
|
||||
| 0.20.x | 0.20.x | ----- | 0.20.x |
|
||||
| v1.0.0-rc.3 | 0.19.x | ----- | 0.16.x |
|
||||
| 0.18.x | 0.18.x | ----- | 0.14.x |
|
||||
| | 0.17.x | ----- | ------ |
|
||||
| | 0.16.x | ----- | ------ |
|
||||
| | 0.15.x | ----- | 0.13.x |
|
||||
| | 0.14.x | ----- | 0.12.x |
|
||||
| | 0.13.x | ----- | ------ |
|
||||
| | 0.12.x | ----- | 0.11.x |
|
||||
| | 0.11.x | ----- | 0.10.x |
|
||||
**Much of OpenTelemetry JS documentation is written assuming the compiled application is run as CommonJS.**
|
||||
For more details on ECMAScript Modules vs CommonJS, refer to [esm-support](https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/esm-support.md).
|
||||
|
||||
## Versioning
|
||||
The following describes how to set up tracing for a basic web application.
|
||||
For more detailed documentation, see the website at <https://opentelemetry.io/docs/instrumentation/js/>.
|
||||
|
||||
The current version for each package can be found in the respective `package.json` file for that module. For additional details see the [versioning and stability][spec-versioning] document in the specification.
|
||||
### Installation
|
||||
|
||||
## Quick start
|
||||
|
||||
### Application Owner
|
||||
|
||||
#### Install Dependencies
|
||||
Dependencies with the `latest` tag on NPM should be compatible with each other.
|
||||
See the [version compatibility matrix](#package-version-compatibility) below for more information.
|
||||
|
||||
```shell
|
||||
npm install --save @opentelemetry/api
|
||||
|
@ -85,7 +60,7 @@ npm install --save @opentelemetry/auto-instrumentations-node
|
|||
|
||||
**Note:** `auto-instrumentations-node` is a meta package from [opentelemetry-js-contrib](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/metapackages/auto-instrumentations-node) that provides a simple way to initialize multiple Node.js instrumentations.
|
||||
|
||||
#### Instantiate Tracing
|
||||
### Set up Tracing
|
||||
|
||||
```js
|
||||
// tracing.js
|
||||
|
@ -96,15 +71,15 @@ const process = require('process');
|
|||
const opentelemetry = require('@opentelemetry/sdk-node');
|
||||
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
||||
const { ConsoleSpanExporter } = require('@opentelemetry/sdk-trace-base');
|
||||
const { Resource } = require('@opentelemetry/resources');
|
||||
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
|
||||
const { resourceFromAttributes } = require('@opentelemetry/resources');
|
||||
const { ATTR_SERVICE_NAME } = require('@opentelemetry/semantic-conventions');
|
||||
|
||||
// configure the SDK to export telemetry data to the console
|
||||
// enable all auto-instrumentations from the meta package
|
||||
const traceExporter = new ConsoleSpanExporter();
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
resource: new Resource({
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: 'my-service',
|
||||
resource: resourceFromAttributes({
|
||||
[ATTR_SERVICE_NAME]: 'my-service',
|
||||
}),
|
||||
traceExporter,
|
||||
instrumentations: [getNodeAutoInstrumentations()]
|
||||
|
@ -112,9 +87,7 @@ const sdk = new opentelemetry.NodeSDK({
|
|||
|
||||
// initialize the SDK and register with the OpenTelemetry API
|
||||
// this enables the API to record telemetry
|
||||
sdk.start()
|
||||
.then(() => console.log('Tracing initialized'))
|
||||
.catch((error) => console.log('Error initializing tracing', error));
|
||||
sdk.start();
|
||||
|
||||
// gracefully shut down the SDK on process exit
|
||||
process.on('SIGTERM', () => {
|
||||
|
@ -125,47 +98,121 @@ process.on('SIGTERM', () => {
|
|||
});
|
||||
```
|
||||
|
||||
#### Run Your Application
|
||||
### Run Your Application
|
||||
|
||||
```shell
|
||||
node -r ./tracing.js app.js
|
||||
```
|
||||
|
||||
The above example will emit auto-instrumented telemetry about your Node.js application to the console. For a more in-depth example, see the [Getting Started Guide](https://opentelemetry.io/docs/js/getting-started/). For more information about automatic instrumentation see [@opentelemetry/sdk-trace-node][otel-node], which provides auto-instrumentation for Node.js applications. If the automatic instrumentation does not suit your needs, or you would like to create manual traces, see [@opentelemetry/sdk-trace-base][otel-tracing]
|
||||
The above example will emit auto-instrumented telemetry about your Node.js application to the console. For a more in-depth example, see the [Getting Started Guide](https://opentelemetry.io/docs/languages/js/getting-started/). For more information about automatic instrumentation see [@opentelemetry/sdk-trace-node][otel-node], which provides auto-instrumentation for Node.js applications. If the automatic instrumentation does not suit your needs, or you would like to create manual traces, see [@opentelemetry/sdk-trace-base][otel-tracing]
|
||||
|
||||
### Library Author
|
||||
## Library Author
|
||||
|
||||
If you are a library author looking to build OpenTelemetry into your library, please see [the documentation][docs]. As a library author, it is important that you only depend on properties and methods published on the public API. If you use any properties or methods from the SDK that are not officially a part of the public API, your library may break if an [Application Owner](#application-owner) uses a different SDK implementation.
|
||||
If you are a library author looking to build OpenTelemetry into your library, please see [the documentation][docs]. As a library author, it is important that you only depend on properties and methods published on the public API. If you use any properties or methods from the SDK that are not officially a part of the public API, your library may break if an application owner uses a different SDK implementation.
|
||||
|
||||
## Supported Runtimes
|
||||
|
||||
| Platform Version | Supported |
|
||||
|------------------|-------------------------------------------------|
|
||||
| Node.JS `v16` | ✅ |
|
||||
| Node.JS `v14` | ✅ |
|
||||
| Node.JS `v12` | ✅ |
|
||||
| Node.JS `v10` | ✅ |
|
||||
| Node.JS `v8` | See [Node Support](#node-support) below |
|
||||
| Web Browsers | ✅ See [Browser Support](#browser-support) below |
|
||||
| Platform Version | Supported |
|
||||
| ------------------- | --------------------------------------------- |
|
||||
| Node.JS `v22` | :heavy_check_mark: |
|
||||
| Node.JS `v20` | :heavy_check_mark: |
|
||||
| Node.JS `v18` | :heavy_check_mark: |
|
||||
| Older Node Versions | See [Node Support](#node-support) |
|
||||
| Web Browsers | See [Browser Support](#browser-support) below |
|
||||
|
||||
### Node Support
|
||||
|
||||
Automated tests are run using the latest release of each currently active version of Node.JS.
|
||||
While Node.JS v8 is no longer supported by the Node.JS team, the latest version of Node.JS v8 is still included in our testing suite.
|
||||
Please note that versions of Node.JS v8 prior to `v8.5.0` will NOT work, because OpenTelemetry Node depends on the `perf_hooks` module introduced in `v8.5.0`
|
||||
Only Node.js Active or Maintenance LTS versions are supported.
|
||||
Previous versions of node *may* work, but they are not tested by OpenTelemetry and they are not guaranteed to work.
|
||||
|
||||
### Browser Support
|
||||
|
||||
Automated browser tests are run in the latest version of Headless Chrome.
|
||||
There is currently no list of officially supported browsers, but OpenTelemetry is developed using standard web technologies with wide support and should work in currently supported versions of major browsers.
|
||||
> [!IMPORTANT]
|
||||
> Client instrumentation for the browser is **experimental** and mostly **unspecified**. If you are interested in
|
||||
> helping out, get in touch with the [Client Instrumentation SIG][client-instrumentation-sig].
|
||||
|
||||
Rather than define versions of specific browsers / runtimes, OpenTelemetry sets the minimum supported version based on the
|
||||
underlying language features used.
|
||||
|
||||
The current minumum language feature support is set as [ECMAScript 2022](https://262.ecma-international.org/13.0/) that are available
|
||||
in all modern browsers / runtimes.
|
||||
|
||||
This means that if you are targeting or your end-users are using a browser / runtime that does not support ES2022, you will need
|
||||
to transpile the code and provide any necessary polyfills for the missing features to ensure compatibility with your target
|
||||
environments. Any support issues that arise from using a browser or runtime that does not support ES2022 will be closed as "won't fix".
|
||||
|
||||
This minimum support level is subject to change as the project evolves and as the underlying language features evolve.
|
||||
|
||||
## TypeScript Support
|
||||
|
||||
OpenTelemetry JavaScript is built with TypeScript `v5.0.4`. If you have a TypeScript project (app, library, instrumentation, etc.)
|
||||
that depends on it, we recommend using same or higher version to compile the project.
|
||||
|
||||
OpenTelemetry JavaScript will follows DefinitelyType's [support policy for TypeScript](https://github.com/DefinitelyTyped/DefinitelyTyped#support-window) which sets a support window of 2 years. Support for TypeScript versions older than 2 years will be dropped in minor releases of OpenTelemetry JavaScript.
|
||||
|
||||
## Package Version Compatibility
|
||||
|
||||
OpenTelemetry is released as a set of distinct packages in 3 categories: API, stable SDK, and experimental.
|
||||
The API is located at [/api](/api/), the stable SDK packages are in the [/packages](/packages/) directory, and the experimental packages are listed in the [/experimental/packages](/experimental/packages/) directory.
|
||||
There may also be API packages for experimental signals in the experimental directory.
|
||||
All stable packages are released with the same version, and all experimental packages are released with the same version.
|
||||
The below table describes which versions of each set of packages are expected to work together.
|
||||
|
||||
| Stable Packages | Experimental Packages |
|
||||
|-----------------|-----------------------|
|
||||
| 2.0.x | 0.200.x |
|
||||
| 1.30.x | 0.57.x |
|
||||
| 1.29.x | 0.56.x |
|
||||
| 1.28.x | 0.55.x |
|
||||
| 1.27.x | 0.54.x |
|
||||
| 1.25.x | 0.52.x |
|
||||
|
||||
<details>
|
||||
<summary>Older version compatibility matrix</summary>
|
||||
|
||||
<table>
|
||||
<tr><th>Stable Packages</th> <th>Experimental Packages</th></tr>
|
||||
<tr><td>1.24.x</td> <td>0.51.x</td></tr>
|
||||
<tr><td>1.23.x</td> <td>0.50.x</td></tr>
|
||||
<tr><td>1.22.x</td> <td>0.49.x</td></tr>
|
||||
<tr><td>1.21.x</td> <td>0.48.x</td></tr>
|
||||
<tr><td>1.20.x</td> <td>0.47.x</td></tr>
|
||||
<tr><td>1.19.x</td> <td>0.46.x</td></tr>
|
||||
<tr><td>1.18.x</td> <td>0.45.x</td></tr>
|
||||
<tr><td>1.17.x</td> <td>0.43.x, 0.44.x</td></tr>
|
||||
<tr><td>1.16.x</td> <td>0.42.x</td></tr>
|
||||
<tr><td>1.15.x</td> <td>0.41.x</td></tr>
|
||||
<tr><td>1.14.x</td> <td>0.40.x</td></tr>
|
||||
<tr><td>1.13.x</td> <td>0.39.x</td></tr>
|
||||
<tr><td>1.12.x</td> <td>0.38.x</td></tr>
|
||||
<tr><td>1.11.x</td> <td>0.37.x</td></tr>
|
||||
<tr><td>1.10.x</td> <td>0.36.x</td></tr>
|
||||
<tr><td>1.9.x</td> <td>0.35.x</td></tr>
|
||||
<tr><td>1.8.x (this and later versions require API >=1.3.0 for metrics)</td><td>0.34.x</td></tr>
|
||||
<tr><td>1.7.x</td> <td>0.33.x</td></tr>
|
||||
<tr><td>1.6.x</td> <td>0.32.x</td></tr>
|
||||
<tr><td>1.5.x</td> <td>0.31.x</td></tr>
|
||||
<tr><td>1.4.x</td> <td>0.30.x</td></tr>
|
||||
<tr><td>1.3.x</td> <td>0.29.x</td></tr>
|
||||
<tr><td>1.2.x</td> <td>0.29.x</td></tr>
|
||||
<tr><td>1.1.x</td> <td>0.28.x</td></tr>
|
||||
<tr><td>1.0.x</td> <td>0.27.x</td></tr>
|
||||
<tr><td>1.0.x (this and later versions require API >=1.0.0 for traces)</td><td>0.26.x</td></tr>
|
||||
</table>
|
||||
|
||||
</details>
|
||||
|
||||
## Versioning
|
||||
|
||||
The current version for each package can be found in the respective `package.json` file for that module. For additional details see the [versioning and stability][spec-versioning] document in the specification.
|
||||
|
||||
## Feature Status
|
||||
|
||||
| Signal | API Status | SDK Status |
|
||||
|---------|-------------|-------------------|
|
||||
| Tracing | Stable | Release Candidate |
|
||||
| Metrics | Development | Development |
|
||||
| Logs | Roadmap | Roadmap |
|
||||
| Signal | API Status | SDK Status |
|
||||
| ------- | ----------- | ----------- |
|
||||
| Tracing | Stable | Stable |
|
||||
| Metrics | Stable | Stable |
|
||||
| Logs | Development | Development |
|
||||
|
||||
For a more detailed breakdown of feature support see the [specification compliance matrix][compliance-matrix].
|
||||
|
||||
|
@ -174,62 +221,108 @@ For a more detailed breakdown of feature support see the [specification complian
|
|||
We'd love your help!. Use tags [up-for-grabs][up-for-grabs-issues] and
|
||||
[good first issue][good-first-issues] to get started with the project. For
|
||||
instructions to build and make changes to this project, see the
|
||||
[CONTRIBUTING](CONTRIBUTING.md) guide.
|
||||
[CONTRIBUTING][CONTRIBUTING] guide.
|
||||
|
||||
We have a weekly SIG meeting! See the [community page](https://github.com/open-telemetry/community#javascript-sdk) for meeting details and notes.
|
||||
|
||||
Approvers ([@open-telemetry/js-approvers](https://github.com/orgs/open-telemetry/teams/javascript-approvers)):
|
||||
### Maintainers
|
||||
|
||||
- [Chengzhong Wu](https://github.com/legendecas), Alibaba
|
||||
- [Gerhard Stöbich](https://github.com/Flarna), Dynatrace
|
||||
- [John Bley](https://github.com/johnbley), Splunk
|
||||
- [Mark Wolff](https://github.com/markwolff), Microsoft
|
||||
- [Matthew Wear](https://github.com/mwear), LightStep
|
||||
- [Naseem K. Ullah](https://github.com/naseemkullah), Transit
|
||||
- [Neville Wylie](https://github.com/MSNev), Microsoft
|
||||
- [Olivier Albertini](https://github.com/OlivierAlbertini), Ville de Montréal
|
||||
- [Rauno Viskus](https://github.com/Rauno56), Splunk
|
||||
|
||||
*Find more about the approver role in [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md#approver).*
|
||||
|
||||
Maintainers ([@open-telemetry/js-maintainers](https://github.com/orgs/open-telemetry/teams/javascript-maintainers)):
|
||||
|
||||
- [Bartlomiej Obecny](https://github.com/obecny), LightStep
|
||||
- [Amir Blum](https://github.com/blumamir), Odigos
|
||||
- [Chengzhong Wu](https://github.com/legendecas), Bloomberg
|
||||
- [Daniel Dyla](https://github.com/dyladan), Dynatrace
|
||||
- [Valentin Marchaud](https://github.com/vmarchaud), Open Source Contributor
|
||||
- [Jamie Danielson](https://github.com/JamieDanielson), Honeycomb
|
||||
- [Marc Pichler](https://github.com/pichlermarc), Dynatrace
|
||||
- [Trent Mick](https://github.com/trentm), Elastic
|
||||
|
||||
*Find more about the maintainer role in [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md#maintainer).*
|
||||
For more information about the maintainer role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer).
|
||||
|
||||
### Thanks to all the people who already contributed
|
||||
### Approvers
|
||||
|
||||
- [David Luna](https://github.com/david-luna), Elastic
|
||||
- [Hector Hernandez](https://github.com/hectorhdzg), Microsoft
|
||||
- [Martin Kuba](https://github.com/martinkuba), Lightstep
|
||||
- [Marylia Gutierrez](https://github.com/maryliag), Grafana Labs
|
||||
- [Matthew Wear](https://github.com/mwear), LightStep
|
||||
- [Neville Wylie](https://github.com/MSNev), Microsoft
|
||||
- [Purvi Kanal](https://github.com/pkanal), Honeycomb
|
||||
- [Svetlana Brennan](https://github.com/svetlanabrennan), New Relic
|
||||
|
||||
For more information about the approver role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver).
|
||||
|
||||
### Triagers
|
||||
|
||||
Members of this team have triager permissions for opentelemetry-js.git and opentelemetry-js-contrib.git.
|
||||
|
||||
- [Jackson Weber](https://github.com/JacksonWeber), Microsoft
|
||||
|
||||
For more information about the triager role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#triager).
|
||||
|
||||
### Contrib Triagers
|
||||
|
||||
Members of this team have triager permissions for opentelemetry-js-contrib.git.
|
||||
Typically, members of this are [component owners](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/.github/component_owners.yml) of one or more packages in the contrib repo.
|
||||
|
||||
- [Aaron Abbott](https://github.com/aabmass), Google
|
||||
- [Abhinav Mathur](https://github.com/abhee11), AppDynamics
|
||||
- [Bartlomiej Obecny](https://github.com/obecny)
|
||||
- [Daniel Li](https://github.com/d4nyll)
|
||||
- [Florencia Acosta](https://github.com/facostaembrace), Embrace
|
||||
- [Jackson Weber](https://github.com/JacksonWeber), Microsoft
|
||||
- [Jaryk](https://github.com/Ugzuzg), Volvo Cars
|
||||
- [Jonathan Lee](https://github.com/jj22ee)
|
||||
- [Jonathan Munz](https://github.com/jpmunz), Embrace
|
||||
- [kirrg001](https://github.com/kirrg001), Instana
|
||||
- [MartenH](https://github.com/mhennoch), Splunk
|
||||
- [Mike Goldsmith](https://github.com/MikeGoldsmith), Honeycomb
|
||||
- [Motti](https://github.com/mottibec)
|
||||
- [Punya Biswal](https://github.com/punya), Google
|
||||
- [Siim Kallas](https://github.com/seemk), Splunk
|
||||
- [t2t2](https://github.com/t2t2), Splunk
|
||||
- [Trivikram Kamat](https://github.com/trivikr), AWS
|
||||
|
||||
For more information about the triager role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#triager).
|
||||
|
||||
### Emeriti
|
||||
|
||||
- [Bartlomiej Obecny](https://github.com/obecny), Maintainer
|
||||
- [Brandon Gonzalez](https://github.com/bg451), Approver
|
||||
- [Daniel Khan](https://github.com/dkhan), Maintainer
|
||||
- [Gerhard Stöbich](https://github.com/Flarna), Approver
|
||||
- [Haddas Bronfman](https://github.com/haddasbronfman), Approver
|
||||
- [John Bley](https://github.com/johnbley), Approver
|
||||
- [Mark Wolff](https://github.com/markwolff), Approver
|
||||
- [Mayur Kale](https://github.com/mayurkale22), Maintainer
|
||||
- [Naseem K. Ullah](https://github.com/naseemkullah), Approver
|
||||
- [Olivier Albertini](https://github.com/OlivierAlbertini), Approver
|
||||
- [Rauno Viskus](https://github.com/rauno56), Maintainer
|
||||
- [Roch Devost](https://github.com/rochdev), Approver
|
||||
- [Valentin Marchaud](https://github.com/vmarchaud), Maintainer
|
||||
|
||||
For more information about the emeritus role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager).
|
||||
|
||||
### Thanks to all of our contributors!
|
||||
|
||||
<a href="https://github.com/open-telemetry/opentelemetry-js/graphs/contributors">
|
||||
<img src="https://contributors-img.web.app/image?repo=open-telemetry/opentelemetry-js" />
|
||||
<img alt="Repo contributors" src="https://contrib.rocks/image?repo=open-telemetry/opentelemetry-js" />
|
||||
</a>
|
||||
|
||||
### Thanks to all previous approvers and maintainers
|
||||
|
||||
- [Daniel Khan](https://github.com/dkhan), Dynatrace, Maintainer
|
||||
- [Mayur Kale](https://github.com/mayurkale22), Google, Maintainer
|
||||
- [Brandon Gonzalez](https://github.com/bg451), LightStep, Approver
|
||||
- [Roch Devost](https://github.com/rochdev), DataDog, Approver
|
||||
|
||||
## Packages
|
||||
|
||||
### API
|
||||
|
||||
| Package | Description |
|
||||
|----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [@opentelemetry/api][otel-api] | This package provides TypeScript interfaces, enums and no-op implementations for the OpenTelemetry core trace and metrics model. It is intended for use both on the server and in the browser. |
|
||||
| [@opentelemetry/core][otel-core] | This package provides default and no-op implementations of the OpenTelemetry api for trace and metrics. It's intended for use both on the server and in the browser. |
|
||||
|
||||
### Implementation / SDKs
|
||||
|
||||
| Package | Description |
|
||||
|----------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [@opentelemetry/sdk-trace-base][otel-tracing] | This module provides a full control over instrumentation and span creation. It doesn't load [`async_hooks`](https://nodejs.org/api/async_hooks.html) or any instrumentation by default. It is intended for use both on the server and in the browser. |
|
||||
| [@opentelemetry/sdk-metrics-base][otel-metrics] | This module provides instruments and meters for reporting of time series data. |
|
||||
| [@opentelemetry/sdk-trace-node][otel-node] | This module provides automatic tracing for Node.js applications. It is intended for use on the server only. |
|
||||
| [@opentelemetry/sdk-trace-web][otel-web] | This module provides automated instrumentation and tracing for Web applications. It is intended for use in the browser only. |
|
||||
| Package | Description |
|
||||
| --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [@opentelemetry/sdk-trace-base][otel-tracing] | This module provides a full control over instrumentation and span creation. It doesn't load [`async_hooks`](https://nodejs.org/api/async_hooks.html) or any instrumentation by default. It is intended for use both on the server and in the browser. |
|
||||
| [@opentelemetry/sdk-metrics][otel-metrics] | This module provides instruments and meters for reporting of time series data. |
|
||||
| [@opentelemetry/sdk-trace-node][otel-node] | This module provides automatic tracing for Node.js applications. It is intended for use on the server only. |
|
||||
| [@opentelemetry/sdk-trace-web][otel-web] | This module provides automated instrumentation and tracing for Web applications. It is intended for use in the browser only. |
|
||||
|
||||
### Compatible Exporters
|
||||
|
||||
|
@ -239,7 +332,11 @@ See the [OpenTelemetry registry](https://opentelemetry.io/registry/?language=js&
|
|||
|
||||
### Instrumentations
|
||||
|
||||
OpenTelemetry can collect tracing data automatically using instrumentations. Vendors/Users can also create and use their own. Currently, OpenTelemetry supports automatic tracing for:
|
||||
OpenTelemetry can collect tracing data automatically using instrumentations.
|
||||
|
||||
To request automatic tracing support for a module not on this list, please [file an issue](https://github.com/open-telemetry/opentelemetry-js/issues). Alternatively, Vendor/Users can [write an instrumentation yourself](https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/instrumentation-guide.md).
|
||||
|
||||
Currently, OpenTelemetry supports automatic tracing for:
|
||||
|
||||
#### Node Instrumentations
|
||||
|
||||
|
@ -250,17 +347,7 @@ OpenTelemetry can collect tracing data automatically using instrumentations. Ven
|
|||
|
||||
##### Contrib
|
||||
|
||||
These plugins are hosted at <https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/node>
|
||||
|
||||
- [@opentelemetry/instrumentation-mongodb][otel-contrib-instrumentation-mongodb]
|
||||
- [@opentelemetry/instrumentation-mysql][otel-contrib-instrumentation-mysql]
|
||||
- [@opentelemetry/instrumentation-pg][otel-contrib-instrumentation-pg]
|
||||
- [@opentelemetry/instrumentation-redis][otel-contrib-instrumentation-redis]
|
||||
- [@opentelemetry/instrumentation-ioredis][otel-contrib-instrumentation-ioredis]
|
||||
- [@opentelemetry/instrumentation-express][otel-contrib-instrumentation-express]
|
||||
- [@opentelemetry/instrumentation-dns][otel-contrib-instrumentation-dns]
|
||||
- [@opentelemetry/instrumentation-hapi][otel-contrib-instrumentation-hapi]
|
||||
- [@opentelemetry/instrumentation-koa][otel-contrib-instrumentation-koa]
|
||||
These instrumentations are hosted at <https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/node>
|
||||
|
||||
#### Web Instrumentations
|
||||
|
||||
|
@ -273,254 +360,15 @@ These plugins are hosted at <https://github.com/open-telemetry/opentelemetry-js-
|
|||
|
||||
These instrumentations are hosted at <https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/web>
|
||||
|
||||
- [@opentelemetry/instrumentation-document-load][otel-contrib-instrumentation-document-load]
|
||||
- [@opentelemetry/instrumentation-user-interaction][otel-contrib-instrumentation-user-interaction]
|
||||
|
||||
To request automatic tracing support for a module not on this list, please [file an issue](https://github.com/open-telemetry/opentelemetry-js/issues). Alternatively, you can [write an instrumentation yourself](https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/instrumentation-guide.md).
|
||||
|
||||
### Shims
|
||||
|
||||
| Package | Description |
|
||||
|----------------------------------------------------------|-----------------------------------------------------------------------------------------|
|
||||
| -------------------------------------------------------- | --------------------------------------------------------------------------------------- |
|
||||
| [@opentelemetry/shim-opentracing][otel-shim-opentracing] | OpenTracing shim allows existing OpenTracing instrumentation to report to OpenTelemetry |
|
||||
|
||||
## Upgrade guidelines
|
||||
|
||||
### 0.26.x to 0.27.x
|
||||
|
||||
Metric and trace exporters are split into separate packages:
|
||||
|
||||
- `@opentelemetry/exporter-otlp-http` => `@opentelemetry/exporter-trace-otlp-http` and `@opentelemetry/exporter-metrics-otlp-http`
|
||||
- `@opentelemetry/exporter-otlp-grpc` => `@opentelemetry/exporter-trace-otlp-grpc` and `@opentelemetry/exporter-metrics-otlp-grpc`
|
||||
- `@opentelemetry/exporter-otlp-proto` => `@opentelemetry/exporter-trace-otlp-proto` and `@opentelemetry/exporter-metrics-otlp-proto`
|
||||
|
||||
Metric types are renamed:
|
||||
|
||||
- `@openetelemetry/api-metrics`
|
||||
- `Meter`
|
||||
- `createValueRecorder` => `createHistogram`
|
||||
- `createValueObserver` => `createObservableGauge`
|
||||
- `createSumObserver` => `createObservableCounter`
|
||||
- `createUpDownSumObserver` => `createObservableUpDownCounter`
|
||||
- `ValueRecorder` => `Histogram`
|
||||
- `ValueObserver` => `ObservableGauge`
|
||||
- `SumObserver` => `ObservableCounter`
|
||||
- `UpDownSumObserver` => `ObservableUpDownCounter`
|
||||
- `ObserverResult` => `ObservableResult`
|
||||
- `Observation.observer` => `Observation.observable`
|
||||
- `@opentelemetry/sdk-metrics-base`
|
||||
- `MetricKind`
|
||||
- `VALUE_RECORDER` => `HISTOGRAM`
|
||||
- `SUM_OBSERVER` => `OBSERVABLE_COUNTER`
|
||||
- `UP_DOWN_SUM_OBSERVER` => `OBSERVABLE_UP_DOWN_COUNTER`
|
||||
- `VALUE_OBSERVER` => `OBSERVABLE_GAUGE`
|
||||
|
||||
### 0.25.x to 1.x.y
|
||||
|
||||
Collector exporter packages and types are renamed:
|
||||
|
||||
- `@opentelemetry/exporter-collector` => `@opentelemetry/exporter-otlp-http`
|
||||
- `CollectorExporterBase` => `OTLPExporterBase`
|
||||
- `CollectorTraceExporter` => `OTLPTraceExporter`
|
||||
- `CollectorMetricExporter` => `OTLPMetricExporter`
|
||||
- `CollectorExporterBrowserBase` => `OTLPExporterBrowserBase`
|
||||
- `CollectorExporterNodeBase` => `OTLPExporterNodeBase`
|
||||
- `CollectorExporterConfigBase` => `OTLPExporterConfigBase`
|
||||
- `CollectorExporterError` => `OTLPExporterError`
|
||||
- `COLLECTOR_SPAN_KIND_MAPPING` => `OTLP_SPAN_KIND_MAPPING`
|
||||
- `collectorTypes` => `otlpTypes`
|
||||
- `@opentelemetry/exporter-collector-grpc` => `@opentelemetry/exporter-otlp-grpc`
|
||||
- `CollectorTraceExporter` => `OTLPTraceExporter`
|
||||
- `CollectorMetricExporter` => `OTLPMetricExporter`
|
||||
- `CollectorExporterConfigNode` => `OTLPExporterConfigNode`
|
||||
- `@opentelemetry/exporter-collector-proto` => `@opentelemetry/exporter-otlp-proto`
|
||||
- `CollectorExporterNodeBase` => `OTLPExporterNodeBase`
|
||||
- `CollectorMetricExporter` => `OTLPMetricExporter`
|
||||
- `CollectorTraceExporter` => `OTLPTraceExporter`
|
||||
- W3C propagators in @opentelemetry/core were renamed
|
||||
- `HttpTraceContextPropagator` -> `W3CTraceContextPropagator`
|
||||
- `HttpBaggagePropagator` -> `W3CBaggagePropagator`
|
||||
|
||||
### 0.24.x to 0.25.x
|
||||
|
||||
- SDKs packages for trace and metrics has been renamed to have a consistent naming schema:
|
||||
- @opentelemetry/tracing -> @opentelemetry/sdk-trace-base
|
||||
- @opentelemetry/node -> @opentelemetry/sdk-trace-node
|
||||
- @opentelemetry/web -> @opentelemetry/sdk-trace-web
|
||||
- @opentelemetry/metrics -> @opentelemetry/sdk-metrics-base
|
||||
- @opentelemetry/node-sdk -> @opentelemetry/sdk-node
|
||||
|
||||
### 0.23.x to 0.24.x
|
||||
|
||||
- `ResourceAttributes` renamed to `SemanticResourceAttributes` in the `@opentelemetry/semantic-conventions` package
|
||||
|
||||
### 0.19.x to 0.20.0
|
||||
|
||||
- `HttpBaggage` renamed to `HttpBaggagePropagator`
|
||||
|
||||
- `HttpTraceContext` renamed to `HttpTraceContextPropagator`
|
||||
|
||||
- `JaegerHttpTracePropagator` renamed to `JaegerPropagator`
|
||||
|
||||
- `serviceName` configuration removed from Collector exporters. Use `service.name` Resource attribute instead.
|
||||
|
||||
### 0.18.x to 0.19.0
|
||||
|
||||
- API is now a peer dependency. This means that users will need to include `@opentelemetry/api` as a dependency of their project in order to use the SDK. NPM version 7+ (Node 15+) should do this automatically.
|
||||
|
||||
- All plugins have been removed in favor of instrumentations.
|
||||
|
||||
- The `@opentelemetry/propagator-b3` package previously exported three propagators: `B3Propagator`,`B3SinglePropagator`, and `B3MultiPropagator`, but now only exports the `B3Propagator`. It extracts b3 context in single and multi-header encodings, and injects context using the single-header encoding by default, but can be configured to inject context using the multi-header endcoding during construction: `new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER })`. If you were previously using the `B3SinglePropagator` or `B3MultiPropagator` directly, you should update your code to use the `B3Propagator` with the appropriate configuration. See the [readme](./packages/opentelemetry-propagator-b3/readme.md) for full details and usage.
|
||||
|
||||
- Sampling configuration via environment variable has changed. If you were using `OTEL_SAMPLING_PROBABILITY` then you should replace it with `OTEL_TRACES_SAMPLER=parentbased_traceidratio` and `OTEL_TRACES_SAMPLER_ARG=<number>` where `<number>` is a number in the [0..1] range, e.g. "0.25". Default is 1.0 if unset.
|
||||
|
||||
### 0.17.0 to 0.18.0
|
||||
|
||||
- `diag.setLogLevel` is removed and LogLevel can be set by an optional second parameter to `setLogger`
|
||||
|
||||
[PR-1975](https://github.com/open-telemetry/opentelemetry-js/pull/1975)
|
||||
|
||||
- Breaking change - The resulting resource MUST have all attributes that are on any of the two input resources. If a key exists on both the old and updating resource, the value of the updating resource MUST be picked - previously it was opposite.
|
||||
|
||||
### 0.16.0 to 0.17.0
|
||||
|
||||
[PR-1880](https://github.com/open-telemetry/opentelemetry-js/pull/1880) feat(diag-logger): introduce a new global level api.diag for internal diagnostic logging
|
||||
|
||||
[PR-1925](https://github.com/open-telemetry/opentelemetry-js/pull/1925) feat(diag-logger): part 2 - breaking changes - remove api.Logger, api.NoopLogger, core.LogLevel, core.ConsoleLogger
|
||||
|
||||
- These PR's remove the previous ```Logger``` and ```LogLevel``` implementations and change the way you should use the replacement ```DiagLogger``` and ```DiagLogLevel```, below are simple examples of how to change your existing usages.
|
||||
|
||||
#### Setting the global diagnostic logger
|
||||
|
||||
The new global [```api.diag```](https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-api/src/api/diag.ts#L32) provides the ability to set the global diagnostic logger ```setLogger()``` and logging level ```setLogLevel()```, it is also a ```DiagLogger``` implementation and should be directly to log diagnostic messages.
|
||||
|
||||
All included logger references have been removed in preference to using the global ```api.diag``` directly, so you no longer need to pass around the logger instance via function parameters or included as part of the configuration for a component.
|
||||
|
||||
```javascript
|
||||
import { diag, DiagConsoleLogger, DiagLogLevel } from "@opentelemetry/api";
|
||||
// Setting the default Global logger to use the Console
|
||||
// And optionally change the logging level (Defaults to INFO)
|
||||
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ERROR)
|
||||
```
|
||||
|
||||
#### Using the logger anywhere in the code
|
||||
|
||||
```typescript
|
||||
import { diag } from "@opentelemetry/api";
|
||||
|
||||
// Remove or make optional the parameter and don't use it.
|
||||
export function MyFunction() {
|
||||
diag.debug("...");
|
||||
diag.info("...");
|
||||
diag.warn("...");
|
||||
diag.error("...");
|
||||
diag.verbose("..");
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
#### Setting the logger back to a noop
|
||||
|
||||
```typescript
|
||||
import { diag } from "@opentelemetry/api";
|
||||
diag.setLogger();
|
||||
|
||||
```
|
||||
|
||||
[PR-1855](https://github.com/open-telemetry/opentelemetry-js/pull/1855) Use instrumentation loader to load plugins and instrumentations
|
||||
|
||||
- Providers do no load the plugins anymore. Also PluginLoader has been removed from providers, use `registerInstrumentations` instead
|
||||
|
||||
```javascript
|
||||
//Previously in node
|
||||
const provider = new NodeTracerProvider({
|
||||
plugins: {
|
||||
'@grpc/grpc-js': {
|
||||
enabled: true,
|
||||
path: '@opentelemetry/plugin-grpc-js',
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
// Now
|
||||
const provider = new NodeTracerProvider();
|
||||
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
|
||||
registerInstrumentations({
|
||||
instrumentations: [
|
||||
{
|
||||
plugins: {
|
||||
'@grpc/grpc-js': {
|
||||
enabled: true,
|
||||
path: '@opentelemetry/plugin-grpc-js',
|
||||
},
|
||||
}
|
||||
}
|
||||
],
|
||||
tracerProvider: provider,
|
||||
});
|
||||
|
||||
// or if you want to load only default instrumentations / plugins
|
||||
registerInstrumentations({
|
||||
tracerProvider: provider,
|
||||
});
|
||||
|
||||
//Previously in browser
|
||||
const provider = new WebTracerProvider({
|
||||
plugins: [
|
||||
new DocumentLoad()
|
||||
]
|
||||
});
|
||||
// Now
|
||||
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
|
||||
const provider = new WebTracerProvider();
|
||||
registerInstrumentations({
|
||||
instrumentations: [
|
||||
new DocumentLoad(),
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
- `registerInstrumentations` supports loading old plugins and instrumentations together. It also supports setting tracer provider and meter provider on instrumentations
|
||||
|
||||
[PR-1874](https://github.com/open-telemetry/opentelemetry-js/pull/1874) More specific API type names
|
||||
|
||||
Some types exported from `"@opentelemetry/api"` have been changed to be more specific.
|
||||
|
||||
- `AttributeValue` renamed to `SpanAttributeValue`
|
||||
- `Attributes` renamed to `SpanAttributes`
|
||||
- `EntryTtl` renamed to `BaggageEntryTtl`
|
||||
- `EntryValue` renamed to `BaggageEntryValue`
|
||||
- `Status` renamed to `SpanStatus`
|
||||
- `StatusCode` renamed to `SpanStatusCode`
|
||||
|
||||
### 0.15.0 to 0.16.0
|
||||
|
||||
[PR-1863](https://github.com/open-telemetry/opentelemetry-js/pull/1863) removed public attributes `keepAlive` and `httpAgentOptions` from nodejs `CollectorTraceExporter` and `CollectorMetricExporter`
|
||||
|
||||
### 0.14.0 to 0.15.0
|
||||
|
||||
[PR-1764](https://github.com/open-telemetry/opentelemetry-js/pull/1764) removed some APIs from `Tracer`:
|
||||
|
||||
- `Tracer.getCurrentSpan()`: use `api.getSpan(api.context.active())`
|
||||
- `Tracer.withSpan(span)`: use `api.context.with(api.setSpan(api.context.active(), span))`
|
||||
- `Tracer.bind(target)`: use `api.context.bind(target)`
|
||||
|
||||
[PR-1797](https://github.com/open-telemetry/opentelemetry-js/pull/1797) chore!: split metrics into its own api package:
|
||||
|
||||
- Any references to `require("@opentelemetry/api").metrics` will need to be changed to `require("@opentelemetry/api-metrics").metrics`
|
||||
|
||||
[PR-1725](https://github.com/open-telemetry/opentelemetry-js/pull/1725) Use new gRPC default port
|
||||
|
||||
- The default port used by `@opentelemetry/exporter-collector-grpc` is changed from `55680` to `4317`
|
||||
|
||||
[PR-1749](https://github.com/open-telemetry/opentelemetry-js/pull/1749) chore: improve naming of span related context APIs
|
||||
|
||||
- Rename `[gs]etActiveSpan()` to `[gs]etSpan()`
|
||||
- Rename `setExtractedSpanContext()` to `setSpanContext()`
|
||||
- Rename `getParentSpanContext()` to `getSpanContext()`
|
||||
|
||||
## Useful links
|
||||
|
||||
- [Upgrade to SDK 2.x guide](./doc/upgrade-to-2.x.md)
|
||||
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
|
||||
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
|
||||
|
||||
|
@ -533,10 +381,13 @@ Apache 2.0 - See [LICENSE][license-url] for more information.
|
|||
[up-for-grabs-issues]: https://github.com/open-telemetry/OpenTelemetry-js/issues?q=is%3Aissue+is%3Aopen+label%3Aup-for-grabs
|
||||
[good-first-issues]: https://github.com/open-telemetry/OpenTelemetry-js/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22
|
||||
|
||||
[client-instrumentation-sig]: https://docs.google.com/document/d/16Vsdh-DM72AfMg_FIt9yT9ExEWF4A_vRbQ3jRNBe09w/edit
|
||||
|
||||
[docs]: https://open-telemetry.github.io/opentelemetry-js
|
||||
[compliance-matrix]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/spec-compliance-matrix.md
|
||||
[CONTRIBUTING]: https://github.com/open-telemetry/opentelemetry-js/blob/main/CONTRIBUTING.md
|
||||
|
||||
[otel-metrics]: https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-sdk-metrics-base
|
||||
[otel-metrics]: https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/sdk-metrics
|
||||
[otel-node]: https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node
|
||||
|
||||
[otel-instrumentation-fetch]: https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-fetch
|
||||
|
@ -547,20 +398,7 @@ Apache 2.0 - See [LICENSE][license-url] for more information.
|
|||
[otel-shim-opentracing]: https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-shim-opentracing
|
||||
[otel-tracing]: https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-base
|
||||
[otel-web]: https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-web
|
||||
[otel-api]: https://github.com/open-telemetry/opentelemetry-js-api
|
||||
[otel-api]: https://github.com/open-telemetry/opentelemetry-js/tree/main/api
|
||||
[otel-core]: https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-core
|
||||
[generate-api-documentation]: https://github.com/open-telemetry/opentelemetry-js/blob/main/CONTRIBUTING.md#generating-api-documentation
|
||||
|
||||
[otel-contrib-instrumentation-dns]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-dns
|
||||
[otel-contrib-instrumentation-ioredis]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-ioredis
|
||||
[otel-contrib-instrumentation-mongodb]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-mongodb
|
||||
[otel-contrib-instrumentation-mysql]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-mysql
|
||||
[otel-contrib-instrumentation-pg]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-pg
|
||||
[otel-contrib-instrumentation-redis]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-redis
|
||||
[otel-contrib-instrumentation-express]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-express
|
||||
[otel-contrib-instrumentation-user-interaction]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/web/opentelemetry-instrumentation-user-interaction
|
||||
[otel-contrib-instrumentation-document-load]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/web/opentelemetry-instrumentation-document-load
|
||||
[otel-contrib-instrumentation-hapi]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-hapi
|
||||
[otel-contrib-instrumentation-koa]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-koa
|
||||
|
||||
[spec-versioning]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md
|
||||
|
|
123
RELEASING.md
123
RELEASING.md
|
@ -1,123 +0,0 @@
|
|||
# Releasing OpenTelemetry Packages
|
||||
|
||||
This document explains how to publish all OT modules at version x.y.z. Ensure that you’re following semver when choosing a version number.
|
||||
|
||||
Release Process:
|
||||
|
||||
- [Release Process (Maintainers only)](#release-process)
|
||||
- [Update to latest locally](#update-to-latest-locally)
|
||||
- [Create a new branch](#create-a-new-branch)
|
||||
- [Prepare each package for release](#prepare-each-package-for-release)
|
||||
- [Use the Changelog to create a GitHub Release](#use-the-changelog-to-create-a-github-release)
|
||||
- [Generate the changelog with lerna](#generate-the-changelog-with-lerna)
|
||||
- [How to use](#how-to-use)
|
||||
- [Update Changelog file](#update-changelog-file)
|
||||
- [Create a new PR](#create-a-new-pr)
|
||||
- [Merge and pull](#merge-and-pull)
|
||||
- [Publish all packages](#publish-all-packages)
|
||||
- [Publish the GitHub Release](#publish-the-github-release)
|
||||
- [Update CHANGELOG](#update-changelog)
|
||||
- [Known Issues](#known-issues)
|
||||
|
||||
## Release Process
|
||||
|
||||
### Update to latest locally
|
||||
|
||||
Use `git fetch` and `git checkout origin/main` to ensure you’re on the latest commit. Make sure you have no unstaged changes. Ideally, also use `git clean -dfx` to remove all ignored and untracked files.
|
||||
|
||||
### Create a new branch
|
||||
|
||||
Create a new branch called `x.y.z-proposal` from the current commit.
|
||||
|
||||
### Prepare each package for release
|
||||
|
||||
Decide on the next `major.minor.patch` release number based on [semver](http://semver.org/) guidelines.
|
||||
|
||||
- Use `npm install` command to initialize all package directories
|
||||
- Use `lerna publish --skip-npm --no-git-tag-version --no-push` to bump the version in all `package.json`
|
||||
- Use `npm run bootstrap` to generate latest `version.ts` files
|
||||
|
||||
### Use the Changelog to create a GitHub Release
|
||||
|
||||
#### Generate the changelog with lerna
|
||||
|
||||
Since we use `lerna`, we can use [lerna-changelog](https://github.com/lerna/lerna-changelog#lerna-changelog)
|
||||
|
||||
##### How to use
|
||||
|
||||
Pass your [github token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) to generate the changelog automatically.
|
||||
For security reasons, when you create a Github token, select the permissions: under **repo**, select **Access public repositories**, **Access commit status**.
|
||||
|
||||
In your terminal, execute the following command:
|
||||
|
||||
```bash
|
||||
GITHUB_AUTH=<your token> lerna-changelog
|
||||
```
|
||||
|
||||
It will print something like:
|
||||
|
||||
```md
|
||||
### Unreleased (2018-05-24)
|
||||
|
||||
##### :bug: Bug Fix
|
||||
* [#198](https://github.com/my-org/my-repo/pull/198) Avoid an infinite loop ([@helpful-hacker](https://github.com/helpful-hacker))
|
||||
|
||||
##### :house: Internal
|
||||
* [#183](https://github.com/my-org/my-repo/pull/183) Standardize error messages ([@careful-coder](https://github.com/careful-coder))
|
||||
|
||||
##### Commiters: 2
|
||||
- Helpful Hacker ([@helpful-hacker](https://github.com/helpful-hacker))
|
||||
- [@careful-coder](https://github.com/careful-coder)
|
||||
```
|
||||
|
||||
By default lerna-changelog will show all pull requests that have been merged since the latest tagged commit in the repository. That is however only true for pull requests **with certain labels applied** (see [lerna.json](lerna.json) for authorized labels).
|
||||
|
||||
You can also use the `--from` and `--to` options to view a different range of pull requests:
|
||||
|
||||
```sh
|
||||
GITHUB_AUTH=xxxxx lerna-changelog --from=v1.0.0 --to=v2.0.0
|
||||
```
|
||||
|
||||
##### Update Changelog file
|
||||
|
||||
From what `lerna-changelog` has generated, starts new Unreleased label. Follow the example set by recent Released label.
|
||||
|
||||
On [GitHub Releases](https://github.com/open-telemetry/opentelemetry-js/releases), follow the example set by recent releases to populate a summary of changes, as well as a list of commits that were applied since the last release. Save it as a draft, don’t publish it. Don’t forget the tag -- call it `vx.y.z` and leave it pointing at `main` for now (this can be changed as long as the GitHub release isn’t published).
|
||||
|
||||
### Create a new PR
|
||||
|
||||
Create a pull request titled `chore: x.y.z release proposal`. The commit body should just be a link to the draft notes. Someone who can access draft notes should approve it, looking in particular for test passing, and whether the draft notes are satisfactory.
|
||||
|
||||
### Merge and pull
|
||||
|
||||
Merge the PR, and pull the changes locally (using the commands in the first step). Ensure that `chore: x.y.z release proposal` is the most recent commit.
|
||||
|
||||
### Publish all packages
|
||||
|
||||
Go into each directory and use `npm publish` (requires permissions) to publish the package. You can use the following script to automate this.
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
for dir in $(ls packages); do
|
||||
pushd packages/$dir
|
||||
npm publish
|
||||
popd
|
||||
done
|
||||
```
|
||||
|
||||
Check your e-mail and make sure the number of “you’ve published this module” emails matches the number you expect.
|
||||
|
||||
### Publish the GitHub Release
|
||||
|
||||
Publish the GitHub release, ensuring that the tag points to the newly landed commit corresponding to release proposal `x.y.z`.
|
||||
|
||||
### Update CHANGELOG
|
||||
|
||||
- After releasing is done, update the [CHANGELOG.md](https://github.com/open-telemetry/opentelemetry-js/blob/main/CHANGELOG.md) and start new Unreleased label.
|
||||
- Create a new commit with the exact title: `Post Release: update CHANGELOG.md`.
|
||||
- Go through PR review and merge it to GitHub main branch.
|
||||
|
||||
### Known Issues
|
||||
|
||||
- The `examples/` and `getting-started/` folders are not part of lerna packages, we need to manually bump the version in `package.json`.
|
|
@ -4,5 +4,5 @@ module.exports = {
|
|||
"commonjs": true,
|
||||
"shared-node-browser": true
|
||||
},
|
||||
...require('../../../eslint.config.js')
|
||||
...require('../eslint.base.js')
|
||||
}
|
|
@ -0,0 +1,295 @@
|
|||
<!-- markdownlint-disable MD004 -->
|
||||
# CHANGELOG
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## Unreleased
|
||||
|
||||
### :boom: Breaking Change
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(api): improve isValidSpanId, isValidTraceId performance [#5714](https://github.com/open-telemetry/opentelemetry-js/pull/5714) @seemk
|
||||
* feat(diag): change types in `DiagComponentLogger` from `any` to `unknown`[#5478](https://github.com/open-telemetry/opentelemetry-js/pull/5478) @loganrosen
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
### :books: (Refine Doc)
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* refactor(api): remove "export *" in favor of explicit named exports [#4880](https://github.com/open-telemetry/opentelemetry-js/pull/4880) @robbkidd
|
||||
* chore: enable tsconfig isolatedModules [#5697](https://github.com/open-telemetry/opentelemetry-js/pull/5697) @legendecas
|
||||
|
||||
## 1.9.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(metrics): added synchronous gauge [#4528](https://github.com/open-telemetry/opentelemetry-js/pull/4528) @clintonb
|
||||
* feat(api): allow adding span links after span creation [#4536](https://github.com/open-telemetry/opentelemetry-js/pull/4536) @seemk
|
||||
* This change is non-breaking for end-users, but breaking for Trace SDK implmentations in accordance with the [specification](https://github.com/open-telemetry/opentelemetry-specification/blob/a03382ada8afa9415266a84dafac0510ec8c160f/specification/upgrading.md?plain=1#L97-L122) as new features need to be implemented.
|
||||
* feat: support node 22 [#4666](https://github.com/open-telemetry/opentelemetry-js/pull/4666) @dyladan
|
||||
|
||||
## 1.8.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(api): add SugaredTracer for functions not defined in the spec
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(api): fix unreachable @opentelemetry/api/experimental entry [#4446](https://github.com/open-telemetry/opentelemetry-js/pull/4446) @legendecas
|
||||
|
||||
## 1.7.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(metrics): prototype experimental advice support [#3876](https://github.com/open-telemetry/opentelemetry-js/pull/3876) @legendecas
|
||||
* feat(api): publish api esnext target [#4231](https://github.com/open-telemetry/opentelemetry-js/pull/4231) @legendecas
|
||||
|
||||
## 1.6.0
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* Revert "feat(api): add attributes argument to recordException API [#4071](https://github.com/open-telemetry/opentelemetry-js/pull/4071)"
|
||||
* This feature was an unintentional breaking change introduced with 1.5.0
|
||||
|
||||
## 1.5.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(api): add attributes argument to recordException API [#4071](https://github.com/open-telemetry/opentelemetry-js/pull/4071)
|
||||
|
||||
## 1.4.1
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(metrics): export `MetricsAPI` type [#3535](https://github.com/open-telemetry/opentelemetry-js/pull/3535)
|
||||
* fix(api): rename `LoggerOptions` to `DiagLoggerOptions` [#3641](https://github.com/open-telemetry/opentelemetry-js/pull/3641)
|
||||
* fix(api): export `DiagLoggerOptions` type [#3639](https://github.com/open-telemetry/opentelemetry-js/pull/3639)
|
||||
|
||||
## 1.4.0
|
||||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(api): add `getActiveBaggage` API [#3385](https://github.com/open-telemetry/opentelemetry-js/pull/3385)
|
||||
* feat(api): add optional `droppedAttributesCount` property in the `Link` interface [#3576](https://github.com/open-telemetry/opentelemetry-js/pull/3576) @mohitk05
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(api): deprecate MetricAttributes and MetricAttributeValue [#3406](https://github.com/open-telemetry/opentelemetry-js/pull/3406) @blumamir
|
||||
* fix(api): use active context as default in NoopTracer [#3476](https://github.com/open-telemetry/opentelemetry-js/pull/3476) @flarna
|
||||
* fix(api): declare this parameter type in observable callbacks [#3497](https://github.com/open-telemetry/opentelemetry-js/pull/3497) @legendecas
|
||||
|
||||
### :house: (Internal)
|
||||
|
||||
* test(api): disable module concatenation in tree-shaking test [#3409](https://github.com/open-telemetry/opentelemetry-js/pull/3409) @legendecas
|
||||
|
||||
## [1.3.0](https://www.github.com/open-telemetry/opentelemetry-js-api/compare/v1.2.0...v1.3.0)
|
||||
|
||||
* feat(api): merge api-metrics into api [#3374](https://github.com/open-telemetry/opentelemetry-js/pull/3374) @legendecas
|
||||
* Optionally suppress warning about logger being overwritten ([#3366](https://www.github.com/open-telemetry/opentelemetry-js-api/pull/3366))
|
||||
|
||||
## [1.2.0](https://www.github.com/open-telemetry/opentelemetry-js-api/compare/v1.1.0...v1.2.0) (2022-08-09)
|
||||
|
||||
### Features
|
||||
|
||||
* Add getActiveSpan to trace API ([#163](https://www.github.com/open-telemetry/opentelemetry-js-api/issues/163)) ([17ccb3a](https://www.github.com/open-telemetry/opentelemetry-js-api/commit/17ccb3a4e385bc5769ded6fc742c9782a93244a5))
|
||||
* deprecate Sampler ([#166](https://www.github.com/open-telemetry/opentelemetry-js-api/issues/166)) ([313b2e2](https://www.github.com/open-telemetry/opentelemetry-js-api/commit/313b2e2225f246a6a9518ec4da6942f7d61babce))
|
||||
|
||||
## [1.1.0](https://www.github.com/open-telemetry/opentelemetry-js-api/compare/v1.0.4...v1.1.0) (2022-01-25)
|
||||
|
||||
### Features
|
||||
|
||||
* add tracestate implementation to api ([#147](https://www.github.com/open-telemetry/opentelemetry-js-api/issues/147)) ([82842c7](https://www.github.com/open-telemetry/opentelemetry-js-api/commit/82842c7097614e6ece99e73838ac5e94ff5460b7))
|
||||
* define common attributes type ([#142](https://www.github.com/open-telemetry/opentelemetry-js-api/issues/142)) ([ae9bead](https://www.github.com/open-telemetry/opentelemetry-js-api/commit/ae9bead17750d35dec4b63cfae098087666abc85))
|
||||
* **trace:** add optional schema url to TracerProvider.getTracer ([#129](https://www.github.com/open-telemetry/opentelemetry-js-api/issues/129)) ([aa65fc6](https://www.github.com/open-telemetry/opentelemetry-js-api/commit/aa65fc66809d45090d6e4951c265386d17ccc6f6))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* export tracer options ([#154](https://www.github.com/open-telemetry/opentelemetry-js-api/issues/154)) ([b125324](https://www.github.com/open-telemetry/opentelemetry-js-api/commit/b125324438fb2f24eb80c7c6673afc8cfc99575e))
|
||||
|
||||
## [1.0.4](https://www.github.com/open-telemetry/opentelemetry-js-api/compare/v1.0.3...v1.0.4) (2021-12-18)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* align globalThis fallbacks with otel-core ([#126](https://www.github.com/open-telemetry/opentelemetry-js-api/issues/126)) ([3507de7](https://www.github.com/open-telemetry/opentelemetry-js-api/commit/3507de7c3b95396696657c021953b0b24a63a029))
|
||||
|
||||
## [1.0.3](https://www.github.com/open-telemetry/opentelemetry-js-api/compare/v1.0.2...v1.0.3) (2021-08-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove all circular dependencies ([#119](https://www.github.com/open-telemetry/opentelemetry-js-api/issues/119)) ([a8083e8](https://www.github.com/open-telemetry/opentelemetry-js-api/commit/a8083e84b23227828745da80fd5fe512357dd34b))
|
||||
|
||||
## 1.0.2
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
* [#105](https://github.com/open-telemetry/opentelemetry-js-api/pull/105) fix: set delegate after successful registration ([@Flarna](https://github.com/Flarna))
|
||||
* [#94](https://github.com/open-telemetry/opentelemetry-js-api/pull/94) fix: enforce strict equality on prerelease versions ([@dyladan](https://github.com/dyladan))
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
* [#106](https://github.com/open-telemetry/opentelemetry-js-api/pull/106) docs: fix crash in README example ([@trentm](https://github.com/trentm))
|
||||
* [#101](https://github.com/open-telemetry/opentelemetry-js-api/pull/101) docs: Format example for tracer.startActiveSpan ([@ad-m](https://github.com/ad-m))
|
||||
* [#99](https://github.com/open-telemetry/opentelemetry-js-api/pull/99) chore: fix link to API docs ([@dyladan](https://github.com/dyladan))
|
||||
|
||||
### :house: Internal
|
||||
|
||||
* [#109](https://github.com/open-telemetry/opentelemetry-js-api/pull/109) internal: add missing approvers from core ([@dyladan](https://github.com/dyladan))
|
||||
* [#103](https://github.com/open-telemetry/opentelemetry-js-api/pull/103) chore: reuse NoopTracer in ProxyTracer ([@Flarna](https://github.com/Flarna))
|
||||
|
||||
### Committers: 4
|
||||
|
||||
* Adam Dobrawy ([@ad-m](https://github.com/ad-m))
|
||||
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
|
||||
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna))
|
||||
* Trent Mick ([@trentm](https://github.com/trentm))
|
||||
|
||||
## 1.0.1
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
* [#96](https://github.com/open-telemetry/opentelemetry-js-api/pull/96) chore: remove circular dependency ([@dyladan](https://github.com/dyladan))
|
||||
|
||||
### Committers: 1
|
||||
|
||||
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
|
||||
|
||||
## 1.0.0
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
* [#89](https://github.com/open-telemetry/opentelemetry-js-api/pull/89) chore: update upgrade guidelines ([@dyladan](https://github.com/dyladan))
|
||||
|
||||
### :house: Internal
|
||||
|
||||
* [#90](https://github.com/open-telemetry/opentelemetry-js-api/pull/90) chore: enable typescript 4.3 noImplicitOverride option ([@Flarna](https://github.com/Flarna))
|
||||
|
||||
### Committers: 2
|
||||
|
||||
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
|
||||
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna))
|
||||
|
||||
## 0.21.0
|
||||
|
||||
### :boom: Breaking Change
|
||||
|
||||
* [#78](https://github.com/open-telemetry/opentelemetry-js-api/pull/78) feat: unify signatures of `with` and `bind` ([@Rauno56](https://github.com/Rauno56))
|
||||
* [#46](https://github.com/open-telemetry/opentelemetry-js-api/pull/46) chore: do not export singletons ([@dyladan](https://github.com/dyladan))
|
||||
|
||||
### :rocket: Enhancement
|
||||
|
||||
* [#81](https://github.com/open-telemetry/opentelemetry-js-api/pull/81) chore: function overloads implementation of startActiveSpan in noop t… ([@naseemkullah](https://github.com/naseemkullah))
|
||||
|
||||
### :house: Internal
|
||||
|
||||
* [#84](https://github.com/open-telemetry/opentelemetry-js-api/pull/84) chore: remove unused backwards compatibility folder ([@Flarna](https://github.com/Flarna))
|
||||
* [#85](https://github.com/open-telemetry/opentelemetry-js-api/pull/85) chore: add node:16 to the test matrix ([@Rauno56](https://github.com/Rauno56))
|
||||
* [#63](https://github.com/open-telemetry/opentelemetry-js-api/pull/63) feat: debug log global registrations and logger overwrites ([@Rauno56](https://github.com/Rauno56))
|
||||
* [#75](https://github.com/open-telemetry/opentelemetry-js-api/pull/75) Add CodeQL Security Scan ([@xukaren](https://github.com/xukaren))
|
||||
* [#79](https://github.com/open-telemetry/opentelemetry-js-api/pull/79) chore: fix eslint config ([@Rauno56](https://github.com/Rauno56))
|
||||
|
||||
### Committers: 5
|
||||
|
||||
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
|
||||
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna))
|
||||
* Karen Xu ([@xukaren](https://github.com/xukaren))
|
||||
* Naseem ([@naseemkullah](https://github.com/naseemkullah))
|
||||
* Rauno Viskus ([@Rauno56](https://github.com/Rauno56))
|
||||
|
||||
## 0.20.0
|
||||
|
||||
### :rocket: Enhancement
|
||||
|
||||
* [#69](https://github.com/open-telemetry/opentelemetry-js-api/pull/69) feat(context): add utils method to remove keys from context ([@vmarchaud](https://github.com/vmarchaud))
|
||||
* [#71](https://github.com/open-telemetry/opentelemetry-js-api/pull/71) chore: export baggage ([@dyladan](https://github.com/dyladan))
|
||||
|
||||
### Committers: 2
|
||||
|
||||
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
|
||||
* Valentin Marchaud ([@vmarchaud](https://github.com/vmarchaud))
|
||||
|
||||
## 0.19.0
|
||||
|
||||
### :boom: Breaking Change
|
||||
|
||||
* [#55](https://github.com/open-telemetry/opentelemetry-js-api/pull/55) chore: move baggage methods in propagation namespace ([@vmarchaud](https://github.com/vmarchaud))
|
||||
* [#65](https://github.com/open-telemetry/opentelemetry-js-api/pull/65) chore: remove suppress instrumentation ([@dyladan](https://github.com/dyladan))
|
||||
* [#60](https://github.com/open-telemetry/opentelemetry-js-api/pull/60) chore: removing timed event ([@obecny](https://github.com/obecny))
|
||||
* [#58](https://github.com/open-telemetry/opentelemetry-js-api/pull/58) chore: use spancontext for link ([@dyladan](https://github.com/dyladan))
|
||||
* [#47](https://github.com/open-telemetry/opentelemetry-js-api/pull/47) chore: move span method for context in trace API #40 ([@vmarchaud](https://github.com/vmarchaud))
|
||||
* [#45](https://github.com/open-telemetry/opentelemetry-js-api/pull/45) chore: rename `span#context()` to `span#spanContext` ([@dyladan](https://github.com/dyladan))
|
||||
* [#43](https://github.com/open-telemetry/opentelemetry-js-api/pull/43) chore: renaming noop span to non recording span ([@obecny](https://github.com/obecny))
|
||||
* [#32](https://github.com/open-telemetry/opentelemetry-js-api/pull/32) feat!: return boolean success value from setGlobalXXX methods ([@dyladan](https://github.com/dyladan))
|
||||
|
||||
### :rocket: Enhancement
|
||||
|
||||
* [#62](https://github.com/open-telemetry/opentelemetry-js-api/pull/62) chore: adding component logger ([@obecny](https://github.com/obecny))
|
||||
* [#54](https://github.com/open-telemetry/opentelemetry-js-api/pull/54) feat: add tracer.startActiveSpan() ([@naseemkullah](https://github.com/naseemkullah))
|
||||
* [#58](https://github.com/open-telemetry/opentelemetry-js-api/pull/58) chore: use spancontext for link ([@dyladan](https://github.com/dyladan))
|
||||
* [#51](https://github.com/open-telemetry/opentelemetry-js-api/pull/51) feat: add function to wrap SpanContext in NonRecordingSpan #49 ([@dyladan](https://github.com/dyladan))
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
* [#64](https://github.com/open-telemetry/opentelemetry-js-api/pull/64) chore: document the reason for symbol.for ([@dyladan](https://github.com/dyladan))
|
||||
* [#44](https://github.com/open-telemetry/opentelemetry-js-api/pull/44) chore: updating readme headline and fixing links ([@obecny](https://github.com/obecny))
|
||||
|
||||
### Committers: 6
|
||||
|
||||
* Bartlomiej Obecny ([@obecny](https://github.com/obecny))
|
||||
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
|
||||
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna))
|
||||
* Naseem ([@naseemkullah](https://github.com/naseemkullah))
|
||||
* Valentin Marchaud ([@vmarchaud](https://github.com/vmarchaud))
|
||||
* t2t2 ([@t2t2](https://github.com/t2t2))
|
||||
|
||||
## 1.0.0-rc.0
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
* [#20](https://github.com/open-telemetry/opentelemetry-js-api/pull/20) docs: document latest manual tracing ([@dyladan](https://github.com/dyladan))
|
||||
* [#18](https://github.com/open-telemetry/opentelemetry-js-api/pull/18) chore: deploy docs on a release ([@dyladan](https://github.com/dyladan))
|
||||
* [#19](https://github.com/open-telemetry/opentelemetry-js-api/pull/19) docs: fix readme links ([@dyladan](https://github.com/dyladan))
|
||||
|
||||
### Committers: 1
|
||||
|
||||
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
|
||||
|
||||
## 0.18.1
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
* [#16](https://github.com/open-telemetry/opentelemetry-js-api/pull/16) fix: Reverse the direction of the semver check ([@dyladan](https://github.com/dyladan))
|
||||
|
||||
### Committers: 1
|
||||
|
||||
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
|
||||
|
||||
## v0.18.0
|
||||
|
||||
### :boom: Breaking Change
|
||||
|
||||
* [#9](https://github.com/open-telemetry/opentelemetry-js-api/pull/9) chore: refactor diag logger ([@dyladan](https://github.com/dyladan))
|
||||
|
||||
### :rocket: Enhancement
|
||||
|
||||
* [#10](https://github.com/open-telemetry/opentelemetry-js-api/pull/10) Use semver to determine API compatibility ([@dyladan](https://github.com/dyladan))
|
||||
|
||||
### :house: Internal
|
||||
|
||||
* [#12](https://github.com/open-telemetry/opentelemetry-js-api/pull/12) chore: don't disable rule eqeqeq ([@Flarna](https://github.com/Flarna))
|
||||
* [#8](https://github.com/open-telemetry/opentelemetry-js-api/pull/8) chore: remove nycrc in favor of tsconfig reporting ([@dyladan](https://github.com/dyladan))
|
||||
* [#3](https://github.com/open-telemetry/opentelemetry-js-api/pull/3) chore: add test workflow ([@dyladan](https://github.com/dyladan))
|
||||
* [#4](https://github.com/open-telemetry/opentelemetry-js-api/pull/4) chore: remove package lock ([@dyladan](https://github.com/dyladan))
|
||||
* [#2](https://github.com/open-telemetry/opentelemetry-js-api/pull/2) chore: add lint workflow ([@dyladan](https://github.com/dyladan))
|
||||
|
||||
### Committers: 2
|
||||
|
||||
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
|
||||
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna))
|
||||
|
||||
## v0.17.0
|
||||
|
||||
Versions previous to `0.18.0` were developed in another repository.
|
||||
To see previous changelog entries see the [CHANGELOG.md](https://github.com/open-telemetry/opentelemetry-js/blob/main/CHANGELOG.md).
|
|
@ -0,0 +1,117 @@
|
|||
# OpenTelemetry API for JavaScript
|
||||
|
||||
<p align="center">
|
||||
<strong>
|
||||
<a href="https://open-telemetry.github.io/opentelemetry-js/modules/_opentelemetry_api.html">API Reference</a>
|
||||
•
|
||||
<a href="https://opentelemetry.io/docs/instrumentation/js/">Documentation</a>
|
||||
</br>
|
||||
<a href="https://github.com/open-telemetry/opentelemetry-js/releases">
|
||||
<img alt="NPM Release" src="https://img.shields.io/npm/v/@opentelemetry/api?color=brightgreen&logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAACQAAAAAQAAAJAAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAABigAwAEAAAAAQAAABgAAAAA8A2UOAAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAABK5JREFUSA2dVm1sFEUYfmd2b%2Ff2Pkqghn5eEQWKrRgjpkYgpoRCLC0oxV5apAiGUDEpJvwxEQ2raWPU%2BKf8INU%2FRtEedwTCR9tYPloxGNJYTTQUwYqJ1aNpaLH3sXu3t7vjvFevpSqt7eSyM%2B%2FczvM8877PzB3APBoLgoDLsNePF56LBwqa07EKlDGg84CcWsI4CEbhNnDpAd951lXE2NkiNknCCTLv4HtzZuvPm1C%2FIKv4oDNXqNDHragety2XVzjECZsJARuBMyRzJrh1O0gQwLXuxofxsPSj4hG8fMLQo7bl9JJD8XZfC1E5yWFOMtd07dvX5kDwg6%2B2%2B%2BChq8txHGtfPoAp0gOFmhYoNFkHjn2TNUmrwRdna7W1QSkU8hvbGk4uThLrapaiLA2E6QY4u%2FlS9ItHfvJkxYsTMVtnAJLipYIWtVrcdX%2B8%2Bb8IVnPl%2FR81prbuPZ1jpYw%2B0aEUGSkdFsgyBIaFTXCm6nyaxMtJ4n%2BTeDhJzGqZtQZcuYDgqDwDbqb0JF9oRpIG1Oea3bC1Y6N3x%2FWV8Zh83emhCs%2B%2BhlaghDw%2B8w5UlYKq2lU7Pl8IkvS9KDqXmKmEwdMppVPKwGSEilmyAwJhRwWcq7wYC6z4wZ1rrEoMWxecdOjZWXeAQClBcYDN3NwVwD9pGwqUSyQgclcmxpNJqCuwLmDh3WtvPqXdlt%2B6Oz70HPGDNSNBee%2FEOen%2BrGbEFqDENBPDbtdCp0ukPANmzO0QQJYUpyS5IJJI3Hqt4maS%2BEB3199ozm8EDU%2F6fVNU2dQpdx3ZnKzeFXyaUTiasEV%2FgZMzJMjr3Z%2BWvAdQ%2Bhs%2Fzw9savimxUntDSaBdZ2f%2BIdbm1rlNY8esFffBit9HtK5%2FMejsrJVxikOXlb1Ukir2X%2BRbdkd1KG2Ixfn2Ql4JRmELnYK9mEM8G36fAA3xEQ89fxXihC8q%2BsAKi9jhHxNqagY2hiaYgRCm0f0QP7H4Fp11LSXiuBY2aYFlh0DeDIVVFUJQn5rCnpiNI2gvLxHnASn9DIVHJJlm5rXvQAGEo4zvKq2w5G1NxENN7jrft1oxMdekETjxdH2Z3x%2BVTVYsPb%2BO0C%2F9%2FauN6v2hNZw5b2UOmSbG5%2FrkC3LBA%2B1PdxFxORjxpQ81GcxKc%2BybVjEBvUJvaGJ7p7n5A5KSwe4AzkasA%2BcrmzFtowoIVTiLjANm8GDsrWW35ScI3JY8Urv83tnkF8JR0yLvEt2hO%2F0qNyy3Jb3YKeHeHeLeOuVLRpNF%2Bpkf85OW7%2FzJxWdXsbsKBUk2TC0BCPwMq5Q%2FCPvaJFkNS%2F1l1qUPe%2BuH3oD59erYGI%2FY4sce6KaXYElAIOLt%2B0O3t2%2B%2FxJDF1XvOlWGC1W1B8VMszbGfOvT5qaRRAIFK3BCO164nZ0uYLH2YjNN8thXS2v2BK9gTfD7jHVxzHr4roOlEvYYz9QIz%2BVl%2FsLDXInsctFsXjqIRnO2ZO387lxmIboLDZCJ59KLFliNIgh9ipt6tLg9SihpRPDO1ia5byw7de1aCQmF5geOQtK509rzfdwxaKOIq%2B73AvwCC5%2F5fcV4vo3%2B3LpMdtWHh0ywsJC%2FZGoCb8%2F9D8F%2FifgLLl8S8QWfU8cAAAAASUVORK5CYII%3D">
|
||||
</a>
|
||||
</strong>
|
||||
</p>
|
||||
|
||||
This package provides everything needed to interact with the OpenTelemetry API, including all TypeScript interfaces, enums, and no-op implementations. It is intended for use both on the server and in the browser.
|
||||
|
||||
The methods in this package perform no operations by default. This means they can be safely called by a library or end-user application whether there is an SDK registered or not. In order to generate and export telemetry data, you will also need an SDK such as the [OpenTelemetry JS SDK][opentelemetry-js].
|
||||
|
||||
## Tracing Quick Start
|
||||
|
||||
### You Will Need
|
||||
|
||||
- An application you wish to instrument
|
||||
- [OpenTelemetry JS SDK][opentelemetry-js]
|
||||
- Node.js >=8.5.0 (14+ is preferred) or an ECMAScript 5+ compatible browser
|
||||
|
||||
**Note:** ECMAScript 5+ compatibility is for this package only. Please refer to the documentation for the SDK you are using to determine its minimum ECMAScript version.
|
||||
|
||||
**Note for library authors:** Only your end users will need an OpenTelemetry SDK. If you wish to support OpenTelemetry in your library, you only need to use the OpenTelemetry API. For more information, please read the [tracing documentation][docs-tracing].
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
```sh
|
||||
npm install @opentelemetry/api @opentelemetry/sdk-trace-base
|
||||
```
|
||||
|
||||
### Trace Your Application
|
||||
|
||||
In order to get started with tracing, you will need to first register an SDK. The SDK you are using may provide a convenience method which calls the registration methods for you, but if you would like to call them directly they are documented here: [SDK registration methods][docs-sdk-registration].
|
||||
|
||||
Once you have registered an SDK, you can start and end spans. A simple example of basic SDK registration and tracing a simple operation is below. The example should export spans to the console once per second. For more information, see the [tracing documentation][docs-tracing].
|
||||
|
||||
```javascript
|
||||
const { trace } = require("@opentelemetry/api");
|
||||
const { BasicTracerProvider, ConsoleSpanExporter, SimpleSpanProcessor } = require("@opentelemetry/sdk-trace-base");
|
||||
|
||||
// Create and register an SDK
|
||||
const provider = new BasicTracerProvider({
|
||||
spanProcessors: [new SimpleSpanProcessor(new ConsoleSpanExporter())]
|
||||
});
|
||||
trace.setGlobalTracerProvider(provider);
|
||||
|
||||
// Acquire a tracer from the global tracer provider which will be used to trace the application
|
||||
const name = 'my-application-name';
|
||||
const version = '0.1.0';
|
||||
const tracer = trace.getTracer(name, version);
|
||||
|
||||
// Trace your application by creating spans
|
||||
async function operation() {
|
||||
const span = tracer.startSpan("do operation");
|
||||
|
||||
// mock some work by sleeping 1 second
|
||||
await new Promise((resolve, reject) => {
|
||||
setTimeout(resolve, 1000);
|
||||
})
|
||||
|
||||
span.end();
|
||||
}
|
||||
|
||||
async function main() {
|
||||
while (true) {
|
||||
await operation();
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
```
|
||||
|
||||
## Version Compatibility
|
||||
|
||||
Because the npm installer and node module resolution algorithm could potentially allow two or more copies of any given package to exist within the same `node_modules` structure, the OpenTelemetry API takes advantage of a variable on the `global` object to store the global API. When an API method in the API package is called, it checks if this `global` API exists and proxies calls to it if and only if it is a compatible API version. This means if a package has a dependency on an OpenTelemetry API version which is not compatible with the API used by the end user, the package will receive a no-op implementation of the API.
|
||||
|
||||
## Upgrade Guidelines
|
||||
|
||||
### 0.21.0 to 1.0.0
|
||||
|
||||
No breaking changes
|
||||
|
||||
### 0.20.0 to 0.21.0
|
||||
|
||||
- [#78](https://github.com/open-telemetry/opentelemetry-js-api/issues/78) `api.context.bind` arguments reversed and `context` is now a required argument.
|
||||
- [#46](https://github.com/open-telemetry/opentelemetry-js-api/issues/46) Noop classes and singletons are no longer exported. To create a noop span it is recommended to use `api.trace.wrapSpanContext` with `INVALID_SPAN_CONTEXT` instead of using the `NOOP_TRACER`.
|
||||
|
||||
### 1.0.0-rc.3 to 0.20.0
|
||||
|
||||
- Removing `TimedEvent` which was not part of spec
|
||||
- `HttpBaggage` renamed to `HttpBaggagePropagator`
|
||||
- [#45](https://github.com/open-telemetry/opentelemetry-js-api/pull/45) `Span#context` renamed to `Span#spanContext`
|
||||
- [#47](https://github.com/open-telemetry/opentelemetry-js-api/pull/47) `getSpan`/`setSpan`/`getSpanContext`/`setSpanContext` moved to `trace` namespace
|
||||
- [#55](https://github.com/open-telemetry/opentelemetry-js-api/pull/55) `getBaggage`/`setBaggage`/`createBaggage` moved to `propagation` namespace
|
||||
|
||||
## Useful links
|
||||
|
||||
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
|
||||
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
|
||||
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
|
||||
|
||||
## License
|
||||
|
||||
Apache 2.0 - See [LICENSE][license-url] for more information.
|
||||
|
||||
[opentelemetry-js]: https://github.com/open-telemetry/opentelemetry-js
|
||||
|
||||
[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
|
||||
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/api/LICENSE
|
||||
[docs-tracing]: https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/tracing.md
|
||||
[docs-sdk-registration]: https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/sdk-registration.md
|
|
@ -0,0 +1,24 @@
|
|||
/*!
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const karmaWebpackConfig = require('../karma.webpack');
|
||||
const karmaBaseConfig = require('../karma.base');
|
||||
|
||||
module.exports = (config) => {
|
||||
config.set(Object.assign({}, karmaBaseConfig, {
|
||||
webpack: karmaWebpackConfig,
|
||||
}))
|
||||
};
|
|
@ -0,0 +1,24 @@
|
|||
/*!
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const karmaWebpackConfig = require('../karma.webpack');
|
||||
const karmaBaseConfig = require('../karma.worker');
|
||||
|
||||
module.exports = (config) => {
|
||||
config.set(Object.assign({}, karmaBaseConfig, {
|
||||
webpack: karmaWebpackConfig,
|
||||
}))
|
||||
};
|
|
@ -0,0 +1,103 @@
|
|||
{
|
||||
"name": "@opentelemetry/api",
|
||||
"version": "1.9.0",
|
||||
"description": "Public API for OpenTelemetry",
|
||||
"main": "build/src/index.js",
|
||||
"module": "build/esm/index.js",
|
||||
"esnext": "build/esnext/index.js",
|
||||
"types": "build/src/index.d.ts",
|
||||
"browser": {
|
||||
"./src/platform/index.ts": "./src/platform/browser/index.ts",
|
||||
"./build/esm/platform/index.js": "./build/esm/platform/browser/index.js",
|
||||
"./build/esnext/platform/index.js": "./build/esnext/platform/browser/index.js",
|
||||
"./build/src/platform/index.js": "./build/src/platform/browser/index.js"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"module": "./build/esm/index.js",
|
||||
"esnext": "./build/esnext/index.js",
|
||||
"types": "./build/src/index.d.ts",
|
||||
"default": "./build/src/index.js"
|
||||
},
|
||||
"./experimental": {
|
||||
"module": "./build/esm/experimental/index.js",
|
||||
"esnext": "./build/esnext/experimental/index.js",
|
||||
"types": "./build/src/experimental/index.d.ts",
|
||||
"default": "./build/src/experimental/index.js"
|
||||
}
|
||||
},
|
||||
"repository": "open-telemetry/opentelemetry-js",
|
||||
"scripts": {
|
||||
"clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
|
||||
"precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies",
|
||||
"compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
|
||||
"lint:fix": "eslint . --ext .ts --fix",
|
||||
"lint": "eslint . --ext .ts",
|
||||
"test:browser": "karma start --single-run",
|
||||
"test": "nyc mocha 'test/**/*.test.ts'",
|
||||
"test:webworker": "karma start karma.worker.js --single-run",
|
||||
"cycle-check": "dpdm --exit-code circular:1 src/index.ts",
|
||||
"version": "node ../scripts/version-update.js",
|
||||
"prewatch": "npm run precompile",
|
||||
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
|
||||
"peer-api-check": "node ../scripts/peer-api-check.js"
|
||||
},
|
||||
"keywords": [
|
||||
"opentelemetry",
|
||||
"nodejs",
|
||||
"browser",
|
||||
"tracing",
|
||||
"profiling",
|
||||
"stats",
|
||||
"monitoring"
|
||||
],
|
||||
"author": "OpenTelemetry Authors",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
},
|
||||
"files": [
|
||||
"build/esm/**/*.js",
|
||||
"build/esm/**/*.js.map",
|
||||
"build/esm/**/*.d.ts",
|
||||
"build/esnext/**/*.js",
|
||||
"build/esnext/**/*.js.map",
|
||||
"build/esnext/**/*.d.ts",
|
||||
"build/src/**/*.js",
|
||||
"build/src/**/*.js.map",
|
||||
"build/src/**/*.d.ts",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mocha": "10.0.10",
|
||||
"@types/node": "^8.10.66",
|
||||
"@types/sinon": "17.0.4",
|
||||
"@types/webpack": "5.28.5",
|
||||
"@types/webpack-env": "1.16.3",
|
||||
"babel-plugin-istanbul": "7.0.0",
|
||||
"cross-var": "1.1.0",
|
||||
"dpdm": "3.13.1",
|
||||
"karma": "6.4.4",
|
||||
"karma-chrome-launcher": "3.1.0",
|
||||
"karma-coverage": "2.2.1",
|
||||
"karma-mocha": "2.0.1",
|
||||
"karma-mocha-webworker": "1.3.0",
|
||||
"karma-spec-reporter": "0.0.36",
|
||||
"karma-webpack": "5.0.1",
|
||||
"lerna": "6.6.2",
|
||||
"memfs": "3.5.3",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"typescript": "5.0.4",
|
||||
"unionfs": "4.5.4",
|
||||
"webpack": "5.99.9"
|
||||
},
|
||||
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/api",
|
||||
"sideEffects": false
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { NoopContextManager } from '../context/NoopContextManager';
|
||||
import { Context, ContextManager } from '../context/types';
|
||||
import {
|
||||
getGlobal,
|
||||
registerGlobal,
|
||||
unregisterGlobal,
|
||||
} from '../internal/global-utils';
|
||||
import { DiagAPI } from './diag';
|
||||
|
||||
const API_NAME = 'context';
|
||||
const NOOP_CONTEXT_MANAGER = new NoopContextManager();
|
||||
|
||||
/**
|
||||
* Singleton object which represents the entry point to the OpenTelemetry Context API
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export class ContextAPI {
|
||||
private static _instance?: ContextAPI;
|
||||
|
||||
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
||||
private constructor() {}
|
||||
|
||||
/** Get the singleton instance of the Context API */
|
||||
public static getInstance(): ContextAPI {
|
||||
if (!this._instance) {
|
||||
this._instance = new ContextAPI();
|
||||
}
|
||||
|
||||
return this._instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current context manager.
|
||||
*
|
||||
* @returns true if the context manager was successfully registered, else false
|
||||
*/
|
||||
public setGlobalContextManager(contextManager: ContextManager): boolean {
|
||||
return registerGlobal(API_NAME, contextManager, DiagAPI.instance());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currently active context
|
||||
*/
|
||||
public active(): Context {
|
||||
return this._getContextManager().active();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a function with an active context
|
||||
*
|
||||
* @param context context to be active during function execution
|
||||
* @param fn function to execute in a context
|
||||
* @param thisArg optional receiver to be used for calling fn
|
||||
* @param args optional arguments forwarded to fn
|
||||
*/
|
||||
public with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(
|
||||
context: Context,
|
||||
fn: F,
|
||||
thisArg?: ThisParameterType<F>,
|
||||
...args: A
|
||||
): ReturnType<F> {
|
||||
return this._getContextManager().with(context, fn, thisArg, ...args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind a context to a target function or event emitter
|
||||
*
|
||||
* @param context context to bind to the event emitter or function. Defaults to the currently active context
|
||||
* @param target function or event emitter to bind
|
||||
*/
|
||||
public bind<T>(context: Context, target: T): T {
|
||||
return this._getContextManager().bind(context, target);
|
||||
}
|
||||
|
||||
private _getContextManager(): ContextManager {
|
||||
return getGlobal(API_NAME) || NOOP_CONTEXT_MANAGER;
|
||||
}
|
||||
|
||||
/** Disable and remove the global context manager */
|
||||
public disable() {
|
||||
this._getContextManager().disable();
|
||||
unregisterGlobal(API_NAME, DiagAPI.instance());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DiagComponentLogger } from '../diag/ComponentLogger';
|
||||
import { createLogLevelDiagLogger } from '../diag/internal/logLevelLogger';
|
||||
import {
|
||||
ComponentLoggerOptions,
|
||||
DiagLogFunction,
|
||||
DiagLogger,
|
||||
DiagLoggerApi,
|
||||
DiagLogLevel,
|
||||
} from '../diag/types';
|
||||
import {
|
||||
getGlobal,
|
||||
registerGlobal,
|
||||
unregisterGlobal,
|
||||
} from '../internal/global-utils';
|
||||
|
||||
const API_NAME = 'diag';
|
||||
|
||||
/**
|
||||
* Singleton object which represents the entry point to the OpenTelemetry internal
|
||||
* diagnostic API
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export class DiagAPI implements DiagLogger, DiagLoggerApi {
|
||||
private static _instance?: DiagAPI;
|
||||
|
||||
/** Get the singleton instance of the DiagAPI API */
|
||||
public static instance(): DiagAPI {
|
||||
if (!this._instance) {
|
||||
this._instance = new DiagAPI();
|
||||
}
|
||||
|
||||
return this._instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Private internal constructor
|
||||
* @private
|
||||
*/
|
||||
private constructor() {
|
||||
function _logProxy(funcName: keyof DiagLogger): DiagLogFunction {
|
||||
return function (...args) {
|
||||
const logger = getGlobal('diag');
|
||||
// shortcut if logger not set
|
||||
if (!logger) return;
|
||||
return logger[funcName](...args);
|
||||
};
|
||||
}
|
||||
|
||||
// Using self local variable for minification purposes as 'this' cannot be minified
|
||||
const self = this;
|
||||
|
||||
// DiagAPI specific functions
|
||||
|
||||
const setLogger: DiagLoggerApi['setLogger'] = (
|
||||
logger,
|
||||
optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }
|
||||
) => {
|
||||
if (logger === self) {
|
||||
// There isn't much we can do here.
|
||||
// Logging to the console might break the user application.
|
||||
// Try to log to self. If a logger was previously registered it will receive the log.
|
||||
const err = new Error(
|
||||
'Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation'
|
||||
);
|
||||
self.error(err.stack ?? err.message);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof optionsOrLogLevel === 'number') {
|
||||
optionsOrLogLevel = {
|
||||
logLevel: optionsOrLogLevel,
|
||||
};
|
||||
}
|
||||
|
||||
const oldLogger = getGlobal('diag');
|
||||
const newLogger = createLogLevelDiagLogger(
|
||||
optionsOrLogLevel.logLevel ?? DiagLogLevel.INFO,
|
||||
logger
|
||||
);
|
||||
// There already is an logger registered. We'll let it know before overwriting it.
|
||||
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
||||
const stack = new Error().stack ?? '<failed to generate stacktrace>';
|
||||
oldLogger.warn(`Current logger will be overwritten from ${stack}`);
|
||||
newLogger.warn(
|
||||
`Current logger will overwrite one already registered from ${stack}`
|
||||
);
|
||||
}
|
||||
|
||||
return registerGlobal('diag', newLogger, self, true);
|
||||
};
|
||||
|
||||
self.setLogger = setLogger;
|
||||
|
||||
self.disable = () => {
|
||||
unregisterGlobal(API_NAME, self);
|
||||
};
|
||||
|
||||
self.createComponentLogger = (options: ComponentLoggerOptions) => {
|
||||
return new DiagComponentLogger(options);
|
||||
};
|
||||
|
||||
self.verbose = _logProxy('verbose');
|
||||
self.debug = _logProxy('debug');
|
||||
self.info = _logProxy('info');
|
||||
self.warn = _logProxy('warn');
|
||||
self.error = _logProxy('error');
|
||||
}
|
||||
|
||||
public setLogger!: DiagLoggerApi['setLogger'];
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public createComponentLogger!: (
|
||||
options: ComponentLoggerOptions
|
||||
) => DiagLogger;
|
||||
|
||||
// DiagLogger implementation
|
||||
public verbose!: DiagLogFunction;
|
||||
public debug!: DiagLogFunction;
|
||||
public info!: DiagLogFunction;
|
||||
public warn!: DiagLogFunction;
|
||||
public error!: DiagLogFunction;
|
||||
|
||||
/**
|
||||
* Unregister the global logger and return to Noop
|
||||
*/
|
||||
public disable!: () => void;
|
||||
}
|
|
@ -14,15 +14,17 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Meter, MeterOptions } from '../types/Meter';
|
||||
import { MeterProvider } from '../types/MeterProvider';
|
||||
import { NOOP_METER_PROVIDER } from '../NoopMeterProvider';
|
||||
import { Meter, MeterOptions } from '../metrics/Meter';
|
||||
import { MeterProvider } from '../metrics/MeterProvider';
|
||||
import { NOOP_METER_PROVIDER } from '../metrics/NoopMeterProvider';
|
||||
import {
|
||||
API_BACKWARDS_COMPATIBILITY_VERSION,
|
||||
GLOBAL_METRICS_API_KEY,
|
||||
makeGetter,
|
||||
_global,
|
||||
} from './global-utils';
|
||||
getGlobal,
|
||||
registerGlobal,
|
||||
unregisterGlobal,
|
||||
} from '../internal/global-utils';
|
||||
import { DiagAPI } from './diag';
|
||||
|
||||
const API_NAME = 'metrics';
|
||||
|
||||
/**
|
||||
* Singleton object which represents the entry point to the OpenTelemetry Metrics API
|
||||
|
@ -43,42 +45,33 @@ export class MetricsAPI {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the current global meter. Returns the initialized global meter provider.
|
||||
* Set the current global meter provider.
|
||||
* Returns true if the meter provider was successfully registered, else false.
|
||||
*/
|
||||
public setGlobalMeterProvider(provider: MeterProvider): MeterProvider {
|
||||
if (_global[GLOBAL_METRICS_API_KEY]) {
|
||||
// global meter provider has already been set
|
||||
return this.getMeterProvider();
|
||||
}
|
||||
|
||||
_global[GLOBAL_METRICS_API_KEY] = makeGetter(
|
||||
API_BACKWARDS_COMPATIBILITY_VERSION,
|
||||
provider,
|
||||
NOOP_METER_PROVIDER
|
||||
);
|
||||
|
||||
return provider;
|
||||
public setGlobalMeterProvider(provider: MeterProvider): boolean {
|
||||
return registerGlobal(API_NAME, provider, DiagAPI.instance());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the global meter provider.
|
||||
*/
|
||||
public getMeterProvider(): MeterProvider {
|
||||
return (
|
||||
_global[GLOBAL_METRICS_API_KEY]?.(API_BACKWARDS_COMPATIBILITY_VERSION) ??
|
||||
NOOP_METER_PROVIDER
|
||||
);
|
||||
return getGlobal(API_NAME) || NOOP_METER_PROVIDER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a meter from the global meter provider.
|
||||
*/
|
||||
public getMeter(name: string, version?: string, options?: MeterOptions): Meter {
|
||||
public getMeter(
|
||||
name: string,
|
||||
version?: string,
|
||||
options?: MeterOptions
|
||||
): Meter {
|
||||
return this.getMeterProvider().getMeter(name, version, options);
|
||||
}
|
||||
|
||||
/** Remove the global meter provider */
|
||||
public disable(): void {
|
||||
delete _global[GLOBAL_METRICS_API_KEY];
|
||||
unregisterGlobal(API_NAME, DiagAPI.instance());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Context } from '../context/types';
|
||||
import {
|
||||
getGlobal,
|
||||
registerGlobal,
|
||||
unregisterGlobal,
|
||||
} from '../internal/global-utils';
|
||||
import { NoopTextMapPropagator } from '../propagation/NoopTextMapPropagator';
|
||||
import {
|
||||
defaultTextMapGetter,
|
||||
defaultTextMapSetter,
|
||||
TextMapGetter,
|
||||
TextMapPropagator,
|
||||
TextMapSetter,
|
||||
} from '../propagation/TextMapPropagator';
|
||||
import {
|
||||
getBaggage,
|
||||
getActiveBaggage,
|
||||
setBaggage,
|
||||
deleteBaggage,
|
||||
} from '../baggage/context-helpers';
|
||||
import { createBaggage } from '../baggage/utils';
|
||||
import { DiagAPI } from './diag';
|
||||
|
||||
const API_NAME = 'propagation';
|
||||
const NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();
|
||||
|
||||
/**
|
||||
* Singleton object which represents the entry point to the OpenTelemetry Propagation API
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export class PropagationAPI {
|
||||
private static _instance?: PropagationAPI;
|
||||
|
||||
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
||||
private constructor() {}
|
||||
|
||||
/** Get the singleton instance of the Propagator API */
|
||||
public static getInstance(): PropagationAPI {
|
||||
if (!this._instance) {
|
||||
this._instance = new PropagationAPI();
|
||||
}
|
||||
|
||||
return this._instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current propagator.
|
||||
*
|
||||
* @returns true if the propagator was successfully registered, else false
|
||||
*/
|
||||
public setGlobalPropagator(propagator: TextMapPropagator): boolean {
|
||||
return registerGlobal(API_NAME, propagator, DiagAPI.instance());
|
||||
}
|
||||
|
||||
/**
|
||||
* Inject context into a carrier to be propagated inter-process
|
||||
*
|
||||
* @param context Context carrying tracing data to inject
|
||||
* @param carrier carrier to inject context into
|
||||
* @param setter Function used to set values on the carrier
|
||||
*/
|
||||
public inject<Carrier>(
|
||||
context: Context,
|
||||
carrier: Carrier,
|
||||
setter: TextMapSetter<Carrier> = defaultTextMapSetter
|
||||
): void {
|
||||
return this._getGlobalPropagator().inject(context, carrier, setter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract context from a carrier
|
||||
*
|
||||
* @param context Context which the newly created context will inherit from
|
||||
* @param carrier Carrier to extract context from
|
||||
* @param getter Function used to extract keys from a carrier
|
||||
*/
|
||||
public extract<Carrier>(
|
||||
context: Context,
|
||||
carrier: Carrier,
|
||||
getter: TextMapGetter<Carrier> = defaultTextMapGetter
|
||||
): Context {
|
||||
return this._getGlobalPropagator().extract(context, carrier, getter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all fields which may be used by the propagator.
|
||||
*/
|
||||
public fields(): string[] {
|
||||
return this._getGlobalPropagator().fields();
|
||||
}
|
||||
|
||||
/** Remove the global propagator */
|
||||
public disable() {
|
||||
unregisterGlobal(API_NAME, DiagAPI.instance());
|
||||
}
|
||||
|
||||
public createBaggage = createBaggage;
|
||||
|
||||
public getBaggage = getBaggage;
|
||||
|
||||
public getActiveBaggage = getActiveBaggage;
|
||||
|
||||
public setBaggage = setBaggage;
|
||||
|
||||
public deleteBaggage = deleteBaggage;
|
||||
|
||||
private _getGlobalPropagator(): TextMapPropagator {
|
||||
return getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
getGlobal,
|
||||
registerGlobal,
|
||||
unregisterGlobal,
|
||||
} from '../internal/global-utils';
|
||||
import { ProxyTracerProvider } from '../trace/ProxyTracerProvider';
|
||||
import {
|
||||
isSpanContextValid,
|
||||
wrapSpanContext,
|
||||
} from '../trace/spancontext-utils';
|
||||
import { Tracer } from '../trace/tracer';
|
||||
import { TracerProvider } from '../trace/tracer_provider';
|
||||
import {
|
||||
deleteSpan,
|
||||
getActiveSpan,
|
||||
getSpan,
|
||||
getSpanContext,
|
||||
setSpan,
|
||||
setSpanContext,
|
||||
} from '../trace/context-utils';
|
||||
import { DiagAPI } from './diag';
|
||||
|
||||
const API_NAME = 'trace';
|
||||
|
||||
/**
|
||||
* Singleton object which represents the entry point to the OpenTelemetry Tracing API
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export class TraceAPI {
|
||||
private static _instance?: TraceAPI;
|
||||
|
||||
private _proxyTracerProvider = new ProxyTracerProvider();
|
||||
|
||||
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
||||
private constructor() {}
|
||||
|
||||
/** Get the singleton instance of the Trace API */
|
||||
public static getInstance(): TraceAPI {
|
||||
if (!this._instance) {
|
||||
this._instance = new TraceAPI();
|
||||
}
|
||||
|
||||
return this._instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current global tracer.
|
||||
*
|
||||
* @returns true if the tracer provider was successfully registered, else false
|
||||
*/
|
||||
public setGlobalTracerProvider(provider: TracerProvider): boolean {
|
||||
const success = registerGlobal(
|
||||
API_NAME,
|
||||
this._proxyTracerProvider,
|
||||
DiagAPI.instance()
|
||||
);
|
||||
if (success) {
|
||||
this._proxyTracerProvider.setDelegate(provider);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the global tracer provider.
|
||||
*/
|
||||
public getTracerProvider(): TracerProvider {
|
||||
return getGlobal(API_NAME) || this._proxyTracerProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a tracer from the global tracer provider.
|
||||
*/
|
||||
public getTracer(name: string, version?: string): Tracer {
|
||||
return this.getTracerProvider().getTracer(name, version);
|
||||
}
|
||||
|
||||
/** Remove the global tracer provider */
|
||||
public disable() {
|
||||
unregisterGlobal(API_NAME, DiagAPI.instance());
|
||||
this._proxyTracerProvider = new ProxyTracerProvider();
|
||||
}
|
||||
|
||||
public wrapSpanContext = wrapSpanContext;
|
||||
|
||||
public isSpanContextValid = isSpanContextValid;
|
||||
|
||||
public deleteSpan = deleteSpan;
|
||||
|
||||
public getSpan = getSpan;
|
||||
|
||||
public getActiveSpan = getActiveSpan;
|
||||
|
||||
public getSpanContext = getSpanContext;
|
||||
|
||||
public setSpan = setSpan;
|
||||
|
||||
public setSpanContext = setSpanContext;
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ContextAPI } from '../api/context';
|
||||
import { createContextKey } from '../context/context';
|
||||
import { Context } from '../context/types';
|
||||
import { Baggage } from './types';
|
||||
|
||||
/**
|
||||
* Baggage key
|
||||
*/
|
||||
const BAGGAGE_KEY = createContextKey('OpenTelemetry Baggage Key');
|
||||
|
||||
/**
|
||||
* Retrieve the current baggage from the given context
|
||||
*
|
||||
* @param {Context} Context that manage all context values
|
||||
* @returns {Baggage} Extracted baggage from the context
|
||||
*/
|
||||
export function getBaggage(context: Context): Baggage | undefined {
|
||||
return (context.getValue(BAGGAGE_KEY) as Baggage) || undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the current baggage from the active/current context
|
||||
*
|
||||
* @returns {Baggage} Extracted baggage from the context
|
||||
*/
|
||||
export function getActiveBaggage(): Baggage | undefined {
|
||||
return getBaggage(ContextAPI.getInstance().active());
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a baggage in the given context
|
||||
*
|
||||
* @param {Context} Context that manage all context values
|
||||
* @param {Baggage} baggage that will be set in the actual context
|
||||
*/
|
||||
export function setBaggage(context: Context, baggage: Baggage): Context {
|
||||
return context.setValue(BAGGAGE_KEY, baggage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the baggage stored in the given context
|
||||
*
|
||||
* @param {Context} Context that manage all context values
|
||||
*/
|
||||
export function deleteBaggage(context: Context): Context {
|
||||
return context.deleteValue(BAGGAGE_KEY);
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Baggage, BaggageEntry } from '../types';
|
||||
|
||||
export class BaggageImpl implements Baggage {
|
||||
private _entries: Map<string, BaggageEntry>;
|
||||
|
||||
constructor(entries?: Map<string, BaggageEntry>) {
|
||||
this._entries = entries ? new Map(entries) : new Map();
|
||||
}
|
||||
|
||||
getEntry(key: string): BaggageEntry | undefined {
|
||||
const entry = this._entries.get(key);
|
||||
if (!entry) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return Object.assign({}, entry);
|
||||
}
|
||||
|
||||
getAllEntries(): [string, BaggageEntry][] {
|
||||
return Array.from(this._entries.entries()).map(([k, v]) => [k, v]);
|
||||
}
|
||||
|
||||
setEntry(key: string, entry: BaggageEntry): BaggageImpl {
|
||||
const newBaggage = new BaggageImpl(this._entries);
|
||||
newBaggage._entries.set(key, entry);
|
||||
return newBaggage;
|
||||
}
|
||||
|
||||
removeEntry(key: string): BaggageImpl {
|
||||
const newBaggage = new BaggageImpl(this._entries);
|
||||
newBaggage._entries.delete(key);
|
||||
return newBaggage;
|
||||
}
|
||||
|
||||
removeEntries(...keys: string[]): BaggageImpl {
|
||||
const newBaggage = new BaggageImpl(this._entries);
|
||||
for (const key of keys) {
|
||||
newBaggage._entries.delete(key);
|
||||
}
|
||||
return newBaggage;
|
||||
}
|
||||
|
||||
clear(): BaggageImpl {
|
||||
return new BaggageImpl();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Symbol used to make BaggageEntryMetadata an opaque type
|
||||
*/
|
||||
export const baggageEntryMetadataSymbol = Symbol('BaggageEntryMetadata');
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { baggageEntryMetadataSymbol } from './internal/symbol';
|
||||
|
||||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export interface BaggageEntry {
|
||||
/** `String` value of the `BaggageEntry`. */
|
||||
value: string;
|
||||
/**
|
||||
* Metadata is an optional string property defined by the W3C baggage specification.
|
||||
* It currently has no special meaning defined by the specification.
|
||||
*/
|
||||
metadata?: BaggageEntryMetadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializable Metadata defined by the W3C baggage specification.
|
||||
* It currently has no special meaning defined by the OpenTelemetry or W3C.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export type BaggageEntryMetadata = { toString(): string } & {
|
||||
__TYPE__: typeof baggageEntryMetadataSymbol;
|
||||
};
|
||||
|
||||
/**
|
||||
* Baggage represents collection of key-value pairs with optional metadata.
|
||||
* Each key of Baggage is associated with exactly one value.
|
||||
* Baggage may be used to annotate and enrich telemetry data.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export interface Baggage {
|
||||
/**
|
||||
* Get an entry from Baggage if it exists
|
||||
*
|
||||
* @param key The key which identifies the BaggageEntry
|
||||
*/
|
||||
getEntry(key: string): BaggageEntry | undefined;
|
||||
|
||||
/**
|
||||
* Get a list of all entries in the Baggage
|
||||
*/
|
||||
getAllEntries(): [string, BaggageEntry][];
|
||||
|
||||
/**
|
||||
* Returns a new baggage with the entries from the current bag and the specified entry
|
||||
*
|
||||
* @param key string which identifies the baggage entry
|
||||
* @param entry BaggageEntry for the given key
|
||||
*/
|
||||
setEntry(key: string, entry: BaggageEntry): Baggage;
|
||||
|
||||
/**
|
||||
* Returns a new baggage with the entries from the current bag except the removed entry
|
||||
*
|
||||
* @param key key identifying the entry to be removed
|
||||
*/
|
||||
removeEntry(key: string): Baggage;
|
||||
|
||||
/**
|
||||
* Returns a new baggage with the entries from the current bag except the removed entries
|
||||
*
|
||||
* @param key keys identifying the entries to be removed
|
||||
*/
|
||||
removeEntries(...key: string[]): Baggage;
|
||||
|
||||
/**
|
||||
* Returns a new baggage with no entries
|
||||
*/
|
||||
clear(): Baggage;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DiagAPI } from '../api/diag';
|
||||
import { BaggageImpl } from './internal/baggage-impl';
|
||||
import { baggageEntryMetadataSymbol } from './internal/symbol';
|
||||
import { Baggage, BaggageEntry, BaggageEntryMetadata } from './types';
|
||||
|
||||
const diag = DiagAPI.instance();
|
||||
|
||||
/**
|
||||
* Create a new Baggage with optional entries
|
||||
*
|
||||
* @param entries An array of baggage entries the new baggage should contain
|
||||
*/
|
||||
export function createBaggage(
|
||||
entries: Record<string, BaggageEntry> = {}
|
||||
): Baggage {
|
||||
return new BaggageImpl(new Map(Object.entries(entries)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a serializable BaggageEntryMetadata object from a string.
|
||||
*
|
||||
* @param str string metadata. Format is currently not defined by the spec and has no special meaning.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export function baggageEntryMetadataFromString(
|
||||
str: string
|
||||
): BaggageEntryMetadata {
|
||||
if (typeof str !== 'string') {
|
||||
diag.error(
|
||||
`Cannot create baggage metadata from unknown type: ${typeof str}`
|
||||
);
|
||||
str = '';
|
||||
}
|
||||
|
||||
return {
|
||||
__TYPE__: baggageEntryMetadataSymbol,
|
||||
toString() {
|
||||
return str;
|
||||
},
|
||||
};
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Attributes is a map from string to attribute values.
|
||||
*
|
||||
* Note: only the own enumerable keys are counted as valid attribute keys.
|
||||
*
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export interface Attributes {
|
||||
[attributeKey: string]: AttributeValue | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attribute values may be any non-nullish primitive value except an object.
|
||||
*
|
||||
* null or undefined attribute values are invalid and will result in undefined behavior.
|
||||
*
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export type AttributeValue =
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| Array<null | undefined | string>
|
||||
| Array<null | undefined | number>
|
||||
| Array<null | undefined | boolean>;
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
interface ExceptionWithCode {
|
||||
code: string | number;
|
||||
name?: string;
|
||||
message?: string;
|
||||
stack?: string;
|
||||
}
|
||||
|
||||
interface ExceptionWithMessage {
|
||||
code?: string | number;
|
||||
message: string;
|
||||
name?: string;
|
||||
stack?: string;
|
||||
}
|
||||
|
||||
interface ExceptionWithName {
|
||||
code?: string | number;
|
||||
message?: string;
|
||||
name: string;
|
||||
stack?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines Exception.
|
||||
*
|
||||
* string or an object with one of (message or name or code) and optional stack
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export type Exception =
|
||||
| ExceptionWithCode
|
||||
| ExceptionWithMessage
|
||||
| ExceptionWithName
|
||||
| string;
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Defines High-Resolution Time.
|
||||
*
|
||||
* The first number, HrTime[0], is UNIX Epoch time in seconds since 00:00:00 UTC on 1 January 1970.
|
||||
* The second number, HrTime[1], represents the partial second elapsed since Unix Epoch time represented by first number in nanoseconds.
|
||||
* For example, 2021-01-01T12:30:10.150Z in UNIX Epoch time in milliseconds is represented as 1609504210150.
|
||||
* The first number is calculated by converting and truncating the Epoch time in milliseconds to seconds:
|
||||
* HrTime[0] = Math.trunc(1609504210150 / 1000) = 1609504210.
|
||||
* The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:
|
||||
* HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.
|
||||
* This is represented in HrTime format as [1609504210, 150000000].
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export type HrTime = [number, number];
|
||||
|
||||
/**
|
||||
* Defines TimeInput.
|
||||
*
|
||||
* hrtime, epoch milliseconds, performance.now() or Date
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export type TimeInput = HrTime | number | Date;
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Split module-level variable definition into separate files to allow
|
||||
// tree-shaking on each api instance.
|
||||
import { ContextAPI } from './api/context';
|
||||
/**
|
||||
* Entrypoint for context API
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export const context = ContextAPI.getInstance();
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ROOT_CONTEXT } from './context';
|
||||
import * as types from './types';
|
||||
|
||||
export class NoopContextManager implements types.ContextManager {
|
||||
active(): types.Context {
|
||||
return ROOT_CONTEXT;
|
||||
}
|
||||
|
||||
with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(
|
||||
_context: types.Context,
|
||||
fn: F,
|
||||
thisArg?: ThisParameterType<F>,
|
||||
...args: A
|
||||
): ReturnType<F> {
|
||||
return fn.call(thisArg, ...args);
|
||||
}
|
||||
|
||||
bind<T>(_context: types.Context, target: T): T {
|
||||
return target;
|
||||
}
|
||||
|
||||
enable(): this {
|
||||
return this;
|
||||
}
|
||||
|
||||
disable(): this {
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Context } from './types';
|
||||
|
||||
/**
|
||||
* Get a key to uniquely identify a context value
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export function createContextKey(description: string) {
|
||||
// The specification states that for the same input, multiple calls should
|
||||
// return different keys. Due to the nature of the JS dependency management
|
||||
// system, this creates problems where multiple versions of some package
|
||||
// could hold different keys for the same property.
|
||||
//
|
||||
// Therefore, we use Symbol.for which returns the same key for the same input.
|
||||
return Symbol.for(description);
|
||||
}
|
||||
|
||||
class BaseContext implements Context {
|
||||
private _currentContext!: Map<symbol, unknown>;
|
||||
|
||||
/**
|
||||
* Construct a new context which inherits values from an optional parent context.
|
||||
*
|
||||
* @param parentContext a context from which to inherit values
|
||||
*/
|
||||
constructor(parentContext?: Map<symbol, unknown>) {
|
||||
// for minification
|
||||
const self = this;
|
||||
|
||||
self._currentContext = parentContext ? new Map(parentContext) : new Map();
|
||||
|
||||
self.getValue = (key: symbol) => self._currentContext.get(key);
|
||||
|
||||
self.setValue = (key: symbol, value: unknown): Context => {
|
||||
const context = new BaseContext(self._currentContext);
|
||||
context._currentContext.set(key, value);
|
||||
return context;
|
||||
};
|
||||
|
||||
self.deleteValue = (key: symbol): Context => {
|
||||
const context = new BaseContext(self._currentContext);
|
||||
context._currentContext.delete(key);
|
||||
return context;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value from the context.
|
||||
*
|
||||
* @param key key which identifies a context value
|
||||
*/
|
||||
public getValue!: (key: symbol) => unknown;
|
||||
|
||||
/**
|
||||
* Create a new context which inherits from this context and has
|
||||
* the given key set to the given value.
|
||||
*
|
||||
* @param key context key for which to set the value
|
||||
* @param value value to set for the given key
|
||||
*/
|
||||
public setValue!: (key: symbol, value: unknown) => Context;
|
||||
|
||||
/**
|
||||
* Return a new context which inherits from this context but does
|
||||
* not contain a value for the given key.
|
||||
*
|
||||
* @param key context key for which to clear a value
|
||||
*/
|
||||
public deleteValue!: (key: symbol) => Context;
|
||||
}
|
||||
|
||||
/**
|
||||
* The root context is used as the default parent context when there is no active context
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export const ROOT_CONTEXT: Context = new BaseContext();
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export interface Context {
|
||||
/**
|
||||
* Get a value from the context.
|
||||
*
|
||||
* @param key key which identifies a context value
|
||||
*/
|
||||
getValue(key: symbol): unknown;
|
||||
|
||||
/**
|
||||
* Create a new context which inherits from this context and has
|
||||
* the given key set to the given value.
|
||||
*
|
||||
* @param key context key for which to set the value
|
||||
* @param value value to set for the given key
|
||||
*/
|
||||
setValue(key: symbol, value: unknown): Context;
|
||||
|
||||
/**
|
||||
* Return a new context which inherits from this context but does
|
||||
* not contain a value for the given key.
|
||||
*
|
||||
* @param key context key for which to clear a value
|
||||
*/
|
||||
deleteValue(key: symbol): Context;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export interface ContextManager {
|
||||
/**
|
||||
* Get the current active context
|
||||
*/
|
||||
active(): Context;
|
||||
|
||||
/**
|
||||
* Run the fn callback with object set as the current active context
|
||||
* @param context Any object to set as the current active context
|
||||
* @param fn A callback to be immediately run within a specific context
|
||||
* @param thisArg optional receiver to be used for calling fn
|
||||
* @param args optional arguments forwarded to fn
|
||||
*/
|
||||
with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(
|
||||
context: Context,
|
||||
fn: F,
|
||||
thisArg?: ThisParameterType<F>,
|
||||
...args: A
|
||||
): ReturnType<F>;
|
||||
|
||||
/**
|
||||
* Bind an object as the current context (or a specific one)
|
||||
* @param [context] Optionally specify the context which you want to assign
|
||||
* @param target Any object to which a context need to be set
|
||||
*/
|
||||
bind<T>(context: Context, target: T): T;
|
||||
|
||||
/**
|
||||
* Enable context management
|
||||
*/
|
||||
enable(): this;
|
||||
|
||||
/**
|
||||
* Disable context management
|
||||
*/
|
||||
disable(): this;
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Split module-level variable definition into separate files to allow
|
||||
// tree-shaking on each api instance.
|
||||
import { DiagAPI } from './api/diag';
|
||||
/**
|
||||
* Entrypoint for Diag API.
|
||||
* Defines Diagnostic handler used for internal diagnostic logging operations.
|
||||
* The default provides a Noop DiagLogger implementation which may be changed via the
|
||||
* diag.setLogger(logger: DiagLogger) function.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export const diag = DiagAPI.instance();
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { getGlobal } from '../internal/global-utils';
|
||||
import { ComponentLoggerOptions, DiagLogger, DiagLogFunction } from './types';
|
||||
|
||||
/**
|
||||
* Component Logger which is meant to be used as part of any component which
|
||||
* will add automatically additional namespace in front of the log message.
|
||||
* It will then forward all message to global diag logger
|
||||
* @example
|
||||
* const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' });
|
||||
* cLogger.debug('test');
|
||||
* // @opentelemetry/instrumentation-http test
|
||||
*/
|
||||
export class DiagComponentLogger implements DiagLogger {
|
||||
private _namespace: string;
|
||||
|
||||
constructor(props: ComponentLoggerOptions) {
|
||||
this._namespace = props.namespace || 'DiagComponentLogger';
|
||||
}
|
||||
|
||||
public debug(...args: unknown[]): void {
|
||||
return logProxy('debug', this._namespace, args);
|
||||
}
|
||||
|
||||
public error(...args: unknown[]): void {
|
||||
return logProxy('error', this._namespace, args);
|
||||
}
|
||||
|
||||
public info(...args: unknown[]): void {
|
||||
return logProxy('info', this._namespace, args);
|
||||
}
|
||||
|
||||
public warn(...args: unknown[]): void {
|
||||
return logProxy('warn', this._namespace, args);
|
||||
}
|
||||
|
||||
public verbose(...args: unknown[]): void {
|
||||
return logProxy('verbose', this._namespace, args);
|
||||
}
|
||||
}
|
||||
|
||||
function logProxy(
|
||||
funcName: keyof DiagLogger,
|
||||
namespace: string,
|
||||
args: unknown[]
|
||||
): void {
|
||||
const logger = getGlobal('diag');
|
||||
// shortcut if logger not set
|
||||
if (!logger) {
|
||||
return;
|
||||
}
|
||||
|
||||
args.unshift(namespace);
|
||||
return logger[funcName](...(args as Parameters<DiagLogFunction>));
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DiagLogger, DiagLogFunction } from './types';
|
||||
|
||||
type ConsoleMapKeys = 'error' | 'warn' | 'info' | 'debug' | 'trace';
|
||||
const consoleMap: { n: keyof DiagLogger; c: ConsoleMapKeys }[] = [
|
||||
{ n: 'error', c: 'error' },
|
||||
{ n: 'warn', c: 'warn' },
|
||||
{ n: 'info', c: 'info' },
|
||||
{ n: 'debug', c: 'debug' },
|
||||
{ n: 'verbose', c: 'trace' },
|
||||
];
|
||||
|
||||
/**
|
||||
* A simple Immutable Console based diagnostic logger which will output any messages to the Console.
|
||||
* If you want to limit the amount of logging to a specific level or lower use the
|
||||
* {@link createLogLevelDiagLogger}
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export class DiagConsoleLogger implements DiagLogger {
|
||||
constructor() {
|
||||
function _consoleFunc(funcName: ConsoleMapKeys): DiagLogFunction {
|
||||
return function (...args) {
|
||||
if (console) {
|
||||
// Some environments only expose the console when the F12 developer console is open
|
||||
// eslint-disable-next-line no-console
|
||||
let theFunc = console[funcName];
|
||||
if (typeof theFunc !== 'function') {
|
||||
// Not all environments support all functions
|
||||
// eslint-disable-next-line no-console
|
||||
theFunc = console.log;
|
||||
}
|
||||
|
||||
// One last final check
|
||||
if (typeof theFunc === 'function') {
|
||||
return theFunc.apply(console, args);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
for (let i = 0; i < consoleMap.length; i++) {
|
||||
this[consoleMap[i].n] = _consoleFunc(consoleMap[i].c);
|
||||
}
|
||||
}
|
||||
|
||||
/** Log an error scenario that was not expected and caused the requested operation to fail. */
|
||||
public error!: DiagLogFunction;
|
||||
|
||||
/**
|
||||
* Log a warning scenario to inform the developer of an issues that should be investigated.
|
||||
* The requested operation may or may not have succeeded or completed.
|
||||
*/
|
||||
public warn!: DiagLogFunction;
|
||||
|
||||
/**
|
||||
* Log a general informational message, this should not affect functionality.
|
||||
* This is also the default logging level so this should NOT be used for logging
|
||||
* debugging level information.
|
||||
*/
|
||||
public info!: DiagLogFunction;
|
||||
|
||||
/**
|
||||
* Log a general debug message that can be useful for identifying a failure.
|
||||
* Information logged at this level may include diagnostic details that would
|
||||
* help identify a failure scenario. Useful scenarios would be to log the execution
|
||||
* order of async operations
|
||||
*/
|
||||
public debug!: DiagLogFunction;
|
||||
|
||||
/**
|
||||
* Log a detailed (verbose) trace level logging that can be used to identify failures
|
||||
* where debug level logging would be insufficient, this level of tracing can include
|
||||
* input and output parameters and as such may include PII information passing through
|
||||
* the API. As such it is recommended that this level of tracing should not be enabled
|
||||
* in a production environment.
|
||||
*/
|
||||
public verbose!: DiagLogFunction;
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DiagLogFunction, DiagLogger, DiagLogLevel } from '../types';
|
||||
|
||||
export function createLogLevelDiagLogger(
|
||||
maxLevel: DiagLogLevel,
|
||||
logger: DiagLogger
|
||||
): DiagLogger {
|
||||
if (maxLevel < DiagLogLevel.NONE) {
|
||||
maxLevel = DiagLogLevel.NONE;
|
||||
} else if (maxLevel > DiagLogLevel.ALL) {
|
||||
maxLevel = DiagLogLevel.ALL;
|
||||
}
|
||||
|
||||
// In case the logger is null or undefined
|
||||
logger = logger || {};
|
||||
|
||||
function _filterFunc(
|
||||
funcName: keyof DiagLogger,
|
||||
theLevel: DiagLogLevel
|
||||
): DiagLogFunction {
|
||||
const theFunc = logger[funcName];
|
||||
|
||||
if (typeof theFunc === 'function' && maxLevel >= theLevel) {
|
||||
return theFunc.bind(logger);
|
||||
}
|
||||
return function () {};
|
||||
}
|
||||
|
||||
return {
|
||||
error: _filterFunc('error', DiagLogLevel.ERROR),
|
||||
warn: _filterFunc('warn', DiagLogLevel.WARN),
|
||||
info: _filterFunc('info', DiagLogLevel.INFO),
|
||||
debug: _filterFunc('debug', DiagLogLevel.DEBUG),
|
||||
verbose: _filterFunc('verbose', DiagLogLevel.VERBOSE),
|
||||
};
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DiagLogger } from '../types';
|
||||
|
||||
function noopLogFunction() {}
|
||||
|
||||
/**
|
||||
* Returns a No-Op Diagnostic logger where all messages do nothing.
|
||||
* @implements {@link DiagLogger}
|
||||
* @returns {DiagLogger}
|
||||
*/
|
||||
export function createNoopDiagLogger(): DiagLogger {
|
||||
return {
|
||||
verbose: noopLogFunction,
|
||||
debug: noopLogFunction,
|
||||
info: noopLogFunction,
|
||||
warn: noopLogFunction,
|
||||
error: noopLogFunction,
|
||||
};
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export type DiagLogFunction = (message: string, ...args: unknown[]) => void;
|
||||
|
||||
/**
|
||||
* Defines an internal diagnostic logger interface which is used to log internal diagnostic
|
||||
* messages, you can set the default diagnostic logger via the {@link DiagAPI} setLogger function.
|
||||
* API provided implementations include :-
|
||||
* - a No-Op {@link createNoopDiagLogger}
|
||||
* - a {@link DiagLogLevel} filtering wrapper {@link createLogLevelDiagLogger}
|
||||
* - a general Console {@link DiagConsoleLogger} version.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export interface DiagLogger {
|
||||
/** Log an error scenario that was not expected and caused the requested operation to fail. */
|
||||
error: DiagLogFunction;
|
||||
|
||||
/**
|
||||
* Log a warning scenario to inform the developer of an issues that should be investigated.
|
||||
* The requested operation may or may not have succeeded or completed.
|
||||
*/
|
||||
warn: DiagLogFunction;
|
||||
|
||||
/**
|
||||
* Log a general informational message, this should not affect functionality.
|
||||
* This is also the default logging level so this should NOT be used for logging
|
||||
* debugging level information.
|
||||
*/
|
||||
info: DiagLogFunction;
|
||||
|
||||
/**
|
||||
* Log a general debug message that can be useful for identifying a failure.
|
||||
* Information logged at this level may include diagnostic details that would
|
||||
* help identify a failure scenario.
|
||||
* For example: Logging the order of execution of async operations.
|
||||
*/
|
||||
debug: DiagLogFunction;
|
||||
|
||||
/**
|
||||
* Log a detailed (verbose) trace level logging that can be used to identify failures
|
||||
* where debug level logging would be insufficient, this level of tracing can include
|
||||
* input and output parameters and as such may include PII information passing through
|
||||
* the API. As such it is recommended that this level of tracing should not be enabled
|
||||
* in a production environment.
|
||||
*/
|
||||
verbose: DiagLogFunction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the available internal logging levels for the diagnostic logger, the numeric values
|
||||
* of the levels are defined to match the original values from the initial LogLevel to avoid
|
||||
* compatibility/migration issues for any implementation that assume the numeric ordering.
|
||||
*/
|
||||
export enum DiagLogLevel {
|
||||
/** Diagnostic Logging level setting to disable all logging (except and forced logs) */
|
||||
NONE = 0,
|
||||
|
||||
/** Identifies an error scenario */
|
||||
ERROR = 30,
|
||||
|
||||
/** Identifies a warning scenario */
|
||||
WARN = 50,
|
||||
|
||||
/** General informational log message */
|
||||
INFO = 60,
|
||||
|
||||
/** General debug log message */
|
||||
DEBUG = 70,
|
||||
|
||||
/**
|
||||
* Detailed trace level logging should only be used for development, should only be set
|
||||
* in a development environment.
|
||||
*/
|
||||
VERBOSE = 80,
|
||||
|
||||
/** Used to set the logging level to include all logging */
|
||||
ALL = 9999,
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines options for ComponentLogger
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export interface ComponentLoggerOptions {
|
||||
namespace: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.4.1
|
||||
*/
|
||||
export interface DiagLoggerOptions {
|
||||
/**
|
||||
* The {@link DiagLogLevel} used to filter logs sent to the logger.
|
||||
*
|
||||
* @defaultValue DiagLogLevel.INFO
|
||||
*/
|
||||
logLevel?: DiagLogLevel;
|
||||
|
||||
/**
|
||||
* Setting this value to `true` will suppress the warning message normally emitted when registering a logger when another logger is already registered.
|
||||
*/
|
||||
suppressOverrideMessage?: boolean;
|
||||
}
|
||||
|
||||
export interface DiagLoggerApi {
|
||||
/**
|
||||
* Set the global DiagLogger and DiagLogLevel.
|
||||
* If a global diag logger is already set, this will override it.
|
||||
*
|
||||
* @param logger - The {@link DiagLogger} instance to set as the default logger.
|
||||
* @param options - A {@link DiagLoggerOptions} object. If not provided, default values will be set.
|
||||
* @returns `true` if the logger was successfully registered, else `false`
|
||||
*/
|
||||
setLogger(logger: DiagLogger, options?: DiagLoggerOptions): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param logger - The {@link DiagLogger} instance to set as the default logger.
|
||||
* @param logLevel - The {@link DiagLogLevel} used to filter logs sent to the logger. If not provided it will default to {@link DiagLogLevel.INFO}.
|
||||
* @returns `true` if the logger was successfully registered, else `false`
|
||||
*/
|
||||
setLogger(logger: DiagLogger, logLevel?: DiagLogLevel): boolean;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Any exports here may change at any time and without warning
|
||||
* @module @opentelemetry/api/experimental
|
||||
*/
|
||||
|
||||
export { wrapTracer, SugaredTracer } from './trace/SugaredTracer';
|
||||
export type { SugaredSpanOptions } from './trace/SugaredOptions';
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Span, SpanOptions } from '../../';
|
||||
|
||||
/**
|
||||
* Options needed for span creation
|
||||
*/
|
||||
export interface SugaredSpanOptions extends SpanOptions {
|
||||
/**
|
||||
* function to overwrite default exception behavior to record the exception. No exceptions should be thrown in the function.
|
||||
* @param e Error which triggered this exception
|
||||
* @param span current span from context
|
||||
*/
|
||||
onException?: (e: Error, span: Span) => void;
|
||||
}
|
|
@ -0,0 +1,215 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { SugaredSpanOptions } from './SugaredOptions';
|
||||
import { context, Context, Span, SpanStatusCode, Tracer } from '../../';
|
||||
|
||||
const defaultOnException = (e: Error, span: Span) => {
|
||||
span.recordException(e);
|
||||
span.setStatus({
|
||||
code: SpanStatusCode.ERROR,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* return a new SugaredTracer created from the supplied one
|
||||
* @param tracer
|
||||
*/
|
||||
export function wrapTracer(tracer: Tracer): SugaredTracer {
|
||||
return new SugaredTracer(tracer);
|
||||
}
|
||||
|
||||
export class SugaredTracer implements Tracer {
|
||||
private readonly _tracer: Tracer;
|
||||
|
||||
constructor(tracer: Tracer) {
|
||||
this._tracer = tracer;
|
||||
this.startSpan = tracer.startSpan.bind(this._tracer);
|
||||
this.startActiveSpan = tracer.startActiveSpan.bind(this._tracer);
|
||||
}
|
||||
|
||||
startActiveSpan: Tracer['startActiveSpan'];
|
||||
startSpan: Tracer['startSpan'];
|
||||
|
||||
/**
|
||||
* Starts a new {@link Span} and calls the given function passing it the
|
||||
* created span as first argument.
|
||||
* Additionally, the new span gets set in context and this context is activated
|
||||
* for the duration of the function call.
|
||||
* The span will be closed after the function has executed.
|
||||
* If an exception occurs, it is recorded, the status is set to ERROR and the exception is rethrown.
|
||||
*
|
||||
* @param name The name of the span
|
||||
* @param [options] SugaredSpanOptions used for span creation
|
||||
* @param [context] Context to use to extract parent
|
||||
* @param fn function called in the context of the span and receives the newly created span as an argument
|
||||
* @returns return value of fn
|
||||
* @example
|
||||
* const something = tracer.withActiveSpan('op', span => {
|
||||
* // do some work
|
||||
* });
|
||||
* @example
|
||||
* const something = await tracer.withActiveSpan('op', span => {
|
||||
* // do some async work
|
||||
* });
|
||||
*/
|
||||
withActiveSpan<F extends (span: Span) => ReturnType<F>>(
|
||||
name: string,
|
||||
fn: F
|
||||
): ReturnType<F>;
|
||||
withActiveSpan<F extends (span: Span) => ReturnType<F>>(
|
||||
name: string,
|
||||
options: SugaredSpanOptions,
|
||||
fn: F
|
||||
): ReturnType<F>;
|
||||
withActiveSpan<F extends (span: Span) => ReturnType<F>>(
|
||||
name: string,
|
||||
options: SugaredSpanOptions,
|
||||
context: Context,
|
||||
fn: F
|
||||
): ReturnType<F>;
|
||||
withActiveSpan<F extends (span: Span) => ReturnType<F>>(
|
||||
name: string,
|
||||
arg2: F | SugaredSpanOptions,
|
||||
arg3?: F | Context,
|
||||
arg4?: F
|
||||
): ReturnType<F> {
|
||||
const { opts, ctx, fn } = massageParams(arg2, arg3, arg4);
|
||||
|
||||
return this._tracer.startActiveSpan(name, opts, ctx, (span: Span) =>
|
||||
handleFn(span, opts, fn)
|
||||
) as ReturnType<F>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a new {@link Span} and ends it after execution of fn without setting it on context.
|
||||
* The span will be closed after the function has executed.
|
||||
* If an exception occurs, it is recorded, the status is et to ERROR and rethrown.
|
||||
*
|
||||
* This method does NOT modify the current Context.
|
||||
*
|
||||
* @param name The name of the span
|
||||
* @param [options] SugaredSpanOptions used for span creation
|
||||
* @param [context] Context to use to extract parent
|
||||
* @param fn function called in the context of the span and receives the newly created span as an argument
|
||||
* @returns Span The newly created span
|
||||
* @example
|
||||
* const something = tracer.withSpan('op', span => {
|
||||
* // do some work
|
||||
* });
|
||||
* @example
|
||||
* const something = await tracer.withSpan('op', span => {
|
||||
* // do some async work
|
||||
* });
|
||||
*/
|
||||
withSpan<F extends (span: Span) => ReturnType<F>>(
|
||||
name: string,
|
||||
fn: F
|
||||
): ReturnType<F>;
|
||||
withSpan<F extends (span: Span) => ReturnType<F>>(
|
||||
name: string,
|
||||
options: SugaredSpanOptions,
|
||||
fn: F
|
||||
): ReturnType<F>;
|
||||
withSpan<F extends (span: Span) => ReturnType<F>>(
|
||||
name: string,
|
||||
options: SugaredSpanOptions,
|
||||
context: Context,
|
||||
fn: F
|
||||
): ReturnType<F>;
|
||||
withSpan<F extends (span: Span) => ReturnType<F>>(
|
||||
name: string,
|
||||
options: SugaredSpanOptions,
|
||||
context: Context,
|
||||
fn: F
|
||||
): ReturnType<F>;
|
||||
withSpan<F extends (span: Span) => ReturnType<F>>(
|
||||
name: string,
|
||||
arg2: SugaredSpanOptions | F,
|
||||
arg3?: Context | F,
|
||||
arg4?: F
|
||||
): ReturnType<F> {
|
||||
const { opts, ctx, fn } = massageParams(arg2, arg3, arg4);
|
||||
|
||||
const span = this._tracer.startSpan(name, opts, ctx);
|
||||
return handleFn(span, opts, fn) as ReturnType<F>;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Massages parameters of withSpan and withActiveSpan to allow signature overwrites
|
||||
* @param arg
|
||||
* @param arg2
|
||||
* @param arg3
|
||||
*/
|
||||
function massageParams<F extends (span: Span) => ReturnType<F>>(
|
||||
arg: F | SugaredSpanOptions,
|
||||
arg2?: F | Context,
|
||||
arg3?: F
|
||||
) {
|
||||
let opts: SugaredSpanOptions | undefined;
|
||||
let ctx: Context | undefined;
|
||||
let fn: F;
|
||||
|
||||
if (!arg2 && !arg3) {
|
||||
fn = arg as F;
|
||||
} else if (!arg3) {
|
||||
opts = arg as SugaredSpanOptions;
|
||||
fn = arg2 as F;
|
||||
} else {
|
||||
opts = arg as SugaredSpanOptions;
|
||||
ctx = arg2 as Context;
|
||||
fn = arg3 as F;
|
||||
}
|
||||
opts = opts ?? {};
|
||||
ctx = ctx ?? context.active();
|
||||
|
||||
return { opts, ctx, fn };
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes fn, returns results and runs onException in the case of exception to allow overwriting of error handling
|
||||
* @param span
|
||||
* @param opts
|
||||
* @param fn
|
||||
*/
|
||||
function handleFn<F extends (span: Span) => ReturnType<F>>(
|
||||
span: Span,
|
||||
opts: SugaredSpanOptions,
|
||||
fn: F
|
||||
): ReturnType<F> {
|
||||
const onException = opts.onException ?? defaultOnException;
|
||||
const errorHandler = (e: Error) => {
|
||||
onException(e, span);
|
||||
span.end();
|
||||
throw e;
|
||||
};
|
||||
|
||||
try {
|
||||
const ret = fn(span) as Promise<ReturnType<F>>;
|
||||
// if fn is an async function, attach a recordException and spanEnd callback to the promise
|
||||
if (typeof ret?.then === 'function') {
|
||||
return ret.then(val => {
|
||||
span.end();
|
||||
return val;
|
||||
}, errorHandler) as ReturnType<F>;
|
||||
}
|
||||
span.end();
|
||||
return ret as ReturnType<F>;
|
||||
} catch (e) {
|
||||
// add throw to signal the compiler that this will throw in the inner scope
|
||||
throw errorHandler(e);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @module @opentelemetry/api
|
||||
*/
|
||||
|
||||
export type {
|
||||
BaggageEntry,
|
||||
BaggageEntryMetadata,
|
||||
Baggage,
|
||||
} from './baggage/types';
|
||||
export { baggageEntryMetadataFromString } from './baggage/utils';
|
||||
export type { Exception } from './common/Exception';
|
||||
export type { HrTime, TimeInput } from './common/Time';
|
||||
export type { Attributes, AttributeValue } from './common/Attributes';
|
||||
|
||||
// Context APIs
|
||||
export { createContextKey, ROOT_CONTEXT } from './context/context';
|
||||
export type { Context, ContextManager } from './context/types';
|
||||
export type { ContextAPI } from './api/context';
|
||||
|
||||
// Diag APIs
|
||||
export { DiagConsoleLogger } from './diag/consoleLogger';
|
||||
export { DiagLogLevel } from './diag/types';
|
||||
export type {
|
||||
DiagLogFunction,
|
||||
DiagLogger,
|
||||
ComponentLoggerOptions,
|
||||
DiagLoggerOptions,
|
||||
} from './diag/types';
|
||||
export type { DiagAPI } from './api/diag';
|
||||
|
||||
// Metrics APIs
|
||||
export { createNoopMeter } from './metrics/NoopMeter';
|
||||
export type { MeterOptions, Meter } from './metrics/Meter';
|
||||
export type { MeterProvider } from './metrics/MeterProvider';
|
||||
export { ValueType } from './metrics/Metric';
|
||||
export type {
|
||||
Counter,
|
||||
Gauge,
|
||||
Histogram,
|
||||
MetricOptions,
|
||||
Observable,
|
||||
ObservableCounter,
|
||||
ObservableGauge,
|
||||
ObservableUpDownCounter,
|
||||
UpDownCounter,
|
||||
BatchObservableCallback,
|
||||
MetricAdvice,
|
||||
MetricAttributes,
|
||||
MetricAttributeValue,
|
||||
ObservableCallback,
|
||||
} from './metrics/Metric';
|
||||
export type {
|
||||
BatchObservableResult,
|
||||
ObservableResult,
|
||||
} from './metrics/ObservableResult';
|
||||
export type { MetricsAPI } from './api/metrics';
|
||||
|
||||
// Propagation APIs
|
||||
export {
|
||||
defaultTextMapGetter,
|
||||
defaultTextMapSetter,
|
||||
} from './propagation/TextMapPropagator';
|
||||
export type {
|
||||
TextMapPropagator,
|
||||
TextMapSetter,
|
||||
TextMapGetter,
|
||||
} from './propagation/TextMapPropagator';
|
||||
export type { PropagationAPI } from './api/propagation';
|
||||
|
||||
// Trace APIs
|
||||
export type { SpanAttributes, SpanAttributeValue } from './trace/attributes';
|
||||
export type { Link } from './trace/link';
|
||||
export { ProxyTracer, type TracerDelegator } from './trace/ProxyTracer';
|
||||
export { ProxyTracerProvider } from './trace/ProxyTracerProvider';
|
||||
export type { Sampler } from './trace/Sampler';
|
||||
export { SamplingDecision, type SamplingResult } from './trace/SamplingResult';
|
||||
export type { SpanContext } from './trace/span_context';
|
||||
export { SpanKind } from './trace/span_kind';
|
||||
export type { Span } from './trace/span';
|
||||
export type { SpanOptions } from './trace/SpanOptions';
|
||||
export { type SpanStatus, SpanStatusCode } from './trace/status';
|
||||
export { TraceFlags } from './trace/trace_flags';
|
||||
export type { TraceState } from './trace/trace_state';
|
||||
export { createTraceState } from './trace/internal/utils';
|
||||
export type { TracerProvider } from './trace/tracer_provider';
|
||||
export type { Tracer } from './trace/tracer';
|
||||
export type { TracerOptions } from './trace/tracer_options';
|
||||
export {
|
||||
isSpanContextValid,
|
||||
isValidTraceId,
|
||||
isValidSpanId,
|
||||
} from './trace/spancontext-utils';
|
||||
export {
|
||||
INVALID_SPANID,
|
||||
INVALID_TRACEID,
|
||||
INVALID_SPAN_CONTEXT,
|
||||
} from './trace/invalid-span-constants';
|
||||
export type { TraceAPI } from './api/trace';
|
||||
|
||||
// Split module-level variable definition into separate files to allow
|
||||
// tree-shaking on each api instance.
|
||||
import { context } from './context-api';
|
||||
import { diag } from './diag-api';
|
||||
import { metrics } from './metrics-api';
|
||||
import { propagation } from './propagation-api';
|
||||
import { trace } from './trace-api';
|
||||
|
||||
// Named export.
|
||||
export { context, diag, metrics, propagation, trace };
|
||||
// Default export.
|
||||
export default {
|
||||
context,
|
||||
diag,
|
||||
metrics,
|
||||
propagation,
|
||||
trace,
|
||||
};
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { MeterProvider } from '../metrics/MeterProvider';
|
||||
import { ContextManager } from '../context/types';
|
||||
import { DiagLogger } from '../diag/types';
|
||||
import { _globalThis } from '../platform';
|
||||
import { TextMapPropagator } from '../propagation/TextMapPropagator';
|
||||
import type { TracerProvider } from '../trace/tracer_provider';
|
||||
import { VERSION } from '../version';
|
||||
import { isCompatible } from './semver';
|
||||
|
||||
const major = VERSION.split('.')[0];
|
||||
const GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(
|
||||
`opentelemetry.js.api.${major}`
|
||||
);
|
||||
|
||||
const _global = _globalThis as OTelGlobal;
|
||||
|
||||
export function registerGlobal<Type extends keyof OTelGlobalAPI>(
|
||||
type: Type,
|
||||
instance: OTelGlobalAPI[Type],
|
||||
diag: DiagLogger,
|
||||
allowOverride = false
|
||||
): boolean {
|
||||
const api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = _global[
|
||||
GLOBAL_OPENTELEMETRY_API_KEY
|
||||
] ?? {
|
||||
version: VERSION,
|
||||
});
|
||||
|
||||
if (!allowOverride && api[type]) {
|
||||
// already registered an API of this type
|
||||
const err = new Error(
|
||||
`@opentelemetry/api: Attempted duplicate registration of API: ${type}`
|
||||
);
|
||||
diag.error(err.stack || err.message);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (api.version !== VERSION) {
|
||||
// All registered APIs must be of the same version exactly
|
||||
const err = new Error(
|
||||
`@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION}`
|
||||
);
|
||||
diag.error(err.stack || err.message);
|
||||
return false;
|
||||
}
|
||||
|
||||
api[type] = instance;
|
||||
diag.debug(
|
||||
`@opentelemetry/api: Registered a global for ${type} v${VERSION}.`
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
export function getGlobal<Type extends keyof OTelGlobalAPI>(
|
||||
type: Type
|
||||
): OTelGlobalAPI[Type] | undefined {
|
||||
const globalVersion = _global[GLOBAL_OPENTELEMETRY_API_KEY]?.version;
|
||||
if (!globalVersion || !isCompatible(globalVersion)) {
|
||||
return;
|
||||
}
|
||||
return _global[GLOBAL_OPENTELEMETRY_API_KEY]?.[type];
|
||||
}
|
||||
|
||||
export function unregisterGlobal(type: keyof OTelGlobalAPI, diag: DiagLogger) {
|
||||
diag.debug(
|
||||
`@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`
|
||||
);
|
||||
const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
|
||||
|
||||
if (api) {
|
||||
delete api[type];
|
||||
}
|
||||
}
|
||||
|
||||
type OTelGlobal = {
|
||||
[GLOBAL_OPENTELEMETRY_API_KEY]?: OTelGlobalAPI;
|
||||
};
|
||||
|
||||
type OTelGlobalAPI = {
|
||||
version: string;
|
||||
|
||||
diag?: DiagLogger;
|
||||
trace?: TracerProvider;
|
||||
context?: ContextManager;
|
||||
metrics?: MeterProvider;
|
||||
propagation?: TextMapPropagator;
|
||||
};
|
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { VERSION } from '../version';
|
||||
|
||||
const re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
||||
|
||||
/**
|
||||
* Create a function to test an API version to see if it is compatible with the provided ownVersion.
|
||||
*
|
||||
* The returned function has the following semantics:
|
||||
* - Exact match is always compatible
|
||||
* - Major versions must match exactly
|
||||
* - 1.x package cannot use global 2.x package
|
||||
* - 2.x package cannot use global 1.x package
|
||||
* - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API
|
||||
* - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects
|
||||
* - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3
|
||||
* - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor
|
||||
* - Patch and build tag differences are not considered at this time
|
||||
*
|
||||
* @param ownVersion version which should be checked against
|
||||
*/
|
||||
export function _makeCompatibilityCheck(
|
||||
ownVersion: string
|
||||
): (globalVersion: string) => boolean {
|
||||
const acceptedVersions = new Set<string>([ownVersion]);
|
||||
const rejectedVersions = new Set<string>();
|
||||
|
||||
const myVersionMatch = ownVersion.match(re);
|
||||
if (!myVersionMatch) {
|
||||
// we cannot guarantee compatibility so we always return noop
|
||||
return () => false;
|
||||
}
|
||||
|
||||
const ownVersionParsed = {
|
||||
major: +myVersionMatch[1],
|
||||
minor: +myVersionMatch[2],
|
||||
patch: +myVersionMatch[3],
|
||||
prerelease: myVersionMatch[4],
|
||||
};
|
||||
|
||||
// if ownVersion has a prerelease tag, versions must match exactly
|
||||
if (ownVersionParsed.prerelease != null) {
|
||||
return function isExactmatch(globalVersion: string): boolean {
|
||||
return globalVersion === ownVersion;
|
||||
};
|
||||
}
|
||||
|
||||
function _reject(v: string) {
|
||||
rejectedVersions.add(v);
|
||||
return false;
|
||||
}
|
||||
|
||||
function _accept(v: string) {
|
||||
acceptedVersions.add(v);
|
||||
return true;
|
||||
}
|
||||
|
||||
return function isCompatible(globalVersion: string): boolean {
|
||||
if (acceptedVersions.has(globalVersion)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (rejectedVersions.has(globalVersion)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const globalVersionMatch = globalVersion.match(re);
|
||||
if (!globalVersionMatch) {
|
||||
// cannot parse other version
|
||||
// we cannot guarantee compatibility so we always noop
|
||||
return _reject(globalVersion);
|
||||
}
|
||||
|
||||
const globalVersionParsed = {
|
||||
major: +globalVersionMatch[1],
|
||||
minor: +globalVersionMatch[2],
|
||||
patch: +globalVersionMatch[3],
|
||||
prerelease: globalVersionMatch[4],
|
||||
};
|
||||
|
||||
// if globalVersion has a prerelease tag, versions must match exactly
|
||||
if (globalVersionParsed.prerelease != null) {
|
||||
return _reject(globalVersion);
|
||||
}
|
||||
|
||||
// major versions must match
|
||||
if (ownVersionParsed.major !== globalVersionParsed.major) {
|
||||
return _reject(globalVersion);
|
||||
}
|
||||
|
||||
if (ownVersionParsed.major === 0) {
|
||||
if (
|
||||
ownVersionParsed.minor === globalVersionParsed.minor &&
|
||||
ownVersionParsed.patch <= globalVersionParsed.patch
|
||||
) {
|
||||
return _accept(globalVersion);
|
||||
}
|
||||
|
||||
return _reject(globalVersion);
|
||||
}
|
||||
|
||||
if (ownVersionParsed.minor <= globalVersionParsed.minor) {
|
||||
return _accept(globalVersion);
|
||||
}
|
||||
|
||||
return _reject(globalVersion);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Test an API version to see if it is compatible with this API.
|
||||
*
|
||||
* - Exact match is always compatible
|
||||
* - Major versions must match exactly
|
||||
* - 1.x package cannot use global 2.x package
|
||||
* - 2.x package cannot use global 1.x package
|
||||
* - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API
|
||||
* - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects
|
||||
* - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3
|
||||
* - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor
|
||||
* - Patch and build tag differences are not considered at this time
|
||||
*
|
||||
* @param version version of the API requesting an instance of the global API
|
||||
*/
|
||||
export const isCompatible = _makeCompatibilityCheck(VERSION);
|
|
@ -14,14 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './NoopMeter';
|
||||
export * from './NoopMeterProvider';
|
||||
export * from './types/Meter';
|
||||
export * from './types/MeterProvider';
|
||||
export * from './types/Metric';
|
||||
export * from './types/Observation';
|
||||
export * from './types/ObservableResult';
|
||||
|
||||
// Split module-level variable definition into separate files to allow
|
||||
// tree-shaking on each api instance.
|
||||
import { MetricsAPI } from './api/metrics';
|
||||
/** Entrypoint for metrics API */
|
||||
/**
|
||||
* Entrypoint for metrics API
|
||||
*
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export const metrics = MetricsAPI.getInstance();
|
|
@ -0,0 +1,190 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
BatchObservableCallback,
|
||||
Counter,
|
||||
Gauge,
|
||||
Histogram,
|
||||
MetricAttributes,
|
||||
MetricOptions,
|
||||
Observable,
|
||||
ObservableCounter,
|
||||
ObservableGauge,
|
||||
ObservableUpDownCounter,
|
||||
UpDownCounter,
|
||||
} from './Metric';
|
||||
|
||||
/**
|
||||
* An interface describes additional metadata of a meter.
|
||||
*
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export interface MeterOptions {
|
||||
/**
|
||||
* The schemaUrl of the meter or instrumentation library
|
||||
*/
|
||||
schemaUrl?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An interface to allow the recording metrics.
|
||||
*
|
||||
* {@link Metric}s are used for recording pre-defined aggregation (`Counter`),
|
||||
* or raw values (`Histogram`) in which the aggregation and attributes
|
||||
* for the exported metric are deferred.
|
||||
*
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export interface Meter {
|
||||
/**
|
||||
* Creates and returns a new `Gauge`.
|
||||
* @param name the name of the metric.
|
||||
* @param [options] the metric options.
|
||||
*/
|
||||
createGauge<AttributesTypes extends MetricAttributes = MetricAttributes>(
|
||||
name: string,
|
||||
options?: MetricOptions
|
||||
): Gauge<AttributesTypes>;
|
||||
|
||||
/**
|
||||
* Creates and returns a new `Histogram`.
|
||||
* @param name the name of the metric.
|
||||
* @param [options] the metric options.
|
||||
*/
|
||||
createHistogram<AttributesTypes extends MetricAttributes = MetricAttributes>(
|
||||
name: string,
|
||||
options?: MetricOptions
|
||||
): Histogram<AttributesTypes>;
|
||||
|
||||
/**
|
||||
* Creates a new `Counter` metric. Generally, this kind of metric when the
|
||||
* value is a quantity, the sum is of primary interest, and the event count
|
||||
* and value distribution are not of primary interest.
|
||||
* @param name the name of the metric.
|
||||
* @param [options] the metric options.
|
||||
*/
|
||||
createCounter<AttributesTypes extends MetricAttributes = MetricAttributes>(
|
||||
name: string,
|
||||
options?: MetricOptions
|
||||
): Counter<AttributesTypes>;
|
||||
|
||||
/**
|
||||
* Creates a new `UpDownCounter` metric. UpDownCounter is a synchronous
|
||||
* instrument and very similar to Counter except that Add(increment)
|
||||
* supports negative increments. It is generally useful for capturing changes
|
||||
* in an amount of resources used, or any quantity that rises and falls
|
||||
* during a request.
|
||||
* Example uses for UpDownCounter:
|
||||
* <ol>
|
||||
* <li> count the number of active requests. </li>
|
||||
* <li> count memory in use by instrumenting new and delete. </li>
|
||||
* <li> count queue size by instrumenting enqueue and dequeue. </li>
|
||||
* <li> count semaphore up and down operations. </li>
|
||||
* </ol>
|
||||
*
|
||||
* @param name the name of the metric.
|
||||
* @param [options] the metric options.
|
||||
*/
|
||||
createUpDownCounter<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
>(
|
||||
name: string,
|
||||
options?: MetricOptions
|
||||
): UpDownCounter<AttributesTypes>;
|
||||
|
||||
/**
|
||||
* Creates a new `ObservableGauge` metric.
|
||||
*
|
||||
* The callback SHOULD be safe to be invoked concurrently.
|
||||
*
|
||||
* @param name the name of the metric.
|
||||
* @param [options] the metric options.
|
||||
*/
|
||||
createObservableGauge<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
>(
|
||||
name: string,
|
||||
options?: MetricOptions
|
||||
): ObservableGauge<AttributesTypes>;
|
||||
|
||||
/**
|
||||
* Creates a new `ObservableCounter` metric.
|
||||
*
|
||||
* The callback SHOULD be safe to be invoked concurrently.
|
||||
*
|
||||
* @param name the name of the metric.
|
||||
* @param [options] the metric options.
|
||||
*/
|
||||
createObservableCounter<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
>(
|
||||
name: string,
|
||||
options?: MetricOptions
|
||||
): ObservableCounter<AttributesTypes>;
|
||||
|
||||
/**
|
||||
* Creates a new `ObservableUpDownCounter` metric.
|
||||
*
|
||||
* The callback SHOULD be safe to be invoked concurrently.
|
||||
*
|
||||
* @param name the name of the metric.
|
||||
* @param [options] the metric options.
|
||||
*/
|
||||
createObservableUpDownCounter<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
>(
|
||||
name: string,
|
||||
options?: MetricOptions
|
||||
): ObservableUpDownCounter<AttributesTypes>;
|
||||
|
||||
/**
|
||||
* Sets up a function that will be called whenever a metric collection is
|
||||
* initiated.
|
||||
*
|
||||
* If the function is already in the list of callbacks for this Observable,
|
||||
* the function is not added a second time.
|
||||
*
|
||||
* Only the associated observables can be observed in the callback.
|
||||
* Measurements of observables that are not associated observed in the
|
||||
* callback are dropped.
|
||||
*
|
||||
* @param callback the batch observable callback
|
||||
* @param observables the observables associated with this batch observable callback
|
||||
*/
|
||||
addBatchObservableCallback<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
>(
|
||||
callback: BatchObservableCallback<AttributesTypes>,
|
||||
observables: Observable<AttributesTypes>[]
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Removes a callback previously registered with {@link Meter.addBatchObservableCallback}.
|
||||
*
|
||||
* The callback to be removed is identified using a combination of the callback itself,
|
||||
* and the set of the observables associated with it.
|
||||
*
|
||||
* @param callback the batch observable callback
|
||||
* @param observables the observables associated with this batch observable callback
|
||||
*/
|
||||
removeBatchObservableCallback<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
>(
|
||||
callback: BatchObservableCallback<AttributesTypes>,
|
||||
observables: Observable<AttributesTypes>[]
|
||||
): void;
|
||||
}
|
|
@ -18,6 +18,8 @@ import { Meter, MeterOptions } from './Meter';
|
|||
|
||||
/**
|
||||
* A registry for creating named {@link Meter}s.
|
||||
*
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export interface MeterProvider {
|
||||
/**
|
|
@ -0,0 +1,209 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Attributes, AttributeValue } from '../common/Attributes';
|
||||
import { Context } from '../context/types';
|
||||
import { BatchObservableResult, ObservableResult } from './ObservableResult';
|
||||
|
||||
/**
|
||||
* Advisory options influencing aggregation configuration parameters.
|
||||
*
|
||||
* @since 1.7.0
|
||||
* @experimental
|
||||
*/
|
||||
export interface MetricAdvice {
|
||||
/**
|
||||
* Hint the explicit bucket boundaries for SDK if the metric is been
|
||||
* aggregated with a HistogramAggregator.
|
||||
*/
|
||||
explicitBucketBoundaries?: number[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Options needed for metric creation
|
||||
*
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export interface MetricOptions {
|
||||
/**
|
||||
* The description of the Metric.
|
||||
* @default ''
|
||||
*/
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* The unit of the Metric values.
|
||||
* @default ''
|
||||
*/
|
||||
unit?: string;
|
||||
|
||||
/**
|
||||
* Indicates the type of the recorded value.
|
||||
* @default {@link ValueType.DOUBLE}
|
||||
*/
|
||||
valueType?: ValueType;
|
||||
|
||||
/**
|
||||
* The advice influencing aggregation configuration parameters.
|
||||
* @experimental
|
||||
* @since 1.7.0
|
||||
*/
|
||||
advice?: MetricAdvice;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Type of value. It describes how the data is reported.
|
||||
*
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export enum ValueType {
|
||||
INT,
|
||||
DOUBLE,
|
||||
}
|
||||
|
||||
/**
|
||||
* Counter is the most common synchronous instrument. This instrument supports
|
||||
* an `Add(increment)` function for reporting a sum, and is restricted to
|
||||
* non-negative increments. The default aggregation is Sum, as for any additive
|
||||
* instrument.
|
||||
*
|
||||
* Example uses for Counter:
|
||||
* <ol>
|
||||
* <li> count the number of bytes received. </li>
|
||||
* <li> count the number of requests completed. </li>
|
||||
* <li> count the number of accounts created. </li>
|
||||
* <li> count the number of checkpoints run. </li>
|
||||
* <li> count the number of 5xx errors. </li>
|
||||
* <ol>
|
||||
*
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export interface Counter<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
> {
|
||||
/**
|
||||
* Increment value of counter by the input. Inputs must not be negative.
|
||||
*/
|
||||
add(value: number, attributes?: AttributesTypes, context?: Context): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export interface UpDownCounter<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
> {
|
||||
/**
|
||||
* Increment value of counter by the input. Inputs may be negative.
|
||||
*/
|
||||
add(value: number, attributes?: AttributesTypes, context?: Context): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.9.0
|
||||
*/
|
||||
export interface Gauge<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
> {
|
||||
/**
|
||||
* Records a measurement.
|
||||
*/
|
||||
record(value: number, attributes?: AttributesTypes, context?: Context): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export interface Histogram<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
> {
|
||||
/**
|
||||
* Records a measurement. Value of the measurement must not be negative.
|
||||
*/
|
||||
record(value: number, attributes?: AttributesTypes, context?: Context): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated please use {@link Attributes}
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export type MetricAttributes = Attributes;
|
||||
|
||||
/**
|
||||
* @deprecated please use {@link AttributeValue}
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export type MetricAttributeValue = AttributeValue;
|
||||
|
||||
/**
|
||||
* The observable callback for Observable instruments.
|
||||
*
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export type ObservableCallback<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
> = (
|
||||
observableResult: ObservableResult<AttributesTypes>
|
||||
) => void | Promise<void>;
|
||||
|
||||
/**
|
||||
* The observable callback for a batch of Observable instruments.
|
||||
*
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export type BatchObservableCallback<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
> = (
|
||||
observableResult: BatchObservableResult<AttributesTypes>
|
||||
) => void | Promise<void>;
|
||||
|
||||
/**
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export interface Observable<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
> {
|
||||
/**
|
||||
* Sets up a function that will be called whenever a metric collection is initiated.
|
||||
*
|
||||
* If the function is already in the list of callbacks for this Observable, the function is not added a second time.
|
||||
*/
|
||||
addCallback(callback: ObservableCallback<AttributesTypes>): void;
|
||||
|
||||
/**
|
||||
* Removes a callback previously registered with {@link Observable.addCallback}.
|
||||
*/
|
||||
removeCallback(callback: ObservableCallback<AttributesTypes>): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export type ObservableCounter<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
> = Observable<AttributesTypes>;
|
||||
/**
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export type ObservableUpDownCounter<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
> = Observable<AttributesTypes>;
|
||||
/**
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export type ObservableGauge<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
> = Observable<AttributesTypes>;
|
|
@ -14,20 +14,21 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Meter } from './types/Meter';
|
||||
import { Meter } from './Meter';
|
||||
import {
|
||||
MetricOptions,
|
||||
Attributes,
|
||||
BatchObservableCallback,
|
||||
Counter,
|
||||
Gauge,
|
||||
Histogram,
|
||||
ObservableGauge,
|
||||
UpDownCounter,
|
||||
ObservableBase,
|
||||
MetricAttributes,
|
||||
MetricOptions,
|
||||
Observable,
|
||||
ObservableCallback,
|
||||
ObservableCounter,
|
||||
ObservableGauge,
|
||||
ObservableUpDownCounter,
|
||||
} from './types/Metric';
|
||||
import { ObservableResult } from './types/ObservableResult';
|
||||
import { Observation } from './types/Observation';
|
||||
UpDownCounter,
|
||||
} from './Metric';
|
||||
|
||||
/**
|
||||
* NoopMeter is a noop implementation of the {@link Meter} interface. It reuses
|
||||
|
@ -37,106 +38,135 @@ export class NoopMeter implements Meter {
|
|||
constructor() {}
|
||||
|
||||
/**
|
||||
* Returns a constant noop histogram.
|
||||
* @param name the name of the metric.
|
||||
* @param [options] the metric options.
|
||||
* @see {@link Meter.createGauge}
|
||||
*/
|
||||
createGauge(_name: string, _options?: MetricOptions): Gauge {
|
||||
return NOOP_GAUGE_METRIC;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see {@link Meter.createHistogram}
|
||||
*/
|
||||
createHistogram(_name: string, _options?: MetricOptions): Histogram {
|
||||
return NOOP_HISTOGRAM_METRIC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a constant noop counter.
|
||||
* @param name the name of the metric.
|
||||
* @param [options] the metric options.
|
||||
* @see {@link Meter.createCounter}
|
||||
*/
|
||||
createCounter(_name: string, _options?: MetricOptions): Counter {
|
||||
return NOOP_COUNTER_METRIC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a constant noop UpDownCounter.
|
||||
* @param name the name of the metric.
|
||||
* @param [options] the metric options.
|
||||
* @see {@link Meter.createUpDownCounter}
|
||||
*/
|
||||
createUpDownCounter(_name: string, _options?: MetricOptions): UpDownCounter {
|
||||
return NOOP_UP_DOWN_COUNTER_METRIC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a constant noop observable gauge.
|
||||
* @param name the name of the metric.
|
||||
* @param [options] the metric options.
|
||||
* @param [callback] the observable gauge callback
|
||||
* @see {@link Meter.createObservableGauge}
|
||||
*/
|
||||
createObservableGauge(
|
||||
_name: string,
|
||||
_options?: MetricOptions,
|
||||
_callback?: (observableResult: ObservableResult) => void
|
||||
_options?: MetricOptions
|
||||
): ObservableGauge {
|
||||
return NOOP_OBSERVABLE_GAUGE_METRIC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a constant noop observable counter.
|
||||
* @param name the name of the metric.
|
||||
* @param [options] the metric options.
|
||||
* @param [callback] the observable counter callback
|
||||
* @see {@link Meter.createObservableCounter}
|
||||
*/
|
||||
createObservableCounter(
|
||||
_name: string,
|
||||
_options?: MetricOptions,
|
||||
_callback?: (observableResult: ObservableResult) => void
|
||||
_options?: MetricOptions
|
||||
): ObservableCounter {
|
||||
return NOOP_OBSERVABLE_COUNTER_METRIC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a constant noop up down observable counter.
|
||||
* @param name the name of the metric.
|
||||
* @param [options] the metric options.
|
||||
* @param [callback] the up down observable counter callback
|
||||
* @see {@link Meter.createObservableUpDownCounter}
|
||||
*/
|
||||
createObservableUpDownCounter(
|
||||
_name: string,
|
||||
_options?: MetricOptions,
|
||||
_callback?: (observableResult: ObservableResult) => void
|
||||
_options?: MetricOptions
|
||||
): ObservableUpDownCounter {
|
||||
return NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see {@link Meter.addBatchObservableCallback}
|
||||
*/
|
||||
addBatchObservableCallback(
|
||||
_callback: BatchObservableCallback,
|
||||
_observables: Observable[]
|
||||
): void {}
|
||||
|
||||
/**
|
||||
* @see {@link Meter.removeBatchObservableCallback}
|
||||
*/
|
||||
removeBatchObservableCallback(_callback: BatchObservableCallback): void {}
|
||||
}
|
||||
|
||||
export class NoopMetric {}
|
||||
|
||||
export class NoopCounterMetric extends NoopMetric implements Counter {
|
||||
add(_value: number, _attributes: Attributes): void {}
|
||||
add(_value: number, _attributes: MetricAttributes): void {}
|
||||
}
|
||||
|
||||
export class NoopUpDownCounterMetric extends NoopMetric implements UpDownCounter {
|
||||
add(_value: number, _attributes: Attributes): void {}
|
||||
export class NoopUpDownCounterMetric
|
||||
extends NoopMetric
|
||||
implements UpDownCounter
|
||||
{
|
||||
add(_value: number, _attributes: MetricAttributes): void {}
|
||||
}
|
||||
|
||||
export class NoopGaugeMetric extends NoopMetric implements Gauge {
|
||||
record(_value: number, _attributes: MetricAttributes): void {}
|
||||
}
|
||||
|
||||
export class NoopHistogramMetric extends NoopMetric implements Histogram {
|
||||
record(_value: number, _attributes: Attributes): void {}
|
||||
record(_value: number, _attributes: MetricAttributes): void {}
|
||||
}
|
||||
|
||||
export class NoopObservableBaseMetric extends NoopMetric implements ObservableBase {
|
||||
observation(): Observation {
|
||||
return {
|
||||
observable: this as ObservableBase,
|
||||
value: 0,
|
||||
};
|
||||
}
|
||||
export class NoopObservableMetric {
|
||||
addCallback(_callback: ObservableCallback) {}
|
||||
|
||||
removeCallback(_callback: ObservableCallback) {}
|
||||
}
|
||||
|
||||
export class NoopObservableCounterMetric
|
||||
extends NoopObservableMetric
|
||||
implements ObservableCounter {}
|
||||
|
||||
export class NoopObservableGaugeMetric
|
||||
extends NoopObservableMetric
|
||||
implements ObservableGauge {}
|
||||
|
||||
export class NoopObservableUpDownCounterMetric
|
||||
extends NoopObservableMetric
|
||||
implements ObservableUpDownCounter {}
|
||||
|
||||
export const NOOP_METER = new NoopMeter();
|
||||
|
||||
// Synchronous instruments
|
||||
export const NOOP_COUNTER_METRIC = new NoopCounterMetric();
|
||||
export const NOOP_GAUGE_METRIC = new NoopGaugeMetric();
|
||||
export const NOOP_HISTOGRAM_METRIC = new NoopHistogramMetric();
|
||||
export const NOOP_UP_DOWN_COUNTER_METRIC = new NoopUpDownCounterMetric();
|
||||
|
||||
// Asynchronous instruments
|
||||
export const NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableBaseMetric();
|
||||
export const NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableBaseMetric();
|
||||
export const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = new NoopObservableBaseMetric();
|
||||
export const NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric();
|
||||
export const NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableGaugeMetric();
|
||||
export const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC =
|
||||
new NoopObservableUpDownCounterMetric();
|
||||
|
||||
/**
|
||||
* Create a no-op Meter
|
||||
*
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export function createNoopMeter(): Meter {
|
||||
return NOOP_METER;
|
||||
}
|
|
@ -14,8 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Meter, MeterOptions } from './types/Meter';
|
||||
import { MeterProvider } from './types/MeterProvider';
|
||||
import { Meter, MeterOptions } from './Meter';
|
||||
import { MeterProvider } from './MeterProvider';
|
||||
import { NOOP_METER } from './NoopMeter';
|
||||
|
||||
/**
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { MetricAttributes, Observable } from './Metric';
|
||||
|
||||
/**
|
||||
* Interface that is being used in callback function for Observable Metric.
|
||||
*
|
||||
* @since 1.3.0
|
||||
*/
|
||||
export interface ObservableResult<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
> {
|
||||
/**
|
||||
* Observe a measurement of the value associated with the given attributes.
|
||||
*
|
||||
* @param value The value to be observed.
|
||||
* @param attributes The attributes associated with the value. If more than
|
||||
* one values associated with the same attributes values, SDK may pick the
|
||||
* last one or simply drop the entire observable result.
|
||||
*/
|
||||
observe(
|
||||
this: ObservableResult<AttributesTypes>,
|
||||
value: number,
|
||||
attributes?: AttributesTypes
|
||||
): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface that is being used in batch observable callback function.
|
||||
*/
|
||||
export interface BatchObservableResult<
|
||||
AttributesTypes extends MetricAttributes = MetricAttributes,
|
||||
> {
|
||||
/**
|
||||
* Observe a measurement of the value associated with the given attributes.
|
||||
*
|
||||
* @param metric The observable metric to be observed.
|
||||
* @param value The value to be observed.
|
||||
* @param attributes The attributes associated with the value. If more than
|
||||
* one values associated with the same attributes values, SDK may pick the
|
||||
* last one or simply drop the entire observable result.
|
||||
*/
|
||||
observe(
|
||||
this: BatchObservableResult<AttributesTypes>,
|
||||
metric: Observable<AttributesTypes>,
|
||||
value: number,
|
||||
attributes?: AttributesTypes
|
||||
): void;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Updates to this file should also be replicated to @opentelemetry/core too.
|
||||
|
||||
/**
|
||||
* - globalThis (New standard)
|
||||
* - self (Will return the current window instance for supported browsers)
|
||||
* - window (fallback for older browser implementations)
|
||||
* - global (NodeJS implementation)
|
||||
* - <object> (When all else fails)
|
||||
*/
|
||||
|
||||
/** only globals that common to node and browsers are allowed */
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-builtins, no-undef
|
||||
export const _globalThis: typeof globalThis =
|
||||
typeof globalThis === 'object'
|
||||
? globalThis
|
||||
: typeof self === 'object'
|
||||
? self
|
||||
: typeof window === 'object'
|
||||
? window
|
||||
: typeof global === 'object'
|
||||
? (global as unknown as typeof globalThis)
|
||||
: ({} as typeof globalThis);
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export { _globalThis } from './globalThis';
|
|
@ -14,4 +14,4 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './globalThis';
|
||||
export { _globalThis } from './node';
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export { _globalThis } from './globalThis';
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Split module-level variable definition into separate files to allow
|
||||
// tree-shaking on each api instance.
|
||||
import { PropagationAPI } from './api/propagation';
|
||||
/**
|
||||
* Entrypoint for propagation API
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export const propagation = PropagationAPI.getInstance();
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Context } from '../context/types';
|
||||
import { TextMapPropagator } from './TextMapPropagator';
|
||||
|
||||
/**
|
||||
* No-op implementations of {@link TextMapPropagator}.
|
||||
*/
|
||||
export class NoopTextMapPropagator implements TextMapPropagator {
|
||||
/** Noop inject function does nothing */
|
||||
inject(_context: Context, _carrier: unknown): void {}
|
||||
/** Noop extract function does nothing and returns the input context */
|
||||
extract(context: Context, _carrier: unknown): Context {
|
||||
return context;
|
||||
}
|
||||
fields(): string[] {
|
||||
return [];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Context } from '../context/types';
|
||||
|
||||
/**
|
||||
* Injects `Context` into and extracts it from carriers that travel
|
||||
* in-band across process boundaries. Encoding is expected to conform to the
|
||||
* HTTP Header Field semantics. Values are often encoded as RPC/HTTP request
|
||||
* headers.
|
||||
*
|
||||
* The carrier of propagated data on both the client (injector) and server
|
||||
* (extractor) side is usually an object such as http headers. Propagation is
|
||||
* usually implemented via library-specific request interceptors, where the
|
||||
* client-side injects values and the server-side extracts them.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export interface TextMapPropagator<Carrier = any> {
|
||||
/**
|
||||
* Injects values from a given `Context` into a carrier.
|
||||
*
|
||||
* OpenTelemetry defines a common set of format values (TextMapPropagator),
|
||||
* and each has an expected `carrier` type.
|
||||
*
|
||||
* @param context the Context from which to extract values to transmit over
|
||||
* the wire.
|
||||
* @param carrier the carrier of propagation fields, such as http request
|
||||
* headers.
|
||||
* @param setter an optional {@link TextMapSetter}. If undefined, values will be
|
||||
* set by direct object assignment.
|
||||
*/
|
||||
inject(
|
||||
context: Context,
|
||||
carrier: Carrier,
|
||||
setter: TextMapSetter<Carrier>
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Given a `Context` and a carrier, extract context values from a
|
||||
* carrier and return a new context, created from the old context, with the
|
||||
* extracted values.
|
||||
*
|
||||
* @param context the Context from which to extract values to transmit over
|
||||
* the wire.
|
||||
* @param carrier the carrier of propagation fields, such as http request
|
||||
* headers.
|
||||
* @param getter an optional {@link TextMapGetter}. If undefined, keys will be all
|
||||
* own properties, and keys will be accessed by direct object access.
|
||||
*/
|
||||
extract(
|
||||
context: Context,
|
||||
carrier: Carrier,
|
||||
getter: TextMapGetter<Carrier>
|
||||
): Context;
|
||||
|
||||
/**
|
||||
* Return a list of all fields which may be used by the propagator.
|
||||
*/
|
||||
fields(): string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A setter is specified by the caller to define a specific method
|
||||
* to set key/value pairs on the carrier within a propagator
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export interface TextMapSetter<Carrier = any> {
|
||||
/**
|
||||
* Callback used to set a key/value pair on an object.
|
||||
*
|
||||
* Should be called by the propagator each time a key/value pair
|
||||
* should be set, and should set that key/value pair on the propagator.
|
||||
*
|
||||
* @param carrier object or class which carries key/value pairs
|
||||
* @param key string key to modify
|
||||
* @param value value to be set to the key on the carrier
|
||||
*/
|
||||
set(carrier: Carrier, key: string, value: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A getter is specified by the caller to define a specific method
|
||||
* to get the value of a key from a carrier.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export interface TextMapGetter<Carrier = any> {
|
||||
/**
|
||||
* Get a list of all keys available on the carrier.
|
||||
*
|
||||
* @param carrier
|
||||
*/
|
||||
keys(carrier: Carrier): string[];
|
||||
|
||||
/**
|
||||
* Get the value of a specific key from the carrier.
|
||||
*
|
||||
* @param carrier
|
||||
* @param key
|
||||
*/
|
||||
get(carrier: Carrier, key: string): undefined | string | string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export const defaultTextMapGetter: TextMapGetter = {
|
||||
get(carrier, key) {
|
||||
if (carrier == null) {
|
||||
return undefined;
|
||||
}
|
||||
return carrier[key];
|
||||
},
|
||||
|
||||
keys(carrier) {
|
||||
if (carrier == null) {
|
||||
return [];
|
||||
}
|
||||
return Object.keys(carrier);
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export const defaultTextMapSetter: TextMapSetter = {
|
||||
set(carrier, key, value) {
|
||||
if (carrier == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
carrier[key] = value;
|
||||
},
|
||||
};
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Split module-level variable definition into separate files to allow
|
||||
// tree-shaking on each api instance.
|
||||
import { TraceAPI } from './api/trace';
|
||||
|
||||
/**
|
||||
* Entrypoint for trace API
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export const trace = TraceAPI.getInstance();
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Exception } from '../common/Exception';
|
||||
import { TimeInput } from '../common/Time';
|
||||
import { SpanAttributes } from './attributes';
|
||||
import { INVALID_SPAN_CONTEXT } from './invalid-span-constants';
|
||||
import { Span } from './span';
|
||||
import { SpanContext } from './span_context';
|
||||
import { SpanStatus } from './status';
|
||||
import { Link } from './link';
|
||||
|
||||
/**
|
||||
* The NonRecordingSpan is the default {@link Span} that is used when no Span
|
||||
* implementation is available. All operations are no-op including context
|
||||
* propagation.
|
||||
*/
|
||||
export class NonRecordingSpan implements Span {
|
||||
constructor(
|
||||
private readonly _spanContext: SpanContext = INVALID_SPAN_CONTEXT
|
||||
) {}
|
||||
|
||||
// Returns a SpanContext.
|
||||
spanContext(): SpanContext {
|
||||
return this._spanContext;
|
||||
}
|
||||
|
||||
// By default does nothing
|
||||
setAttribute(_key: string, _value: unknown): this {
|
||||
return this;
|
||||
}
|
||||
|
||||
// By default does nothing
|
||||
setAttributes(_attributes: SpanAttributes): this {
|
||||
return this;
|
||||
}
|
||||
|
||||
// By default does nothing
|
||||
addEvent(_name: string, _attributes?: SpanAttributes): this {
|
||||
return this;
|
||||
}
|
||||
|
||||
addLink(_link: Link): this {
|
||||
return this;
|
||||
}
|
||||
|
||||
addLinks(_links: Link[]): this {
|
||||
return this;
|
||||
}
|
||||
|
||||
// By default does nothing
|
||||
setStatus(_status: SpanStatus): this {
|
||||
return this;
|
||||
}
|
||||
|
||||
// By default does nothing
|
||||
updateName(_name: string): this {
|
||||
return this;
|
||||
}
|
||||
|
||||
// By default does nothing
|
||||
end(_endTime?: TimeInput): void {}
|
||||
|
||||
// isRecording always returns false for NonRecordingSpan.
|
||||
isRecording(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
// By default does nothing
|
||||
recordException(_exception: Exception, _time?: TimeInput): void {}
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ContextAPI } from '../api/context';
|
||||
import { Context } from '../context/types';
|
||||
import { getSpanContext, setSpan } from '../trace/context-utils';
|
||||
import { NonRecordingSpan } from './NonRecordingSpan';
|
||||
import { Span } from './span';
|
||||
import { isSpanContextValid } from './spancontext-utils';
|
||||
import { SpanOptions } from './SpanOptions';
|
||||
import { SpanContext } from './span_context';
|
||||
import { Tracer } from './tracer';
|
||||
|
||||
const contextApi = ContextAPI.getInstance();
|
||||
|
||||
/**
|
||||
* No-op implementations of {@link Tracer}.
|
||||
*/
|
||||
export class NoopTracer implements Tracer {
|
||||
// startSpan starts a noop span.
|
||||
startSpan(
|
||||
name: string,
|
||||
options?: SpanOptions,
|
||||
context = contextApi.active()
|
||||
): Span {
|
||||
const root = Boolean(options?.root);
|
||||
if (root) {
|
||||
return new NonRecordingSpan();
|
||||
}
|
||||
|
||||
const parentFromContext = context && getSpanContext(context);
|
||||
|
||||
if (
|
||||
isSpanContext(parentFromContext) &&
|
||||
isSpanContextValid(parentFromContext)
|
||||
) {
|
||||
return new NonRecordingSpan(parentFromContext);
|
||||
} else {
|
||||
return new NonRecordingSpan();
|
||||
}
|
||||
}
|
||||
|
||||
startActiveSpan<F extends (span: Span) => ReturnType<F>>(
|
||||
name: string,
|
||||
fn: F
|
||||
): ReturnType<F>;
|
||||
startActiveSpan<F extends (span: Span) => ReturnType<F>>(
|
||||
name: string,
|
||||
opts: SpanOptions | undefined,
|
||||
fn: F
|
||||
): ReturnType<F>;
|
||||
startActiveSpan<F extends (span: Span) => ReturnType<F>>(
|
||||
name: string,
|
||||
opts: SpanOptions | undefined,
|
||||
ctx: Context | undefined,
|
||||
fn: F
|
||||
): ReturnType<F>;
|
||||
startActiveSpan<F extends (span: Span) => ReturnType<F>>(
|
||||
name: string,
|
||||
arg2?: F | SpanOptions,
|
||||
arg3?: F | Context,
|
||||
arg4?: F
|
||||
): ReturnType<F> | undefined {
|
||||
let opts: SpanOptions | undefined;
|
||||
let ctx: Context | undefined;
|
||||
let fn: F;
|
||||
|
||||
if (arguments.length < 2) {
|
||||
return;
|
||||
} else if (arguments.length === 2) {
|
||||
fn = arg2 as F;
|
||||
} else if (arguments.length === 3) {
|
||||
opts = arg2 as SpanOptions | undefined;
|
||||
fn = arg3 as F;
|
||||
} else {
|
||||
opts = arg2 as SpanOptions | undefined;
|
||||
ctx = arg3 as Context | undefined;
|
||||
fn = arg4 as F;
|
||||
}
|
||||
|
||||
const parentContext = ctx ?? contextApi.active();
|
||||
const span = this.startSpan(name, opts, parentContext);
|
||||
const contextWithSpanSet = setSpan(parentContext, span);
|
||||
|
||||
return contextApi.with(contextWithSpanSet, fn, undefined, span);
|
||||
}
|
||||
}
|
||||
|
||||
function isSpanContext(spanContext: unknown): spanContext is SpanContext {
|
||||
return (
|
||||
spanContext !== null &&
|
||||
typeof spanContext === 'object' &&
|
||||
'spanId' in spanContext &&
|
||||
typeof spanContext['spanId'] === 'string' &&
|
||||
'traceId' in spanContext &&
|
||||
typeof spanContext['traceId'] === 'string' &&
|
||||
'traceFlags' in spanContext &&
|
||||
typeof spanContext['traceFlags'] === 'number'
|
||||
);
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { NoopTracer } from './NoopTracer';
|
||||
import { Tracer } from './tracer';
|
||||
import { TracerOptions } from './tracer_options';
|
||||
import { TracerProvider } from './tracer_provider';
|
||||
|
||||
/**
|
||||
* An implementation of the {@link TracerProvider} which returns an impotent
|
||||
* Tracer for all calls to `getTracer`.
|
||||
*
|
||||
* All operations are no-op.
|
||||
*/
|
||||
export class NoopTracerProvider implements TracerProvider {
|
||||
getTracer(
|
||||
_name?: string,
|
||||
_version?: string,
|
||||
_options?: TracerOptions
|
||||
): Tracer {
|
||||
return new NoopTracer();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Context } from '../context/types';
|
||||
import { NoopTracer } from './NoopTracer';
|
||||
import { Span } from './span';
|
||||
import { SpanOptions } from './SpanOptions';
|
||||
import { Tracer } from './tracer';
|
||||
import { TracerOptions } from './tracer_options';
|
||||
|
||||
const NOOP_TRACER = new NoopTracer();
|
||||
|
||||
/**
|
||||
* Proxy tracer provided by the proxy tracer provider
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export class ProxyTracer implements Tracer {
|
||||
// When a real implementation is provided, this will be it
|
||||
private _delegate?: Tracer;
|
||||
|
||||
constructor(
|
||||
private _provider: TracerDelegator,
|
||||
public readonly name: string,
|
||||
public readonly version?: string,
|
||||
public readonly options?: TracerOptions
|
||||
) {}
|
||||
|
||||
startSpan(name: string, options?: SpanOptions, context?: Context): Span {
|
||||
return this._getTracer().startSpan(name, options, context);
|
||||
}
|
||||
|
||||
startActiveSpan<F extends (span: Span) => unknown>(
|
||||
_name: string,
|
||||
_options: F | SpanOptions,
|
||||
_context?: F | Context,
|
||||
_fn?: F
|
||||
): ReturnType<F> {
|
||||
const tracer = this._getTracer();
|
||||
return Reflect.apply(tracer.startActiveSpan, tracer, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to get a tracer from the proxy tracer provider.
|
||||
* If the proxy tracer provider has no delegate, return a noop tracer.
|
||||
*/
|
||||
private _getTracer() {
|
||||
if (this._delegate) {
|
||||
return this._delegate;
|
||||
}
|
||||
|
||||
const tracer = this._provider.getDelegateTracer(
|
||||
this.name,
|
||||
this.version,
|
||||
this.options
|
||||
);
|
||||
|
||||
if (!tracer) {
|
||||
return NOOP_TRACER;
|
||||
}
|
||||
|
||||
this._delegate = tracer;
|
||||
return this._delegate;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.0.3
|
||||
*/
|
||||
export interface TracerDelegator {
|
||||
getDelegateTracer(
|
||||
name: string,
|
||||
version?: string,
|
||||
options?: TracerOptions
|
||||
): Tracer | undefined;
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Tracer } from './tracer';
|
||||
import { TracerProvider } from './tracer_provider';
|
||||
import { ProxyTracer } from './ProxyTracer';
|
||||
import { NoopTracerProvider } from './NoopTracerProvider';
|
||||
import { TracerOptions } from './tracer_options';
|
||||
|
||||
const NOOP_TRACER_PROVIDER = new NoopTracerProvider();
|
||||
|
||||
/**
|
||||
* Tracer provider which provides {@link ProxyTracer}s.
|
||||
*
|
||||
* Before a delegate is set, tracers provided are NoOp.
|
||||
* When a delegate is set, traces are provided from the delegate.
|
||||
* When a delegate is set after tracers have already been provided,
|
||||
* all tracers already provided will use the provided delegate implementation.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export class ProxyTracerProvider implements TracerProvider {
|
||||
private _delegate?: TracerProvider;
|
||||
|
||||
/**
|
||||
* Get a {@link ProxyTracer}
|
||||
*/
|
||||
getTracer(name: string, version?: string, options?: TracerOptions): Tracer {
|
||||
return (
|
||||
this.getDelegateTracer(name, version, options) ??
|
||||
new ProxyTracer(this, name, version, options)
|
||||
);
|
||||
}
|
||||
|
||||
getDelegate(): TracerProvider {
|
||||
return this._delegate ?? NOOP_TRACER_PROVIDER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the delegate tracer provider
|
||||
*/
|
||||
setDelegate(delegate: TracerProvider) {
|
||||
this._delegate = delegate;
|
||||
}
|
||||
|
||||
getDelegateTracer(
|
||||
name: string,
|
||||
version?: string,
|
||||
options?: TracerOptions
|
||||
): Tracer | undefined {
|
||||
return this._delegate?.getTracer(name, version, options);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Context } from '../context/types';
|
||||
import { SpanAttributes } from './attributes';
|
||||
import { Link } from './link';
|
||||
import { SamplingResult } from './SamplingResult';
|
||||
import { SpanKind } from './span_kind';
|
||||
|
||||
/**
|
||||
* @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.
|
||||
* This interface represent a sampler. Sampling is a mechanism to control the
|
||||
* noise and overhead introduced by OpenTelemetry by reducing the number of
|
||||
* samples of traces collected and sent to the backend.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export interface Sampler {
|
||||
/**
|
||||
* Checks whether span needs to be created and tracked.
|
||||
*
|
||||
* @param context Parent Context which may contain a span.
|
||||
* @param traceId of the span to be created. It can be different from the
|
||||
* traceId in the {@link SpanContext}. Typically in situations when the
|
||||
* span to be created starts a new trace.
|
||||
* @param spanName of the span to be created.
|
||||
* @param spanKind of the span to be created.
|
||||
* @param attributes Initial set of SpanAttributes for the Span being constructed.
|
||||
* @param links Collection of links that will be associated with the Span to
|
||||
* be created. Typically useful for batch operations.
|
||||
* @returns a {@link SamplingResult}.
|
||||
*/
|
||||
shouldSample(
|
||||
context: Context,
|
||||
traceId: string,
|
||||
spanName: string,
|
||||
spanKind: SpanKind,
|
||||
attributes: SpanAttributes,
|
||||
links: Link[]
|
||||
): SamplingResult;
|
||||
|
||||
/** Returns the sampler name or short description with the configuration. */
|
||||
toString(): string;
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { SpanAttributes } from './attributes';
|
||||
import { TraceState } from './trace_state';
|
||||
|
||||
/**
|
||||
* @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.
|
||||
* A sampling decision that determines how a {@link Span} will be recorded
|
||||
* and collected.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export enum SamplingDecision {
|
||||
/**
|
||||
* `Span.isRecording() === false`, span will not be recorded and all events
|
||||
* and attributes will be dropped.
|
||||
*/
|
||||
NOT_RECORD,
|
||||
/**
|
||||
* `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags}
|
||||
* MUST NOT be set.
|
||||
*/
|
||||
RECORD,
|
||||
/**
|
||||
* `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags}
|
||||
* MUST be set.
|
||||
*/
|
||||
RECORD_AND_SAMPLED,
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.
|
||||
* A sampling result contains a decision for a {@link Span} and additional
|
||||
* attributes the sampler would like to added to the Span.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export interface SamplingResult {
|
||||
/**
|
||||
* A sampling decision, refer to {@link SamplingDecision} for details.
|
||||
*/
|
||||
decision: SamplingDecision;
|
||||
/**
|
||||
* The list of attributes returned by SamplingResult MUST be immutable.
|
||||
* Caller may call {@link Sampler}.shouldSample any number of times and
|
||||
* can safely cache the returned value.
|
||||
*/
|
||||
attributes?: Readonly<SpanAttributes>;
|
||||
/**
|
||||
* A {@link TraceState} that will be associated with the {@link Span} through
|
||||
* the new {@link SpanContext}. Samplers SHOULD return the TraceState from
|
||||
* the passed-in {@link Context} if they do not intend to change it. Leaving
|
||||
* the value undefined will also leave the TraceState unchanged.
|
||||
*/
|
||||
traceState?: TraceState;
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { TimeInput } from '../common/Time';
|
||||
import { SpanAttributes } from './attributes';
|
||||
import { Link } from './link';
|
||||
import { SpanKind } from './span_kind';
|
||||
|
||||
/**
|
||||
* Options needed for span creation
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export interface SpanOptions {
|
||||
/**
|
||||
* The SpanKind of a span
|
||||
* @default {@link SpanKind.INTERNAL}
|
||||
*/
|
||||
kind?: SpanKind;
|
||||
|
||||
/** A span's attributes */
|
||||
attributes?: SpanAttributes;
|
||||
|
||||
/** {@link Link}s span to other spans */
|
||||
links?: Link[];
|
||||
|
||||
/** A manually specified start time for the created `Span` object. */
|
||||
startTime?: TimeInput;
|
||||
|
||||
/** The new span should be a root span. (Ignore parent from context). */
|
||||
root?: boolean;
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Attributes, AttributeValue } from '../common/Attributes';
|
||||
|
||||
/**
|
||||
* @deprecated please use {@link Attributes}
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export type SpanAttributes = Attributes;
|
||||
|
||||
/**
|
||||
* @deprecated please use {@link AttributeValue}
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export type SpanAttributeValue = AttributeValue;
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createContextKey } from '../context/context';
|
||||
import { Context } from '../context/types';
|
||||
import { Span } from './span';
|
||||
import { SpanContext } from './span_context';
|
||||
import { NonRecordingSpan } from './NonRecordingSpan';
|
||||
import { ContextAPI } from '../api/context';
|
||||
|
||||
/**
|
||||
* span key
|
||||
*/
|
||||
const SPAN_KEY = createContextKey('OpenTelemetry Context Key SPAN');
|
||||
|
||||
/**
|
||||
* Return the span if one exists
|
||||
*
|
||||
* @param context context to get span from
|
||||
*/
|
||||
export function getSpan(context: Context): Span | undefined {
|
||||
return (context.getValue(SPAN_KEY) as Span) || undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the span from the current context, if one exists.
|
||||
*/
|
||||
export function getActiveSpan(): Span | undefined {
|
||||
return getSpan(ContextAPI.getInstance().active());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the span on a context
|
||||
*
|
||||
* @param context context to use as parent
|
||||
* @param span span to set active
|
||||
*/
|
||||
export function setSpan(context: Context, span: Span): Context {
|
||||
return context.setValue(SPAN_KEY, span);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove current span stored in the context
|
||||
*
|
||||
* @param context context to delete span from
|
||||
*/
|
||||
export function deleteSpan(context: Context): Context {
|
||||
return context.deleteValue(SPAN_KEY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap span context in a NoopSpan and set as span in a new
|
||||
* context
|
||||
*
|
||||
* @param context context to set active span on
|
||||
* @param spanContext span context to be wrapped
|
||||
*/
|
||||
export function setSpanContext(
|
||||
context: Context,
|
||||
spanContext: SpanContext
|
||||
): Context {
|
||||
return setSpan(context, new NonRecordingSpan(spanContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the span context of the span if it exists.
|
||||
*
|
||||
* @param context context to get values from
|
||||
*/
|
||||
export function getSpanContext(context: Context): SpanContext | undefined {
|
||||
return getSpan(context)?.spanContext();
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { TraceState } from '../trace_state';
|
||||
import { validateKey, validateValue } from './tracestate-validators';
|
||||
|
||||
const MAX_TRACE_STATE_ITEMS = 32;
|
||||
const MAX_TRACE_STATE_LEN = 512;
|
||||
const LIST_MEMBERS_SEPARATOR = ',';
|
||||
const LIST_MEMBER_KEY_VALUE_SPLITTER = '=';
|
||||
|
||||
/**
|
||||
* TraceState must be a class and not a simple object type because of the spec
|
||||
* requirement (https://www.w3.org/TR/trace-context/#tracestate-field).
|
||||
*
|
||||
* Here is the list of allowed mutations:
|
||||
* - New key-value pair should be added into the beginning of the list
|
||||
* - The value of any key can be updated. Modified keys MUST be moved to the
|
||||
* beginning of the list.
|
||||
*/
|
||||
export class TraceStateImpl implements TraceState {
|
||||
private _internalState: Map<string, string> = new Map();
|
||||
|
||||
constructor(rawTraceState?: string) {
|
||||
if (rawTraceState) this._parse(rawTraceState);
|
||||
}
|
||||
|
||||
set(key: string, value: string): TraceStateImpl {
|
||||
// TODO: Benchmark the different approaches(map vs list) and
|
||||
// use the faster one.
|
||||
const traceState = this._clone();
|
||||
if (traceState._internalState.has(key)) {
|
||||
traceState._internalState.delete(key);
|
||||
}
|
||||
traceState._internalState.set(key, value);
|
||||
return traceState;
|
||||
}
|
||||
|
||||
unset(key: string): TraceStateImpl {
|
||||
const traceState = this._clone();
|
||||
traceState._internalState.delete(key);
|
||||
return traceState;
|
||||
}
|
||||
|
||||
get(key: string): string | undefined {
|
||||
return this._internalState.get(key);
|
||||
}
|
||||
|
||||
serialize(): string {
|
||||
return this._keys()
|
||||
.reduce((agg: string[], key) => {
|
||||
agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + this.get(key));
|
||||
return agg;
|
||||
}, [])
|
||||
.join(LIST_MEMBERS_SEPARATOR);
|
||||
}
|
||||
|
||||
private _parse(rawTraceState: string) {
|
||||
if (rawTraceState.length > MAX_TRACE_STATE_LEN) return;
|
||||
this._internalState = rawTraceState
|
||||
.split(LIST_MEMBERS_SEPARATOR)
|
||||
.reverse() // Store in reverse so new keys (.set(...)) will be placed at the beginning
|
||||
.reduce((agg: Map<string, string>, part: string) => {
|
||||
const listMember = part.trim(); // Optional Whitespace (OWS) handling
|
||||
const i = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);
|
||||
if (i !== -1) {
|
||||
const key = listMember.slice(0, i);
|
||||
const value = listMember.slice(i + 1, part.length);
|
||||
if (validateKey(key) && validateValue(value)) {
|
||||
agg.set(key, value);
|
||||
} else {
|
||||
// TODO: Consider to add warning log
|
||||
}
|
||||
}
|
||||
return agg;
|
||||
}, new Map());
|
||||
|
||||
// Because of the reverse() requirement, trunc must be done after map is created
|
||||
if (this._internalState.size > MAX_TRACE_STATE_ITEMS) {
|
||||
this._internalState = new Map(
|
||||
Array.from(this._internalState.entries())
|
||||
.reverse() // Use reverse same as original tracestate parse chain
|
||||
.slice(0, MAX_TRACE_STATE_ITEMS)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private _keys(): string[] {
|
||||
return Array.from(this._internalState.keys()).reverse();
|
||||
}
|
||||
|
||||
private _clone(): TraceStateImpl {
|
||||
const traceState = new TraceStateImpl();
|
||||
traceState._internalState = new Map(this._internalState);
|
||||
return traceState;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const VALID_KEY_CHAR_RANGE = '[_0-9a-z-*/]';
|
||||
const VALID_KEY = `[a-z]${VALID_KEY_CHAR_RANGE}{0,255}`;
|
||||
const VALID_VENDOR_KEY = `[a-z0-9]${VALID_KEY_CHAR_RANGE}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE}{0,13}`;
|
||||
const VALID_KEY_REGEX = new RegExp(`^(?:${VALID_KEY}|${VALID_VENDOR_KEY})$`);
|
||||
const VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/;
|
||||
const INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/;
|
||||
|
||||
/**
|
||||
* Key is opaque string up to 256 characters printable. It MUST begin with a
|
||||
* lowercase letter, and can only contain lowercase letters a-z, digits 0-9,
|
||||
* underscores _, dashes -, asterisks *, and forward slashes /.
|
||||
* For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the
|
||||
* vendor name. Vendors SHOULD set the tenant ID at the beginning of the key.
|
||||
* see https://www.w3.org/TR/trace-context/#key
|
||||
*/
|
||||
export function validateKey(key: string): boolean {
|
||||
return VALID_KEY_REGEX.test(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Value is opaque string up to 256 characters printable ASCII RFC0020
|
||||
* characters (i.e., the range 0x20 to 0x7E) except comma , and =.
|
||||
*/
|
||||
export function validateValue(value: string): boolean {
|
||||
return (
|
||||
VALID_VALUE_BASE_REGEX.test(value) &&
|
||||
!INVALID_VALUE_COMMA_EQUAL_REGEX.test(value)
|
||||
);
|
||||
}
|
|
@ -14,14 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
MetricDescriptor,
|
||||
AggregatorKind,
|
||||
MetricRecord,
|
||||
} from '@opentelemetry/sdk-metrics-base';
|
||||
import { TraceState } from '../trace_state';
|
||||
import { TraceStateImpl } from './tracestate-impl';
|
||||
|
||||
export interface PrometheusCheckpoint {
|
||||
descriptor: MetricDescriptor;
|
||||
aggregatorKind: AggregatorKind;
|
||||
records: MetricRecord[];
|
||||
/**
|
||||
* @since 1.1.0
|
||||
*/
|
||||
export function createTraceState(rawTraceState?: string): TraceState {
|
||||
return new TraceStateImpl(rawTraceState);
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { SpanContext } from './span_context';
|
||||
import { TraceFlags } from './trace_flags';
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export const INVALID_SPANID = '0000000000000000';
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export const INVALID_TRACEID = '00000000000000000000000000000000';
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export const INVALID_SPAN_CONTEXT: SpanContext = {
|
||||
traceId: INVALID_TRACEID,
|
||||
spanId: INVALID_SPANID,
|
||||
traceFlags: TraceFlags.NONE,
|
||||
};
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { SpanAttributes } from './attributes';
|
||||
import { SpanContext } from './span_context';
|
||||
|
||||
/**
|
||||
* A pointer from the current {@link Span} to another span in the same trace or
|
||||
* in a different trace.
|
||||
* Few examples of Link usage.
|
||||
* 1. Batch Processing: A batch of elements may contain elements associated
|
||||
* with one or more traces/spans. Since there can only be one parent
|
||||
* SpanContext, Link is used to keep reference to SpanContext of all
|
||||
* elements in the batch.
|
||||
* 2. Public Endpoint: A SpanContext in incoming client request on a public
|
||||
* endpoint is untrusted from service provider perspective. In such case it
|
||||
* is advisable to start a new trace with appropriate sampling decision.
|
||||
* However, it is desirable to associate incoming SpanContext to new trace
|
||||
* initiated on service provider side so two traces (from Client and from
|
||||
* Service Provider) can be correlated.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export interface Link {
|
||||
/** The {@link SpanContext} of a linked span. */
|
||||
context: SpanContext;
|
||||
/** A set of {@link SpanAttributes} on the link. */
|
||||
attributes?: SpanAttributes;
|
||||
/** Count of attributes of the link that were dropped due to collection limits */
|
||||
droppedAttributesCount?: number;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue