Compare commits
537 Commits
Author | SHA1 | Date |
---|---|---|
|
4237a26517 | |
|
590f11213c | |
|
ff4d32646a | |
|
17b4065d6c | |
|
b79242d858 | |
|
dfd35c7a8d | |
|
c0855e867a | |
|
5764814b8e | |
|
42c4091802 | |
|
dc2874e2fa | |
|
352acfb24b | |
|
3e5368eba8 | |
|
80da2ab3d9 | |
|
29a7fe8f13 | |
|
887778fa0b | |
|
8e232157d1 | |
|
b185cfb94f | |
|
57580f56e5 | |
|
7781706de2 | |
|
ce1e26f579 | |
|
80094155e9 | |
|
38207b740e | |
|
c54a301e5e | |
|
804d5f3a07 | |
|
40f71ed52a | |
|
95dc35b2dd | |
|
6cac14d649 | |
|
78a917da2e | |
|
4821c37ec0 | |
|
cecfb835be | |
|
915c64a365 | |
|
de491791a4 | |
|
05f67023da | |
|
e949555a70 | |
|
d9c9583409 | |
|
15ae8c0f35 | |
|
518623882b | |
|
7768b2d106 | |
|
e0fdeb3dae | |
|
ab078e0f35 | |
|
9406936154 | |
|
85f662abfe | |
|
317c00261b | |
|
9db6f62129 | |
|
0309b30c44 | |
|
43f3f7d059 | |
|
360897b98e | |
|
6dd69e96e8 | |
|
50e3d4d949 | |
|
2c0ee00508 | |
|
a7315c63b6 | |
|
edd51d45a1 | |
|
e2e2dbbc26 | |
|
b203d2f23e | |
|
6e8a466ca4 | |
|
0ca502bddd | |
|
9329f8675e | |
|
9262a81432 | |
|
11e424de8d | |
|
aeb08f40a0 | |
|
b0a9deb7d8 | |
|
76913bb224 | |
|
55a1b57644 | |
|
bf65026b71 | |
|
fa31e52722 | |
|
ada5af60d1 | |
|
2eb84bf417 | |
|
d90cf44c87 | |
|
cc2844d867 | |
|
07f01c363f | |
|
3f73f12f83 | |
|
fe315a3a23 | |
|
f9dc916a80 | |
|
4a33b66996 | |
|
d5a2fa2bda | |
|
6a164a9a36 | |
|
67e3f7baf0 | |
|
e35ba16e55 | |
|
289bebaf15 | |
|
7a4a452603 | |
|
5a25bb6fe1 | |
|
07e8d434f3 | |
|
d37f6bd93a | |
|
e25b776840 | |
|
c34a25efd5 | |
|
d034464ffd | |
|
f2f29f5976 | |
|
8ed10f2ad7 | |
|
5e50aa7ee6 | |
|
cb92d970d4 | |
|
5fada737bf | |
|
c874197d64 | |
|
d41c099e62 | |
|
9e76c90a04 | |
|
93d9e7278f | |
|
b11316b0bd | |
|
a756317511 | |
|
3b596aae1b | |
|
d239b7017d | |
|
f7207352a1 | |
|
2c762e0be8 | |
|
dfbea872b1 | |
|
fd93c2b8c4 | |
|
ba37bf1a69 | |
|
6982730ffb | |
|
f94b056f83 | |
|
5898a425c5 | |
|
afe3440e91 | |
|
53b1f7c624 | |
|
90e030f213 | |
|
03e7f98965 | |
|
145ceaa94c | |
|
6153023d98 | |
|
04fc212451 | |
|
cc7d0855e7 | |
|
452464820a | |
|
deeceebe8d | |
|
6bd13ffcbc | |
|
3c1f556831 | |
|
4c6ba0aed1 | |
|
d698c1d326 | |
|
3219437316 | |
|
bed02d5f61 | |
|
394cd354a3 | |
|
e419b5d588 | |
|
acc64ee012 | |
|
e8305ee3f5 | |
|
983133fd0d | |
|
58acb531c5 | |
|
18548f47ad | |
|
f0f263031a | |
|
288907d349 | |
|
eec21201b1 | |
|
54e5ea7bf2 | |
|
d70fe5b029 | |
|
5bda810da8 | |
|
39ba216f00 | |
|
804714d28e | |
|
7cbcdd65b6 | |
|
4aeb2f79be | |
|
29523e62ea | |
|
3ef4be2d84 | |
|
56ae62e2d6 | |
|
2e59170339 | |
|
e2a5d20955 | |
|
33a1a9e5fe | |
|
eb14ef665e | |
|
d114161694 | |
|
8c1e348fb8 | |
|
beb5917939 | |
|
b8d9c027fd | |
|
b468a2e9bf | |
|
2460c92400 | |
|
86b7e76082 | |
|
5c4a0ad78f | |
|
8fda429ae6 | |
|
9e3f702d5b | |
|
04677f93b3 | |
|
349052c34d | |
|
9e1e9c6e9f | |
|
65472798f6 | |
|
f17b8b0414 | |
|
e392b11bbf | |
|
4e457f75a8 | |
|
d13f04d084 | |
|
14e2fefe7a | |
|
ccfcecf8fe | |
|
8a998225d0 | |
|
a01bf6cfd0 | |
|
0191a01b3b | |
|
e695b66950 | |
|
563087f0f0 | |
|
00fbeb2695 | |
|
6855cd3143 | |
|
5d3ae0199f | |
|
dc0b4acd86 | |
|
2d1c14ee56 | |
|
9cb636502e | |
|
4e243f2b63 | |
|
d7fb208d06 | |
|
1f5a560fbb | |
|
58bf4e4018 | |
|
a8493271bc | |
|
00b61a2d87 | |
|
10eda198c0 | |
|
aa17528ec1 | |
|
688e1031c6 | |
|
7f86458580 | |
|
3eb7ef00ad | |
|
f801a159f3 | |
|
b3126023db | |
|
233e111a09 | |
|
4ecc0becfd | |
|
184090914e | |
|
8fe071afee | |
|
a7e92dfe81 | |
|
dc44948c4f | |
|
a48b48fa29 | |
|
e34049b74e | |
|
1500b0f3ba | |
|
0c6a04710b | |
|
22acb3e8ec | |
|
f2f990c81d | |
|
e46742d944 | |
|
2cf5f0128b | |
|
e6f90f58ce | |
|
9698d24fdf | |
|
526137fd64 | |
|
7b732c8498 | |
|
a1fed61742 | |
|
3c12e3af1a | |
|
9e0efd4267 | |
|
cc7b268cec | |
|
3ac1f9f695 | |
|
747368a94b | |
|
000fd0f209 | |
|
9172089ab9 | |
|
9b596d03d1 | |
|
9c1b9f609f | |
|
09bac7d077 | |
|
490173b0da | |
|
0673fcfda5 | |
|
a3dd67739a | |
|
d0848e3351 | |
|
d511a28df9 | |
|
708244ec48 | |
|
9d4f61ad0b | |
|
974653fe66 | |
|
2e4f9ede58 | |
|
8efade69a1 | |
|
4d34b53e0c | |
|
0de9fc084d | |
|
1b1d537375 | |
|
42056f57c8 | |
|
b3e3fff83c | |
|
cd86405148 | |
|
33b37abe9a | |
|
0618791928 | |
|
5015698d2b | |
|
3c71b798a5 | |
|
0a993b392c | |
|
16f3637b0b | |
|
dc46ccd2c9 | |
|
d1ce438e00 | |
|
173e80b9c2 | |
|
3dd7134f81 | |
|
cd1f61725c | |
|
313d391e55 | |
|
865c89f47d | |
|
5a10b685d4 | |
|
3d3bff5bda | |
|
31f484f39f | |
|
2de5a2c484 | |
|
9f5b67b3c3 | |
|
80af8a33a0 | |
|
c91f56ece8 | |
|
f33cba3b1d | |
|
b5daeb0871 | |
|
3c77016788 | |
|
ee731aabd3 | |
|
56941a5ba6 | |
|
37969926d1 | |
|
0465c79151 | |
|
5879f48dc8 | |
|
f937eff1ee | |
|
5b93c08eed | |
|
a9d7f1ebda | |
|
d08c5030d3 | |
|
3f3b42483a | |
|
8ed2e0c79f | |
|
d69ea6c37d | |
|
ca6fa4e801 | |
|
41e54f7481 | |
|
fe73fb737a | |
|
3d3355305b | |
|
e47963612e | |
|
3e1d9536f8 | |
|
43fba2e984 | |
|
b56b10ff57 | |
|
27d863375b | |
|
c285def1d9 | |
|
8e71517fdb | |
|
768e789160 | |
|
517893e817 | |
|
c77e66475a | |
|
00f00433f3 | |
|
06449488ce | |
|
92b089ab2c | |
|
89a830cfb4 | |
|
867bb1f24e | |
|
5b1e444980 | |
|
d22baecc95 | |
|
41c51a052c | |
|
bd6b974e99 | |
|
355d17ffaa | |
|
19650df469 | |
|
a17dcd531d | |
|
e075cc157c | |
|
22b6fea9ea | |
|
ab24130dcb | |
|
a5739eba19 | |
|
d16cad3f73 | |
|
2fcd5f5bf8 | |
|
9f0a29124e | |
|
cb64451c72 | |
|
045c3e65d6 | |
|
19e964a636 | |
|
bf71be17d4 | |
|
8e31bf4f28 | |
|
05bf32c5df | |
|
df425b684a | |
|
f8836deff7 | |
|
d7962af43e | |
|
c4412f2070 | |
|
1c1d56113d | |
|
5e1a3979b6 | |
|
070aedcf58 | |
|
d2b8497de0 | |
|
cd3b0e7f9d | |
|
85b99e94f9 | |
|
013d1669fa | |
|
b4fec0573b | |
|
14d714a311 | |
|
d704117f9d | |
|
13e2b8c4df | |
|
2770fa1bb1 | |
|
81d165d75c | |
|
31869a3fc6 | |
|
4eeef33524 | |
|
a1c0d0bd64 | |
|
97410cb24a | |
|
2fb3ebad3d | |
|
c8da0201ab | |
|
bfd87cad4e | |
|
4b3cedda0d | |
|
d71db3a2f0 | |
|
d56bdf5723 | |
|
492b94f2b0 | |
|
d13fd38df1 | |
|
0920d11aec | |
|
2e0b315ce6 | |
|
d74e277ecb | |
|
ccb6346e32 | |
|
43b38e276c | |
|
330881a1d1 | |
|
6f8d4915b9 | |
|
5f90b0352e | |
|
d3e38077e7 | |
|
cf95056770 | |
|
1a84cbd00f | |
|
ccccd1b0a5 | |
|
e36e185c6a | |
|
2367ae5312 | |
|
8369d7f57e | |
|
aa5c74c9e0 | |
|
ddc9c9162b | |
|
986dbaa26e | |
|
98c3fc1b85 | |
|
fe810e73d3 | |
|
abdbf07dfd | |
|
717d8b0032 | |
|
ee05c5cb08 | |
|
a3d807b70f | |
|
d294a42afb | |
|
a084b3ae0a | |
|
b934a0a3d4 | |
|
c1b9ec789c | |
|
40b74b05e1 | |
|
21529fa339 | |
|
0e6af66d10 | |
|
d95c4ea484 | |
|
a7a2c06145 | |
|
e454311bd5 | |
|
77b1f64252 | |
|
c80845dfe4 | |
|
1fcbed8d81 | |
|
e80506a92f | |
|
09b8db6563 | |
|
b32f64420c | |
|
f68ba65d6b | |
|
62f060ed9a | |
|
e3cfedee7d | |
|
efdacc1c18 | |
|
aca4ee35cb | |
|
3928febd2d | |
|
1f8ee517bf | |
|
e61e19ae23 | |
|
af1e1d57ee | |
|
23780762b0 | |
|
bd8c008c3d | |
|
541ef89e6a | |
|
b07dab31cd | |
|
ee8d735de1 | |
|
236e119f66 | |
|
3a5222f808 | |
|
6d62e8b742 | |
|
59b49cf741 | |
|
d2a0299587 | |
|
0ef86fae7d | |
|
d61a5c3b37 | |
|
3df2068d9f | |
|
9b2f6bace9 | |
|
bc482c996e | |
|
e78de66e5f | |
|
1cdb04d725 | |
|
7829f53c24 | |
|
8a3329be4d | |
|
6487ac2976 | |
|
c71bd9dfd5 | |
|
d2e56b59c6 | |
|
bab9fb9cdb | |
|
7d74adafdc | |
|
8d6578fbe8 | |
|
e0a6e64fc7 | |
|
cde3d45f04 | |
|
2a97eaedc5 | |
|
ec3c55ffeb | |
|
26f359b3e9 | |
|
4c30ec48d3 | |
|
46b2fcda7d | |
|
dbda01ec07 | |
|
9084a59127 | |
|
b482e76711 | |
|
fb2a47cf76 | |
|
acde5b62f8 | |
|
78565d813b | |
|
bd31b457f0 | |
|
9a0bfb2311 | |
|
ca98fc53be | |
|
1566984262 | |
|
6c0d140dff | |
|
e62d7c69cb | |
|
597eb09de4 | |
|
e38ebf5dc3 | |
|
b5fab78314 | |
|
7dcf73f2d8 | |
|
0a4aa3cbd2 | |
|
2a1c2749ff | |
|
6c3725d916 | |
|
bc2487f274 | |
|
a6b33029be | |
|
98fa296098 | |
|
7e4da160ba | |
|
fd58d10628 | |
|
ef032394dc | |
|
e4f39789bd | |
|
d9fce84689 | |
|
ff4fe978e5 | |
|
2e8bf7f9a1 | |
|
2de12fee5a | |
|
1e3cf0b7e3 | |
|
fcae15e927 | |
|
3f05bf6ae2 | |
|
73894cfe96 | |
|
e65edd942b | |
|
c7e797c5b4 | |
|
c8967098c7 | |
|
fc86a76c87 | |
|
2b0df092dc | |
|
e6e2f3c36a | |
|
8af18033cf | |
|
ee21d4dcf3 | |
|
740dd14f52 | |
|
74579aa2a1 | |
|
fd4e5fe569 | |
|
192f7fa4fe | |
|
bc4bacf5ee | |
|
10bca8b2b2 | |
|
5ec1e8688e | |
|
45b8c13b12 | |
|
f52554bc52 | |
|
8793935d8f | |
|
628db61339 | |
|
680c9406fd | |
|
62df132007 | |
|
1ac476b3b7 | |
|
07b6903b85 | |
|
537f5c4e79 | |
|
8194c10b78 | |
|
83b30b5d0e | |
|
3e650f00a1 | |
|
e4d5109c49 | |
|
1554ccbf18 | |
|
b1cd30ef7f | |
|
b6badb2ca3 | |
|
e6eceb5115 | |
|
b927d9daf4 | |
|
eb53fe3a61 | |
|
0f859b4385 | |
|
a7f950d7fd | |
|
65af6511e5 | |
|
503cc533f2 | |
|
814e06401d | |
|
a6a9acb1dd | |
|
361f035efe | |
|
4aa7f57842 | |
|
6c7efe280b | |
|
0260d82716 | |
|
27f9868117 | |
|
7f8fbc9bbd | |
|
184685536e | |
|
de6efccb99 | |
|
fa7db47889 | |
|
d904b133e4 | |
|
94b7d25905 | |
|
46b28eb45e | |
|
2dbb8de349 | |
|
697b4e0c70 | |
|
fa826fdef0 | |
|
a5de6d5cbb | |
|
c5f6218ded | |
|
325822ce85 | |
|
39b24118a1 | |
|
af59cc4a0b | |
|
799039247b | |
|
de13ff183a | |
|
485c123a42 | |
|
9c466f4a13 | |
|
bd88acae57 | |
|
31e562f9a5 | |
|
c9c857c908 | |
|
d773f3bfe2 | |
|
a63f9195a1 | |
|
5b421b6d57 | |
|
9249653f69 | |
|
d899702eab | |
|
82b9e9b64d | |
|
0132d5d98b | |
|
983800cc56 | |
|
18d192d1fa | |
|
57f94cf92a | |
|
8fb169e934 | |
|
0feca55ee2 | |
|
a55e9b6440 | |
|
9ddccada89 | |
|
b0643fef38 | |
|
0a47581b2e |
|
@ -0,0 +1,8 @@
|
||||||
|
# see https://github.com/cncf/clomonitor/blob/main/docs/checks.md#exemptions
|
||||||
|
exemptions:
|
||||||
|
- check: artifacthub_badge
|
||||||
|
reason: "Artifact Hub doesn't support Java packages"
|
||||||
|
- check: signed_releases
|
||||||
|
reason: "Maven central releases are signed and there are no GitHub release artifacts"
|
||||||
|
- check: openssf_badge
|
||||||
|
reason: "ETOOMANYBADGES, but the work has been done: https://www.bestpractices.dev/projects/9991"
|
|
@ -11,7 +11,7 @@ coverage:
|
||||||
status:
|
status:
|
||||||
project:
|
project:
|
||||||
default:
|
default:
|
||||||
target: 90%
|
target: 89%
|
||||||
paths:
|
paths:
|
||||||
- "!opencensus-shim/"
|
- "!opencensus-shim/"
|
||||||
- "!opentracing-shim/"
|
- "!opentracing-shim/"
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
version: 3
|
||||||
|
|
||||||
|
targets:
|
||||||
|
only:
|
||||||
|
- type: gradle
|
||||||
|
exclude:
|
||||||
|
# these modules are not published and so consumers will not be exposed to them
|
||||||
|
- type: gradle
|
||||||
|
path: ./
|
||||||
|
target: ':api:testing-internal'
|
||||||
|
- type: gradle
|
||||||
|
path: ./
|
||||||
|
target: ':exporters:otlp:testing-internal'
|
||||||
|
- type: gradle
|
||||||
|
path: ./
|
||||||
|
target: ':integration-tests'
|
||||||
|
- type: gradle
|
||||||
|
path: ./
|
||||||
|
target: ':integration-tests:graal'
|
||||||
|
- type: gradle
|
||||||
|
path: ./
|
||||||
|
target: ':integration-tests:graal-incubating'
|
||||||
|
- type: gradle
|
||||||
|
path: ./
|
||||||
|
target: ':integration-tests:otlp'
|
||||||
|
- type: gradle
|
||||||
|
path: ./
|
||||||
|
target: ':integration-tests:tracecontext'
|
||||||
|
- type: gradle
|
||||||
|
path: ./
|
||||||
|
target: ':perf-harness'
|
||||||
|
- type: gradle
|
||||||
|
path: ./
|
||||||
|
target: ':testing-internal'
|
||||||
|
|
||||||
|
experimental:
|
||||||
|
gradle:
|
||||||
|
configurations-only:
|
||||||
|
# consumer will only be exposed to these dependencies
|
||||||
|
- runtimeClasspath
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"retryOn429": true,
|
|
||||||
"aliveStatusCodes": [
|
|
||||||
200,
|
|
||||||
403
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,48 +1,85 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
|
||||||
"extends": [
|
extends: [
|
||||||
"config:base"
|
'config:best-practices',
|
||||||
|
'helpers:pinGitHubActionDigestsToSemver',
|
||||||
],
|
],
|
||||||
"packageRules": [
|
packageRules: [
|
||||||
{
|
{
|
||||||
"matchPackageNames": [
|
// this is to reduce the number of renovate PRs
|
||||||
"io.opentelemetry.proto:opentelemetry-proto",
|
matchManagers: [
|
||||||
"io.opentelemetry.semconv:opentelemetry-semconv-incubating"
|
'github-actions',
|
||||||
|
'dockerfile',
|
||||||
|
],
|
||||||
|
extends: [
|
||||||
|
'schedule:weekly',
|
||||||
|
],
|
||||||
|
groupName: 'weekly update',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
matchPackageNames: [
|
||||||
|
'io.opentelemetry.contrib:opentelemetry-aws-xray-propagator',
|
||||||
|
'io.opentelemetry.proto:opentelemetry-proto',
|
||||||
|
'io.opentelemetry.semconv:opentelemetry-semconv-incubating',
|
||||||
],
|
],
|
||||||
// Renovate's default behavior is only to update from unstable -> unstable if it's for the
|
// Renovate's default behavior is only to update from unstable -> unstable if it's for the
|
||||||
// major.minor.patch, under the assumption that you would want to update to the stable version
|
// major.minor.patch, under the assumption that you would want to update to the stable version
|
||||||
// of that release instead of the unstable version for a future release
|
// of that release instead of the unstable version for a future release
|
||||||
// (TODO remove once the artifacts above release stable versions)
|
// (TODO remove once the artifacts above release stable versions)
|
||||||
"ignoreUnstable": false,
|
ignoreUnstable: false,
|
||||||
"allowedVersions": "!/\\-SNAPSHOT$/"
|
allowedVersions: '!/\\-SNAPSHOT$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// junit-pioneer 2+ requires Java 11+
|
// junit-pioneer 2+ requires Java 11+
|
||||||
"matchPackageNames": ["org.junit-pioneer:junit-pioneer"],
|
matchPackageNames: [
|
||||||
"matchUpdateTypes": ["major"],
|
'org.junit-pioneer:junit-pioneer',
|
||||||
"enabled": false
|
],
|
||||||
|
matchUpdateTypes: [
|
||||||
|
'major',
|
||||||
|
],
|
||||||
|
enabled: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// mockito 5+ requires Java 11+
|
// mockito 5+ requires Java 11+
|
||||||
"matchPackagePrefixes": ["org.mockito:"],
|
matchUpdateTypes: [
|
||||||
"matchUpdateTypes": ["major"],
|
'major',
|
||||||
"enabled": false
|
],
|
||||||
|
enabled: false,
|
||||||
|
matchPackageNames: [
|
||||||
|
'org.mockito:{/,}**',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// jqf-fuzz version 1.8+ requires Java 11+
|
// jqf-fuzz version 1.8+ requires Java 11+
|
||||||
"matchPackageNames": ["edu.berkeley.cs.jqf:jqf-fuzz"],
|
matchPackageNames: [
|
||||||
"matchUpdateTypes": ["major", "minor"],
|
'edu.berkeley.cs.jqf:jqf-fuzz',
|
||||||
"enabled": false
|
],
|
||||||
|
matchUpdateTypes: [
|
||||||
|
'major',
|
||||||
|
'minor',
|
||||||
|
],
|
||||||
|
enabled: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// pinned version for compatibility
|
// pinned version for compatibility
|
||||||
"matchPackageNames": ["org.jetbrains.kotlinx:kotlinx-coroutines-core"],
|
matchPackageNames: [
|
||||||
"matchCurrentVersion": "1.5.2",
|
'org.jetbrains.kotlinx:kotlinx-coroutines-core',
|
||||||
"enabled": false
|
],
|
||||||
|
matchCurrentVersion: '1.5.2',
|
||||||
|
enabled: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"matchPackagePrefixes": ["com.diffplug.spotless"],
|
groupName: 'spotless packages',
|
||||||
"groupName": "spotless packages"
|
matchPackageNames: [
|
||||||
|
'com.diffplug.spotless{/,}**',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// equals verifier v4+ requires java 17+
|
||||||
|
groupName: 'nl.jqno.equalsverifier',
|
||||||
|
matchPackageNames: [ 'equalsverifier'],
|
||||||
|
matchUpdateTypes: [ 'major' ],
|
||||||
|
enabled: false
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,79 +1,24 @@
|
||||||
# Repository settings
|
# Repository settings
|
||||||
|
|
||||||
Repository settings in addition to what's documented already at
|
This document describes any changes that have been made to the
|
||||||
<https://github.com/open-telemetry/community/blob/main/docs/how-to-configure-new-repository.md>.
|
settings in this repository outside the settings tracked in the
|
||||||
|
private admin repo.
|
||||||
## General > Pull Requests
|
|
||||||
|
|
||||||
* Allow squash merging > Default to pull request title
|
|
||||||
|
|
||||||
## Actions > General
|
|
||||||
|
|
||||||
* Fork pull request workflows from outside collaborators:
|
|
||||||
"Require approval for first-time contributors who are new to GitHub"
|
|
||||||
|
|
||||||
(To reduce friction for new contributors,
|
|
||||||
as the default is "Require approval for first-time contributors")
|
|
||||||
|
|
||||||
## Branch protections
|
|
||||||
|
|
||||||
The order of branch protection rules
|
|
||||||
[can be important](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule#about-branch-protection-rules).
|
|
||||||
The branch protection rules below should be added before the `**/**` branch protection rule
|
|
||||||
(this may require deleting the `**/**` rule and recreating it at the end).
|
|
||||||
|
|
||||||
### `main`
|
|
||||||
|
|
||||||
* Require branches to be up to date before merging: UNCHECKED
|
|
||||||
|
|
||||||
(PR jobs take too long, and leaving this unchecked has not been a significant problem)
|
|
||||||
|
|
||||||
* Status checks that are required:
|
|
||||||
|
|
||||||
* EasyCLA
|
|
||||||
* required-status-check
|
|
||||||
|
|
||||||
### `release/*`
|
|
||||||
|
|
||||||
Same settings as above for `main`, except:
|
|
||||||
|
|
||||||
* Restrict pushes that create matching branches: UNCHECKED
|
|
||||||
|
|
||||||
(So that opentelemetrybot can create release branches)
|
|
||||||
|
|
||||||
### `renovate/**/**`, and `opentelemetrybot/*`
|
|
||||||
|
|
||||||
* Require status checks to pass before merging: UNCHECKED
|
|
||||||
|
|
||||||
(So that renovate PRs can be rebased)
|
|
||||||
|
|
||||||
* Restrict who can push to matching branches: UNCHECKED
|
|
||||||
|
|
||||||
(So that bots can create PR branches in this repository)
|
|
||||||
|
|
||||||
* Allow force pushes > Everyone
|
|
||||||
|
|
||||||
(So that renovate PRs can be rebased)
|
|
||||||
|
|
||||||
* Allow deletions: CHECKED
|
|
||||||
|
|
||||||
(So that bot PR branches can be deleted)
|
|
||||||
|
|
||||||
### `benchmarks`
|
|
||||||
|
|
||||||
- Everything UNCHECKED
|
|
||||||
|
|
||||||
(This branch is currently only used for directly pushing benchmarking results from the
|
|
||||||
[overhead benchmark](https://github.com/open-telemetry/opentelemetry-java/actions/workflows/benchmark.yml)
|
|
||||||
job)
|
|
||||||
|
|
||||||
## Secrets and variables > Actions
|
## Secrets and variables > Actions
|
||||||
|
|
||||||
* `GPG_PASSWORD` - stored in OpenTelemetry-Java 1Password
|
- `GPG_PASSWORD` - stored in OpenTelemetry-Java 1Password
|
||||||
* `GPG_PRIVATE_KEY` - stored in OpenTelemetry-Java 1Password
|
- `GPG_PRIVATE_KEY` - stored in OpenTelemetry-Java 1Password
|
||||||
* `DEVELOCITY_ACCESS_KEY` - owned by [@jack-berg](https://github.com/jack-berg)
|
- `NVD_API_KEY` - stored in OpenTelemetry-Java 1Password
|
||||||
* Generated at https://ge.opentelemetry.io > My settings > Access keys
|
- Generated at https://nvd.nist.gov/developers/request-an-api-key
|
||||||
* format of env var is `ge.opentelemetry.io=<access key>`,
|
- Key is associated with [@trask](https://github.com/trask)'s gmail address
|
||||||
see [docs](https://docs.gradle.com/enterprise/gradle-plugin/#via_environment_variable)
|
- `SONATYPE_KEY` - owned by [@jack-berg](https://github.com/jack-berg)
|
||||||
* `SONATYPE_KEY` - owned by [@jack-berg](https://github.com/jack-berg)
|
- `SONATYPE_USER` - owned by [@jack-berg](https://github.com/jack-berg)
|
||||||
* `SONATYPE_USER` - owned by [@jack-berg](https://github.com/jack-berg)
|
|
||||||
|
### Organization secrets
|
||||||
|
|
||||||
|
- `FOSSA_API_KEY`
|
||||||
|
- `OTELBOT_PRIVATE_KEY`
|
||||||
|
|
||||||
|
### Organization variables
|
||||||
|
|
||||||
|
- `OTELBOT_APP_ID`
|
||||||
|
|
|
@ -86,5 +86,5 @@ echo $contributors1 $contributors2 \
|
||||||
| grep -v github-actions \
|
| grep -v github-actions \
|
||||||
| grep -v renovate \
|
| grep -v renovate \
|
||||||
| grep -v codecov \
|
| grep -v codecov \
|
||||||
| grep -v opentelemetrybot \
|
| grep -v otelbot \
|
||||||
| sed 's/^/@/'
|
| sed 's/^/@/'
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
# this script helps to reduce sporadic link check failures by retrying at a file-by-file level
|
|
||||||
|
|
||||||
retry_count=3
|
|
||||||
|
|
||||||
for file in "$@"; do
|
|
||||||
for i in $(seq 1 $retry_count); do
|
|
||||||
if markdown-link-check --config "$(dirname "$0")/../config/markdown-link-check-config.json" \
|
|
||||||
"$file"; then
|
|
||||||
break
|
|
||||||
elif [[ $i -eq $retry_count ]]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
done
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
version=$1
|
||||||
|
versionWithSnapshot="$version-SNAPSHOT"
|
||||||
|
|
||||||
|
sed -Ei "s/[0-9]+\.[0-9]+\.[0-9]+/$version/" version.gradle.kts
|
||||||
|
|
||||||
|
sed -Ei "1 s/(Comparing source compatibility of [a-z-]+)-[0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT)?.jar/\1-$versionWithSnapshot.jar/" docs/apidiffs/current_vs_latest/*.txt
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
git config user.name opentelemetrybot
|
git config user.name otelbot
|
||||||
git config user.email 107717825+opentelemetrybot@users.noreply.github.com
|
git config user.email 197425009+otelbot@users.noreply.github.com
|
||||||
|
|
|
@ -6,8 +6,13 @@ on:
|
||||||
description: "The pull request # to backport"
|
description: "The pull request # to backport"
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
backport:
|
backport:
|
||||||
|
permissions:
|
||||||
|
contents: write # for git push to PR branch
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- run: |
|
- run: |
|
||||||
|
@ -16,7 +21,7 @@ jobs:
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
with:
|
with:
|
||||||
# history is needed to run git cherry-pick below
|
# history is needed to run git cherry-pick below
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
@ -24,16 +29,22 @@ jobs:
|
||||||
- name: Use CLA approved github bot
|
- name: Use CLA approved github bot
|
||||||
run: .github/scripts/use-cla-approved-github-bot.sh
|
run: .github/scripts/use-cla-approved-github-bot.sh
|
||||||
|
|
||||||
|
- uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
|
||||||
|
id: otelbot-token
|
||||||
|
with:
|
||||||
|
app-id: ${{ vars.OTELBOT_APP_ID }}
|
||||||
|
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
|
||||||
|
|
||||||
- name: Create pull request
|
- name: Create pull request
|
||||||
env:
|
env:
|
||||||
NUMBER: ${{ github.event.inputs.number }}
|
NUMBER: ${{ github.event.inputs.number }}
|
||||||
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
|
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
|
||||||
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
|
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
|
||||||
run: |
|
run: |
|
||||||
commit=$(gh pr view $NUMBER --json mergeCommit --jq .mergeCommit.oid)
|
commit=$(gh pr view $NUMBER --json mergeCommit --jq .mergeCommit.oid)
|
||||||
title=$(gh pr view $NUMBER --json title --jq .title)
|
title=$(gh pr view $NUMBER --json title --jq .title)
|
||||||
|
|
||||||
branch="opentelemetrybot/backport-${NUMBER}-to-${GITHUB_REF_NAME//\//-}"
|
branch="otelbot/backport-${NUMBER}-to-${GITHUB_REF_NAME//\//-}"
|
||||||
|
|
||||||
git checkout -b $branch
|
git checkout -b $branch
|
||||||
git cherry-pick $commit
|
git cherry-pick $commit
|
||||||
|
|
|
@ -3,10 +3,15 @@ name: Benchmark Tags
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sdk-benchmark:
|
sdk-benchmark:
|
||||||
|
permissions:
|
||||||
|
contents: write # for git push to benchmarks branch
|
||||||
name: Benchmark SDK
|
name: Benchmark SDK
|
||||||
runs-on: self-hosted
|
runs-on: equinix-bare-metal
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
@ -39,23 +44,21 @@ jobs:
|
||||||
- v1.30.0
|
- v1.30.0
|
||||||
- v1.30.1
|
- v1.30.1
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
with:
|
with:
|
||||||
ref: ${{ matrix.tag-version }}
|
ref: ${{ matrix.tag-version }}
|
||||||
|
|
||||||
- id: setup-java
|
- id: setup-java
|
||||||
name: Set up Java for build
|
name: Set up Java for build
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 17
|
java-version: 17
|
||||||
|
|
||||||
- name: Set up gradle
|
- name: Set up gradle
|
||||||
uses: gradle/actions/setup-gradle@v4
|
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||||
- name: Run jmh
|
- name: Run jmh
|
||||||
run: ./gradlew jmhJar
|
run: ./gradlew jmhJar
|
||||||
env:
|
|
||||||
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
|
|
||||||
|
|
||||||
- name: Run Benchmark
|
- name: Run Benchmark
|
||||||
run: |
|
run: |
|
||||||
|
@ -63,7 +66,7 @@ jobs:
|
||||||
java -jar libs/opentelemetry-sdk-trace-*-jmh.jar -rf json SpanBenchmark SpanPipelineBenchmark ExporterBenchmark
|
java -jar libs/opentelemetry-sdk-trace-*-jmh.jar -rf json SpanBenchmark SpanPipelineBenchmark ExporterBenchmark
|
||||||
|
|
||||||
- name: Store benchmark results
|
- name: Store benchmark results
|
||||||
uses: benchmark-action/github-action-benchmark@v1
|
uses: benchmark-action/github-action-benchmark@d48d326b4ca9ba73ca0cd0d59f108f9e02a381c7 # v1.20.4
|
||||||
with:
|
with:
|
||||||
tool: 'jmh'
|
tool: 'jmh'
|
||||||
output-file-path: sdk/trace/build/jmh-result.json
|
output-file-path: sdk/trace/build/jmh-result.json
|
||||||
|
|
|
@ -5,27 +5,30 @@ on:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sdk-benchmark:
|
sdk-benchmark:
|
||||||
|
permissions:
|
||||||
|
contents: write # for git push to benchmarks branch
|
||||||
name: Benchmark SDK
|
name: Benchmark SDK
|
||||||
runs-on: self-hosted
|
runs-on: equinix-bare-metal
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- id: setup-java
|
- id: setup-java
|
||||||
name: Set up Java for build
|
name: Set up Java for build
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 17
|
java-version: 17
|
||||||
|
|
||||||
- name: Set up gradle
|
- name: Set up gradle
|
||||||
uses: gradle/actions/setup-gradle@v4
|
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||||
- name: Run jmh
|
- name: Run jmh
|
||||||
run: ./gradlew jmhJar
|
run: ./gradlew jmhJar
|
||||||
env:
|
|
||||||
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
|
|
||||||
|
|
||||||
- name: Run Benchmark
|
- name: Run Benchmark
|
||||||
run: |
|
run: |
|
||||||
|
@ -33,7 +36,7 @@ jobs:
|
||||||
java -jar libs/opentelemetry-sdk-trace-*-jmh.jar -rf json SpanBenchmark SpanPipelineBenchmark ExporterBenchmark
|
java -jar libs/opentelemetry-sdk-trace-*-jmh.jar -rf json SpanBenchmark SpanPipelineBenchmark ExporterBenchmark
|
||||||
|
|
||||||
- name: Store benchmark results
|
- name: Store benchmark results
|
||||||
uses: benchmark-action/github-action-benchmark@v1
|
uses: benchmark-action/github-action-benchmark@d48d326b4ca9ba73ca0cd0d59f108f9e02a381c7 # v1.20.4
|
||||||
with:
|
with:
|
||||||
tool: 'jmh'
|
tool: 'jmh'
|
||||||
output-file-path: sdk/trace/build/jmh-result.json
|
output-file-path: sdk/trace/build/jmh-result.json
|
||||||
|
|
|
@ -9,21 +9,27 @@ on:
|
||||||
- main
|
- main
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Login to GitHub package registry
|
- name: Login to GitHub package registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
|
||||||
with:
|
with:
|
||||||
context: integration-tests/tracecontext/docker
|
context: integration-tests/tracecontext/docker
|
||||||
push: true
|
push: true
|
||||||
|
|
|
@ -12,6 +12,9 @@ concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
|
@ -23,14 +26,16 @@ jobs:
|
||||||
- macos-latest
|
- macos-latest
|
||||||
- macos-13
|
- macos-13
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
|
- windows-latest
|
||||||
test-java-version:
|
test-java-version:
|
||||||
- 8
|
- 8
|
||||||
- 11
|
- 11
|
||||||
- 17
|
- 17
|
||||||
- 21
|
- 21
|
||||||
|
- 23
|
||||||
# Collect coverage on latest LTS
|
# Collect coverage on latest LTS
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-latest
|
||||||
test-java-version: 21
|
test-java-version: 21
|
||||||
coverage: true
|
coverage: true
|
||||||
jmh-based-tests: true
|
jmh-based-tests: true
|
||||||
|
@ -44,39 +49,43 @@ jobs:
|
||||||
test-java-version: 17
|
test-java-version: 17
|
||||||
- os: macos-13
|
- os: macos-13
|
||||||
test-java-version: 21
|
test-java-version: 21
|
||||||
|
- os: macos-13
|
||||||
|
test-java-version: 23
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- id: setup-java-test
|
- id: setup-java-test
|
||||||
name: Set up Java ${{ matrix.test-java-version }} for tests
|
name: Set up Java ${{ matrix.test-java-version }} for tests
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: ${{ matrix.test-java-version }}
|
java-version: ${{ matrix.test-java-version }}
|
||||||
|
|
||||||
- id: setup-java
|
- id: setup-java
|
||||||
name: Set up Java for build
|
name: Set up Java for build
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 17
|
java-version: 17
|
||||||
|
|
||||||
- name: Set up gradle
|
- name: Set up gradle
|
||||||
uses: gradle/actions/setup-gradle@v4
|
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||||
- name: Build
|
- name: Build
|
||||||
run: >
|
run: >
|
||||||
./gradlew build
|
./gradlew build
|
||||||
${{ matrix.coverage && 'jacocoTestReport' || '' }}
|
${{ matrix.coverage && 'jacocoTestReport' || '' }}
|
||||||
-PtestJavaVersion=${{ matrix.test-java-version }}
|
-PtestJavaVersion=${{ matrix.test-java-version }}
|
||||||
-Porg.gradle.java.installations.paths=${{ steps.setup-java-test.outputs.path }},${{ steps.setup-java.outputs.path }}
|
"-Porg.gradle.java.installations.paths=${{ steps.setup-java-test.outputs.path }}"
|
||||||
|
"-Porg.gradle.java.installations.auto-download=false"
|
||||||
env:
|
env:
|
||||||
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
|
|
||||||
# JMH-based tests run only if this environment variable is set to true
|
# JMH-based tests run only if this environment variable is set to true
|
||||||
RUN_JMH_BASED_TESTS: ${{ matrix.jmh-based-tests }}
|
RUN_JMH_BASED_TESTS: ${{ matrix.jmh-based-tests }}
|
||||||
|
|
||||||
- name: Check for diff
|
- name: Check for diff
|
||||||
# The jApiCmp diff compares current to latest, which isn't appropriate for release branches, or for bot-generated PRs
|
# The jApiCmp diff compares current to latest, which isn't appropriate for release branches
|
||||||
if: ${{ !startsWith(github.ref_name, 'release/') && !startsWith(github.base_ref, 'release/') && (github.actor != 'opentelemetrybot') }}
|
# this fails on windows because of the bash-specific if/then/else syntax, but that's ok
|
||||||
|
# because we only need to run this validation once (on any platform)
|
||||||
|
if: ${{ matrix.os != 'windows-latest' && !startsWith(github.ref_name, 'release/') && !startsWith(github.base_ref, 'release/') }}
|
||||||
run: |
|
run: |
|
||||||
# need to "git add" in case any generated files did not already exist
|
# need to "git add" in case any generated files did not already exist
|
||||||
git add docs/apidiffs
|
git add docs/apidiffs
|
||||||
|
@ -90,12 +99,12 @@ jobs:
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- uses: codecov/codecov-action@v4
|
- uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
|
||||||
if: ${{ matrix.coverage }}
|
if: ${{ matrix.coverage }}
|
||||||
env:
|
env:
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||||
if: ${{ matrix.coverage }}
|
if: ${{ matrix.coverage }}
|
||||||
with:
|
with:
|
||||||
name: coverage-report
|
name: coverage-report
|
||||||
|
@ -124,19 +133,19 @@ jobs:
|
||||||
name: publish-snapshots${{ (github.ref_name != 'main' || github.repository != 'open-telemetry/opentelemetry-java') && ' (skipped)' || '' }}
|
name: publish-snapshots${{ (github.ref_name != 'main' || github.repository != 'open-telemetry/opentelemetry-java') && ' (skipped)' || '' }}
|
||||||
# intentionally not blocking snapshot publishing on markdown-link-check or misspell-check
|
# intentionally not blocking snapshot publishing on markdown-link-check or misspell-check
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- id: setup-java
|
- id: setup-java
|
||||||
name: Set up Java
|
name: Set up Java
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 17
|
java-version: 17
|
||||||
|
|
||||||
- name: Set up gradle
|
- name: Set up gradle
|
||||||
uses: gradle/actions/setup-gradle@v4
|
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||||
# skipping release branches because the versions in those branches are not snapshots
|
# skipping release branches because the versions in those branches are not snapshots
|
||||||
# (also this skips pull requests)
|
# (also this skips pull requests)
|
||||||
if: ${{ github.ref_name == 'main' && github.repository == 'open-telemetry/opentelemetry-java' }}
|
if: ${{ github.ref_name == 'main' && github.repository == 'open-telemetry/opentelemetry-java' }}
|
||||||
|
@ -152,13 +161,19 @@ jobs:
|
||||||
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
|
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
|
||||||
|
|
||||||
build-graal:
|
build-graal:
|
||||||
|
name: Build GraalVM
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
test-graal-version:
|
||||||
|
- 21
|
||||||
|
- 23
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- uses: graalvm/setup-graalvm@v1
|
- uses: graalvm/setup-graalvm@7f488cf82a3629ee755e4e97342c01d6bed318fa # v1.3.5
|
||||||
with:
|
with:
|
||||||
# TODO(jack-berg): Which versions do we need to test? Should we use a matrix scheme?
|
java-version: ${{ matrix.test-graal-version }}
|
||||||
java-version: '21'
|
|
||||||
distribution: 'graalvm'
|
distribution: 'graalvm'
|
||||||
components: 'native-image'
|
components: 'native-image'
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
name: CodeQL (daily)
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
# Daily at 01:30 (UTC)
|
|
||||||
- cron: '30 1 * * *'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
analyze:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Java 17
|
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
distribution: temurin
|
|
||||||
java-version: 17
|
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v3
|
|
||||||
with:
|
|
||||||
languages: java
|
|
||||||
# using "latest" helps to keep up with the latest Kotlin support
|
|
||||||
# see https://github.com/github/codeql-action/issues/1555#issuecomment-1452228433
|
|
||||||
tools: latest
|
|
||||||
|
|
||||||
- name: Set up gradle
|
|
||||||
uses: gradle/actions/setup-gradle@v4
|
|
||||||
- name: Assemble
|
|
||||||
# skipping build cache is needed so that all modules will be analyzed
|
|
||||||
run: ./gradlew assemble --no-build-cache
|
|
||||||
|
|
||||||
- name: Perform CodeQL analysis
|
|
||||||
uses: github/codeql-action/analyze@v3
|
|
||||||
|
|
||||||
open-issue-on-failure:
|
|
||||||
# open an issue on failure because it can be easy to miss CI failure notifications
|
|
||||||
needs:
|
|
||||||
- analyze
|
|
||||||
if: failure() && github.run_attempt == 1
|
|
||||||
uses: ./.github/workflows/reusable-open-issue-on-failure.yml
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
name: CodeQL
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- release/*
|
||||||
|
- benchmarks
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- release/*
|
||||||
|
- benchmarks
|
||||||
|
schedule:
|
||||||
|
- cron: "23 16 * * 2" # weekly at 16:23 UTC on Tuesday
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
actions: read # for github/codeql-action/init to get workflow details
|
||||||
|
security-events: write # for github/codeql-action/analyze to upload SARIF results
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- language: actions
|
||||||
|
- language: java
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
|
- name: Set up Java 17
|
||||||
|
if: matrix.language == 'java'
|
||||||
|
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: 17
|
||||||
|
|
||||||
|
- name: Set up gradle
|
||||||
|
if: matrix.language == 'java'
|
||||||
|
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||||
|
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
# using "latest" helps to keep up with the latest Kotlin support
|
||||||
|
# see https://github.com/github/codeql-action/issues/1555#issuecomment-1452228433
|
||||||
|
tools: latest
|
||||||
|
|
||||||
|
- name: Assemble
|
||||||
|
if: matrix.language == 'java'
|
||||||
|
# --no-build-cache is required for codeql to analyze all modules
|
||||||
|
# --no-daemon is required for codeql to observe the compilation
|
||||||
|
# (see https://docs.github.com/en/code-security/codeql-cli/getting-started-with-the-codeql-cli/preparing-your-code-for-codeql-analysis#specifying-build-commands)
|
||||||
|
run: ./gradlew assemble --no-build-cache --no-daemon
|
||||||
|
|
||||||
|
- name: Perform CodeQL analysis
|
||||||
|
uses: github/codeql-action/analyze@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
|
||||||
|
with:
|
||||||
|
category: "/language:${{matrix.language}}"
|
|
@ -5,8 +5,14 @@ on:
|
||||||
- cron: "23 3 * * *"
|
- cron: "23 3 * * *"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
copy-images:
|
copy-images:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
@ -21,7 +27,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Docker login
|
- name: Docker login
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
name: FOSSA
|
||||||
|
|
||||||
|
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@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0
|
||||||
|
with:
|
||||||
|
api-key: ${{secrets.FOSSA_API_KEY}}
|
||||||
|
team: OpenTelemetry
|
|
@ -1,69 +0,0 @@
|
||||||
name: Generate Post-Release PR
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
prereqs:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Verify prerequisites
|
|
||||||
run: |
|
|
||||||
if [[ $GITHUB_REF_NAME != main ]]; then
|
|
||||||
echo this workflow should only be run against main
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
create-pull-request-against-main:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs:
|
|
||||||
- prereqs
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- id: setup-java
|
|
||||||
name: Set up Java for build
|
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
distribution: temurin
|
|
||||||
java-version: 17
|
|
||||||
|
|
||||||
- name: Set environment variables
|
|
||||||
run: |
|
|
||||||
version=$(.github/scripts/get-version.sh)
|
|
||||||
echo "VERSION=$version" >> $GITHUB_ENV
|
|
||||||
prior_version=$(.github/scripts/get-prior-version.sh)
|
|
||||||
echo "PRIOR_VERSION=$prior_version" >> $GITHUB_ENV
|
|
||||||
if [[ $prior_version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
|
|
||||||
major="${BASH_REMATCH[1]}"
|
|
||||||
minor="${BASH_REMATCH[2]}"
|
|
||||||
patch="${BASH_REMATCH[3]}"
|
|
||||||
|
|
||||||
two_releases_ago="$major.$((minor - 1)).$patch"
|
|
||||||
else
|
|
||||||
echo "unexpected prior version: $prior_version"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "TWO_VERSIONS_AGO=$two_releases_ago" >> $GITHUB_ENV
|
|
||||||
- name: Use CLA approved github bot
|
|
||||||
run: .github/scripts/use-cla-approved-github-bot.sh
|
|
||||||
|
|
||||||
- name: Create pull request against main
|
|
||||||
env:
|
|
||||||
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
|
|
||||||
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
./gradlew updateVersionInDocs -Prelease.version=$PRIOR_VERSION
|
|
||||||
./gradlew japicmp -PapiBaseVersion=$TWO_VERSIONS_AGO -PapiNewVersion=$PRIOR_VERSION
|
|
||||||
./gradlew --refresh-dependencies japicmp
|
|
||||||
|
|
||||||
message="Post release for version $PRIOR_VERSION"
|
|
||||||
body="Post-release updates for version \`$PRIOR_VERSION\`."
|
|
||||||
branch="opentelemetrybot/post-release-for-${PRIOR_VERSION}"
|
|
||||||
|
|
||||||
git checkout -b $branch
|
|
||||||
git add docs/apidiffs
|
|
||||||
git commit -a -m "$message"
|
|
||||||
git push --set-upstream origin $branch
|
|
||||||
gh pr create --title "$message" \
|
|
||||||
--body "$body" \
|
|
||||||
--base main
|
|
|
@ -1,16 +1,16 @@
|
||||||
name: Gradle wrapper validation
|
name: Gradle wrapper validation
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- '**/gradle/wrapper/**'
|
|
||||||
push:
|
push:
|
||||||
paths:
|
pull_request:
|
||||||
- '**/gradle/wrapper/**'
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
validation:
|
gradle-wrapper-validation:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- uses: gradle/actions/wrapper-validation@v4.0.1
|
- uses: gradle/actions/wrapper-validation@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||||
|
|
|
@ -4,14 +4,21 @@ on:
|
||||||
issue_comment:
|
issue_comment:
|
||||||
types: [created]
|
types: [created]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
issue_comment:
|
issue_comment:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: write
|
||||||
|
pull-requests: write
|
||||||
if: >
|
if: >
|
||||||
contains(github.event.issue.labels.*.name, 'needs author feedback') &&
|
contains(github.event.issue.labels.*.name, 'needs author feedback') &&
|
||||||
github.event.comment.user.login == github.event.issue.user.login
|
github.event.comment.user.login == github.event.issue.user.login
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Remove label
|
- name: Remove label
|
||||||
env:
|
env:
|
||||||
|
|
|
@ -5,11 +5,18 @@ on:
|
||||||
# hourly at minute 23
|
# hourly at minute 23
|
||||||
- cron: "23 * * * *"
|
- cron: "23 * * * *"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
stale:
|
stale:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: write # for actions/stale to close stale issues
|
||||||
|
pull-requests: write # for actions/stale to close stale PRs
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v9
|
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
days-before-stale: 7
|
days-before-stale: 7
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
name: Javadoc.io site crawler (daily)
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "30 1 * * *" # daily at 1:30 UTC
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
crawl:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
|
- uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: 17
|
||||||
|
|
||||||
|
- name: Set up gradle
|
||||||
|
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||||
|
|
||||||
|
- name: Run crawler
|
||||||
|
run: ./gradlew :javadoc-crawler:crawl
|
|
@ -0,0 +1,47 @@
|
||||||
|
name: OSSF Scorecard
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
schedule:
|
||||||
|
- cron: "43 6 * * 5" # weekly at 06:43 (UTC) on Friday
|
||||||
|
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@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
|
||||||
|
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@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
|
||||||
|
with:
|
||||||
|
sarif_file: results.sarif
|
|
@ -4,28 +4,44 @@ name: OWASP dependency check (daily)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '30 1 * * *'
|
- cron: "30 1 * * *" # daily at 1:30 UTC
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
analyze:
|
analyze:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- uses: actions/setup-java@v4
|
- uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 17
|
java-version: 17
|
||||||
|
|
||||||
- name: Set up gradle
|
- name: Set up gradle
|
||||||
uses: gradle/actions/setup-gradle@v4
|
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||||
|
|
||||||
- name: Check dependencies
|
- name: Check dependencies
|
||||||
run: ./gradlew dependencyCheckAnalyze
|
run: ./gradlew dependencyCheckAnalyze
|
||||||
|
env:
|
||||||
|
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
|
||||||
|
|
||||||
- name: Upload report
|
- name: Upload report
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||||
with:
|
with:
|
||||||
path: javaagent/build/reports
|
path: javaagent/build/reports
|
||||||
|
|
||||||
|
workflow-notification:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: write
|
||||||
|
needs:
|
||||||
|
- analyze
|
||||||
|
if: always()
|
||||||
|
uses: ./.github/workflows/reusable-workflow-notification.yml
|
||||||
|
with:
|
||||||
|
success: ${{ needs.analyze.result == 'success' }}
|
||||||
|
|
|
@ -2,11 +2,16 @@ name: Prepare patch release
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prepare-patch-release:
|
prepare-patch-release:
|
||||||
|
permissions:
|
||||||
|
contents: write # for git push to PR branch
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
if [[ ! $GITHUB_REF_NAME =~ ^release/v[0-9]+\.[0-9]+\.x$ ]]; then
|
if [[ ! $GITHUB_REF_NAME =~ ^release/v[0-9]+\.[0-9]+\.x$ ]]; then
|
||||||
|
@ -32,7 +37,7 @@ jobs:
|
||||||
echo "VERSION=$major_minor.$((patch + 1))" >> $GITHUB_ENV
|
echo "VERSION=$major_minor.$((patch + 1))" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Update version
|
- name: Update version
|
||||||
run: sed -Ei "s/[0-9]+\.[0-9]+\.[0-9]+/$VERSION/" version.gradle.kts
|
run: .github/scripts/update-version.sh $VERSION
|
||||||
|
|
||||||
- name: Update the change log with the approximate release date
|
- name: Update the change log with the approximate release date
|
||||||
run: |
|
run: |
|
||||||
|
@ -42,13 +47,19 @@ jobs:
|
||||||
- name: Use CLA approved github bot
|
- name: Use CLA approved github bot
|
||||||
run: .github/scripts/use-cla-approved-github-bot.sh
|
run: .github/scripts/use-cla-approved-github-bot.sh
|
||||||
|
|
||||||
|
- uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
|
||||||
|
id: otelbot-token
|
||||||
|
with:
|
||||||
|
app-id: ${{ vars.OTELBOT_APP_ID }}
|
||||||
|
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
|
||||||
|
|
||||||
- name: Create pull request
|
- name: Create pull request
|
||||||
env:
|
env:
|
||||||
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
|
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
|
||||||
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
|
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
|
||||||
run: |
|
run: |
|
||||||
message="Prepare release $VERSION"
|
message="Prepare release $VERSION"
|
||||||
branch="opentelemetrybot/prepare-release-${VERSION}"
|
branch="otelbot/prepare-release-${VERSION}"
|
||||||
|
|
||||||
git checkout -b $branch
|
git checkout -b $branch
|
||||||
git commit -a -m "$message"
|
git commit -a -m "$message"
|
||||||
|
|
|
@ -2,11 +2,14 @@ name: Prepare release branch
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prereqs:
|
prereqs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Verify prerequisites
|
- name: Verify prerequisites
|
||||||
run: |
|
run: |
|
||||||
|
@ -21,11 +24,13 @@ jobs:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
create-pull-request-against-release-branch:
|
create-pull-request-against-release-branch:
|
||||||
|
permissions:
|
||||||
|
contents: write # for git push to PR branch
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- prereqs
|
- prereqs
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Create release branch
|
- name: Create release branch
|
||||||
run: |
|
run: |
|
||||||
|
@ -54,13 +59,19 @@ jobs:
|
||||||
- name: Use CLA approved github bot
|
- name: Use CLA approved github bot
|
||||||
run: .github/scripts/use-cla-approved-github-bot.sh
|
run: .github/scripts/use-cla-approved-github-bot.sh
|
||||||
|
|
||||||
|
- uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
|
||||||
|
id: otelbot-token
|
||||||
|
with:
|
||||||
|
app-id: ${{ vars.OTELBOT_APP_ID }}
|
||||||
|
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
|
||||||
|
|
||||||
- name: Create pull request against the release branch
|
- name: Create pull request against the release branch
|
||||||
env:
|
env:
|
||||||
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
|
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
|
||||||
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
|
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
|
||||||
run: |
|
run: |
|
||||||
message="Prepare release $VERSION"
|
message="Prepare release $VERSION"
|
||||||
branch="opentelemetrybot/prepare-release-${VERSION}"
|
branch="otelbot/prepare-release-${VERSION}"
|
||||||
|
|
||||||
git checkout -b $branch
|
git checkout -b $branch
|
||||||
git commit -a -m "$message"
|
git commit -a -m "$message"
|
||||||
|
@ -70,11 +81,13 @@ jobs:
|
||||||
--base $RELEASE_BRANCH_NAME
|
--base $RELEASE_BRANCH_NAME
|
||||||
|
|
||||||
create-pull-request-against-main:
|
create-pull-request-against-main:
|
||||||
|
permissions:
|
||||||
|
contents: write # for git push to PR branch
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- prereqs
|
- prereqs
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Set environment variables
|
- name: Set environment variables
|
||||||
run: |
|
run: |
|
||||||
|
@ -87,11 +100,11 @@ jobs:
|
||||||
echo "unexpected version: $version"
|
echo "unexpected version: $version"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "NEXT_VERSION=$next_version" >> $GITHUB_ENV
|
echo "NEXT_VERSION=${next_version}" >> $GITHUB_ENV
|
||||||
echo "VERSION=$version" >> $GITHUB_ENV
|
echo "VERSION=$version" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Update version
|
- name: Update version
|
||||||
run: sed -Ei "s/[0-9]+\.[0-9]+\.[0-9]+/$NEXT_VERSION/" version.gradle.kts
|
run: .github/scripts/update-version.sh $NEXT_VERSION
|
||||||
|
|
||||||
- name: Update the change log on main
|
- name: Update the change log on main
|
||||||
run: |
|
run: |
|
||||||
|
@ -102,14 +115,20 @@ jobs:
|
||||||
- name: Use CLA approved github bot
|
- name: Use CLA approved github bot
|
||||||
run: .github/scripts/use-cla-approved-github-bot.sh
|
run: .github/scripts/use-cla-approved-github-bot.sh
|
||||||
|
|
||||||
|
- uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
|
||||||
|
id: otelbot-token
|
||||||
|
with:
|
||||||
|
app-id: ${{ vars.OTELBOT_APP_ID }}
|
||||||
|
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
|
||||||
|
|
||||||
- name: Create pull request against main
|
- name: Create pull request against main
|
||||||
env:
|
env:
|
||||||
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
|
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
|
||||||
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
|
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
|
||||||
run: |
|
run: |
|
||||||
message="Update version to $NEXT_VERSION"
|
message="Update version to $NEXT_VERSION"
|
||||||
body="Update version to \`$NEXT_VERSION\`."
|
body="Update version to \`$NEXT_VERSION\`."
|
||||||
branch="opentelemetrybot/update-version-to-${NEXT_VERSION}"
|
branch="otelbot/update-version-to-${NEXT_VERSION}"
|
||||||
|
|
||||||
git checkout -b $branch
|
git checkout -b $branch
|
||||||
git commit -a -m "$message"
|
git commit -a -m "$message"
|
||||||
|
|
|
@ -2,11 +2,17 @@ name: Release
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-22.04
|
permissions:
|
||||||
|
contents: write # for creating the release
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
outputs:
|
outputs:
|
||||||
version: ${{ steps.create-github-release.outputs.version }}
|
version: ${{ steps.create-github-release.outputs.version }}
|
||||||
|
prior-version: ${{ steps.create-github-release.outputs.prior-version }}
|
||||||
steps:
|
steps:
|
||||||
- run: |
|
- run: |
|
||||||
if [[ $GITHUB_REF_NAME != release/* ]]; then
|
if [[ $GITHUB_REF_NAME != release/* ]]; then
|
||||||
|
@ -14,15 +20,15 @@ jobs:
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- uses: actions/setup-java@v4
|
- uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 17
|
java-version: 17
|
||||||
|
|
||||||
- name: Set up gradle
|
- name: Set up gradle
|
||||||
uses: gradle/actions/setup-gradle@v4
|
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||||
|
|
||||||
- name: Build and publish artifacts
|
- name: Build and publish artifacts
|
||||||
run: ./gradlew assemble publishToSonatype closeAndReleaseSonatypeStagingRepository
|
run: ./gradlew assemble publishToSonatype closeAndReleaseSonatypeStagingRepository
|
||||||
|
@ -59,7 +65,7 @@ jobs:
|
||||||
|
|
||||||
# check out main branch to verify there won't be problems with merging the change log
|
# check out main branch to verify there won't be problems with merging the change log
|
||||||
# at the end of this workflow
|
# at the end of this workflow
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
with:
|
with:
|
||||||
ref: main
|
ref: main
|
||||||
|
|
||||||
|
@ -74,7 +80,7 @@ jobs:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# back to the release branch
|
# back to the release branch
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
with:
|
with:
|
||||||
# tags are needed for the generate-release-contributors.sh script
|
# tags are needed for the generate-release-contributors.sh script
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
@ -123,14 +129,20 @@ jobs:
|
||||||
--notes-file /tmp/release-notes.txt \
|
--notes-file /tmp/release-notes.txt \
|
||||||
v$VERSION
|
v$VERSION
|
||||||
|
|
||||||
|
# these are used as job outputs
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "prior-version=$PRIOR_VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
merge-change-log-to-main:
|
update-apidiff-baseline-and-docs-to-released-version:
|
||||||
|
permissions:
|
||||||
|
contents: write # for git push to PR branch
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- release
|
- release
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
# add change log sync (if any) into this PR since the apidiff update
|
||||||
|
# is required before any other PR can be merged anyway
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Copy change log section from release branch
|
- name: Copy change log section from release branch
|
||||||
env:
|
env:
|
||||||
|
@ -139,7 +151,7 @@ jobs:
|
||||||
sed -n "0,/^## Version $VERSION /d;/^## Version /q;p" CHANGELOG.md \
|
sed -n "0,/^## Version $VERSION /d;/^## Version /q;p" CHANGELOG.md \
|
||||||
> /tmp/changelog-section.md
|
> /tmp/changelog-section.md
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
with:
|
with:
|
||||||
ref: main
|
ref: main
|
||||||
|
|
||||||
|
@ -150,32 +162,59 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
release_date=$(gh release view v$VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
|
release_date=$(gh release view v$VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
|
||||||
RELEASE_DATE=$release_date .github/scripts/merge-change-log-after-release.sh
|
RELEASE_DATE=$release_date .github/scripts/merge-change-log-after-release.sh
|
||||||
|
git add CHANGELOG.md
|
||||||
|
|
||||||
- name: Use CLA approved github bot
|
- name: Wait for release to be available in maven central
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.release.outputs.version }}
|
||||||
|
run: |
|
||||||
|
until curl --silent \
|
||||||
|
--show-error \
|
||||||
|
--output /dev/null \
|
||||||
|
--head \
|
||||||
|
--fail \
|
||||||
|
https://repo1.maven.org/maven2/io/opentelemetry/opentelemetry-api/$VERSION/opentelemetry-api-$VERSION.jar
|
||||||
|
do
|
||||||
|
sleep 60
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Update apidiff baseline
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.release.outputs.version }}
|
||||||
|
PRIOR_VERSION: ${{ needs.release.outputs.prior-version }}
|
||||||
|
run: |
|
||||||
|
./gradlew japicmp -PapiBaseVersion=$PRIOR_VERSION -PapiNewVersion=$VERSION
|
||||||
|
./gradlew --refresh-dependencies japicmp
|
||||||
|
git add docs/apidiffs
|
||||||
|
|
||||||
|
- name: Update versions in README.md
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.release.outputs.version }}
|
||||||
|
run: |
|
||||||
|
./gradlew updateVersionInDocs -Prelease.version=$VERSION
|
||||||
|
git add README.md
|
||||||
|
|
||||||
|
- name: Use CLA approved bot
|
||||||
run: .github/scripts/use-cla-approved-github-bot.sh
|
run: .github/scripts/use-cla-approved-github-bot.sh
|
||||||
|
|
||||||
|
- uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
|
||||||
|
id: otelbot-token
|
||||||
|
with:
|
||||||
|
app-id: ${{ vars.OTELBOT_APP_ID }}
|
||||||
|
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
|
||||||
|
|
||||||
- name: Create pull request against main
|
- name: Create pull request against main
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ needs.release.outputs.version }}
|
VERSION: ${{ needs.release.outputs.version }}
|
||||||
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
|
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
|
||||||
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
|
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
|
||||||
run: |
|
run: |
|
||||||
if git diff --quiet; then
|
message="Update apidiff baseline and documentation versions to released version $VERSION"
|
||||||
if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.0 ]]; then
|
body="Update apidiff baseline and documentation versions to released version \`$VERSION\`."
|
||||||
echo there are no updates to merge, not creating pull request
|
branch="otelbot/update-apidiff-baseline-and-documentation-to-released-version-${VERSION}"
|
||||||
exit 0 # success
|
|
||||||
else
|
|
||||||
echo patch release notes did not get applied for some reason
|
|
||||||
exit 1 # failure
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
message="Merge change log updates from $GITHUB_REF_NAME"
|
|
||||||
body="Merge log updates from \`$GITHUB_REF_NAME\`."
|
|
||||||
branch="opentelemetrybot/merge-change-log-updates-from-${GITHUB_REF_NAME//\//-}"
|
|
||||||
|
|
||||||
git checkout -b $branch
|
git checkout -b $branch
|
||||||
git commit -a -m "$message"
|
git commit -m "$message"
|
||||||
git push --set-upstream origin $branch
|
git push --set-upstream origin $branch
|
||||||
gh pr create --title "$message" \
|
gh pr create --title "$message" \
|
||||||
--body "$body" \
|
--body "$body" \
|
||||||
|
|
|
@ -3,19 +3,22 @@ name: Reusable - Markdown link check
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
markdown-link-check:
|
markdown-link-check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Install markdown-link-check
|
- uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332 # v2.4.1
|
||||||
# TODO(jack-berg): use latest when config file reading bug is fixed: https://github.com/tcort/markdown-link-check/issues/246
|
with:
|
||||||
run: npm install -g markdown-link-check@3.10.3
|
# excluding links to pull requests and issues is done for performance
|
||||||
|
args: >
|
||||||
- name: Run markdown-link-check
|
--include-fragments
|
||||||
run: |
|
--exclude "^https://github.com/open-telemetry/opentelemetry-java/(issues|pull)/\\d+$"
|
||||||
find . -type f \
|
--max-retries 6
|
||||||
-name '*.md' \
|
--retry-wait-time 10
|
||||||
-not -path './CHANGELOG.md' \
|
--max-concurrency 1
|
||||||
| xargs .github/scripts/markdown-link-check-with-retry.sh
|
.
|
||||||
|
|
|
@ -3,11 +3,14 @@ name: Reusable - Misspell check
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
misspell-check:
|
misspell-check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Install misspell
|
- name: Install misspell
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -3,11 +3,17 @@ name: Reusable - Open issue on workflow failure
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
open-issue:
|
open-issue:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: write # for creating the issue
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Open issue
|
- name: Open issue
|
||||||
env:
|
env:
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
# this is useful because notifications for scheduled workflows are only sent to the user who
|
||||||
|
# initially created the given workflow
|
||||||
|
name: Reusable - Workflow notification
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
success:
|
||||||
|
type: boolean
|
||||||
|
required: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
workflow-notification:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
|
- name: Open issue or add comment if issue already open
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
# TODO (trask) search doesn't support exact phrases, so it's possible that this could grab the wrong issue
|
||||||
|
number=$(gh issue list --search "in:title Workflow failed: $GITHUB_WORKFLOW" --limit 1 --json number -q .[].number)
|
||||||
|
|
||||||
|
echo $number
|
||||||
|
echo ${{ inputs.success }}
|
||||||
|
|
||||||
|
if [[ $number ]]; then
|
||||||
|
if [[ "${{ inputs.success }}" == "true" ]]; then
|
||||||
|
gh issue close $number
|
||||||
|
else
|
||||||
|
gh issue comment $number \
|
||||||
|
--body "See [$GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER](https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)."
|
||||||
|
fi
|
||||||
|
elif [[ "${{ inputs.success }}" == "false" ]]; then
|
||||||
|
gh issue create --title "Workflow failed: $GITHUB_WORKFLOW (#$GITHUB_RUN_NUMBER)" \
|
||||||
|
--body "See [$GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER](https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)."
|
||||||
|
fi
|
|
@ -1,6 +1,7 @@
|
||||||
# Gradle
|
# Gradle
|
||||||
build
|
build
|
||||||
.gradle
|
.gradle
|
||||||
|
.kotlin
|
||||||
local.properties
|
local.properties
|
||||||
out/
|
out/
|
||||||
|
|
||||||
|
|
519
CHANGELOG.md
519
CHANGELOG.md
|
@ -2,6 +2,505 @@
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
## Version 1.52.0 (2025-07-11)
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
#### Common
|
||||||
|
|
||||||
|
* Promote `ComponentLoader` to new `opentelemetry-common` artifact,
|
||||||
|
standardize SPI loading
|
||||||
|
([#7446](https://github.com/open-telemetry/opentelemetry-java/pull/7446))
|
||||||
|
|
||||||
|
#### Context
|
||||||
|
|
||||||
|
* LazyStorage passes its ClassLoader when loading ContextStorageProvider SPI
|
||||||
|
([#7424](https://github.com/open-telemetry/opentelemetry-java/pull/7424))
|
||||||
|
|
||||||
|
#### Incubator
|
||||||
|
|
||||||
|
* Add context and severity params to ExtendedLogger#isEnabled
|
||||||
|
([#7268](https://github.com/open-telemetry/opentelemetry-java/pull/7268))
|
||||||
|
* Add new convenience methods for converting DeclarativeConfigProperties to config model
|
||||||
|
([#7453](https://github.com/open-telemetry/opentelemetry-java/pull/7453))
|
||||||
|
|
||||||
|
### SDK
|
||||||
|
|
||||||
|
* Add custom stacktrace renderer which is length limit aware
|
||||||
|
([#7281](https://github.com/open-telemetry/opentelemetry-java/pull/7281))
|
||||||
|
|
||||||
|
#### Metrics
|
||||||
|
|
||||||
|
* Propagate flush to PeriodicMetricReader's metricExporter.
|
||||||
|
([#7410](https://github.com/open-telemetry/opentelemetry-java/pull/7410))
|
||||||
|
|
||||||
|
#### Exporters
|
||||||
|
|
||||||
|
* OTLP - JdkHttpSender: ensure proper closure of HttpClient in shutdown method
|
||||||
|
([#7390](https://github.com/open-telemetry/opentelemetry-java/pull/7390))
|
||||||
|
* OTLP: profile exporters fix and test improvements
|
||||||
|
([#7442](https://github.com/open-telemetry/opentelemetry-java/pull/7442))
|
||||||
|
* OTLP: Loading Compressor SPI via ComponentLoader configured through setComponentLoader
|
||||||
|
([#7428](https://github.com/open-telemetry/opentelemetry-java/pull/7428))
|
||||||
|
* Prometheus: add scope schema URL and attributes
|
||||||
|
([#7356](https://github.com/open-telemetry/opentelemetry-java/pull/7356))
|
||||||
|
* Prometheus: extend prometheus declarative config support to include without_scope_info,
|
||||||
|
with_resource_constant_labels
|
||||||
|
([#6840](https://github.com/open-telemetry/opentelemetry-java/pull/6840))
|
||||||
|
|
||||||
|
#### Extensions
|
||||||
|
|
||||||
|
* Autoconfigure: fix race condition of `GlobalOpenTelemetry` initialization with
|
||||||
|
`AutoConfiguredOpenTelemetrySdkBuilder`
|
||||||
|
([#7365](https://github.com/open-telemetry/opentelemetry-java/pull/7365))
|
||||||
|
* Declarative config: update to declarative config 1.0-rc.1
|
||||||
|
([#7436](https://github.com/open-telemetry/opentelemetry-java/pull/7436))
|
||||||
|
* Declarative config: resolve environment variable substitution for mixed quotes
|
||||||
|
([#7433](https://github.com/open-telemetry/opentelemetry-java/pull/7433))
|
||||||
|
|
||||||
|
## Version 1.51.0 (2025-06-06)
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
#### Context
|
||||||
|
|
||||||
|
* Fix context storage provider property name in log message
|
||||||
|
([#7342](https://github.com/open-telemetry/opentelemetry-java/pull/7342))
|
||||||
|
|
||||||
|
### SDK
|
||||||
|
|
||||||
|
* Experimental configurable exception.* attribute resolution for SdkTracerProvider,
|
||||||
|
SdkLoggerProvider
|
||||||
|
([#7266](https://github.com/open-telemetry/opentelemetry-java/pull/7266))
|
||||||
|
|
||||||
|
#### Exporters
|
||||||
|
|
||||||
|
* All exporters: implement new SemConv exporter health metrics, with configuration API for selecting
|
||||||
|
schema version
|
||||||
|
([#7265](https://github.com/open-telemetry/opentelemetry-java/pull/7265))
|
||||||
|
* OTLP: Add gRPC export for profiles signal type.
|
||||||
|
([#7301](https://github.com/open-telemetry/opentelemetry-java/pull/7301))
|
||||||
|
* OTLP: Run JDK HTTP sender on non-daemon threads.
|
||||||
|
([#7322](https://github.com/open-telemetry/opentelemetry-java/pull/7322))
|
||||||
|
* Prometheus: fix serialization of arrays
|
||||||
|
([#7291](https://github.com/open-telemetry/opentelemetry-java/pull/7291))
|
||||||
|
* OTLP: exporter tolerates instances of LogRecordData when incubator is present
|
||||||
|
([#7393](https://github.com/open-telemetry/opentelemetry-java/pull/7393))
|
||||||
|
|
||||||
|
#### Extensions
|
||||||
|
|
||||||
|
* Declarative config: Handle instrumentation node changes in yaml config file format 0.4
|
||||||
|
([#7357](https://github.com/open-telemetry/opentelemetry-java/pull/7357))
|
||||||
|
|
||||||
|
## Version 1.50.0 (2025-05-09)
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
* Clarify that AttributesBuilder.put allows nulls
|
||||||
|
([#7271](https://github.com/open-telemetry/opentelemetry-java/pull/7271))
|
||||||
|
* Stabilize log record event name
|
||||||
|
([#7277](https://github.com/open-telemetry/opentelemetry-java/pull/7277))
|
||||||
|
|
||||||
|
#### Context
|
||||||
|
|
||||||
|
* Fix duplicated ExecutorService wrap
|
||||||
|
([#7245](https://github.com/open-telemetry/opentelemetry-java/pull/7245))
|
||||||
|
* Promote getAll to TextMapGetter stable API
|
||||||
|
([#7267](https://github.com/open-telemetry/opentelemetry-java/pull/7267))
|
||||||
|
|
||||||
|
#### Incubator
|
||||||
|
|
||||||
|
* Add ExtendedLogRecordBuilder#setException
|
||||||
|
([#7182](https://github.com/open-telemetry/opentelemetry-java/pull/7182))
|
||||||
|
* Add experimental support for log extended attributes
|
||||||
|
([#7123](https://github.com/open-telemetry/opentelemetry-java/pull/7123))
|
||||||
|
|
||||||
|
### SDK
|
||||||
|
|
||||||
|
* Remove Java9VersionSpecific clock implementation
|
||||||
|
([#7221](https://github.com/open-telemetry/opentelemetry-java/pull/7221))
|
||||||
|
* Add addProcessorFirst to SdkTracerProviderBuilder, SdkLoggerProviderBuilder
|
||||||
|
([#7243](https://github.com/open-telemetry/opentelemetry-java/pull/7243))
|
||||||
|
|
||||||
|
#### Logs
|
||||||
|
|
||||||
|
* Add `setLoggerConfigurator` support to `LoggerProvider`
|
||||||
|
([#7332](https://github.com/open-telemetry/opentelemetry-java/pull/7332))
|
||||||
|
|
||||||
|
#### Metrics
|
||||||
|
|
||||||
|
* Add DelegatingMetricData
|
||||||
|
([#7229](https://github.com/open-telemetry/opentelemetry-java/pull/7229))
|
||||||
|
* Spatial aggregation for async instruments with filtering views
|
||||||
|
([#7264](https://github.com/open-telemetry/opentelemetry-java/pull/7264))
|
||||||
|
|
||||||
|
#### Exporters
|
||||||
|
|
||||||
|
* Prometheus: Add Authenticator support for PrometheusHttpServer
|
||||||
|
([#7225](https://github.com/open-telemetry/opentelemetry-java/pull/7225))
|
||||||
|
* OTLP: Fix OTLP metric exporter toBuilder() loosing temporality
|
||||||
|
([#7280](https://github.com/open-telemetry/opentelemetry-java/pull/7280))
|
||||||
|
* OTLP: Allow Otlp*MetricExporter's to publish export stats
|
||||||
|
([#7255](https://github.com/open-telemetry/opentelemetry-java/pull/7255))
|
||||||
|
|
||||||
|
#### Extensions
|
||||||
|
|
||||||
|
* Declarative config: Add support for escaping env var substitution
|
||||||
|
([#7033](https://github.com/open-telemetry/opentelemetry-java/pull/7033))
|
||||||
|
* Declarative config: update to opentelemetry-configuration 0.4
|
||||||
|
([#7064](https://github.com/open-telemetry/opentelemetry-java/pull/7064))
|
||||||
|
* Declarativeconfig: Refactor internals to add DeclarativeConfigContext
|
||||||
|
([#7293](https://github.com/open-telemetry/opentelemetry-java/pull/7293))
|
||||||
|
|
||||||
|
### Project tooling
|
||||||
|
|
||||||
|
* Kotlin extension: Update min kotlin version to 1.8
|
||||||
|
([#7155](https://github.com/open-telemetry/opentelemetry-java/pull/7155))
|
||||||
|
* Add javadoc site crawler
|
||||||
|
([#7300](https://github.com/open-telemetry/opentelemetry-java/pull/7300),
|
||||||
|
[#7316](https://github.com/open-telemetry/opentelemetry-java/pull/7316))
|
||||||
|
|
||||||
|
## Version 1.49.0 (2025-04-04)
|
||||||
|
|
||||||
|
### SDK
|
||||||
|
|
||||||
|
#### Trace
|
||||||
|
|
||||||
|
* Avoid linear queue.size() calls in span producers by storing queue size separately
|
||||||
|
([#7141](https://github.com/open-telemetry/opentelemetry-java/pull/7141))
|
||||||
|
|
||||||
|
#### Exporters
|
||||||
|
|
||||||
|
* OTLP: Add support for setting exporter executor service
|
||||||
|
([#7152](https://github.com/open-telemetry/opentelemetry-java/pull/7152))
|
||||||
|
* OTLP: Refine delay jitter for exponential backoff
|
||||||
|
([#7206](https://github.com/open-telemetry/opentelemetry-java/pull/7206))
|
||||||
|
|
||||||
|
#### Extensions
|
||||||
|
|
||||||
|
* Autoconfigure: Remove support for otel.experimental.exporter.otlp.retry.enabled
|
||||||
|
([#7200](https://github.com/open-telemetry/opentelemetry-java/pull/7200))
|
||||||
|
* Autoconfigure: Add stable cardinality limit property otel.java.metrics.cardinality.limit
|
||||||
|
([#7199](https://github.com/open-telemetry/opentelemetry-java/pull/7199))
|
||||||
|
* Incubator: Add declarative config model customizer SPI
|
||||||
|
([#7118](https://github.com/open-telemetry/opentelemetry-java/pull/7118))
|
||||||
|
|
||||||
|
## Version 1.48.0 (2025-03-07)
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
* Add some helpful logging attribute methods to `LogRecordBuilder`
|
||||||
|
([#7089](https://github.com/open-telemetry/opentelemetry-java/pull/7089))
|
||||||
|
|
||||||
|
#### Incubator
|
||||||
|
|
||||||
|
* Introduce ConfigProvider API. Rename `StructuredConfigProperties` to `DeclarativeConfigProperties`
|
||||||
|
and move to `opentelemetry-api-incubator`. Rename `FileConfiguration`
|
||||||
|
to `DeclarativeConfiguration`.
|
||||||
|
([#6549](https://github.com/open-telemetry/opentelemetry-java/pull/6549))
|
||||||
|
|
||||||
|
### SDK
|
||||||
|
|
||||||
|
* Log warning and adjust when BatchLogRecordProcessor, BatchSpanProcessor `maxExportBatchSize`
|
||||||
|
exceeds `maxQueueSize`.
|
||||||
|
([#7045](https://github.com/open-telemetry/opentelemetry-java/pull/7045),
|
||||||
|
[#7148](https://github.com/open-telemetry/opentelemetry-java/pull/7148))
|
||||||
|
* Fix bug causing `ThrottlingLogger` to log more than once per minute
|
||||||
|
([#7156](https://github.com/open-telemetry/opentelemetry-java/pull/7156))
|
||||||
|
|
||||||
|
#### Metrics
|
||||||
|
|
||||||
|
* Remove obsolete `SdkMeterProviderUtil#setCardinalitylimit` API
|
||||||
|
([#7169](https://github.com/open-telemetry/opentelemetry-java/pull/7169))
|
||||||
|
|
||||||
|
#### Traces
|
||||||
|
|
||||||
|
* Fix bug preventing accurate reporting of span event dropped attribute count
|
||||||
|
([#7142](https://github.com/open-telemetry/opentelemetry-java/pull/7142))
|
||||||
|
|
||||||
|
#### Exporters
|
||||||
|
|
||||||
|
* OTLP: remove support for `otel.java.experimental.exporter.memory_mode`
|
||||||
|
which was previously replaced by `otel.java.exporter.memory_mode`
|
||||||
|
([#7127](https://github.com/open-telemetry/opentelemetry-java/pull/7127))
|
||||||
|
* OTLP: Extract sender parameters to config carrier class
|
||||||
|
(incubating API)
|
||||||
|
([#7151](https://github.com/open-telemetry/opentelemetry-java/pull/7151))
|
||||||
|
* OTLP: Add support for setting OTLP exporter service class loader
|
||||||
|
([#7150](https://github.com/open-telemetry/opentelemetry-java/pull/7150))
|
||||||
|
|
||||||
|
### Tooling
|
||||||
|
|
||||||
|
* Update android animalsniffer min API version to 23
|
||||||
|
([#7153](https://github.com/open-telemetry/opentelemetry-java/pull/7153))
|
||||||
|
|
||||||
|
## Version 1.47.0 (2025-02-07)
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
#### Incubator
|
||||||
|
|
||||||
|
* Make `ExtendedTracer` easier to use
|
||||||
|
([#6943](https://github.com/open-telemetry/opentelemetry-java/pull/6943))
|
||||||
|
* Add `ExtendedLogRecordBuilder#setEventName` and corresponding SDK and OTLP serialization
|
||||||
|
([#7012](https://github.com/open-telemetry/opentelemetry-java/pull/7012))
|
||||||
|
* BREAKING: Drop event API / SDK
|
||||||
|
([#7053](https://github.com/open-telemetry/opentelemetry-java/pull/7053))
|
||||||
|
|
||||||
|
### SDK
|
||||||
|
|
||||||
|
* Remove -alpha artifacts from runtime classpath of stable components
|
||||||
|
([#6944](https://github.com/open-telemetry/opentelemetry-java/pull/6944))
|
||||||
|
|
||||||
|
#### Traces
|
||||||
|
|
||||||
|
* Bugfix: Follow spec on span limits, batch processors
|
||||||
|
([#7030](https://github.com/open-telemetry/opentelemetry-java/pull/7030))
|
||||||
|
* Add experimental `SdkTracerProvider.setScopeConfigurator(ScopeConfigurator)` for
|
||||||
|
updating `TracerConfig` at runtime
|
||||||
|
([#7021](https://github.com/open-telemetry/opentelemetry-java/pull/7021))
|
||||||
|
|
||||||
|
#### Profiles
|
||||||
|
|
||||||
|
* Add AttributeKeyValue abstraction to common otlp exporters
|
||||||
|
([#7026](https://github.com/open-telemetry/opentelemetry-java/pull/7026))
|
||||||
|
* Improve profiles attribute table handling
|
||||||
|
([#7031](https://github.com/open-telemetry/opentelemetry-java/pull/7031))
|
||||||
|
|
||||||
|
#### Exporters
|
||||||
|
|
||||||
|
* Interpret timeout zero value as no limit
|
||||||
|
([#7023](https://github.com/open-telemetry/opentelemetry-java/pull/7023))
|
||||||
|
* Bugfix - OTLP: Fix concurrent span reusable data marshaler
|
||||||
|
([#7041](https://github.com/open-telemetry/opentelemetry-java/pull/7041))
|
||||||
|
* OTLP: Add ability to customize retry exception predicate
|
||||||
|
([#6991](https://github.com/open-telemetry/opentelemetry-java/pull/6991))
|
||||||
|
* OTLP: Expand default OkHttp sender retry exception predicate
|
||||||
|
([#7047](https://github.com/open-telemetry/opentelemetry-java/pull/7047),
|
||||||
|
[#7057](https://github.com/open-telemetry/opentelemetry-java/pull/7057))
|
||||||
|
|
||||||
|
#### Extensions
|
||||||
|
|
||||||
|
* Autoconfigure: Consistent application of exporter customizers when otel.{signal}.exporter=none
|
||||||
|
([#7017](https://github.com/open-telemetry/opentelemetry-java/pull/7017))
|
||||||
|
* Autoconfigure: Promote EnvironmentResourceProvider to public API
|
||||||
|
([#7052](https://github.com/open-telemetry/opentelemetry-java/pull/7052))
|
||||||
|
* Autoconfigure: Ensure `OTEL_PROPAGATORS` still works when `OTEL_SDK_DISABLED=true`.
|
||||||
|
([#7062](https://github.com/open-telemetry/opentelemetry-java/pull/7062))%
|
||||||
|
|
||||||
|
#### Testing
|
||||||
|
|
||||||
|
* Add W3CBaggagePropagator to `OpenTelemetryRule`, `OpenTelemetryExtension`.
|
||||||
|
([#7056](https://github.com/open-telemetry/opentelemetry-java/pull/7056))
|
||||||
|
|
||||||
|
## Version 1.46.0 (2025-01-10)
|
||||||
|
|
||||||
|
### SDK
|
||||||
|
|
||||||
|
* Remove unused dependencies, cleanup code after stabilizing Value
|
||||||
|
([#6948](https://github.com/open-telemetry/opentelemetry-java/pull/6948))
|
||||||
|
* Explicitly allow null into CompletableResultCode.failExceptionally()
|
||||||
|
([#6963](https://github.com/open-telemetry/opentelemetry-java/pull/6963))
|
||||||
|
|
||||||
|
#### Traces
|
||||||
|
|
||||||
|
* Fix span setStatus
|
||||||
|
([#6990](https://github.com/open-telemetry/opentelemetry-java/pull/6990))
|
||||||
|
|
||||||
|
#### Logs
|
||||||
|
|
||||||
|
* Add getters/accessors for readable fields in ReadWriteLogRecord.
|
||||||
|
([#6924](https://github.com/open-telemetry/opentelemetry-java/pull/6924))
|
||||||
|
|
||||||
|
#### Exporters
|
||||||
|
|
||||||
|
* OTLP: Update to opentelemetry-proto 1.5
|
||||||
|
([#6999](https://github.com/open-telemetry/opentelemetry-java/pull/6999))
|
||||||
|
* Bugfix - OTLP: Ensure Serializer runtime exceptions are rethrown as IOException
|
||||||
|
([#6969](https://github.com/open-telemetry/opentelemetry-java/pull/6969))
|
||||||
|
* BREAKING - OTLP: Delete experimental OTLP authenticator concept.
|
||||||
|
See [OTLP authentication docs](https://opentelemetry.io/docs/languages/java/sdk/#authentication)
|
||||||
|
for supported solutions.
|
||||||
|
([#6984](https://github.com/open-telemetry/opentelemetry-java/pull/6984))
|
||||||
|
|
||||||
|
#### Extensions
|
||||||
|
|
||||||
|
* BREAKING - Autoconfigure: Remove support for deprecated otel.experimental.resource.disabled.keys
|
||||||
|
([#6931](https://github.com/open-telemetry/opentelemetry-java/pull/6931))
|
||||||
|
|
||||||
|
## Version 1.45.0 (2024-12-06)
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
* Add convenience method `setAttribute(Attribute<Long>, int)` to SpanBuilder (matching the existing
|
||||||
|
convenience method in Span)
|
||||||
|
([#6884](https://github.com/open-telemetry/opentelemetry-java/pull/6884))
|
||||||
|
* Extends TextMapGetter with experimental GetAll() method, implement usage in W3CBaggagePropagator
|
||||||
|
([#6852](https://github.com/open-telemetry/opentelemetry-java/pull/6852))
|
||||||
|
|
||||||
|
### SDK
|
||||||
|
|
||||||
|
#### Traces
|
||||||
|
|
||||||
|
* Add synchronization to SimpleSpanProcessor to ensure thread-safe export of spans
|
||||||
|
([#6885](https://github.com/open-telemetry/opentelemetry-java/pull/6885))
|
||||||
|
|
||||||
|
#### Metrics
|
||||||
|
|
||||||
|
* Lazily initialize ReservoirCells
|
||||||
|
([#6851](https://github.com/open-telemetry/opentelemetry-java/pull/6851))
|
||||||
|
|
||||||
|
#### Logs
|
||||||
|
|
||||||
|
* Add synchronization to SimpleLogRecordProcessor to ensure thread-safe export of logs
|
||||||
|
([#6885](https://github.com/open-telemetry/opentelemetry-java/pull/6885))
|
||||||
|
|
||||||
|
#### Exporters
|
||||||
|
|
||||||
|
* OTLP: Update opentelementry-proto to 1.4
|
||||||
|
([#6906](https://github.com/open-telemetry/opentelemetry-java/pull/6906))
|
||||||
|
* OTLP: Rename internal Marshaler#writeJsonToGenerator method to allow jackson runtimeOnly dependency
|
||||||
|
([#6896](https://github.com/open-telemetry/opentelemetry-java/pull/6896))
|
||||||
|
* OTLP: Fix repeated string serialization for JSON.
|
||||||
|
([#6888](https://github.com/open-telemetry/opentelemetry-java/pull/6888))
|
||||||
|
* OTLP: Fix missing unsafe available check
|
||||||
|
([#6920](https://github.com/open-telemetry/opentelemetry-java/pull/6920))
|
||||||
|
|
||||||
|
#### Extensions
|
||||||
|
|
||||||
|
* Declarative config: Don't require empty objects when referencing custom components
|
||||||
|
([#6891](https://github.com/open-telemetry/opentelemetry-java/pull/6891))
|
||||||
|
|
||||||
|
### Tooling
|
||||||
|
|
||||||
|
* Add javadoc boilerplate internal comment v2 for experimental classes
|
||||||
|
([#6886](https://github.com/open-telemetry/opentelemetry-java/pull/6886))
|
||||||
|
* Update develocity configuration
|
||||||
|
([#6903](https://github.com/open-telemetry/opentelemetry-java/pull/6903))
|
||||||
|
|
||||||
|
## Version 1.44.1 (2024-11-10)
|
||||||
|
|
||||||
|
### SDK
|
||||||
|
|
||||||
|
#### Traces
|
||||||
|
|
||||||
|
* Fix regression in event attributes
|
||||||
|
([#6865](https://github.com/open-telemetry/opentelemetry-java/pull/6865))
|
||||||
|
|
||||||
|
## Version 1.44.0 (2024-11-08)
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
* Fix ConfigUtil#getString ConcurrentModificationException
|
||||||
|
([#6841](https://github.com/open-telemetry/opentelemetry-java/pull/6841))
|
||||||
|
|
||||||
|
### SDK
|
||||||
|
|
||||||
|
#### Traces
|
||||||
|
|
||||||
|
* Stabilize ExceptionEventData
|
||||||
|
([#6795](https://github.com/open-telemetry/opentelemetry-java/pull/6795))
|
||||||
|
|
||||||
|
#### Metrics
|
||||||
|
|
||||||
|
* Stabilize metric cardinality limits
|
||||||
|
([#6794](https://github.com/open-telemetry/opentelemetry-java/pull/6794))
|
||||||
|
* Refactor metrics internals to remove MeterSharedState
|
||||||
|
([#6845](https://github.com/open-telemetry/opentelemetry-java/pull/6845))
|
||||||
|
|
||||||
|
#### Exporters
|
||||||
|
|
||||||
|
* Add memory mode option to stdout exporters
|
||||||
|
([#6774](https://github.com/open-telemetry/opentelemetry-java/pull/6774))
|
||||||
|
* Log a warning if OTLP endpoint port is likely incorrect given the protocol
|
||||||
|
([#6813](https://github.com/open-telemetry/opentelemetry-java/pull/6813))
|
||||||
|
* Fix OTLP gRPC retry mechanism for unsuccessful HTTP responses
|
||||||
|
([#6829](https://github.com/open-telemetry/opentelemetry-java/pull/6829))
|
||||||
|
* Add ByteBuffer field type marshaling support
|
||||||
|
([#6686](https://github.com/open-telemetry/opentelemetry-java/pull/6686))
|
||||||
|
* Fix stdout exporter format by adding newline after each export
|
||||||
|
([#6848](https://github.com/open-telemetry/opentelemetry-java/pull/6848))
|
||||||
|
* Enable `reusuable_data` memory mode by default for `OtlpGrpc{Signal}Exporter`,
|
||||||
|
`OtlpHttp{Signal}Exporter`, `OtlpStdout{Signal}Exporter`, and `PrometheusHttpServer`
|
||||||
|
([#6799](https://github.com/open-telemetry/opentelemetry-java/pull/6799))
|
||||||
|
|
||||||
|
#### Extension
|
||||||
|
|
||||||
|
* Rebrand file configuration to declarative configuration in documentation
|
||||||
|
([#6812](https://github.com/open-telemetry/opentelemetry-java/pull/6812))
|
||||||
|
* Fix declarative config `file_format` validation
|
||||||
|
([#6786](https://github.com/open-telemetry/opentelemetry-java/pull/6786))
|
||||||
|
* Fix declarative config env substitution by disallowing '}' in default value
|
||||||
|
([#6793](https://github.com/open-telemetry/opentelemetry-java/pull/6793))
|
||||||
|
* Set declarative config default OTLP protocol to http/protobuf
|
||||||
|
([#6800](https://github.com/open-telemetry/opentelemetry-java/pull/6800))
|
||||||
|
* Stabilize autoconfigure disabling of resource keys via `otel.resource.disabled.keys`
|
||||||
|
([#6809](https://github.com/open-telemetry/opentelemetry-java/pull/6809))
|
||||||
|
|
||||||
|
### Tooling
|
||||||
|
|
||||||
|
* Run tests on Java 23
|
||||||
|
([#6825](https://github.com/open-telemetry/opentelemetry-java/pull/6825))
|
||||||
|
* Test Windows in CI
|
||||||
|
([#6824](https://github.com/open-telemetry/opentelemetry-java/pull/6824))
|
||||||
|
* Add error prone checks for internal javadoc and private constructors
|
||||||
|
([#6844](https://github.com/open-telemetry/opentelemetry-java/pull/6844))
|
||||||
|
|
||||||
|
## Version 1.43.0 (2024-10-11)
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
* Add helper class to capture context using ScheduledExecutorService
|
||||||
|
([#6712](https://github.com/open-telemetry/opentelemetry-java/pull/6712))
|
||||||
|
* Adds Baggage.getEntry(String key)
|
||||||
|
([#6765](https://github.com/open-telemetry/opentelemetry-java/pull/6765))
|
||||||
|
|
||||||
|
#### Extensions
|
||||||
|
|
||||||
|
* Fix ottracepropagation for short span ids
|
||||||
|
([#6734](https://github.com/open-telemetry/opentelemetry-java/pull/6734))
|
||||||
|
|
||||||
|
### SDK
|
||||||
|
|
||||||
|
#### Metrics
|
||||||
|
|
||||||
|
* Optimize advice with FilteredAttributes
|
||||||
|
([#6633](https://github.com/open-telemetry/opentelemetry-java/pull/6633))
|
||||||
|
|
||||||
|
#### Exporters
|
||||||
|
|
||||||
|
* Add experimental stdout log, metric, trace exporters for printing records to stdout in standard
|
||||||
|
OTLP JSON format.
|
||||||
|
([#6675](https://github.com/open-telemetry/opentelemetry-java/pull/6675), [#6750](https://github.com/open-telemetry/opentelemetry-java/pull/6750))
|
||||||
|
* Add Marshalers for profiling signal type
|
||||||
|
([#6680](https://github.com/open-telemetry/opentelemetry-java/pull/6680))
|
||||||
|
|
||||||
|
#### Extensions
|
||||||
|
|
||||||
|
* Add `*Model` suffix to declarative config generated classes.
|
||||||
|
([#6721](https://github.com/open-telemetry/opentelemetry-java/pull/6721))
|
||||||
|
* Use autoconfigured ClassLoader to load declarative config
|
||||||
|
([#6725](https://github.com/open-telemetry/opentelemetry-java/pull/6725))
|
||||||
|
* Update declarative config to use opentelemetry-configuration v0.3.0
|
||||||
|
([#6733](https://github.com/open-telemetry/opentelemetry-java/pull/6733))
|
||||||
|
* Add `StructuredConfigProperties#getStructured` default method,
|
||||||
|
add `StructuredConfigProperties.empty()`
|
||||||
|
([#6759](https://github.com/open-telemetry/opentelemetry-java/pull/6759))
|
||||||
|
|
||||||
|
#### Testing
|
||||||
|
|
||||||
|
* Add context info about wrong span or trace.
|
||||||
|
([#6703](https://github.com/open-telemetry/opentelemetry-java/pull/6703))
|
||||||
|
|
||||||
|
## Version 1.42.1 (2024-09-10)
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
* Revert `java-test-fixtures` plugin to remove test dependencies from `pom.xml`.
|
||||||
|
([#6695](https://github.com/open-telemetry/opentelemetry-java/pull/6695))
|
||||||
|
|
||||||
|
## Version 1.42.0 (2024-09-06)
|
||||||
|
|
||||||
### API
|
### API
|
||||||
|
|
||||||
* BREAKING: Stabilize log support for AnyValue bodies. Rename `AnyValue` to `Value`, promote
|
* BREAKING: Stabilize log support for AnyValue bodies. Rename `AnyValue` to `Value`, promote
|
||||||
|
@ -348,7 +847,7 @@
|
||||||
have stopped being published. Jaeger
|
have stopped being published. Jaeger
|
||||||
has [native support for OTLP](https://opentelemetry.io/blog/2022/jaeger-native-otlp/), and users
|
has [native support for OTLP](https://opentelemetry.io/blog/2022/jaeger-native-otlp/), and users
|
||||||
should export to jaeger
|
should export to jaeger
|
||||||
using [OTLP](https://opentelemetry.io/docs/instrumentation/java/exporters/#otlp-dependencies)
|
using OTLP
|
||||||
instead.
|
instead.
|
||||||
|
|
||||||
### API
|
### API
|
||||||
|
@ -432,7 +931,7 @@ instead.
|
||||||
and `opentelemetry-exporter-jaeger-thift`. Jaeger
|
and `opentelemetry-exporter-jaeger-thift`. Jaeger
|
||||||
has [native support for OTLP](https://opentelemetry.io/blog/2022/jaeger-native-otlp/), and users
|
has [native support for OTLP](https://opentelemetry.io/blog/2022/jaeger-native-otlp/), and users
|
||||||
should export to jaeger
|
should export to jaeger
|
||||||
using [OTLP](https://opentelemetry.io/docs/instrumentation/java/exporters/#otlp-dependencies)
|
using OTLP
|
||||||
instead.
|
instead.
|
||||||
|
|
||||||
### API
|
### API
|
||||||
|
@ -869,7 +1368,7 @@ The log bridge API / SDK are now stable! Some important notes:
|
||||||
of `otel.logs.exporter` from `none` to `otlp`.
|
of `otel.logs.exporter` from `none` to `otlp`.
|
||||||
|
|
||||||
NOTE: reminder that
|
NOTE: reminder that
|
||||||
the [Logs Bridge API](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/bridge-api.md)
|
the [Logs Bridge API](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/logs/bridge-api.md)
|
||||||
is _not_ meant for end users. Log appenders use the API to bridge logs from existing log
|
is _not_ meant for end users. Log appenders use the API to bridge logs from existing log
|
||||||
frameworks (e.g. JUL, Log4j, SLf4J, Logback) into OpenTelemetry. Users configure the Log SDK to
|
frameworks (e.g. JUL, Log4j, SLf4J, Logback) into OpenTelemetry. Users configure the Log SDK to
|
||||||
dictate how logs are processed and exported.
|
dictate how logs are processed and exported.
|
||||||
|
@ -937,7 +1436,7 @@ merged into `opentelemetry-exporter-otlp`, `opentelemetry-sdk-logs-testing` will
|
||||||
into `opentelemetry-sdk-testing`, `opentelemetry-sdk-extension-autoconfigure` will enable `otlp`
|
into `opentelemetry-sdk-testing`, `opentelemetry-sdk-extension-autoconfigure` will enable `otlp`
|
||||||
log exporter by default (i.e. `otel.logs.exporter=otlp`). For more details, see tracking
|
log exporter by default (i.e. `otel.logs.exporter=otlp`). For more details, see tracking
|
||||||
issue [#5340](https://github.com/open-telemetry/opentelemetry-java/issues/5340). NOTE: reminder that
|
issue [#5340](https://github.com/open-telemetry/opentelemetry-java/issues/5340). NOTE: reminder that
|
||||||
the [Logs Bridge API](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/bridge-api.md)
|
the [Logs Bridge API](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/logs/bridge-api.md)
|
||||||
is _not_ meant for end users. Log appenders use the API to bridge logs from existing log
|
is _not_ meant for end users. Log appenders use the API to bridge logs from existing log
|
||||||
frameworks (e.g. JUL, Log4j, SLf4J, Logback) into OpenTelemetry. Users configure the Log SDK to
|
frameworks (e.g. JUL, Log4j, SLf4J, Logback) into OpenTelemetry. Users configure the Log SDK to
|
||||||
dictate how logs are processed and exported.
|
dictate how logs are processed and exported.
|
||||||
|
@ -1471,7 +1970,7 @@ This release is a notable release for metrics:
|
||||||
* Autoconfigure performs percent decoding on `otel.resource.attributes` values.
|
* Autoconfigure performs percent decoding on `otel.resource.attributes` values.
|
||||||
[(#4653)](https://github.com/open-telemetry/opentelemetry-java/issues/4653)
|
[(#4653)](https://github.com/open-telemetry/opentelemetry-java/issues/4653)
|
||||||
* Unify compression configuration for exporters including
|
* Unify compression configuration for exporters including
|
||||||
[(#4775)](https://github.com/open-telemetry/opentelemetry-java/issues/4775):
|
[(#4775)](https://github.com/open-telemetry/opentelemetry-java/pull/4775):
|
||||||
* Fix handling of `none` in OTLP exporters.
|
* Fix handling of `none` in OTLP exporters.
|
||||||
* Add `JaegerGrpcSpanExporterBuilder#setCompression(String)`.
|
* Add `JaegerGrpcSpanExporterBuilder#setCompression(String)`.
|
||||||
* Add `ZipkinSpanExporterBuilder#setCompression(String)`.
|
* Add `ZipkinSpanExporterBuilder#setCompression(String)`.
|
||||||
|
@ -1499,8 +1998,8 @@ log API component has been added for emitting events and for writing log appende
|
||||||
API is not a substitute for traditional log frameworks like Log4j, JUL, SLF4J, or Logback. While the
|
API is not a substitute for traditional log frameworks like Log4j, JUL, SLF4J, or Logback. While the
|
||||||
event portion of the API is intended for instrumentation authors and end users, the API for emitting
|
event portion of the API is intended for instrumentation authors and end users, the API for emitting
|
||||||
LogRecords is not.
|
LogRecords is not.
|
||||||
See [LoggerProvider](./api/logs/src/main/java/io/opentelemetry/api/logs/LoggerProvider.java)
|
See [LoggerProvider](./api/all/src/main/java/io/opentelemetry/api/logs/LoggerProvider.java)
|
||||||
and [Logger](./api/logs/src/main/java/io/opentelemetry/api/logs/Logger.java) javadoc for more
|
and [Logger](./api/all/src/main/java/io/opentelemetry/api/logs/Logger.java) javadoc for more
|
||||||
details.
|
details.
|
||||||
|
|
||||||
### General
|
### General
|
||||||
|
@ -1786,7 +2285,7 @@ details.
|
||||||
stable `opentelemetry-sdk-extension-autoconfigure-spi`.
|
stable `opentelemetry-sdk-extension-autoconfigure-spi`.
|
||||||
* Autoconfigure now supports multiple values for `otel.metrics.exporter`.
|
* Autoconfigure now supports multiple values for `otel.metrics.exporter`.
|
||||||
* Autoconfigure now
|
* Autoconfigure now
|
||||||
supports [general attribute limits](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md#attribute-limits),
|
supports [general attribute limits](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md#attribute-limits),
|
||||||
applicable to span attributes, span event attributes, span link attributes, and log attributes.
|
applicable to span attributes, span event attributes, span link attributes, and log attributes.
|
||||||
* Autoconfigure now supports an experimental option to disable the SDK.
|
* Autoconfigure now supports an experimental option to disable the SDK.
|
||||||
If `otel.experimental.sdk.enabled=true`, `AutoConfiguredOpenTelemetrySdk#getOpenTelemetrySdk()`
|
If `otel.experimental.sdk.enabled=true`, `AutoConfiguredOpenTelemetrySdk#getOpenTelemetrySdk()`
|
||||||
|
@ -3346,7 +3845,7 @@ See the `opentelemetry-extension-kotlin` module for details.
|
||||||
|
|
||||||
#### Breaking changes
|
#### Breaking changes
|
||||||
|
|
||||||
- There have been many updates to the semantic conventions constants. The constants are now auto-generated from the YAML specification files, so the names will now be consistent across languages. For more information, see the [YAML Model for Semantic Conventions](https://github.com/open-telemetry/opentelemetry-specification/tree/master/semantic_conventions).
|
- There have been many updates to the semantic conventions constants. The constants are now auto-generated from the YAML specification files, so the names will now be consistent across languages. For more information, see the [YAML Model for Semantic Conventions](https://github.com/open-telemetry/semantic-conventions/tree/main/model#yaml-model-for-semantic-conventions).
|
||||||
- All API classes have been moved into the `io.opentelemetry.api.` prefix to support JPMS users.
|
- All API classes have been moved into the `io.opentelemetry.api.` prefix to support JPMS users.
|
||||||
- The API no longer uses the `grpc-context` as the context implementation. It now uses `io.opentelemetry.context.Context`. This is published in the `opentelemetry-context` artifact. Interactions with the context were mostly moved to static methods in the `Span` and `Baggage` interfaces.
|
- The API no longer uses the `grpc-context` as the context implementation. It now uses `io.opentelemetry.context.Context`. This is published in the `opentelemetry-context` artifact. Interactions with the context were mostly moved to static methods in the `Span` and `Baggage` interfaces.
|
||||||
- The Baggage API has been reworked to more closely match the specification. This includes the removal of the `BaggageManager`. Baggage is fully functional within the API, without needing to install an SDK.
|
- The Baggage API has been reworked to more closely match the specification. This includes the removal of the `BaggageManager`. Baggage is fully functional within the API, without needing to install an SDK.
|
||||||
|
@ -3377,7 +3876,7 @@ See the `opentelemetry-extension-kotlin` module for details.
|
||||||
|
|
||||||
#### Breaking changes
|
#### Breaking changes
|
||||||
|
|
||||||
- `TraceConfig` configuration option names (environment variables and system properties) were renamed to match the OpenTelemetery Specification. For more information, see [TraceConfig](./QUICKSTART.md#TraceConfig).
|
- `TraceConfig` configuration option names (environment variables and system properties) were renamed to match the OpenTelemetery Specification.
|
||||||
- The Jaeger gRPC exporter was updated to match the OpenTelemetry Specification. The `message` log entry attribute has been renamed to `event` and a new `dropped attributes count` attribute was added. For more information, see the [Overview](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/overview.md).
|
- The Jaeger gRPC exporter was updated to match the OpenTelemetry Specification. The `message` log entry attribute has been renamed to `event` and a new `dropped attributes count` attribute was added. For more information, see the [Overview](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/overview.md).
|
||||||
- The `SpanData.getHasRemoteParent()` and `SpanData.getHasEnded()` methods were renamed to `hasRemoteParent()` and `hasEnded()`, respectively.
|
- The `SpanData.getHasRemoteParent()` and `SpanData.getHasEnded()` methods were renamed to `hasRemoteParent()` and `hasEnded()`, respectively.
|
||||||
- The `IdsGenerator` interface has been renamed to `IdGenerator`, and all implementations and relevant factory methods were similarly renamed.
|
- The `IdsGenerator` interface has been renamed to `IdGenerator`, and all implementations and relevant factory methods were similarly renamed.
|
||||||
|
|
|
@ -146,6 +146,13 @@ uses [google-java-format](https://github.com/google/google-java-format) library:
|
||||||
synchronized (lock) { ... }
|
synchronized (lock) { ... }
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
* Don't
|
||||||
|
use [gradle test fixtures](https://docs.gradle.org/current/userguide/java_testing.html#sec:java_test_fixtures) (
|
||||||
|
i.e. `java-test-fixtures` plugin) to reuse code for internal testing. The test fixtures plugin has
|
||||||
|
side effects where test dependencies are added to the `pom.xml` and publishes an
|
||||||
|
extra `*-test-fixtures.jar` artifact which is unnecessary for internal testing. Instead, create a
|
||||||
|
new `*:testing-internal` module and omit the `otel.java-conventions`. For example,
|
||||||
|
see [/exporters/otlp/testing-internal](./exporters/otlp/testing-internal).
|
||||||
|
|
||||||
If you notice any practice being applied in the project consistently that isn't listed here, please
|
If you notice any practice being applied in the project consistently that isn't listed here, please
|
||||||
consider a pull request to add it.
|
consider a pull request to add it.
|
||||||
|
|
506
README.md
506
README.md
|
@ -1,69 +1,25 @@
|
||||||
# OpenTelemetry Java
|
# OpenTelemetry Java
|
||||||
[![Continuous Build][ci-image]][ci-url]
|
|
||||||
[![Coverage Status][codecov-image]][codecov-url]
|
|
||||||
[![Maven Central][maven-image]][maven-url]
|
[![Maven Central][maven-image]][maven-url]
|
||||||
|
[![Coverage Status][codecov-image]][codecov-url]
|
||||||
|
[](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Fopen-telemetry%2Fopentelemetry-java?ref=badge_shield&issueType=license)
|
||||||
|
[](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Fopen-telemetry%2Fopentelemetry-java?ref=badge_shield&issueType=security)
|
||||||
|
[](https://scorecard.dev/viewer/?uri=github.com/open-telemetry/opentelemetry-java)
|
||||||
|
[](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/io/opentelemetry/java/README.md)
|
||||||
|
|
||||||
## Project Status
|
`opentelemetry-java` is the home of the Java implementation of the OpenTelemetry API for recording
|
||||||
|
telemetry, and SDK for managing telemetry recorded by the API.
|
||||||
|
|
||||||
See [Java status on OpenTelemetry.io][otel-java-status].
|
See [opentelemetry.io Java Documentation](https://opentelemetry.io/docs/languages/java/intro/) for:
|
||||||
|
|
||||||
## Getting Started
|
* An overview of the OpenTelemetry Java ecosystem and key repositories
|
||||||
|
* Detailed documentation on the components published from this repository
|
||||||
|
* Review of instrumentation ecosystem, including OpenTelemetry Java agent
|
||||||
|
* End-to-end working code examples
|
||||||
|
* And more
|
||||||
|
|
||||||
If you are looking for an all-in-one, easy-to-install **auto-instrumentation
|
> [!IMPORTANT]
|
||||||
javaagent**, see [opentelemetry-java-instrumentation][].
|
> We are currently seeking additional contributors! See [help wanted](#help-wanted) for details.
|
||||||
|
|
||||||
If you are looking for **examples** on how to use the OpenTelemetry API to
|
|
||||||
write your own **manual instrumentation**, or how to set up the OpenTelemetry
|
|
||||||
Java SDK, see [Manual instrumentation][]. Fully-functional examples
|
|
||||||
are available in [opentelemetry-java-examples][].
|
|
||||||
|
|
||||||
If you are looking for generated classes for
|
|
||||||
the [OpenTelemetry semantic conventions][opentelemetry-semantic-conventions],
|
|
||||||
see [semantic-conventions-java][opentelemetry-semantic-conventions-java].
|
|
||||||
|
|
||||||
For a general overview of OpenTelemetry, visit [opentelemetry.io][].
|
|
||||||
|
|
||||||
Would you like to get involved with the project? Read our [contributing guide](CONTRIBUTING.md). We welcome
|
|
||||||
contributions!
|
|
||||||
|
|
||||||
## Contacting us
|
|
||||||
|
|
||||||
We hold regular meetings. See details at [community page](https://github.com/open-telemetry/community#java-sdk).
|
|
||||||
|
|
||||||
We use [GitHub Discussions](https://github.com/open-telemetry/opentelemetry-java/discussions)
|
|
||||||
for support or general questions. Feel free to drop us a line.
|
|
||||||
|
|
||||||
We are also present in the [`#otel-java`](https://cloud-native.slack.com/archives/C014L2KCTE3) channel in the [CNCF slack](https://slack.cncf.io/).
|
|
||||||
Please join us for more informal discussions.
|
|
||||||
|
|
||||||
To report a bug, or request a new feature,
|
|
||||||
please [open an issue](https://github.com/open-telemetry/opentelemetry-java/issues/new/choose).
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
OpenTelemetry is the merging of OpenCensus and OpenTracing into a single project.
|
|
||||||
|
|
||||||
This project contains the following top level components:
|
|
||||||
|
|
||||||
* [OpenTelemetry API](api/):
|
|
||||||
* [stable apis](api/all) including `Tracer`, `Span`, `SpanContext`, `Meter`, and `Baggage`.
|
|
||||||
* [context api](context/) The OpenTelemetry Context implementation.
|
|
||||||
* [incubating apis](api/incubator) incubating APIs, including `Events`.
|
|
||||||
* [extensions](extensions/) define additional API extensions not part of the core API, including propagators.
|
|
||||||
* [sdk](sdk/) defines the implementation of the OpenTelemetry API.
|
|
||||||
* [exporters](exporters/) trace, metric, and log exporters for the SDK.
|
|
||||||
* [sdk-extensions](sdk-extensions/) defines additional SDK extensions, which are not part of the core SDK.
|
|
||||||
* [OpenTracing shim](opentracing-shim/) defines a bridge layer from OpenTracing to the OpenTelemetry API.
|
|
||||||
* [OpenCensus shim](opencensus-shim/) defines a bridge layer from OpenCensus to the OpenTelemetry API.
|
|
||||||
|
|
||||||
This project publishes a lot of artifacts, listed in [releases](#releases).
|
|
||||||
[`opentelemetry-bom`](https://mvnrepository.com/artifact/io.opentelemetry/opentelemetry-bom) (BOM =
|
|
||||||
Bill of Materials) is provided to assist with synchronizing versions of
|
|
||||||
dependencies. [`opentelemetry-bom-alpha`](https://mvnrepository.com/artifact/io.opentelemetry/opentelemetry-bom-alpha)
|
|
||||||
provides the same function for unstable artifacts. See [published releases](#published-releases) for
|
|
||||||
instructions on using the BOMs.
|
|
||||||
|
|
||||||
We would love to hear from the larger community: please provide feedback proactively.
|
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
|
@ -75,144 +31,134 @@ details.
|
||||||
reasons, [library desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring)
|
reasons, [library desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring)
|
||||||
must be enabled.
|
must be enabled.
|
||||||
|
|
||||||
See [CONTRIBUTING.md](./CONTRIBUTING.md) for additional instructions for building this project for
|
See [contributing](#contributing) for details on building this project locally.
|
||||||
development.
|
|
||||||
|
|
||||||
### Note about extensions
|
|
||||||
|
|
||||||
Both API and SDK extensions consist of various additional components which are excluded from the core artifacts
|
|
||||||
to keep them from growing too large.
|
|
||||||
|
|
||||||
We still aim to provide the same level of quality and guarantee for them as for the core components.
|
|
||||||
Please don't hesitate to use them if you find them useful.
|
|
||||||
|
|
||||||
## Project setup and contributing
|
|
||||||
|
|
||||||
Please refer to the [contribution guide](CONTRIBUTING.md) on how to set up for development and contribute!
|
|
||||||
|
|
||||||
## Published Releases
|
|
||||||
|
|
||||||
Published releases are available on maven central. We strongly recommend using our published BOM to keep all
|
|
||||||
dependency versions in sync.
|
|
||||||
|
|
||||||
### Maven
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<project>
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.opentelemetry</groupId>
|
|
||||||
<artifactId>opentelemetry-bom</artifactId>
|
|
||||||
<version>1.41.0</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.opentelemetry</groupId>
|
|
||||||
<artifactId>opentelemetry-api</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Gradle
|
|
||||||
|
|
||||||
```groovy
|
|
||||||
dependencies {
|
|
||||||
implementation platform("io.opentelemetry:opentelemetry-bom:1.41.0")
|
|
||||||
implementation('io.opentelemetry:opentelemetry-api')
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that if you want to use any artifacts that have not fully stabilized yet (such as the [prometheus exporter](https://github.com/open-telemetry/opentelemetry-java/tree/main/exporters/prometheus), then you will need to add an entry for the Alpha BOM as well, e.g.
|
|
||||||
|
|
||||||
```groovy
|
|
||||||
dependencies {
|
|
||||||
implementation platform("io.opentelemetry:opentelemetry-bom:1.41.0")
|
|
||||||
implementation platform('io.opentelemetry:opentelemetry-bom-alpha:1.41.0-alpha')
|
|
||||||
|
|
||||||
implementation('io.opentelemetry:opentelemetry-api')
|
|
||||||
implementation('io.opentelemetry:opentelemetry-exporter-prometheus')
|
|
||||||
implementation('io.opentelemetry:opentelemetry-sdk-extension-autoconfigure')
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Snapshots
|
|
||||||
|
|
||||||
Snapshots based out the `main` branch are available for `opentelemetry-api`, `opentelemetry-sdk` and the rest of the artifacts.
|
|
||||||
We strongly recommend using our published BOM to keep all dependency versions in sync.
|
|
||||||
|
|
||||||
### Maven
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<project>
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>oss.sonatype.org-snapshot</id>
|
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.opentelemetry</groupId>
|
|
||||||
<artifactId>opentelemetry-bom</artifactId>
|
|
||||||
<version>1.42.0-SNAPSHOT</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.opentelemetry</groupId>
|
|
||||||
<artifactId>opentelemetry-api</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Gradle
|
|
||||||
|
|
||||||
```groovy
|
|
||||||
repositories {
|
|
||||||
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation platform("io.opentelemetry:opentelemetry-bom:1.42.0-SNAPSHOT")
|
|
||||||
implementation('io.opentelemetry:opentelemetry-api')
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Libraries will usually only need `opentelemetry-api`, while applications
|
|
||||||
will want to use the `opentelemetry-sdk` module which contains our standard implementation
|
|
||||||
of the APIs.
|
|
||||||
|
|
||||||
## Gradle composite builds
|
|
||||||
|
|
||||||
For opentelemetry-java developers that need to test the latest source code with another
|
|
||||||
project, composite builds can be used as an alternative to `publishToMavenLocal`. This
|
|
||||||
requires some setup which is explained [here](CONTRIBUTING.md#composing-builds).
|
|
||||||
|
|
||||||
## Releases
|
## Releases
|
||||||
|
|
||||||
See the [VERSIONING.md](VERSIONING.md) document for our policies for releases and compatibility
|
Releases are published to maven central. We
|
||||||
guarantees.
|
publish [minor releases monthly](RELEASING.md#release-cadence)
|
||||||
|
and [patch releases as needed](RELEASING.md#preparing-a-new-patch-release).
|
||||||
|
|
||||||
Check out information about the [latest release](https://github.com/open-telemetry/opentelemetry-java/releases).
|
See [releases](https://github.com/open-telemetry/opentelemetry-java/releases) for a listing of
|
||||||
|
released versions and notes (see also [changelog](CHANGELOG.md)).
|
||||||
|
|
||||||
See the project [milestones](https://github.com/open-telemetry/opentelemetry-java/milestones)
|
## Artifacts
|
||||||
for details on upcoming releases. The dates and features described in issues
|
|
||||||
and milestones are estimates, and subject to change.
|
|
||||||
|
|
||||||
The following tables describe the artifacts published by this project. To take a dependency, follow
|
The artifacts published by this repository are summarized below in tables, organized in collapsible
|
||||||
the instructions in [Published Released](#published-releases) to include the BOM, and specify the
|
sections by topic.
|
||||||
dependency as follows, replacing `{{artifact-id}}` with the value from the "Artifact ID" column:
|
|
||||||
|
As discussed in [compatibility](#compatibility), artifact versions must be kept in sync, for which
|
||||||
|
we strongly recommend [using one of our BOMs][dependencies-and-boms].
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Bill of Materials (BOMs)</summary>
|
||||||
|
|
||||||
|
A bill of materials (or BOM) helps sync dependency versions of related artifacts.
|
||||||
|
|
||||||
|
| Component | Description | Artifact ID | Version | Javadoc |
|
||||||
|
|----------------------------------------------|----------------------------------------|---------------------------|-------------------------------------------------------------|---------|
|
||||||
|
| [Bill of Materials (BOM)](./bom) | Bill of materials for stable artifacts | `opentelemetry-bom` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | N/A |
|
||||||
|
| [Alpha Bill of Materials (BOM)](./bom-alpha) | Bill of materials for alpha artifacts | `opentelemetry-bom-alpha` | <!--VERSION_UNSTABLE-->1.52.0-alpha<!--/VERSION_UNSTABLE--> | N/A |
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details open>
|
||||||
|
<summary>API</summary>
|
||||||
|
|
||||||
|
The OpenTelemetry API for recording telemetry.
|
||||||
|
|
||||||
|
| Component | Description | Artifact ID | Version | Javadoc |
|
||||||
|
|-----------------------------------|--------------------------------------------------------------------------------------|-------------------------------|-------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| [API](./api/all) | OpenTelemetry API, including metrics, traces, baggage, context | `opentelemetry-api` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api) |
|
||||||
|
| [API Incubator](./api/incubator) | API incubator, including pass through propagator, and extended tracer, and Event API | `opentelemetry-api-incubator` | <!--VERSION_UNSTABLE-->1.52.0-alpha<!--/VERSION_UNSTABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api-incubator) |
|
||||||
|
| [Context API](./context) | OpenTelemetry context API | `opentelemetry-context` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-context) |
|
||||||
|
| [Common](./common) | Common utility methods used across API components | `opentelemetry-common` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-common) |
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>API Extensions</summary>
|
||||||
|
|
||||||
|
Extensions to the OpenTelemetry API.
|
||||||
|
|
||||||
|
| Component | Description | Artifact ID | Version | Javadoc |
|
||||||
|
|---------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------|-------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| [Kotlin Extension](./extensions/kotlin) | Context extension for coroutines | `opentelemetry-extension-kotlin` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-extension-kotlin) |
|
||||||
|
| [Trace Propagators Extension](./extensions/trace-propagators) | Trace propagators, including B3, Jaeger, OT Trace | `opentelemetry-extension-trace-propagators` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-extension-trace-propagators) |
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details open>
|
||||||
|
<summary>SDK</summary>
|
||||||
|
|
||||||
|
The OpenTelemetry SDK for managing telemetry producing by the API.
|
||||||
|
|
||||||
|
| Component | Description | Artifact ID | Version | Javadoc |
|
||||||
|
|------------------------------|--------------------------------------------------------|-----------------------------|---------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| [SDK](./sdk/all) | OpenTelemetry SDK, including metrics, traces, and logs | `opentelemetry-sdk` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk) |
|
||||||
|
| [Metrics SDK](./sdk/metrics) | OpenTelemetry metrics SDK | `opentelemetry-sdk-metrics` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-metrics) |
|
||||||
|
| [Trace SDK](./sdk/trace) | OpenTelemetry trace SDK | `opentelemetry-sdk-trace` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-trace) |
|
||||||
|
| [Log SDK](./sdk/logs) | OpenTelemetry log SDK | `opentelemetry-sdk-logs` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-logs) |
|
||||||
|
| [SDK Common](./sdk/common) | Shared SDK components | `opentelemetry-sdk-common` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-common) |
|
||||||
|
| [SDK Testing](./sdk/testing) | Components for testing OpenTelemetry instrumentation | `opentelemetry-sdk-testing` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-testing) |
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>SDK Exporters</summary>
|
||||||
|
|
||||||
|
SDK exporters for shipping traces, metrics, and logs out of process.
|
||||||
|
|
||||||
|
| Component | Description | Artifact ID | Version | Javadoc |
|
||||||
|
|-----------------------------------------------------------------------|------------------------------------------------------------------------------|------------------------------------------------------|-------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| [OTLP Exporters](./exporters/otlp/all) | OTLP gRPC & HTTP exporters, including traces, metrics, and logs | `opentelemetry-exporter-otlp` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-otlp) |
|
||||||
|
| [OTLP Logging Exporters](./exporters/logging-otlp) | Logging exporters in OTLP JSON encoding, including traces, metrics, and logs | `opentelemetry-exporter-logging-otlp` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-logging-otlp) |
|
||||||
|
| [OTLP Common](./exporters/otlp/common) | Shared OTLP components (internal) | `opentelemetry-exporter-otlp-common` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-otlp-common) |
|
||||||
|
| [Logging Exporter](./exporters/logging) | Logging exporters, including metrics, traces, and logs | `opentelemetry-exporter-logging` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-logging) |
|
||||||
|
| [Zipkin Exporter](./exporters/zipkin) | Zipkin trace exporter | `opentelemetry-exporter-zipkin` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-zipkin) |
|
||||||
|
| [Prometheus Exporter](./exporters/prometheus) | Prometheus metric exporter | `opentelemetry-exporter-prometheus` | <!--VERSION_UNSTABLE-->1.52.0-alpha<!--/VERSION_UNSTABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-prometheus) |
|
||||||
|
| [Exporter Common](./exporters/common) | Shared exporter components (internal) | `opentelemetry-exporter-common` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-common) |
|
||||||
|
| [OkHttp Sender](./exporters/sender/okhttp) | OkHttp implementation of HttpSender (internal) | `opentelemetry-exporter-sender-okhttp` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-sender-okhttp) |
|
||||||
|
| [JDK Sender](./exporters/sender/jdk) | Java 11+ native HttpClient implementation of HttpSender (internal) | `opentelemetry-exporter-sender-jdk` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-sender-jdk) | |
|
||||||
|
| [gRPC ManagedChannel Sender](./exporters/sender/grpc-managed-channel) | gRPC ManagedChannel implementation of GrpcSender (internal) | `opentelemetry-exporter-sender-grpc-managed-channel` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-sender-grpc-managed-channel) | |
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>SDK Extensions</summary>
|
||||||
|
|
||||||
|
Extensions to the OpenTelemetry SDK.
|
||||||
|
|
||||||
|
| Component | Description | Artifact ID | Version | Javadoc |
|
||||||
|
|-------------------------------------------------------------------------------|------------------------------------------------------------------------------------|-----------------------------------------------------|-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| [SDK Autoconfigure](./sdk-extensions/autoconfigure) | Autoconfigure OpenTelemetry SDK from env vars, system properties, and SPI | `opentelemetry-sdk-extension-autoconfigure` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-extension-autoconfigure) |
|
||||||
|
| [SDK Autoconfigure SPI](./sdk-extensions/autoconfigure-spi) | Service Provider Interface (SPI) definitions for autoconfigure | `opentelemetry-sdk-extension-autoconfigure-spi` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-extension-autoconfigure-spi) |
|
||||||
|
| [SDK Jaeger Remote Sampler Extension](./sdk-extensions/jaeger-remote-sampler) | Sampler which obtains sampling configuration from remote Jaeger server | `opentelemetry-sdk-extension-jaeger-remote-sampler` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-extension-jaeger-remote-sampler) |
|
||||||
|
| [SDK Incubator](./sdk-extensions/incubator) | SDK incubator, including YAML based view configuration, LeakDetectingSpanProcessor | `opentelemetry-sdk-extension-incubator` | <!--VERSION_UNSTABLE-->1.52.0-alpha<!--/VERSION_UNSTABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-extension-incubator) |
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Shims</summary>
|
||||||
|
|
||||||
|
Shims for bridging data from one observability library to another.
|
||||||
|
|
||||||
|
| Component | Description | Artifact ID | Version | Javadoc |
|
||||||
|
|----------------------------------------|--------------------------------------------------------------|----------------------------------|-------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| [OpenCensus Shim](./opencensus-shim) | Bridge opencensus metrics into the OpenTelemetry metrics SDK | `opentelemetry-opencensus-shim` | <!--VERSION_UNSTABLE-->1.52.0-alpha<!--/VERSION_UNSTABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-opencensus-shim) |
|
||||||
|
| [OpenTracing Shim](./opentracing-shim) | Bridge opentracing spans into the OpenTelemetry trace API | `opentelemetry-opentracing-shim` | <!--VERSION_STABLE-->1.52.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-opentracing-shim) |
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
To take a dependency, [include a BOM][dependencies-and-boms] and specify the dependency as follows,
|
||||||
|
replacing `{{artifact-id}}` with the value from the "Artifact ID" column
|
||||||
|
from [artifacts](#artifacts):
|
||||||
|
|
||||||
|
<details open>
|
||||||
|
<summary>Gradle</summary>
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
implementation('io.opentelemetry:{{artifact-id}}')
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Maven</summary>
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -220,126 +166,142 @@ dependency as follows, replacing `{{artifact-id}}` with the value from the "Arti
|
||||||
<artifactId>{{artifact-id}}</artifactId>
|
<artifactId>{{artifact-id}}</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Snapshots
|
||||||
|
|
||||||
|
Snapshots of the `main` branch are available as follows:
|
||||||
|
|
||||||
|
<details open>
|
||||||
|
<summary>Gradle</summary>
|
||||||
|
|
||||||
```groovy
|
```groovy
|
||||||
implementation('io.opentelemetry:{{artifact-id}}')
|
repositories {
|
||||||
|
maven { url 'https://central.sonatype.com/repository/maven-snapshots/' }
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation platform("io.opentelemetry:opentelemetry-bom:1.53.0-SNAPSHOT")
|
||||||
|
implementation('io.opentelemetry:opentelemetry-api')
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
### Bill of Material
|
<details>
|
||||||
|
<summary>Maven</summary>
|
||||||
|
|
||||||
| Component | Description | Artifact ID | Version | Javadoc |
|
```xml
|
||||||
|----------------------------------------------|----------------------------------------|---------------------------|-------------------------------------------------------------|---------|
|
<project>
|
||||||
| [Bill of Materials (BOM)](./bom) | Bill of materials for stable artifacts | `opentelemetry-bom` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | N/A |
|
<repositories>
|
||||||
| [Alpha Bill of Materials (BOM)](./bom-alpha) | Bill of materials for alpha artifacts | `opentelemetry-bom-alpha` | <!--VERSION_UNSTABLE-->1.41.0-alpha<!--/VERSION_UNSTABLE--> | N/A |
|
<repository>
|
||||||
|
<id>sonatype-snapshot-repository</id>
|
||||||
|
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.opentelemetry</groupId>
|
||||||
|
<artifactId>opentelemetry-bom</artifactId>
|
||||||
|
<version>1.53.0-SNAPSHOT</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.opentelemetry</groupId>
|
||||||
|
<artifactId>opentelemetry-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
### API
|
## Compatibility
|
||||||
|
|
||||||
|
Artifacts from this repository follow semantic versioning.
|
||||||
|
|
||||||
| Component | Description | Artifact ID | Version | Javadoc |
|
Stable artifacts (i.e. artifacts without `-alpha` version suffix) come with strong backwards
|
||||||
|-----------------------------------|--------------------------------------------------------------------------------------|-------------------------------|---------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
compatibility guarantees for public APIs.
|
||||||
| [API](./api/all) | OpenTelemetry API, including metrics, traces, baggage, context | `opentelemetry-api` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api) |
|
|
||||||
| [API Incubator](./api/incubator) | API incubator, including pass through propagator, and extended tracer, and Event API | `opentelemetry-api-incubator` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api-incubator) |
|
|
||||||
| [Context API](./context) | OpenTelemetry context API | `opentelemetry-context` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-context) |
|
|
||||||
|
|
||||||
### API Extensions
|
Artifacts may depend on other artifacts from this repository, and may depend on internal APIs (i.e.
|
||||||
|
non-public APIs) which are subject to change across minor versions. Therefore, it's critical to keep
|
||||||
|
artifact versions in sync in order to avoid possible runtime exceptions. We strongly
|
||||||
|
recommend [using one of our BOMs][dependencies-and-boms] to assist in keeping artifacts in sync.
|
||||||
|
|
||||||
| Component | Description | Artifact ID | Version | Javadoc |
|
See the [VERSIONING.md](VERSIONING.md) for complete details on compatibility policy.
|
||||||
|---------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------|-------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
||||||
| [Kotlin Extension](./extensions/kotlin) | Context extension for coroutines | `opentelemetry-extension-kotlin` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-extension-kotlin) |
|
|
||||||
| [Trace Propagators Extension](./extensions/trace-propagators) | Trace propagators, including B3, Jaeger, OT Trace | `opentelemetry-extension-trace-propagators` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-extension-trace-propagators) |
|
|
||||||
|
|
||||||
### SDK
|
## Contacting us
|
||||||
|
|
||||||
| Component | Description | Artifact ID | Version | Javadoc |
|
We hold regular meetings. See details at [community page](https://github.com/open-telemetry/community#java-sdk).
|
||||||
|------------------------------|--------------------------------------------------------|-----------------------------|---------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
||||||
| [SDK](./sdk/all) | OpenTelemetry SDK, including metrics, traces, and logs | `opentelemetry-sdk` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk) |
|
|
||||||
| [Metrics SDK](./sdk/metrics) | OpenTelemetry metrics SDK | `opentelemetry-sdk-metrics` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-metrics) |
|
|
||||||
| [Trace SDK](./sdk/trace) | OpenTelemetry trace SDK | `opentelemetry-sdk-trace` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-trace) |
|
|
||||||
| [Log SDK](./sdk/logs) | OpenTelemetry log SDK | `opentelemetry-sdk-logs` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-logs) |
|
|
||||||
| [SDK Common](./sdk/common) | Shared SDK components | `opentelemetry-sdk-common` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-common) |
|
|
||||||
| [SDK Testing](./sdk/testing) | Components for testing OpenTelemetry instrumentation | `opentelemetry-sdk-testing` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-testing) |
|
|
||||||
|
|
||||||
### SDK Exporters
|
To report a bug, or request a new feature,
|
||||||
|
please [open an issue](https://github.com/open-telemetry/opentelemetry-java/issues/new/choose).
|
||||||
|
|
||||||
| Component | Description | Artifact ID | Version | Javadoc |
|
We use [GitHub Discussions](https://github.com/open-telemetry/opentelemetry-java/discussions)
|
||||||
|-----------------------------------------------------------------------|------------------------------------------------------------------------------|------------------------------------------------------|-------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
for support or general questions. Feel free to drop us a line.
|
||||||
| [OTLP Exporters](./exporters/otlp/all) | OTLP gRPC & HTTP exporters, including traces, metrics, and logs | `opentelemetry-exporter-otlp` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-otlp) |
|
|
||||||
| [OTLP Logging Exporters](./exporters/logging-otlp) | Logging exporters in OTLP JSON encoding, including traces, metrics, and logs | `opentelemetry-exporter-logging-otlp` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-logging-otlp) |
|
|
||||||
| [OTLP Common](./exporters/otlp/common) | Shared OTLP components (internal) | `opentelemetry-exporter-otlp-common` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-otlp-common) |
|
|
||||||
| [Logging Exporter](./exporters/logging) | Logging exporters, including metrics, traces, and logs | `opentelemetry-exporter-logging` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-logging) |
|
|
||||||
| [Zipkin Exporter](./exporters/zipkin) | Zipkin trace exporter | `opentelemetry-exporter-zipkin` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-zipkin) |
|
|
||||||
| [Prometheus Exporter](./exporters/prometheus) | Prometheus metric exporter | `opentelemetry-exporter-prometheus` | <!--VERSION_UNSTABLE-->1.41.0-alpha<!--/VERSION_UNSTABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-prometheus) |
|
|
||||||
| [Exporter Common](./exporters/common) | Shared exporter components (internal) | `opentelemetry-exporter-common` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-common) |
|
|
||||||
| [OkHttp Sender](./exporters/sender/okhttp) | OkHttp implementation of HttpSender (internal) | `opentelemetry-exporter-sender-okhttp` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-sender-okhttp) |
|
|
||||||
| [JDK Sender](./exporters/sender/jdk) | Java 11+ native HttpClient implementation of HttpSender (internal) | `opentelemetry-exporter-sender-jdk` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-sender-jdk) | |
|
|
||||||
| [gRPC ManagedChannel Sender](./exporters/sender/grpc-managed-channel) | gRPC ManagedChannel implementation of GrpcSender (internal) | `opentelemetry-exporter-sender-grpc-managed-channel` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-sender-grpc-managed-channel) | |
|
|
||||||
|
|
||||||
### SDK Extensions
|
We are also present in the [`#otel-java`](https://cloud-native.slack.com/archives/C014L2KCTE3) channel in the [CNCF slack](https://slack.cncf.io/).
|
||||||
|
Please join us for more informal discussions.
|
||||||
| Component | Description | Artifact ID | Version | Javadoc |
|
|
||||||
|-------------------------------------------------------------------------------|------------------------------------------------------------------------------------|-----------------------------------------------------|-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
||||||
| [SDK Autoconfigure](./sdk-extensions/autoconfigure) | Autoconfigure OpenTelemetry SDK from env vars, system properties, and SPI | `opentelemetry-sdk-extension-autoconfigure` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-extension-autoconfigure) |
|
|
||||||
| [SDK Autoconfigure SPI](./sdk-extensions/autoconfigure-spi) | Service Provider Interface (SPI) definitions for autoconfigure | `opentelemetry-sdk-extension-autoconfigure-spi` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-extension-autoconfigure-spi) |
|
|
||||||
| [SDK Jaeger Remote Sampler Extension](./sdk-extensions/jaeger-remote-sampler) | Sampler which obtains sampling configuration from remote Jaeger server | `opentelemetry-sdk-extension-jaeger-remote-sampler` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-extension-jaeger-remote-sampler) |
|
|
||||||
| [SDK Incubator](./sdk-extensions/incubator) | SDK incubator, including YAML based view configuration, LeakDetectingSpanProcessor | `opentelemetry-sdk-extension-incubator` | <!--VERSION_UNSTABLE-->1.41.0-alpha<!--/VERSION_UNSTABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-extension-incubator) |
|
|
||||||
|
|
||||||
### Shims
|
|
||||||
|
|
||||||
| Component | Description | Artifact ID | Version | Javadoc |
|
|
||||||
|----------------------------------------|--------------------------------------------------------------|----------------------------------|-------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
||||||
| [OpenCensus Shim](./opencensus-shim) | Bridge opencensus metrics into the OpenTelemetry metrics SDK | `opentelemetry-opencensus-shim` | <!--VERSION_UNSTABLE-->1.41.0-alpha<!--/VERSION_UNSTABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-opencensus-shim) |
|
|
||||||
| [OpenTracing Shim](./opentracing-shim) | Bridge opentracing spans into the OpenTelemetry trace API | `opentelemetry-opentracing-shim` | <!--VERSION_STABLE-->1.41.0<!--/VERSION_STABLE--> | [](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-opentracing-shim) |
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for:
|
||||||
|
|
||||||
Triagers:
|
* Details on building locally
|
||||||
|
* Project scope
|
||||||
|
* Keys to successful PRs
|
||||||
|
* Guide to using gradle composite builds
|
||||||
|
|
||||||
- [Gregor Zeitlinger](https://github.com/zeitlinger), Grafana Labs
|
### Maintainers
|
||||||
|
|
||||||
*Find more about the triager role in [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#triager).*
|
- [Jack Berg](https://github.com/jack-berg), New Relic
|
||||||
|
- [John Watson](https://github.com/jkwatson), Verta.ai
|
||||||
|
|
||||||
Approvers ([@open-telemetry/java-approvers](https://github.com/orgs/open-telemetry/teams/java-approvers)):
|
For more information about the maintainer role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer).
|
||||||
|
|
||||||
|
### Approvers
|
||||||
|
|
||||||
- [Jason Plumb](https://github.com/breedx-splk), Splunk
|
- [Jason Plumb](https://github.com/breedx-splk), Splunk
|
||||||
- [Josh Suereth](https://github.com/jsuereth), Google
|
- [Josh Suereth](https://github.com/jsuereth), Google
|
||||||
- [Lauri Tulmin](https://github.com/laurit), Splunk
|
- [Lauri Tulmin](https://github.com/laurit), Splunk
|
||||||
- [Trask Stalnaker](https://github.com/trask), Microsoft
|
- [Trask Stalnaker](https://github.com/trask), Microsoft
|
||||||
|
|
||||||
*Find more about the approver role in [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver).*
|
For more information about the approver role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver).
|
||||||
|
|
||||||
Maintainers ([@open-telemetry/java-maintainers](https://github.com/orgs/open-telemetry/teams/java-maintainers)):
|
### Triagers
|
||||||
|
|
||||||
- [Jack Berg](https://github.com/jack-berg), New Relic
|
- [Gregor Zeitlinger](https://github.com/zeitlinger), Grafana Labs
|
||||||
- [John Watson](https://github.com/jkwatson), Verta.ai
|
|
||||||
|
|
||||||
Emeritus:
|
For more information about the triager role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#triager).
|
||||||
|
|
||||||
|
### Emeritus
|
||||||
|
|
||||||
- Maintainer [Bogdan Drutu](https://github.com/BogdanDrutu)
|
- Maintainer [Bogdan Drutu](https://github.com/BogdanDrutu)
|
||||||
- Maintainer [Carlos Alberto](https://github.com/carlosalberto)
|
- Maintainer [Carlos Alberto](https://github.com/carlosalberto)
|
||||||
- Approver [Mateusz Rzeszutek](https://github.com/mateuszrzeszutek)
|
- Approver [Mateusz Rzeszutek](https://github.com/mateuszrzeszutek)
|
||||||
|
|
||||||
*Find more about the maintainer role in [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#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 the people who have contributed
|
### Help wanted
|
||||||
|
|
||||||
|
We are currently resource constrained and are actively seeking new contributors interested in working towards [approver](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver) / [maintainer](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer) roles. In addition to the documentation for approver / maintainer roles and the [contributing](./CONTRIBUTING.md) guide, here are some additional notes on engaging:
|
||||||
|
|
||||||
|
- [Pull request](https://github.com/open-telemetry/opentelemetry-java/pulls) reviews are equally or more helpful than code contributions. Comments and approvals are valuable with or without a formal project role. They're also a great forcing function to explore a fairly complex codebase.
|
||||||
|
- Attending the [Java: SDK + Automatic Instrumentation](https://github.com/open-telemetry/community?tab=readme-ov-file#implementation-sigs) Special Interest Group (SIG) is a great way to get to know community members and learn about project priorities.
|
||||||
|
- Issues labeled [help wanted](https://github.com/open-telemetry/opentelemetry-java/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) are project priorities. Code contributions (or pull request reviews when a PR is linked) for these issues are particularly important.
|
||||||
|
- Triaging / responding to new issues and discussions is a great way to engage with the project.
|
||||||
|
|
||||||
|
### Thanks to all of our contributors!
|
||||||
|
|
||||||
<a href="https://github.com/open-telemetry/opentelemetry-java/graphs/contributors">
|
<a href="https://github.com/open-telemetry/opentelemetry-java/graphs/contributors">
|
||||||
<img src="https://contrib.rocks/image?repo=open-telemetry/opentelemetry-java" />
|
<img alt="Repo contributors" src="https://contrib.rocks/image?repo=open-telemetry/opentelemetry-java" />
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
Made with [contrib.rocks](https://contrib.rocks).
|
|
||||||
|
|
||||||
[ci-image]: https://github.com/open-telemetry/opentelemetry-java/workflows/Build/badge.svg
|
|
||||||
[ci-url]: https://github.com/open-telemetry/opentelemetry-java/actions?query=workflow%3ABuild+branch%3Amain
|
|
||||||
[codecov-image]: https://codecov.io/gh/open-telemetry/opentelemetry-java/branch/main/graph/badge.svg
|
[codecov-image]: https://codecov.io/gh/open-telemetry/opentelemetry-java/branch/main/graph/badge.svg
|
||||||
[codecov-url]: https://app.codecov.io/gh/open-telemetry/opentelemetry-java/branch/main/
|
[codecov-url]: https://app.codecov.io/gh/open-telemetry/opentelemetry-java/branch/main/
|
||||||
[Manual instrumentation]: https://opentelemetry.io/docs/java/manual_instrumentation/
|
[dependencies-and-boms]: https://opentelemetry.io/docs/languages/java/intro/#dependencies-and-boms
|
||||||
[maven-image]: https://maven-badges.herokuapp.com/maven-central/io.opentelemetry/opentelemetry-api/badge.svg
|
[maven-image]: https://maven-badges.sml.io/maven-central/io.opentelemetry/opentelemetry-api/badge.svg
|
||||||
[maven-url]: https://maven-badges.herokuapp.com/maven-central/io.opentelemetry/opentelemetry-api
|
[maven-url]: https://maven-badges.sml.io/maven-central/io.opentelemetry/opentelemetry-api
|
||||||
[opentelemetry-java-instrumentation]: https://github.com/open-telemetry/opentelemetry-java-instrumentation
|
|
||||||
[opentelemetry-java-examples]: https://github.com/open-telemetry/opentelemetry-java-examples
|
|
||||||
[opentelemetry-semantic-conventions]: https://opentelemetry.io/docs/specs/semconv/
|
|
||||||
[opentelemetry-semantic-conventions-java]: https://github.com/open-telemetry/semantic-conventions-java
|
|
||||||
[opentelemetry.io]: https://opentelemetry.io
|
|
||||||
[otel-java-status]: https://opentelemetry.io/docs/instrumentation/java/#status-and-releases
|
|
||||||
|
|
23
RELEASING.md
23
RELEASING.md
|
@ -57,23 +57,16 @@ and deadlocks.
|
||||||
* Review and merge the pull request that it creates for updating the change log in main
|
* Review and merge the pull request that it creates for updating the change log in main
|
||||||
(note that if this is not a patch release then the change log on main may already be up-to-date,
|
(note that if this is not a patch release then the change log on main may already be up-to-date,
|
||||||
in which case no pull request will be created).
|
in which case no pull request will be created).
|
||||||
|
* Once the release artifacts become available on Maven Central, the system will automatically
|
||||||
|
generate a new pull request titled `Update apidiff baseline and documentation versions to
|
||||||
|
released version $VERSION`. This pull request will contain updates to both the API diff baseline
|
||||||
|
and version references in the documentation files (README.md). Please review and merge this
|
||||||
|
automated pull request.
|
||||||
* The [website](https://github.com/open-telemetry/opentelemetry.io) contains automation to update
|
* The [website](https://github.com/open-telemetry/opentelemetry.io) contains automation to update
|
||||||
to the newly released version. Review and approve the pull request when available.
|
to the newly released version. Review and approve the pull request when available.
|
||||||
|
* The [website](https://opentelemetry.io/docs/languages/java/configuration/#zero-code-sdk-autoconfigure)
|
||||||
## Update release versions in documentations
|
contains documentation on autoconfiguration properties. If the release has updated or modified any
|
||||||
|
properties, open and merge a pull request to update the documentation.
|
||||||
After releasing is done, you need to first update the docs. This needs to happen after artifacts have propagated
|
|
||||||
to Maven Central so should probably be done an hour or two after the release workflow finishes.
|
|
||||||
|
|
||||||
```
|
|
||||||
./gradlew updateVersionInDocs -Prelease.version=x.y.z
|
|
||||||
./gradlew japicmp -PapiBaseVersion=a.b.c -PapiNewVersion=x.y.z
|
|
||||||
./gradlew --refresh-dependencies japicmp
|
|
||||||
```
|
|
||||||
|
|
||||||
Where `x.y.z` is the version just released and `a.b.c` is the previous version.
|
|
||||||
|
|
||||||
Create a PR against the main branch with the changes.
|
|
||||||
|
|
||||||
## Credentials
|
## Credentials
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ changes are:
|
||||||
reordering parameters, adding a method to an interface or abstract class without adding a default
|
reordering parameters, adding a method to an interface or abstract class without adding a default
|
||||||
implementation.
|
implementation.
|
||||||
|
|
||||||
- ABI changes that could require code using the artifact to be recompiled, but not changed, e.g.,
|
- [ABI](https://wikipedia.org/wiki/Application_binary_interface) changes that could require code using the artifact to be recompiled, but not changed, e.g.,
|
||||||
changing the return type of a method from `void` to non-`void`, changing a `class` to an `interface`.
|
changing the return type of a method from `void` to non-`void`, changing a `class` to an `interface`.
|
||||||
The [JLS](https://docs.oracle.com/javase/specs/jls/se7/html/jls-13.html) has more information on
|
The [JLS](https://docs.oracle.com/javase/specs/jls/se7/html/jls-13.html) has more information on
|
||||||
what constitutes compatible changes.
|
what constitutes compatible changes.
|
||||||
|
@ -72,8 +72,8 @@ respect to semantic versioning.
|
||||||
| Language | Minimum Version | Applicability | Semconv Notes |
|
| Language | Minimum Version | Applicability | Semconv Notes |
|
||||||
|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| Java | 8+ | All artifacts, unless otherwise noted | Changing requires major version bump. |
|
| Java | 8+ | All artifacts, unless otherwise noted | Changing requires major version bump. |
|
||||||
| Android | 21+ (NOTE: [desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring) is required. We stay up to date with the latest version of [desugar_jdk_libs](https://github.com/google/desugar_jdk_libs).) | Artifacts using `otel.animalsniffer-conventions` plugin | Kept in sync with minimum requirements for [Google Play services](https://developers.google.com/android/guides/setup). Subject to change in minor version. |
|
| Android | 23+ (NOTE: [desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring) is required. We stay up to date with the latest version of [desugar_jdk_libs](https://github.com/google/desugar_jdk_libs).) | Artifacts using `otel.animalsniffer-conventions` plugin | Kept in sync with minimum requirements for [Google Play services](https://developers.google.com/android/guides/setup). Subject to change in minor version. |
|
||||||
| Kotlin | 1.6+ | Only applies to `opentelemetry-extension-kotlin` | Kept in sync with [minimum non-deprecated](https://kotlinlang.org/docs/gradle-compiler-options.html#attributes-common-to-jvm-and-js) version. Subject to change in minor versions. |
|
| Kotlin | 1.8+ | Only applies to `opentelemetry-extension-kotlin` | Kept in sync with [minimum non-deprecated](https://kotlinlang.org/docs/gradle-compiler-options.html#attributes-common-to-jvm-and-js) version. Subject to change in minor versions. |
|
||||||
|
|
||||||
## API vs SDK
|
## API vs SDK
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ class SdkDesignTest {
|
||||||
* Ensures that all SDK methods that: - are defined in classes that extend or implement API model
|
* Ensures that all SDK methods that: - are defined in classes that extend or implement API model
|
||||||
* and are public (to exclude protected builders) - are public (avoids issues with protected
|
* and are public (to exclude protected builders) - are public (avoids issues with protected
|
||||||
* methods returning classes unavailable to test's CL) - override or implement parent method
|
* methods returning classes unavailable to test's CL) - override or implement parent method
|
||||||
* return only API, Context or generic Java type.
|
* return only API, Context, Common, or generic Java type.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
void sdkImplementationOfApiClassesShouldReturnApiTypeOnly() {
|
void sdkImplementationOfApiClassesShouldReturnApiTypeOnly() {
|
||||||
|
@ -45,7 +45,11 @@ class SdkDesignTest {
|
||||||
.and(implementOrOverride())
|
.and(implementOrOverride())
|
||||||
.should()
|
.should()
|
||||||
.haveRawReturnType(
|
.haveRawReturnType(
|
||||||
inPackage("io.opentelemetry.api..", "io.opentelemetry.context..", "java.."))
|
inPackage(
|
||||||
|
"io.opentelemetry.api..",
|
||||||
|
"io.opentelemetry.context..",
|
||||||
|
"io.opentelemetry.common..",
|
||||||
|
"java.."))
|
||||||
.orShould()
|
.orShould()
|
||||||
.haveRawReturnType("void");
|
.haveRawReturnType("void");
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ configurations.add(signatureJarClasspath)
|
||||||
configurations.add(generatedSignature)
|
configurations.add(generatedSignature)
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
signature("com.toasttab.android:gummy-bears-api-21:0.9.0@signature")
|
signature("com.toasttab.android:gummy-bears-api-23:0.12.0@signature")
|
||||||
signatureJar("com.android.tools:desugar_jdk_libs")
|
signatureJar("com.android.tools:desugar_jdk_libs")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("otel.java-conventions")
|
id("otel.java-conventions")
|
||||||
id("otel.publish-conventions")
|
id("otel.publish-conventions")
|
||||||
id("java-test-fixtures")
|
|
||||||
|
|
||||||
id("otel.jmh-conventions")
|
id("otel.jmh-conventions")
|
||||||
id("otel.animalsniffer-conventions")
|
id("otel.animalsniffer-conventions")
|
||||||
|
@ -16,12 +15,10 @@ dependencies {
|
||||||
|
|
||||||
annotationProcessor("com.google.auto.value:auto-value")
|
annotationProcessor("com.google.auto.value:auto-value")
|
||||||
|
|
||||||
|
testImplementation(project(":api:testing-internal"))
|
||||||
|
|
||||||
testImplementation("edu.berkeley.cs.jqf:jqf-fuzz")
|
testImplementation("edu.berkeley.cs.jqf:jqf-fuzz")
|
||||||
testImplementation("com.google.guava:guava-testlib")
|
testImplementation("com.google.guava:guava-testlib")
|
||||||
testFixturesApi(project(":testing-internal"))
|
|
||||||
testFixturesApi("junit:junit")
|
|
||||||
testFixturesApi("org.assertj:assertj-core")
|
|
||||||
testFixturesApi("org.mockito:mockito-core")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.test {
|
tasks.test {
|
||||||
|
|
|
@ -17,6 +17,7 @@ import io.opentelemetry.api.trace.TracerProvider;
|
||||||
import io.opentelemetry.context.propagation.ContextPropagators;
|
import io.opentelemetry.context.propagation.ContextPropagators;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.function.Supplier;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -116,6 +117,21 @@ public final class GlobalOpenTelemetry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the {@link OpenTelemetry} that should be the global instance.
|
||||||
|
*
|
||||||
|
* <p>This method calls the given {@code supplier} and calls {@link #set(OpenTelemetry)}, all
|
||||||
|
* while holding the {@link GlobalOpenTelemetry} mutex.
|
||||||
|
*
|
||||||
|
* @since 1.52.0
|
||||||
|
*/
|
||||||
|
public static void set(Supplier<OpenTelemetry> supplier) {
|
||||||
|
synchronized (mutex) {
|
||||||
|
OpenTelemetry openTelemetry = supplier.get();
|
||||||
|
set(openTelemetry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns the globally registered {@link TracerProvider}. */
|
/** Returns the globally registered {@link TracerProvider}. */
|
||||||
public static TracerProvider getTracerProvider() {
|
public static TracerProvider getTracerProvider() {
|
||||||
return get().getTracerProvider();
|
return get().getTracerProvider();
|
||||||
|
|
|
@ -99,4 +99,23 @@ public interface Baggage extends ImplicitContextKeyed {
|
||||||
* be set to not use an implicit parent, so any parent assignment must be done manually.
|
* be set to not use an implicit parent, so any parent assignment must be done manually.
|
||||||
*/
|
*/
|
||||||
BaggageBuilder toBuilder();
|
BaggageBuilder toBuilder();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@code BaggageEntry} associated with the given key.
|
||||||
|
*
|
||||||
|
* @param entryKey entry key to return the {@code BaggageEntry} for, or {@code null} if no {@code
|
||||||
|
* Entry} with the given {@code entryKey} is in this {@code Baggage}.
|
||||||
|
* @since 1.43.0
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
default BaggageEntry getEntry(String entryKey) {
|
||||||
|
BaggageEntry[] result = new BaggageEntry[] {null};
|
||||||
|
forEach(
|
||||||
|
(key, entry) -> {
|
||||||
|
if (entryKey.equals(key)) {
|
||||||
|
result[0] = entry;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,13 @@ final class ImmutableBaggage extends ImmutableKeyValuePairs<String, BaggageEntry
|
||||||
return entry != null ? entry.getValue() : null;
|
return entry != null ? entry.getValue() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Overrides the default implementation to provide a more performant implementation.
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public BaggageEntry getEntry(String entryKey) {
|
||||||
|
return get(entryKey);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaggageBuilder toBuilder() {
|
public BaggageBuilder toBuilder() {
|
||||||
return new Builder(new ArrayList<>(data()));
|
return new Builder(new ArrayList<>(data()));
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
* <p>Note that entries are independent of the tracing data that is propagated in the {@link
|
* <p>Note that entries are independent of the tracing data that is propagated in the {@link
|
||||||
* io.opentelemetry.context.Context}, such as trace ID.
|
* io.opentelemetry.context.Context}, such as trace ID.
|
||||||
*/
|
*/
|
||||||
// TODO: Add code examples.
|
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
package io.opentelemetry.api.baggage;
|
package io.opentelemetry.api.baggage;
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Parser {
|
||||||
|
|
||||||
private boolean skipToNext;
|
private boolean skipToNext;
|
||||||
|
|
||||||
public Parser(String baggageHeader) {
|
Parser(String baggageHeader) {
|
||||||
this.baggageHeader = baggageHeader;
|
this.baggageHeader = baggageHeader;
|
||||||
reset(0);
|
reset(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import io.opentelemetry.context.propagation.TextMapGetter;
|
||||||
import io.opentelemetry.context.propagation.TextMapPropagator;
|
import io.opentelemetry.context.propagation.TextMapPropagator;
|
||||||
import io.opentelemetry.context.propagation.TextMapSetter;
|
import io.opentelemetry.context.propagation.TextMapSetter;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
@ -95,21 +96,34 @@ public final class W3CBaggagePropagator implements TextMapPropagator {
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
String baggageHeader = getter.get(carrier, FIELD);
|
return extractMulti(context, carrier, getter);
|
||||||
if (baggageHeader == null) {
|
}
|
||||||
return context;
|
|
||||||
}
|
private static <C> Context extractMulti(
|
||||||
if (baggageHeader.isEmpty()) {
|
Context context, @Nullable C carrier, TextMapGetter<C> getter) {
|
||||||
|
Iterator<String> baggageHeaders = getter.getAll(carrier, FIELD);
|
||||||
|
if (baggageHeaders == null) {
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean extracted = false;
|
||||||
BaggageBuilder baggageBuilder = Baggage.builder();
|
BaggageBuilder baggageBuilder = Baggage.builder();
|
||||||
try {
|
|
||||||
extractEntries(baggageHeader, baggageBuilder);
|
while (baggageHeaders.hasNext()) {
|
||||||
} catch (RuntimeException e) {
|
String header = baggageHeaders.next();
|
||||||
return context;
|
if (header.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
extractEntries(header, baggageBuilder);
|
||||||
|
extracted = true;
|
||||||
|
} catch (RuntimeException expected) {
|
||||||
|
// invalid baggage header, continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return context.with(baggageBuilder.build());
|
|
||||||
|
return extracted ? context.with(baggageBuilder.build()) : context;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void extractEntries(String baggageHeader, BaggageBuilder baggageBuilder) {
|
private static void extractEntries(String baggageHeader, BaggageBuilder baggageBuilder) {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
class ArrayBackedAttributesBuilder implements AttributesBuilder {
|
class ArrayBackedAttributesBuilder implements AttributesBuilder {
|
||||||
private final List<Object> data;
|
private final List<Object> data;
|
||||||
|
@ -37,7 +38,7 @@ class ArrayBackedAttributesBuilder implements AttributesBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> AttributesBuilder put(AttributeKey<T> key, T value) {
|
public <T> AttributesBuilder put(AttributeKey<T> key, @Nullable T value) {
|
||||||
if (key == null || key.getKey().isEmpty() || value == null) {
|
if (key == null || key.getKey().isEmpty() || value == null) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,11 @@ public interface AttributeKey<T> {
|
||||||
/** Returns the type of attribute for this key. Useful for building switch statements. */
|
/** Returns the type of attribute for this key. Useful for building switch statements. */
|
||||||
AttributeType getType();
|
AttributeType getType();
|
||||||
|
|
||||||
|
// TODO (jack-berg): uncomment when extended attributes are promoted from incubator to API
|
||||||
|
// default ExtendedAttributeKey<T> asExtendedAttributeKey() {
|
||||||
|
// return InternalAttributeKeyImpl.toExtendedAttributeKey(this);
|
||||||
|
// }
|
||||||
|
|
||||||
/** Returns a new AttributeKey for String valued attributes. */
|
/** Returns a new AttributeKey for String valued attributes. */
|
||||||
static AttributeKey<String> stringKey(String key) {
|
static AttributeKey<String> stringKey(String key) {
|
||||||
return InternalAttributeKeyImpl.create(key, AttributeType.STRING);
|
return InternalAttributeKeyImpl.create(key, AttributeType.STRING);
|
||||||
|
|
|
@ -18,6 +18,7 @@ import static io.opentelemetry.api.common.AttributeKey.stringKey;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/** A builder of {@link Attributes} supporting an arbitrary number of key-value pairs. */
|
/** A builder of {@link Attributes} supporting an arbitrary number of key-value pairs. */
|
||||||
public interface AttributesBuilder {
|
public interface AttributesBuilder {
|
||||||
|
@ -35,18 +36,22 @@ public interface AttributesBuilder {
|
||||||
// version.
|
// version.
|
||||||
<T> AttributesBuilder put(AttributeKey<Long> key, int value);
|
<T> AttributesBuilder put(AttributeKey<Long> key, int value);
|
||||||
|
|
||||||
/** Puts a {@link AttributeKey} with associated value into this. */
|
/**
|
||||||
<T> AttributesBuilder put(AttributeKey<T> key, T value);
|
* Puts an {@link AttributeKey} with an associated value into this if the value is non-null.
|
||||||
|
* Providing a null value does not remove or unset previously set values.
|
||||||
|
*/
|
||||||
|
<T> AttributesBuilder put(AttributeKey<T> key, @Nullable T value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Puts a String attribute into this.
|
* Puts a String attribute into this if the value is non-null. Providing a null value does not
|
||||||
|
* remove or unset previously set values.
|
||||||
*
|
*
|
||||||
* <p>Note: It is strongly recommended to use {@link #put(AttributeKey, Object)}, and pre-allocate
|
* <p>Note: It is strongly recommended to use {@link #put(AttributeKey, Object)}, and pre-allocate
|
||||||
* your keys, if possible.
|
* your keys, if possible.
|
||||||
*
|
*
|
||||||
* @return this Builder
|
* @return this Builder
|
||||||
*/
|
*/
|
||||||
default AttributesBuilder put(String key, String value) {
|
default AttributesBuilder put(String key, @Nullable String value) {
|
||||||
return put(stringKey(key), value);
|
return put(stringKey(key), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,10 @@
|
||||||
|
|
||||||
package io.opentelemetry.api.internal;
|
package io.opentelemetry.api.internal;
|
||||||
|
|
||||||
|
import java.util.ConcurrentModificationException;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,6 +21,17 @@ public final class ConfigUtil {
|
||||||
|
|
||||||
private ConfigUtil() {}
|
private ConfigUtil() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a copy of system properties which is safe to iterate over.
|
||||||
|
*
|
||||||
|
* <p>In java 8 and android environments, iterating through system properties may trigger {@link
|
||||||
|
* ConcurrentModificationException}. This method ensures callers can iterate safely without risk
|
||||||
|
* of exception. See https://github.com/open-telemetry/opentelemetry-java/issues/6732 for details.
|
||||||
|
*/
|
||||||
|
public static Properties safeSystemProperties() {
|
||||||
|
return (Properties) System.getProperties().clone();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the system property or environment variable for the {@code key}.
|
* Return the system property or environment variable for the {@code key}.
|
||||||
*
|
*
|
||||||
|
@ -33,8 +46,9 @@ public final class ConfigUtil {
|
||||||
*/
|
*/
|
||||||
public static String getString(String key, String defaultValue) {
|
public static String getString(String key, String defaultValue) {
|
||||||
String normalizedKey = normalizePropertyKey(key);
|
String normalizedKey = normalizePropertyKey(key);
|
||||||
|
|
||||||
String systemProperty =
|
String systemProperty =
|
||||||
System.getProperties().entrySet().stream()
|
safeSystemProperties().entrySet().stream()
|
||||||
.filter(entry -> normalizedKey.equals(normalizePropertyKey(entry.getKey().toString())))
|
.filter(entry -> normalizedKey.equals(normalizePropertyKey(entry.getKey().toString())))
|
||||||
.map(entry -> entry.getValue().toString())
|
.map(entry -> entry.getValue().toString())
|
||||||
.findFirst()
|
.findFirst()
|
||||||
|
|
|
@ -274,4 +274,13 @@ public abstract class ImmutableKeyValuePairs<K, V> {
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the backing data array for these attributes. This is only exposed for internal use by
|
||||||
|
* opentelemetry authors. The contents of the array MUST NOT be modified.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("AvoidObjectArrays")
|
||||||
|
public Object[] getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import io.opentelemetry.api.common.Value;
|
||||||
import io.opentelemetry.context.Context;
|
import io.opentelemetry.context.Context;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
class DefaultLogger implements Logger {
|
class DefaultLogger implements Logger {
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ class DefaultLogger implements Logger {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> LogRecordBuilder setAttribute(AttributeKey<T> key, T value) {
|
public <T> LogRecordBuilder setAttribute(AttributeKey<T> key, @Nullable T value) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,18 @@
|
||||||
|
|
||||||
package io.opentelemetry.api.logs;
|
package io.opentelemetry.api.logs;
|
||||||
|
|
||||||
|
import static io.opentelemetry.api.common.AttributeKey.booleanKey;
|
||||||
|
import static io.opentelemetry.api.common.AttributeKey.doubleKey;
|
||||||
|
import static io.opentelemetry.api.common.AttributeKey.longKey;
|
||||||
|
import static io.opentelemetry.api.common.AttributeKey.stringKey;
|
||||||
|
|
||||||
import io.opentelemetry.api.common.AttributeKey;
|
import io.opentelemetry.api.common.AttributeKey;
|
||||||
import io.opentelemetry.api.common.Attributes;
|
import io.opentelemetry.api.common.Attributes;
|
||||||
import io.opentelemetry.api.common.Value;
|
import io.opentelemetry.api.common.Value;
|
||||||
import io.opentelemetry.context.Context;
|
import io.opentelemetry.context.Context;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to construct and emit log records from a {@link Logger}.
|
* Used to construct and emit log records from a {@link Logger}.
|
||||||
|
@ -98,8 +104,111 @@ public interface LogRecordBuilder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets an attribute. */
|
/**
|
||||||
<T> LogRecordBuilder setAttribute(AttributeKey<T> key, T value);
|
* Sets an attribute on the {@code LogRecord}. If the {@code LogRecord} previously contained a
|
||||||
|
* mapping for the key, the old value is replaced by the specified value.
|
||||||
|
*
|
||||||
|
* <p>Note: Providing a null value is a no-op and will not remove previously set values.
|
||||||
|
*
|
||||||
|
* @param key the key for this attribute.
|
||||||
|
* @param value the value for this attribute.
|
||||||
|
* @return this.
|
||||||
|
*/
|
||||||
|
<T> LogRecordBuilder setAttribute(AttributeKey<T> key, @Nullable T value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a String attribute on the {@code LogRecord}. If the {@code LogRecord} previously contained
|
||||||
|
* a mapping for the key, the old value is replaced by the specified value.
|
||||||
|
*
|
||||||
|
* <p>Note: Providing a null value is a no-op and will not remove previously set values.
|
||||||
|
*
|
||||||
|
* <p>Note: It is strongly recommended to use {@link #setAttribute(AttributeKey, Object)}, and
|
||||||
|
* pre-allocate your keys, if possible.
|
||||||
|
*
|
||||||
|
* @param key the key for this attribute.
|
||||||
|
* @param value the value for this attribute.
|
||||||
|
* @return this.
|
||||||
|
* @since 1.48.0
|
||||||
|
*/
|
||||||
|
default LogRecordBuilder setAttribute(String key, @Nullable String value) {
|
||||||
|
return setAttribute(stringKey(key), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a Long attribute on the {@code LogRecord}. If the {@code LogRecord} previously contained a
|
||||||
|
* mapping for the key, the old value is replaced by the specified value.
|
||||||
|
*
|
||||||
|
* <p>Note: It is strongly recommended to use {@link #setAttribute(AttributeKey, Object)}, and
|
||||||
|
* pre-allocate your keys, if possible.
|
||||||
|
*
|
||||||
|
* @param key the key for this attribute.
|
||||||
|
* @param value the value for this attribute.
|
||||||
|
* @return this.
|
||||||
|
* @since 1.48.0
|
||||||
|
*/
|
||||||
|
default LogRecordBuilder setAttribute(String key, long value) {
|
||||||
|
return setAttribute(longKey(key), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a Double attribute on the {@code LogRecord}. If the {@code LogRecord} previously contained
|
||||||
|
* a mapping for the key, the old value is replaced by the specified value.
|
||||||
|
*
|
||||||
|
* <p>Note: It is strongly recommended to use {@link #setAttribute(AttributeKey, Object)}, and
|
||||||
|
* pre-allocate your keys, if possible.
|
||||||
|
*
|
||||||
|
* @param key the key for this attribute.
|
||||||
|
* @param value the value for this attribute.
|
||||||
|
* @return this.
|
||||||
|
* @since 1.48.0
|
||||||
|
*/
|
||||||
|
default LogRecordBuilder setAttribute(String key, double value) {
|
||||||
|
return setAttribute(doubleKey(key), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a Boolean attribute on the {@code LogRecord}. If the {@code LogRecord} previously
|
||||||
|
* contained a mapping for the key, the old value is replaced by the specified value.
|
||||||
|
*
|
||||||
|
* <p>Note: It is strongly recommended to use {@link #setAttribute(AttributeKey, Object)}, and
|
||||||
|
* pre-allocate your keys, if possible.
|
||||||
|
*
|
||||||
|
* @param key the key for this attribute.
|
||||||
|
* @param value the value for this attribute.
|
||||||
|
* @return this.
|
||||||
|
* @since 1.48.0
|
||||||
|
*/
|
||||||
|
default LogRecordBuilder setAttribute(String key, boolean value) {
|
||||||
|
return setAttribute(booleanKey(key), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets an Integer attribute on the {@code LogRecord}. If the {@code LogRecord} previously
|
||||||
|
* contained a mapping for the key, the old value is replaced by the specified value.
|
||||||
|
*
|
||||||
|
* <p>Note: It is strongly recommended to use {@link #setAttribute(AttributeKey, Object)}, and
|
||||||
|
* pre-allocate your keys, if possible.
|
||||||
|
*
|
||||||
|
* @param key the key for this attribute.
|
||||||
|
* @param value the value for this attribute.
|
||||||
|
* @return this.
|
||||||
|
* @since 1.48.0
|
||||||
|
*/
|
||||||
|
default LogRecordBuilder setAttribute(String key, int value) {
|
||||||
|
return setAttribute(key, (long) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the event name, which identifies the class / type of the Event.
|
||||||
|
*
|
||||||
|
* <p>This name should uniquely identify the event structure (both attributes and body). A log
|
||||||
|
* record with a non-empty event name is an Event.
|
||||||
|
*
|
||||||
|
* @since 1.50.0
|
||||||
|
*/
|
||||||
|
default LogRecordBuilder setEventName(String eventName) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/** Emit the log record. */
|
/** Emit the log record. */
|
||||||
void emit();
|
void emit();
|
||||||
|
|
|
@ -8,6 +8,7 @@ package io.opentelemetry.api.trace;
|
||||||
import io.opentelemetry.api.common.AttributeKey;
|
import io.opentelemetry.api.common.AttributeKey;
|
||||||
import io.opentelemetry.api.common.Attributes;
|
import io.opentelemetry.api.common.Attributes;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import javax.annotation.concurrent.Immutable;
|
import javax.annotation.concurrent.Immutable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,7 +43,7 @@ final class PropagatedSpan implements Span {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Span setAttribute(String key, String value) {
|
public Span setAttribute(String key, @Nullable String value) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ final class PropagatedSpan implements Span {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> Span setAttribute(AttributeKey<T> key, T value) {
|
public <T> Span setAttribute(AttributeKey<T> key, @Nullable T value) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,9 @@ public interface Span extends ImplicitContextKeyed {
|
||||||
* Sets an attribute to the {@code Span}. If the {@code Span} previously contained a mapping for
|
* Sets an attribute to the {@code Span}. If the {@code Span} previously contained a mapping for
|
||||||
* the key, the old value is replaced by the specified value.
|
* the key, the old value is replaced by the specified value.
|
||||||
*
|
*
|
||||||
* <p>Empty String "" and null are valid attribute {@code value}, but not valid keys.
|
* <p>Empty String "" and null are valid attribute {@code value}s, but not valid keys.
|
||||||
|
*
|
||||||
|
* <p>Note: Providing a null value is a no-op and will not remove previously set values.
|
||||||
*
|
*
|
||||||
* <p>Note: It is strongly recommended to use {@link #setAttribute(AttributeKey, Object)}, and
|
* <p>Note: It is strongly recommended to use {@link #setAttribute(AttributeKey, Object)}, and
|
||||||
* pre-allocate your keys, if possible.
|
* pre-allocate your keys, if possible.
|
||||||
|
@ -97,7 +99,7 @@ public interface Span extends ImplicitContextKeyed {
|
||||||
* @param value the value for this attribute.
|
* @param value the value for this attribute.
|
||||||
* @return this.
|
* @return this.
|
||||||
*/
|
*/
|
||||||
default Span setAttribute(String key, String value) {
|
default Span setAttribute(String key, @Nullable String value) {
|
||||||
return setAttribute(AttributeKey.stringKey(key), value);
|
return setAttribute(AttributeKey.stringKey(key), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,13 +152,13 @@ public interface Span extends ImplicitContextKeyed {
|
||||||
* Sets an attribute to the {@code Span}. If the {@code Span} previously contained a mapping for
|
* Sets an attribute to the {@code Span}. If the {@code Span} previously contained a mapping for
|
||||||
* the key, the old value is replaced by the specified value.
|
* the key, the old value is replaced by the specified value.
|
||||||
*
|
*
|
||||||
* <p>Note: the behavior of null values is undefined, and hence strongly discouraged.
|
* <p>Note: Providing a null value is a no-op.
|
||||||
*
|
*
|
||||||
* @param key the key for this attribute.
|
* @param key the key for this attribute.
|
||||||
* @param value the value for this attribute.
|
* @param value the value for this attribute.
|
||||||
* @return this.
|
* @return this.
|
||||||
*/
|
*/
|
||||||
<T> Span setAttribute(AttributeKey<T> key, T value);
|
<T> Span setAttribute(AttributeKey<T> key, @Nullable T value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets an attribute to the {@code Span}. If the {@code Span} previously contained a mapping for
|
* Sets an attribute to the {@code Span}. If the {@code Span} previously contained a mapping for
|
||||||
|
|
|
@ -238,6 +238,19 @@ public interface SpanBuilder {
|
||||||
*/
|
*/
|
||||||
<T> SpanBuilder setAttribute(AttributeKey<T> key, T value);
|
<T> SpanBuilder setAttribute(AttributeKey<T> key, T value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets an attribute to the newly created {@code Span}. If {@code SpanBuilder} previously
|
||||||
|
* contained a mapping for the key, the old value is replaced by the specified value.
|
||||||
|
*
|
||||||
|
* @param key the key for this attribute.
|
||||||
|
* @param value the value for this attribute.
|
||||||
|
* @return this.
|
||||||
|
* @since 1.45.0
|
||||||
|
*/
|
||||||
|
default SpanBuilder setAttribute(AttributeKey<Long> key, int value) {
|
||||||
|
return setAttribute(key, (long) value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets attributes to the {@link SpanBuilder}. If the {@link SpanBuilder} previously contained a
|
* Sets attributes to the {@link SpanBuilder}. If the {@link SpanBuilder} previously contained a
|
||||||
* mapping for any of the keys, the old values are replaced by the specified values.
|
* mapping for any of the keys, the old values are replaced by the specified values.
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
* io.opentelemetry.context.Context} and between process using one of the wire propagation formats
|
* io.opentelemetry.context.Context} and between process using one of the wire propagation formats
|
||||||
* supported in the {@code opentelemetry.trace.propagation} package.
|
* supported in the {@code opentelemetry.trace.propagation} package.
|
||||||
*/
|
*/
|
||||||
// TODO: Add code examples.
|
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
package io.opentelemetry.api.trace;
|
package io.opentelemetry.api.trace;
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ package io.opentelemetry.api;
|
||||||
|
|
||||||
import io.opentelemetry.api.logs.LoggerProvider;
|
import io.opentelemetry.api.logs.LoggerProvider;
|
||||||
import io.opentelemetry.api.metrics.MeterProvider;
|
import io.opentelemetry.api.metrics.MeterProvider;
|
||||||
|
import io.opentelemetry.api.testing.internal.AbstractOpenTelemetryTest;
|
||||||
import io.opentelemetry.api.trace.TracerProvider;
|
import io.opentelemetry.api.trace.TracerProvider;
|
||||||
|
|
||||||
class OpenTelemetryTest extends AbstractOpenTelemetryTest {
|
class OpenTelemetryTest extends AbstractOpenTelemetryTest {
|
||||||
|
|
|
@ -9,6 +9,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
import io.opentelemetry.context.Context;
|
import io.opentelemetry.context.Context;
|
||||||
import io.opentelemetry.context.Scope;
|
import io.opentelemetry.context.Scope;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
class BaggageTest {
|
class BaggageTest {
|
||||||
|
@ -27,4 +31,45 @@ class BaggageTest {
|
||||||
assertThat(result.getEntryValue("foo")).isEqualTo("bar");
|
assertThat(result.getEntryValue("foo")).isEqualTo("bar");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getEntryDefault() {
|
||||||
|
BaggageEntryMetadata metadata = BaggageEntryMetadata.create("flib");
|
||||||
|
Map<String, BaggageEntry> result = new HashMap<>();
|
||||||
|
result.put("a", ImmutableEntry.create("b", metadata));
|
||||||
|
// Implementation that only implements asMap() which is used by getEntry()
|
||||||
|
Baggage baggage =
|
||||||
|
new Baggage() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, BaggageEntry> asMap() {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int size() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forEach(BiConsumer<? super String, ? super BaggageEntry> consumer) {
|
||||||
|
result.forEach(consumer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public String getEntryValue(String entryKey) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaggageBuilder toBuilder() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
BaggageEntry entry = baggage.getEntry("a");
|
||||||
|
assertThat(entry.getValue()).isEqualTo("b");
|
||||||
|
assertThat(entry.getMetadata().getValue()).isEqualTo("flib");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.assertj.core.api.Assertions.entry;
|
import static org.assertj.core.api.Assertions.entry;
|
||||||
|
|
||||||
import com.google.common.testing.EqualsTester;
|
import com.google.common.testing.EqualsTester;
|
||||||
|
import io.opentelemetry.context.Context;
|
||||||
|
import io.opentelemetry.context.Scope;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -190,4 +192,15 @@ class ImmutableBaggageTest {
|
||||||
.addEqualityGroup(baggage2, baggage3)
|
.addEqualityGroup(baggage2, baggage3)
|
||||||
.testEquals();
|
.testEquals();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getEntry() {
|
||||||
|
BaggageEntryMetadata metadata = BaggageEntryMetadata.create("flib");
|
||||||
|
try (Scope scope =
|
||||||
|
Context.root().with(Baggage.builder().put("a", "b", metadata).build()).makeCurrent()) {
|
||||||
|
Baggage result = Baggage.current();
|
||||||
|
assertThat(result.getEntry("a").getValue()).isEqualTo("b");
|
||||||
|
assertThat(result.getEntry("a").getMetadata().getValue()).isEqualTo("flib");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ package io.opentelemetry.api.baggage.propagation;
|
||||||
import static java.util.Collections.singletonMap;
|
import static java.util.Collections.singletonMap;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import io.opentelemetry.api.baggage.Baggage;
|
import io.opentelemetry.api.baggage.Baggage;
|
||||||
import io.opentelemetry.api.baggage.BaggageEntryMetadata;
|
import io.opentelemetry.api.baggage.BaggageEntryMetadata;
|
||||||
|
@ -15,7 +16,9 @@ import io.opentelemetry.context.Context;
|
||||||
import io.opentelemetry.context.propagation.TextMapGetter;
|
import io.opentelemetry.context.propagation.TextMapGetter;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -36,6 +39,28 @@ class W3CBaggagePropagatorTest {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static final TextMapGetter<Map<String, List<String>>> multiGetter =
|
||||||
|
new TextMapGetter<Map<String, List<String>>>() {
|
||||||
|
@Override
|
||||||
|
public Iterable<String> keys(Map<String, List<String>> carrier) {
|
||||||
|
return carrier.keySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public String get(Map<String, List<String>> carrier, String key) {
|
||||||
|
return carrier.getOrDefault(key, Collections.emptyList()).stream()
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<String> getAll(Map<String, List<String>> carrier, String key) {
|
||||||
|
List<String> values = carrier.get(key);
|
||||||
|
return values == null ? Collections.emptyIterator() : values.iterator();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void fields() {
|
void fields() {
|
||||||
assertThat(W3CBaggagePropagator.getInstance().fields()).containsExactly("baggage");
|
assertThat(W3CBaggagePropagator.getInstance().fields()).containsExactly("baggage");
|
||||||
|
@ -421,6 +446,101 @@ class W3CBaggagePropagatorTest {
|
||||||
.isSameAs(context);
|
.isSameAs(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void extract_multiple_headers() {
|
||||||
|
W3CBaggagePropagator propagator = W3CBaggagePropagator.getInstance();
|
||||||
|
|
||||||
|
Context result =
|
||||||
|
propagator.extract(
|
||||||
|
Context.root(),
|
||||||
|
ImmutableMap.of("baggage", ImmutableList.of("k1=v1", "k2=v2")),
|
||||||
|
multiGetter);
|
||||||
|
|
||||||
|
Baggage expectedBaggage = Baggage.builder().put("k1", "v1").put("k2", "v2").build();
|
||||||
|
assertThat(Baggage.fromContext(result)).isEqualTo(expectedBaggage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void extract_multiple_headers_duplicate_key() {
|
||||||
|
W3CBaggagePropagator propagator = W3CBaggagePropagator.getInstance();
|
||||||
|
|
||||||
|
Context result =
|
||||||
|
propagator.extract(
|
||||||
|
Context.root(),
|
||||||
|
ImmutableMap.of("baggage", ImmutableList.of("k1=v1", "k1=v2")),
|
||||||
|
multiGetter);
|
||||||
|
|
||||||
|
Baggage expectedBaggage = Baggage.builder().put("k1", "v2").build();
|
||||||
|
assertThat(Baggage.fromContext(result)).isEqualTo(expectedBaggage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void extract_multiple_headers_mixed_duplicates_non_duplicates() {
|
||||||
|
W3CBaggagePropagator propagator = W3CBaggagePropagator.getInstance();
|
||||||
|
|
||||||
|
Context result =
|
||||||
|
propagator.extract(
|
||||||
|
Context.root(),
|
||||||
|
ImmutableMap.of("baggage", ImmutableList.of("k1=v1,k2=v0", "k2=v2,k3=v3")),
|
||||||
|
multiGetter);
|
||||||
|
|
||||||
|
Baggage expectedBaggage =
|
||||||
|
Baggage.builder().put("k1", "v1").put("k2", "v2").put("k3", "v3").build();
|
||||||
|
assertThat(Baggage.fromContext(result)).isEqualTo(expectedBaggage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void extract_multiple_headers_all_empty() {
|
||||||
|
W3CBaggagePropagator propagator = W3CBaggagePropagator.getInstance();
|
||||||
|
|
||||||
|
Context result =
|
||||||
|
propagator.extract(
|
||||||
|
Context.root(), ImmutableMap.of("baggage", ImmutableList.of("", "")), multiGetter);
|
||||||
|
|
||||||
|
Baggage expectedBaggage = Baggage.builder().build();
|
||||||
|
assertThat(Baggage.fromContext(result)).isEqualTo(expectedBaggage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void extract_multiple_headers_some_empty() {
|
||||||
|
W3CBaggagePropagator propagator = W3CBaggagePropagator.getInstance();
|
||||||
|
|
||||||
|
Context result =
|
||||||
|
propagator.extract(
|
||||||
|
Context.root(), ImmutableMap.of("baggage", ImmutableList.of("", "k=v")), multiGetter);
|
||||||
|
|
||||||
|
Baggage expectedBaggage = Baggage.builder().put("k", "v").build();
|
||||||
|
assertThat(Baggage.fromContext(result)).isEqualTo(expectedBaggage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void extract_multiple_headers_all_invalid() {
|
||||||
|
W3CBaggagePropagator propagator = W3CBaggagePropagator.getInstance();
|
||||||
|
|
||||||
|
Context result =
|
||||||
|
propagator.extract(
|
||||||
|
Context.root(),
|
||||||
|
ImmutableMap.of("baggage", ImmutableList.of("!@#$%^", "key=va%lue")),
|
||||||
|
multiGetter);
|
||||||
|
|
||||||
|
Baggage expectedBaggage = Baggage.builder().build();
|
||||||
|
assertThat(Baggage.fromContext(result)).isEqualTo(expectedBaggage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void extract_multiple_headers_some_invalid() {
|
||||||
|
W3CBaggagePropagator propagator = W3CBaggagePropagator.getInstance();
|
||||||
|
|
||||||
|
Context result =
|
||||||
|
propagator.extract(
|
||||||
|
Context.root(),
|
||||||
|
ImmutableMap.of("baggage", ImmutableList.of("k1=v1", "key=va%lue", "k2=v2")),
|
||||||
|
multiGetter);
|
||||||
|
|
||||||
|
Baggage expectedBaggage = Baggage.builder().put("k1", "v1").put("k2", "v2").build();
|
||||||
|
assertThat(Baggage.fromContext(result)).isEqualTo(expectedBaggage);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void inject_noBaggage() {
|
void inject_noBaggage() {
|
||||||
W3CBaggagePropagator propagator = W3CBaggagePropagator.getInstance();
|
W3CBaggagePropagator propagator = W3CBaggagePropagator.getInstance();
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/** Unit tests for {@link Attributes}s. */
|
/** Unit tests for {@link Attributes}s. */
|
||||||
|
@ -565,7 +566,7 @@ class AttributesTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> AttributesBuilder put(AttributeKey<T> key, T value) {
|
public <T> AttributesBuilder put(AttributeKey<T> key, @Nullable T value) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,15 @@
|
||||||
package io.opentelemetry.api.internal;
|
package io.opentelemetry.api.internal;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.assertj.core.api.Assertions.assertThatCode;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junitpioneer.jupiter.SetSystemProperty;
|
import org.junitpioneer.jupiter.SetSystemProperty;
|
||||||
|
|
||||||
|
@ -56,4 +64,45 @@ class ConfigUtilTest {
|
||||||
assertThat(ConfigUtil.defaultIfNull("val1", "val2")).isEqualTo("val1");
|
assertThat(ConfigUtil.defaultIfNull("val1", "val2")).isEqualTo("val1");
|
||||||
assertThat(ConfigUtil.defaultIfNull(null, "val2")).isEqualTo("val2");
|
assertThat(ConfigUtil.defaultIfNull(null, "val2")).isEqualTo("val2");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@SuppressWarnings("ReturnValueIgnored")
|
||||||
|
void systemPropertiesConcurrentAccess() throws ExecutionException, InterruptedException {
|
||||||
|
int threads = 4;
|
||||||
|
ExecutorService executor = Executors.newFixedThreadPool(threads);
|
||||||
|
try {
|
||||||
|
int cycles = 1000;
|
||||||
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
List<Future<?>> futures = new ArrayList<>();
|
||||||
|
for (int i = 0; i < threads; i++) {
|
||||||
|
futures.add(
|
||||||
|
executor.submit(
|
||||||
|
() -> {
|
||||||
|
try {
|
||||||
|
latch.await();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = 0; j < cycles; j++) {
|
||||||
|
String property = "prop " + j;
|
||||||
|
System.setProperty(property, "a");
|
||||||
|
System.getProperties().remove(property);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
latch.countDown();
|
||||||
|
for (int i = 0; i < cycles; i++) {
|
||||||
|
assertThatCode(() -> ConfigUtil.getString("x", "y")).doesNotThrowAnyException();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Future<?> future : futures) {
|
||||||
|
future.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
executor.shutdownNow();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
package io.opentelemetry.api.logs;
|
package io.opentelemetry.api.logs;
|
||||||
|
|
||||||
|
import io.opentelemetry.api.testing.internal.AbstractDefaultLoggerTest;
|
||||||
|
|
||||||
class DefaultLoggerTest extends AbstractDefaultLoggerTest {
|
class DefaultLoggerTest extends AbstractDefaultLoggerTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
package io.opentelemetry.api.metrics;
|
package io.opentelemetry.api.metrics;
|
||||||
|
|
||||||
|
import io.opentelemetry.api.testing.internal.AbstractDefaultMeterTest;
|
||||||
|
|
||||||
public class DefaultMeterTest extends AbstractDefaultMeterTest {
|
public class DefaultMeterTest extends AbstractDefaultMeterTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
package io.opentelemetry.api.trace;
|
package io.opentelemetry.api.trace;
|
||||||
|
|
||||||
|
import io.opentelemetry.api.testing.internal.AbstractDefaultTracerTest;
|
||||||
|
|
||||||
class DefaultTracerTest extends AbstractDefaultTracerTest {
|
class DefaultTracerTest extends AbstractDefaultTracerTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,19 +2,12 @@
|
||||||
|
|
||||||
Experimental APIs, including Event API, extended Log Bridge APIs, extended Metrics APIs, extended ContextPropagator APIs, and extended Trace APIs.
|
Experimental APIs, including Event API, extended Log Bridge APIs, extended Metrics APIs, extended ContextPropagator APIs, and extended Trace APIs.
|
||||||
|
|
||||||
## Event API
|
|
||||||
|
|
||||||
Features:
|
|
||||||
|
|
||||||
* Event API for producing log records according to [Event Semantic Conventions](https://opentelemetry.io/docs/specs/semconv/general/events/).
|
|
||||||
|
|
||||||
See [EventApiUsageTest](./src/test/java/io/opentelemetry/api/incubator/events/EventApiUsageTest.java).
|
|
||||||
|
|
||||||
## Extended Log Bridge API
|
## Extended Log Bridge API
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
|
||||||
* Check if logger is enabled before emitting logs to avoid unnecessary computation
|
* Check if logger is enabled before emitting logs to avoid unnecessary computation
|
||||||
|
* Add extended attributes to log records to encode complex data structures
|
||||||
|
|
||||||
See [ExtendedLogsBridgeApiUsageTest](./src/test/java/io/opentelemetry/api/incubator/logs/ExtendedLogsBridgeApiUsageTest.java).
|
See [ExtendedLogsBridgeApiUsageTest](./src/test/java/io/opentelemetry/api/incubator/logs/ExtendedLogsBridgeApiUsageTest.java).
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,31 @@ otelJava.moduleName.set("io.opentelemetry.api.incubator")
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":api:all"))
|
api(project(":api:all"))
|
||||||
|
|
||||||
|
// Supports optional InstrumentationConfigUtil#convertToModel
|
||||||
|
compileOnly("com.fasterxml.jackson.core:jackson-databind")
|
||||||
|
|
||||||
annotationProcessor("com.google.auto.value:auto-value")
|
annotationProcessor("com.google.auto.value:auto-value")
|
||||||
|
|
||||||
|
// To use parsed config file as input for InstrumentationConfigUtilTest
|
||||||
|
testImplementation(project(":sdk-extensions:incubator"))
|
||||||
|
|
||||||
testImplementation(project(":sdk:testing"))
|
testImplementation(project(":sdk:testing"))
|
||||||
testImplementation(testFixtures(project(":api:all")))
|
testImplementation(project(":api:testing-internal"))
|
||||||
|
|
||||||
testImplementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating")
|
testImplementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating")
|
||||||
|
|
||||||
testImplementation("com.google.guava:guava")
|
testImplementation("com.google.guava:guava")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testing {
|
||||||
|
suites {
|
||||||
|
register<JvmTestSuite>("testConvertToModel") {
|
||||||
|
dependencies {
|
||||||
|
implementation("com.fasterxml.jackson.core:jackson-databind")
|
||||||
|
implementation(project(":sdk-extensions:incubator"))
|
||||||
|
implementation(project(":sdk-extensions:autoconfigure"))
|
||||||
|
implementation("com.google.guava:guava")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.api.incubator.common;
|
||||||
|
|
||||||
|
import io.opentelemetry.api.common.AttributeKey;
|
||||||
|
import io.opentelemetry.api.common.Attributes;
|
||||||
|
import io.opentelemetry.api.common.AttributesBuilder;
|
||||||
|
import io.opentelemetry.api.internal.ImmutableKeyValuePairs;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.concurrent.Immutable;
|
||||||
|
|
||||||
|
@Immutable
|
||||||
|
final class ArrayBackedExtendedAttributes
|
||||||
|
extends ImmutableKeyValuePairs<ExtendedAttributeKey<?>, Object> implements ExtendedAttributes {
|
||||||
|
|
||||||
|
// We only compare the key name, not type, when constructing, to allow deduping keys with the
|
||||||
|
// same name but different type.
|
||||||
|
private static final Comparator<ExtendedAttributeKey<?>> KEY_COMPARATOR_FOR_CONSTRUCTION =
|
||||||
|
Comparator.comparing(ExtendedAttributeKey::getKey);
|
||||||
|
|
||||||
|
static final ExtendedAttributes EMPTY = ExtendedAttributes.builder().build();
|
||||||
|
|
||||||
|
@Nullable private Attributes attributes;
|
||||||
|
|
||||||
|
private ArrayBackedExtendedAttributes(
|
||||||
|
Object[] data, Comparator<ExtendedAttributeKey<?>> keyComparator) {
|
||||||
|
super(data, keyComparator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only use this constructor if you can guarantee that the data has been de-duped, sorted by key
|
||||||
|
* and contains no null values or null/empty keys.
|
||||||
|
*
|
||||||
|
* @param data the raw data
|
||||||
|
*/
|
||||||
|
ArrayBackedExtendedAttributes(Object[] data) {
|
||||||
|
super(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExtendedAttributesBuilder toBuilder() {
|
||||||
|
return new ArrayBackedExtendedAttributesBuilder(new ArrayList<>(data()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public <T> T get(ExtendedAttributeKey<T> key) {
|
||||||
|
return (T) super.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public Attributes asAttributes() {
|
||||||
|
if (attributes == null) {
|
||||||
|
AttributesBuilder builder = Attributes.builder();
|
||||||
|
forEach(
|
||||||
|
(extendedAttributeKey, value) -> {
|
||||||
|
AttributeKey<Object> attributeKey =
|
||||||
|
(AttributeKey<Object>) extendedAttributeKey.asAttributeKey();
|
||||||
|
if (attributeKey != null) {
|
||||||
|
builder.put(attributeKey, value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
attributes = builder.build();
|
||||||
|
}
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ExtendedAttributes sortAndFilterToAttributes(Object... data) {
|
||||||
|
// null out any empty keys or keys with null values
|
||||||
|
// so they will then be removed by the sortAndFilter method.
|
||||||
|
for (int i = 0; i < data.length; i += 2) {
|
||||||
|
ExtendedAttributeKey<?> key = (ExtendedAttributeKey<?>) data[i];
|
||||||
|
if (key != null && key.getKey().isEmpty()) {
|
||||||
|
data[i] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new ArrayBackedExtendedAttributes(data, KEY_COMPARATOR_FOR_CONSTRUCTION);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.api.incubator.common;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
class ArrayBackedExtendedAttributesBuilder implements ExtendedAttributesBuilder {
|
||||||
|
private final List<Object> data;
|
||||||
|
|
||||||
|
ArrayBackedExtendedAttributesBuilder() {
|
||||||
|
data = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayBackedExtendedAttributesBuilder(List<Object> data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExtendedAttributes build() {
|
||||||
|
// If only one key-value pair AND the entry hasn't been set to null (by #remove(AttributeKey<T>)
|
||||||
|
// or #removeIf(Predicate<AttributeKey<?>>)), then we can bypass sorting and filtering
|
||||||
|
if (data.size() == 2 && data.get(0) != null) {
|
||||||
|
return new ArrayBackedExtendedAttributes(data.toArray());
|
||||||
|
}
|
||||||
|
return ArrayBackedExtendedAttributes.sortAndFilterToAttributes(data.toArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> ExtendedAttributesBuilder put(ExtendedAttributeKey<T> key, T value) {
|
||||||
|
if (key == null || key.getKey().isEmpty() || value == null) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
data.add(key);
|
||||||
|
data.add(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExtendedAttributesBuilder removeIf(Predicate<ExtendedAttributeKey<?>> predicate) {
|
||||||
|
if (predicate == null) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < data.size() - 1; i += 2) {
|
||||||
|
Object entry = data.get(i);
|
||||||
|
if (entry instanceof ExtendedAttributeKey
|
||||||
|
&& predicate.test((ExtendedAttributeKey<?>) entry)) {
|
||||||
|
// null items are filtered out in ArrayBackedAttributes
|
||||||
|
data.set(i, null);
|
||||||
|
data.set(i + 1, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<Double> toList(double... values) {
|
||||||
|
Double[] boxed = new Double[values.length];
|
||||||
|
for (int i = 0; i < values.length; i++) {
|
||||||
|
boxed[i] = values[i];
|
||||||
|
}
|
||||||
|
return Arrays.asList(boxed);
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<Long> toList(long... values) {
|
||||||
|
Long[] boxed = new Long[values.length];
|
||||||
|
for (int i = 0; i < values.length; i++) {
|
||||||
|
boxed[i] = values[i];
|
||||||
|
}
|
||||||
|
return Arrays.asList(boxed);
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<Boolean> toList(boolean... values) {
|
||||||
|
Boolean[] boxed = new Boolean[values.length];
|
||||||
|
for (int i = 0; i < values.length; i++) {
|
||||||
|
boxed[i] = values[i];
|
||||||
|
}
|
||||||
|
return Arrays.asList(boxed);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,100 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.api.incubator.common;
|
||||||
|
|
||||||
|
import io.opentelemetry.api.common.AttributeKey;
|
||||||
|
import io.opentelemetry.api.incubator.internal.InternalExtendedAttributeKeyImpl;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.concurrent.Immutable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface provides a handle for setting the values of {@link ExtendedAttributes}. The type
|
||||||
|
* of value that can be set with an implementation of this key is denoted by the type parameter.
|
||||||
|
*
|
||||||
|
* <p>Implementations MUST be immutable, as these are used as the keys to Maps.
|
||||||
|
*
|
||||||
|
* <p>The allowed {@link #getType()}s is a superset of those allowed in {@link AttributeKey}.
|
||||||
|
*
|
||||||
|
* <p>Convenience methods are provided for translating to / from {@link AttributeKey}:
|
||||||
|
*
|
||||||
|
* <ul>
|
||||||
|
* <li>{@link #asAttributeKey()} converts from {@link ExtendedAttributeKey} to {@link
|
||||||
|
* AttributeKey}
|
||||||
|
* <li>{@link #fromAttributeKey(AttributeKey)} converts from {@link AttributeKey} to {@link
|
||||||
|
* ExtendedAttributeKey}
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @param <T> The type of value that can be set with the key.
|
||||||
|
*/
|
||||||
|
@Immutable
|
||||||
|
public interface ExtendedAttributeKey<T> {
|
||||||
|
/** Returns the underlying String representation of the key. */
|
||||||
|
String getKey();
|
||||||
|
|
||||||
|
/** Returns the type of attribute for this key. Useful for building switch statements. */
|
||||||
|
ExtendedAttributeType getType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the equivalent {@link AttributeKey}, or {@code null} if the {@link #getType()} has no
|
||||||
|
* equivalent {@link io.opentelemetry.api.common.AttributeType}.
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
default AttributeKey<T> asAttributeKey() {
|
||||||
|
return InternalExtendedAttributeKeyImpl.toAttributeKey(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Return an ExtendedAttributeKey equivalent to the {@code attributeKey}. */
|
||||||
|
// TODO (jack-berg): remove once AttributeKey.asExtendedAttributeKey is available
|
||||||
|
static <T> ExtendedAttributeKey<T> fromAttributeKey(AttributeKey<T> attributeKey) {
|
||||||
|
return InternalExtendedAttributeKeyImpl.toExtendedAttributeKey(attributeKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns a new ExtendedAttributeKey for String valued attributes. */
|
||||||
|
static ExtendedAttributeKey<String> stringKey(String key) {
|
||||||
|
return fromAttributeKey(AttributeKey.stringKey(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns a new ExtendedAttributeKey for Boolean valued attributes. */
|
||||||
|
static ExtendedAttributeKey<Boolean> booleanKey(String key) {
|
||||||
|
return fromAttributeKey(AttributeKey.booleanKey(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns a new ExtendedAttributeKey for Long valued attributes. */
|
||||||
|
static ExtendedAttributeKey<Long> longKey(String key) {
|
||||||
|
return fromAttributeKey(AttributeKey.longKey(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns a new ExtendedAttributeKey for Double valued attributes. */
|
||||||
|
static ExtendedAttributeKey<Double> doubleKey(String key) {
|
||||||
|
return fromAttributeKey(AttributeKey.doubleKey(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns a new ExtendedAttributeKey for List<String> valued attributes. */
|
||||||
|
static ExtendedAttributeKey<List<String>> stringArrayKey(String key) {
|
||||||
|
return fromAttributeKey(AttributeKey.stringArrayKey(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns a new ExtendedAttributeKey for List<Boolean> valued attributes. */
|
||||||
|
static ExtendedAttributeKey<List<Boolean>> booleanArrayKey(String key) {
|
||||||
|
return fromAttributeKey(AttributeKey.booleanArrayKey(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns a new ExtendedAttributeKey for List<Long> valued attributes. */
|
||||||
|
static ExtendedAttributeKey<List<Long>> longArrayKey(String key) {
|
||||||
|
return fromAttributeKey(AttributeKey.longArrayKey(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns a new ExtendedAttributeKey for List<Double> valued attributes. */
|
||||||
|
static ExtendedAttributeKey<List<Double>> doubleArrayKey(String key) {
|
||||||
|
return fromAttributeKey(AttributeKey.doubleArrayKey(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns a new ExtendedAttributeKey for Map valued attributes. */
|
||||||
|
static ExtendedAttributeKey<ExtendedAttributes> extendedAttributesKey(String key) {
|
||||||
|
return InternalExtendedAttributeKeyImpl.create(key, ExtendedAttributeType.EXTENDED_ATTRIBUTES);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.api.incubator.common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An enum that represents all the possible value types for an {@link ExtendedAttributeKey} and
|
||||||
|
* hence the types of values that are allowed for {@link ExtendedAttributes}.
|
||||||
|
*
|
||||||
|
* <p>This is a superset of {@link io.opentelemetry.api.common.AttributeType},
|
||||||
|
*/
|
||||||
|
public enum ExtendedAttributeType {
|
||||||
|
// Types copied AttributeType
|
||||||
|
STRING,
|
||||||
|
BOOLEAN,
|
||||||
|
LONG,
|
||||||
|
DOUBLE,
|
||||||
|
STRING_ARRAY,
|
||||||
|
BOOLEAN_ARRAY,
|
||||||
|
LONG_ARRAY,
|
||||||
|
DOUBLE_ARRAY,
|
||||||
|
// Extended types unique to ExtendedAttributes
|
||||||
|
EXTENDED_ATTRIBUTES;
|
||||||
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.api.incubator.common;
|
||||||
|
|
||||||
|
import io.opentelemetry.api.common.AttributeKey;
|
||||||
|
import io.opentelemetry.api.common.Attributes;
|
||||||
|
import io.opentelemetry.api.incubator.logs.ExtendedLogRecordBuilder;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.concurrent.Immutable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An immutable container for extended attributes.
|
||||||
|
*
|
||||||
|
* <p>"extended" refers an extended set of allowed value types compared to standard {@link
|
||||||
|
* Attributes}. Notably, {@link ExtendedAttributes} values can be of type {@link
|
||||||
|
* ExtendedAttributeType#EXTENDED_ATTRIBUTES}, allowing nested {@link ExtendedAttributes} of
|
||||||
|
* arbitrary depth.
|
||||||
|
*
|
||||||
|
* <p>Where standard {@link Attributes} are accepted everyone that OpenTelemetry represents key /
|
||||||
|
* value pairs, {@link ExtendedAttributes} are only accepted in select places, such as log records
|
||||||
|
* (e.g. {@link ExtendedLogRecordBuilder#setAttribute(ExtendedAttributeKey, Object)}).
|
||||||
|
*
|
||||||
|
* <p>The keys are {@link ExtendedAttributeKey}s and the values are Object instances that match the
|
||||||
|
* type of the provided key.
|
||||||
|
*
|
||||||
|
* <p>Null keys will be silently dropped.
|
||||||
|
*
|
||||||
|
* <p>Note: The behavior of null-valued attributes is undefined, and hence strongly discouraged.
|
||||||
|
*
|
||||||
|
* <p>Implementations of this interface *must* be immutable and have well-defined value-based
|
||||||
|
* equals/hashCode implementations. If an implementation does not strictly conform to these
|
||||||
|
* requirements, behavior of the OpenTelemetry APIs and default SDK cannot be guaranteed.
|
||||||
|
*
|
||||||
|
* <p>For this reason, it is strongly suggested that you use the implementation that is provided
|
||||||
|
* here via the factory methods and the {@link ExtendedAttributesBuilder}.
|
||||||
|
*
|
||||||
|
* <p>Convenience methods are provided for translating to / from {@link Attributes}:
|
||||||
|
*
|
||||||
|
* <ul>
|
||||||
|
* <li>{@link #asAttributes()} converts from {@link ExtendedAttributes} to {@link Attributes}
|
||||||
|
* <li>{@link ExtendedAttributesBuilder#putAll(Attributes)} converts from {@link Attributes} to
|
||||||
|
* {@link ExtendedAttributes}
|
||||||
|
* <li>{@link #get(AttributeKey)} supports reading values using standard {@link AttributeKey}
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
@Immutable
|
||||||
|
public interface ExtendedAttributes {
|
||||||
|
|
||||||
|
/** Returns the value for the given {@link AttributeKey}, or {@code null} if not found. */
|
||||||
|
@Nullable
|
||||||
|
default <T> T get(AttributeKey<T> key) {
|
||||||
|
if (key == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return get(ExtendedAttributeKey.fromAttributeKey(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns the value for the given {@link ExtendedAttributeKey}, or {@code null} if not found. */
|
||||||
|
@Nullable
|
||||||
|
<T> T get(ExtendedAttributeKey<T> key);
|
||||||
|
|
||||||
|
/** Iterates over all the key-value pairs of attributes contained by this instance. */
|
||||||
|
void forEach(BiConsumer<? super ExtendedAttributeKey<?>, ? super Object> consumer);
|
||||||
|
|
||||||
|
/** The number of attributes contained in this. */
|
||||||
|
int size();
|
||||||
|
|
||||||
|
/** Whether there are any attributes contained in this. */
|
||||||
|
boolean isEmpty();
|
||||||
|
|
||||||
|
/** Returns a read-only view of this {@link ExtendedAttributes} as a {@link Map}. */
|
||||||
|
Map<ExtendedAttributeKey<?>, Object> asMap();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a view of this extended attributes with entries limited to those representable as
|
||||||
|
* standard attributes.
|
||||||
|
*/
|
||||||
|
Attributes asAttributes();
|
||||||
|
|
||||||
|
/** Returns a {@link ExtendedAttributes} instance with no attributes. */
|
||||||
|
static ExtendedAttributes empty() {
|
||||||
|
return ArrayBackedExtendedAttributes.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new {@link ExtendedAttributesBuilder} instance for creating arbitrary {@link
|
||||||
|
* ExtendedAttributes}.
|
||||||
|
*/
|
||||||
|
static ExtendedAttributesBuilder builder() {
|
||||||
|
return new ArrayBackedExtendedAttributesBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new {@link ExtendedAttributesBuilder} instance populated with the data of this {@link
|
||||||
|
* ExtendedAttributes}.
|
||||||
|
*/
|
||||||
|
ExtendedAttributesBuilder toBuilder();
|
||||||
|
}
|
|
@ -0,0 +1,233 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.api.incubator.common;
|
||||||
|
|
||||||
|
import static io.opentelemetry.api.incubator.common.ArrayBackedExtendedAttributesBuilder.toList;
|
||||||
|
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.booleanArrayKey;
|
||||||
|
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.booleanKey;
|
||||||
|
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.doubleArrayKey;
|
||||||
|
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.doubleKey;
|
||||||
|
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.longArrayKey;
|
||||||
|
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.longKey;
|
||||||
|
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.stringArrayKey;
|
||||||
|
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.stringKey;
|
||||||
|
|
||||||
|
import io.opentelemetry.api.common.AttributeKey;
|
||||||
|
import io.opentelemetry.api.common.Attributes;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
/** A builder of {@link ExtendedAttributes} supporting an arbitrary number of key-value pairs. */
|
||||||
|
public interface ExtendedAttributesBuilder {
|
||||||
|
/** Create the {@link ExtendedAttributes} from this. */
|
||||||
|
ExtendedAttributes build();
|
||||||
|
|
||||||
|
/** Puts a {@link AttributeKey} with associated value into this. */
|
||||||
|
default <T> ExtendedAttributesBuilder put(AttributeKey<T> key, T value) {
|
||||||
|
if (key == null || key.getKey().isEmpty() || value == null) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return put(ExtendedAttributeKey.fromAttributeKey(key), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Puts a {@link ExtendedAttributeKey} with associated value into this. */
|
||||||
|
<T> ExtendedAttributesBuilder put(ExtendedAttributeKey<T> key, T value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puts a String attribute into this.
|
||||||
|
*
|
||||||
|
* <p>Note: It is strongly recommended to use {@link #put(ExtendedAttributeKey, Object)}, and
|
||||||
|
* pre-allocate your keys, if possible.
|
||||||
|
*
|
||||||
|
* @return this Builder
|
||||||
|
*/
|
||||||
|
default ExtendedAttributesBuilder put(String key, String value) {
|
||||||
|
return put(stringKey(key), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puts a long attribute into this.
|
||||||
|
*
|
||||||
|
* <p>Note: It is strongly recommended to use {@link #put(ExtendedAttributeKey, Object)}, and
|
||||||
|
* pre-allocate your keys, if possible.
|
||||||
|
*
|
||||||
|
* @return this Builder
|
||||||
|
*/
|
||||||
|
default ExtendedAttributesBuilder put(String key, long value) {
|
||||||
|
return put(longKey(key), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puts a double attribute into this.
|
||||||
|
*
|
||||||
|
* <p>Note: It is strongly recommended to use {@link #put(ExtendedAttributeKey, Object)}, and
|
||||||
|
* pre-allocate your keys, if possible.
|
||||||
|
*
|
||||||
|
* @return this Builder
|
||||||
|
*/
|
||||||
|
default ExtendedAttributesBuilder put(String key, double value) {
|
||||||
|
return put(doubleKey(key), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puts a boolean attribute into this.
|
||||||
|
*
|
||||||
|
* <p>Note: It is strongly recommended to use {@link #put(ExtendedAttributeKey, Object)}, and
|
||||||
|
* pre-allocate your keys, if possible.
|
||||||
|
*
|
||||||
|
* @return this Builder
|
||||||
|
*/
|
||||||
|
default ExtendedAttributesBuilder put(String key, boolean value) {
|
||||||
|
return put(booleanKey(key), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puts a {@link ExtendedAttributes} attribute into this.
|
||||||
|
*
|
||||||
|
* <p>Note: It is strongly recommended to use {@link #put(ExtendedAttributeKey, Object)}, and
|
||||||
|
* pre-allocate your keys, if possible.
|
||||||
|
*
|
||||||
|
* @return this Builder
|
||||||
|
*/
|
||||||
|
default <T> ExtendedAttributesBuilder put(String key, ExtendedAttributes value) {
|
||||||
|
return put(ExtendedAttributeKey.extendedAttributesKey(key), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puts a String array attribute into this.
|
||||||
|
*
|
||||||
|
* <p>Note: It is strongly recommended to use {@link #put(ExtendedAttributeKey, Object)}, and
|
||||||
|
* pre-allocate your keys, if possible.
|
||||||
|
*
|
||||||
|
* @return this Builder
|
||||||
|
*/
|
||||||
|
default ExtendedAttributesBuilder put(String key, String... value) {
|
||||||
|
if (value == null) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return put(stringArrayKey(key), Arrays.asList(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puts a List attribute into this.
|
||||||
|
*
|
||||||
|
* @return this Builder
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
default <T> ExtendedAttributesBuilder put(AttributeKey<List<T>> key, T... value) {
|
||||||
|
if (value == null) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return put(key, Arrays.asList(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puts a Long array attribute into this.
|
||||||
|
*
|
||||||
|
* <p>Note: It is strongly recommended to use {@link #put(ExtendedAttributeKey, Object)}, and
|
||||||
|
* pre-allocate your keys, if possible.
|
||||||
|
*
|
||||||
|
* @return this Builder
|
||||||
|
*/
|
||||||
|
default ExtendedAttributesBuilder put(String key, long... value) {
|
||||||
|
if (value == null) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return put(longArrayKey(key), toList(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puts a Double array attribute into this.
|
||||||
|
*
|
||||||
|
* <p>Note: It is strongly recommended to use {@link #put(ExtendedAttributeKey, Object)}, and
|
||||||
|
* pre-allocate your keys, if possible.
|
||||||
|
*
|
||||||
|
* @return this Builder
|
||||||
|
*/
|
||||||
|
default ExtendedAttributesBuilder put(String key, double... value) {
|
||||||
|
if (value == null) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return put(doubleArrayKey(key), toList(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puts a Boolean array attribute into this.
|
||||||
|
*
|
||||||
|
* <p>Note: It is strongly recommended to use {@link #put(ExtendedAttributeKey, Object)}, and
|
||||||
|
* pre-allocate your keys, if possible.
|
||||||
|
*
|
||||||
|
* @return this Builder
|
||||||
|
*/
|
||||||
|
default ExtendedAttributesBuilder put(String key, boolean... value) {
|
||||||
|
if (value == null) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return put(booleanArrayKey(key), toList(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puts all the provided attributes into this Builder.
|
||||||
|
*
|
||||||
|
* @return this Builder
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
|
default ExtendedAttributesBuilder putAll(Attributes attributes) {
|
||||||
|
if (attributes == null) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
attributes.forEach((key, value) -> put((AttributeKey<Object>) key, value));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puts all the provided attributes into this Builder.
|
||||||
|
*
|
||||||
|
* @return this Builder
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
|
default ExtendedAttributesBuilder putAll(ExtendedAttributes attributes) {
|
||||||
|
if (attributes == null) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
attributes.forEach((key, value) -> put((ExtendedAttributeKey<Object>) key, value));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all attributes where {@link AttributeKey#getKey()} and {@link AttributeKey#getType()}
|
||||||
|
* match the {@code key}.
|
||||||
|
*
|
||||||
|
* @return this Builder
|
||||||
|
*/
|
||||||
|
default <T> ExtendedAttributesBuilder remove(AttributeKey<T> key) {
|
||||||
|
return remove(ExtendedAttributeKey.fromAttributeKey(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all attributes where {@link ExtendedAttributeKey#getKey()} and {@link
|
||||||
|
* ExtendedAttributeKey#getType()} match the {@code key}.
|
||||||
|
*
|
||||||
|
* @return this Builder
|
||||||
|
*/
|
||||||
|
default <T> ExtendedAttributesBuilder remove(ExtendedAttributeKey<T> key) {
|
||||||
|
if (key == null || key.getKey().isEmpty()) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return removeIf(
|
||||||
|
entryKey ->
|
||||||
|
key.getKey().equals(entryKey.getKey()) && key.getType().equals(entryKey.getType()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all attributes that satisfy the given predicate. Errors or runtime exceptions thrown by
|
||||||
|
* the predicate are relayed to the caller.
|
||||||
|
*
|
||||||
|
* @return this Builder
|
||||||
|
*/
|
||||||
|
ExtendedAttributesBuilder removeIf(Predicate<ExtendedAttributeKey<?>> filter);
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.api.incubator.config;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.concurrent.ThreadSafe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A registry for accessing declarative configuration.
|
||||||
|
*
|
||||||
|
* <p>The name <i>Provider</i> is for consistency with other languages and it is <b>NOT</b> loaded
|
||||||
|
* using reflection.
|
||||||
|
*
|
||||||
|
* <p>See {@link InstrumentationConfigUtil} for convenience methods for extracting config from
|
||||||
|
* {@link ConfigProvider}.
|
||||||
|
*/
|
||||||
|
@ThreadSafe
|
||||||
|
public interface ConfigProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link DeclarativeConfigProperties} corresponding to <a
|
||||||
|
* href="https://github.com/open-telemetry/opentelemetry-configuration/blob/main/schema/instrumentation.json">instrumentation
|
||||||
|
* config</a>, or {@code null} if unavailable.
|
||||||
|
*
|
||||||
|
* @return the instrumentation {@link DeclarativeConfigProperties}
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
DeclarativeConfigProperties getInstrumentationConfig();
|
||||||
|
|
||||||
|
/** Returns a no-op {@link ConfigProvider}. */
|
||||||
|
static ConfigProvider noop() {
|
||||||
|
return () -> null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.api.incubator.config;
|
||||||
|
|
||||||
|
/** An exception that is thrown when errors occur with declarative configuration. */
|
||||||
|
public final class DeclarativeConfigException extends RuntimeException {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 3036584181551130522L;
|
||||||
|
|
||||||
|
/** Create a new configuration exception with specified {@code message} and without a cause. */
|
||||||
|
public DeclarativeConfigException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a new configuration exception with specified {@code message} and {@code cause}. */
|
||||||
|
public DeclarativeConfigException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,32 +3,51 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.opentelemetry.sdk.autoconfigure.spi.internal;
|
package io.opentelemetry.api.incubator.config;
|
||||||
|
|
||||||
import static io.opentelemetry.api.internal.ConfigUtil.defaultIfNull;
|
import static io.opentelemetry.api.internal.ConfigUtil.defaultIfNull;
|
||||||
|
|
||||||
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
|
import io.opentelemetry.common.ComponentLoader;
|
||||||
import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An interface for accessing structured configuration data.
|
* An interface for accessing declarative configuration data.
|
||||||
*
|
*
|
||||||
* <p>An instance of {@link StructuredConfigProperties} is equivalent to a <a
|
* <p>An instance of {@link DeclarativeConfigProperties} is equivalent to a <a
|
||||||
* href="https://yaml.org/spec/1.2.2/#3211-nodes">YAML mapping node</a>. It has accessors for
|
* href="https://yaml.org/spec/1.2.2/#3211-nodes">YAML mapping node</a>. It has accessors for
|
||||||
* reading scalar properties, {@link #getStructured(String)} for reading children which are
|
* reading scalar properties, {@link #getStructured(String)} for reading children which are
|
||||||
* themselves mappings, and {@link #getStructuredList(String)} for reading children which are
|
* themselves mappings, and {@link #getStructuredList(String)} for reading children which are
|
||||||
* sequences of mappings.
|
* sequences of mappings.
|
||||||
|
*
|
||||||
|
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
|
||||||
|
* at any time.
|
||||||
*/
|
*/
|
||||||
public interface StructuredConfigProperties {
|
public interface DeclarativeConfigProperties {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an empty {@link DeclarativeConfigProperties} instance.
|
||||||
|
*
|
||||||
|
* <p>Useful for walking the tree without checking for null. For example, to access a string key
|
||||||
|
* nested at .foo.bar.baz, call: {@code config.getStructured("foo", empty()).getStructured("bar",
|
||||||
|
* empty()).getString("baz")}.
|
||||||
|
*/
|
||||||
|
static DeclarativeConfigProperties empty() {
|
||||||
|
return EmptyDeclarativeConfigProperties.getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Return a map representation of the {@code declarativeConfigProperties}. */
|
||||||
|
static Map<String, Object> toMap(DeclarativeConfigProperties declarativeConfigProperties) {
|
||||||
|
return DeclarativeConfigPropertyUtil.toMap(declarativeConfigProperties);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@link String} configuration property.
|
* Returns a {@link String} configuration property.
|
||||||
*
|
*
|
||||||
* @return null if the property has not been configured
|
* @return null if the property has not been configured
|
||||||
* @throws ConfigurationException if the property is not a valid scalar string
|
* @throws DeclarativeConfigException if the property is not a valid scalar string
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
String getString(String name);
|
String getString(String name);
|
||||||
|
@ -38,7 +57,7 @@ public interface StructuredConfigProperties {
|
||||||
*
|
*
|
||||||
* @return a {@link String} configuration property or {@code defaultValue} if a property with
|
* @return a {@link String} configuration property or {@code defaultValue} if a property with
|
||||||
* {@code name} has not been configured
|
* {@code name} has not been configured
|
||||||
* @throws ConfigurationException if the property is not a valid scalar string
|
* @throws DeclarativeConfigException if the property is not a valid scalar string
|
||||||
*/
|
*/
|
||||||
default String getString(String name, String defaultValue) {
|
default String getString(String name, String defaultValue) {
|
||||||
return defaultIfNull(getString(name), defaultValue);
|
return defaultIfNull(getString(name), defaultValue);
|
||||||
|
@ -49,7 +68,7 @@ public interface StructuredConfigProperties {
|
||||||
* {@link Boolean#parseBoolean(String)} for handling the values.
|
* {@link Boolean#parseBoolean(String)} for handling the values.
|
||||||
*
|
*
|
||||||
* @return null if the property has not been configured
|
* @return null if the property has not been configured
|
||||||
* @throws ConfigurationException if the property is not a valid scalar boolean
|
* @throws DeclarativeConfigException if the property is not a valid scalar boolean
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
Boolean getBoolean(String name);
|
Boolean getBoolean(String name);
|
||||||
|
@ -59,7 +78,7 @@ public interface StructuredConfigProperties {
|
||||||
*
|
*
|
||||||
* @return a {@link Boolean} configuration property or {@code defaultValue} if a property with
|
* @return a {@link Boolean} configuration property or {@code defaultValue} if a property with
|
||||||
* {@code name} has not been configured
|
* {@code name} has not been configured
|
||||||
* @throws ConfigurationException if the property is not a valid scalar boolean
|
* @throws DeclarativeConfigException if the property is not a valid scalar boolean
|
||||||
*/
|
*/
|
||||||
default boolean getBoolean(String name, boolean defaultValue) {
|
default boolean getBoolean(String name, boolean defaultValue) {
|
||||||
return defaultIfNull(getBoolean(name), defaultValue);
|
return defaultIfNull(getBoolean(name), defaultValue);
|
||||||
|
@ -72,7 +91,7 @@ public interface StructuredConfigProperties {
|
||||||
* {@link Long#intValue()} which may result in loss of precision.
|
* {@link Long#intValue()} which may result in loss of precision.
|
||||||
*
|
*
|
||||||
* @return null if the property has not been configured
|
* @return null if the property has not been configured
|
||||||
* @throws ConfigurationException if the property is not a valid scalar integer
|
* @throws DeclarativeConfigException if the property is not a valid scalar integer
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
Integer getInt(String name);
|
Integer getInt(String name);
|
||||||
|
@ -85,7 +104,7 @@ public interface StructuredConfigProperties {
|
||||||
*
|
*
|
||||||
* @return a {@link Integer} configuration property or {@code defaultValue} if a property with
|
* @return a {@link Integer} configuration property or {@code defaultValue} if a property with
|
||||||
* {@code name} has not been configured
|
* {@code name} has not been configured
|
||||||
* @throws ConfigurationException if the property is not a valid scalar integer
|
* @throws DeclarativeConfigException if the property is not a valid scalar integer
|
||||||
*/
|
*/
|
||||||
default int getInt(String name, int defaultValue) {
|
default int getInt(String name, int defaultValue) {
|
||||||
return defaultIfNull(getInt(name), defaultValue);
|
return defaultIfNull(getInt(name), defaultValue);
|
||||||
|
@ -95,7 +114,7 @@ public interface StructuredConfigProperties {
|
||||||
* Returns a {@link Long} configuration property.
|
* Returns a {@link Long} configuration property.
|
||||||
*
|
*
|
||||||
* @return null if the property has not been configured
|
* @return null if the property has not been configured
|
||||||
* @throws ConfigurationException if the property is not a valid scalar long
|
* @throws DeclarativeConfigException if the property is not a valid scalar long
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
Long getLong(String name);
|
Long getLong(String name);
|
||||||
|
@ -105,7 +124,7 @@ public interface StructuredConfigProperties {
|
||||||
*
|
*
|
||||||
* @return a {@link Long} configuration property or {@code defaultValue} if a property with {@code
|
* @return a {@link Long} configuration property or {@code defaultValue} if a property with {@code
|
||||||
* name} has not been configured
|
* name} has not been configured
|
||||||
* @throws ConfigurationException if the property is not a valid scalar long
|
* @throws DeclarativeConfigException if the property is not a valid scalar long
|
||||||
*/
|
*/
|
||||||
default long getLong(String name, long defaultValue) {
|
default long getLong(String name, long defaultValue) {
|
||||||
return defaultIfNull(getLong(name), defaultValue);
|
return defaultIfNull(getLong(name), defaultValue);
|
||||||
|
@ -115,7 +134,7 @@ public interface StructuredConfigProperties {
|
||||||
* Returns a {@link Double} configuration property.
|
* Returns a {@link Double} configuration property.
|
||||||
*
|
*
|
||||||
* @return null if the property has not been configured
|
* @return null if the property has not been configured
|
||||||
* @throws ConfigurationException if the property is not a valid scalar double
|
* @throws DeclarativeConfigException if the property is not a valid scalar double
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
Double getDouble(String name);
|
Double getDouble(String name);
|
||||||
|
@ -125,7 +144,7 @@ public interface StructuredConfigProperties {
|
||||||
*
|
*
|
||||||
* @return a {@link Double} configuration property or {@code defaultValue} if a property with
|
* @return a {@link Double} configuration property or {@code defaultValue} if a property with
|
||||||
* {@code name} has not been configured
|
* {@code name} has not been configured
|
||||||
* @throws ConfigurationException if the property is not a valid scalar double
|
* @throws DeclarativeConfigException if the property is not a valid scalar double
|
||||||
*/
|
*/
|
||||||
default double getDouble(String name, double defaultValue) {
|
default double getDouble(String name, double defaultValue) {
|
||||||
return defaultIfNull(getDouble(name), defaultValue);
|
return defaultIfNull(getDouble(name), defaultValue);
|
||||||
|
@ -139,8 +158,8 @@ public interface StructuredConfigProperties {
|
||||||
* @param scalarType the scalar type, one of {@link String}, {@link Boolean}, {@link Long} or
|
* @param scalarType the scalar type, one of {@link String}, {@link Boolean}, {@link Long} or
|
||||||
* {@link Double}
|
* {@link Double}
|
||||||
* @return a {@link List} configuration property, or null if the property has not been configured
|
* @return a {@link List} configuration property, or null if the property has not been configured
|
||||||
* @throws ConfigurationException if the property is not a valid sequence of scalars, or if {@code
|
* @throws DeclarativeConfigException if the property is not a valid sequence of scalars, or if
|
||||||
* scalarType} is not supported
|
* {@code scalarType} is not supported
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
<T> List<T> getScalarList(String name, Class<T> scalarType);
|
<T> List<T> getScalarList(String name, Class<T> scalarType);
|
||||||
|
@ -149,34 +168,60 @@ public interface StructuredConfigProperties {
|
||||||
* Returns a {@link List} configuration property. Entries which are not strings are converted to
|
* Returns a {@link List} configuration property. Entries which are not strings are converted to
|
||||||
* their string representation.
|
* their string representation.
|
||||||
*
|
*
|
||||||
* @see ConfigProperties#getList(String name)
|
* @param name the property name
|
||||||
|
* @param scalarType the scalar type, one of {@link String}, {@link Boolean}, {@link Long} or
|
||||||
|
* {@link Double}
|
||||||
* @return a {@link List} configuration property or {@code defaultValue} if a property with {@code
|
* @return a {@link List} configuration property or {@code defaultValue} if a property with {@code
|
||||||
* name} has not been configured
|
* name} has not been configured
|
||||||
* @throws ConfigurationException if the property is not a valid sequence of scalars
|
* @throws DeclarativeConfigException if the property is not a valid sequence of scalars
|
||||||
*/
|
*/
|
||||||
default <T> List<T> getScalarList(String name, Class<T> scalarType, List<T> defaultValue) {
|
default <T> List<T> getScalarList(String name, Class<T> scalarType, List<T> defaultValue) {
|
||||||
return defaultIfNull(getScalarList(name, scalarType), defaultValue);
|
return defaultIfNull(getScalarList(name, scalarType), defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@link StructuredConfigProperties} configuration property.
|
* Returns a {@link DeclarativeConfigProperties} configuration property.
|
||||||
*
|
*
|
||||||
* @return a map-valued configuration property, or {@code null} if {@code name} has not been
|
* @return a map-valued configuration property, or {@code null} if {@code name} has not been
|
||||||
* configured
|
* configured
|
||||||
* @throws ConfigurationException if the property is not a mapping
|
* @throws DeclarativeConfigException if the property is not a mapping
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
StructuredConfigProperties getStructured(String name);
|
DeclarativeConfigProperties getStructured(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of {@link StructuredConfigProperties} configuration property.
|
* Returns a list of {@link DeclarativeConfigProperties} configuration property.
|
||||||
|
*
|
||||||
|
* @return a map-valued configuration property, or {@code defaultValue} if {@code name} has not
|
||||||
|
* been configured
|
||||||
|
* @throws DeclarativeConfigException if the property is not a mapping
|
||||||
|
*/
|
||||||
|
default DeclarativeConfigProperties getStructured(
|
||||||
|
String name, DeclarativeConfigProperties defaultValue) {
|
||||||
|
return defaultIfNull(getStructured(name), defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of {@link DeclarativeConfigProperties} configuration property.
|
||||||
*
|
*
|
||||||
* @return a list of map-valued configuration property, or {@code null} if {@code name} has not
|
* @return a list of map-valued configuration property, or {@code null} if {@code name} has not
|
||||||
* been configured
|
* been configured
|
||||||
* @throws ConfigurationException if the property is not a sequence of mappings
|
* @throws DeclarativeConfigException if the property is not a sequence of mappings
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
List<StructuredConfigProperties> getStructuredList(String name);
|
List<DeclarativeConfigProperties> getStructuredList(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of {@link DeclarativeConfigProperties} configuration property.
|
||||||
|
*
|
||||||
|
* @return a list of map-valued configuration property, or {@code defaultValue} if {@code name}
|
||||||
|
* has not been configured
|
||||||
|
* @throws DeclarativeConfigException if the property is not a sequence of mappings
|
||||||
|
*/
|
||||||
|
default List<DeclarativeConfigProperties> getStructuredList(
|
||||||
|
String name, List<DeclarativeConfigProperties> defaultValue) {
|
||||||
|
return defaultIfNull(getStructuredList(name), defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a set of all configuration property keys.
|
* Returns a set of all configuration property keys.
|
||||||
|
@ -184,4 +229,7 @@ public interface StructuredConfigProperties {
|
||||||
* @return the configuration property keys
|
* @return the configuration property keys
|
||||||
*/
|
*/
|
||||||
Set<String> getPropertyKeys();
|
Set<String> getPropertyKeys();
|
||||||
|
|
||||||
|
/** Return a {@link ComponentLoader} that should be used to load SPIs. */
|
||||||
|
ComponentLoader getComponentLoader();
|
||||||
}
|
}
|
|
@ -0,0 +1,126 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.api.incubator.config;
|
||||||
|
|
||||||
|
import static java.util.stream.Collectors.toList;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.BiFunction;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
final class DeclarativeConfigPropertyUtil {
|
||||||
|
|
||||||
|
private DeclarativeConfigPropertyUtil() {}
|
||||||
|
|
||||||
|
private static final List<BiFunction<String, DeclarativeConfigProperties, Object>>
|
||||||
|
valueResolvers =
|
||||||
|
Arrays.asList(
|
||||||
|
DeclarativeConfigPropertyUtil::getString,
|
||||||
|
DeclarativeConfigPropertyUtil::getBoolean,
|
||||||
|
DeclarativeConfigPropertyUtil::getLong,
|
||||||
|
DeclarativeConfigPropertyUtil::getDouble,
|
||||||
|
DeclarativeConfigPropertyUtil::getStringList,
|
||||||
|
DeclarativeConfigPropertyUtil::getBooleanList,
|
||||||
|
DeclarativeConfigPropertyUtil::getLongList,
|
||||||
|
DeclarativeConfigPropertyUtil::getDoubleList,
|
||||||
|
DeclarativeConfigPropertyUtil::getStringList,
|
||||||
|
DeclarativeConfigPropertyUtil::getStructuredList,
|
||||||
|
DeclarativeConfigPropertyUtil::getStructured);
|
||||||
|
|
||||||
|
static Map<String, Object> toMap(DeclarativeConfigProperties declarativeConfigProperties) {
|
||||||
|
Set<String> propertyKeys = declarativeConfigProperties.getPropertyKeys();
|
||||||
|
Map<String, Object> result = new HashMap<>(propertyKeys.size());
|
||||||
|
for (String key : declarativeConfigProperties.getPropertyKeys()) {
|
||||||
|
result.put(key, resolveValue(key, declarativeConfigProperties));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private static Object resolveValue(
|
||||||
|
String key, DeclarativeConfigProperties declarativeConfigProperties) {
|
||||||
|
for (int i = 0; i < valueResolvers.size(); i++) {
|
||||||
|
try {
|
||||||
|
Object value = valueResolvers.get(i).apply(key, declarativeConfigProperties);
|
||||||
|
if (value != null) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
} catch (DeclarativeConfigException e) {
|
||||||
|
// Ignore and continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private static Object getString(
|
||||||
|
String key, DeclarativeConfigProperties declarativeConfigProperties) {
|
||||||
|
return declarativeConfigProperties.getString(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private static Object getBoolean(
|
||||||
|
String key, DeclarativeConfigProperties declarativeConfigProperties) {
|
||||||
|
return declarativeConfigProperties.getBoolean(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private static Object getLong(
|
||||||
|
String key, DeclarativeConfigProperties declarativeConfigProperties) {
|
||||||
|
return declarativeConfigProperties.getLong(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private static Object getDouble(
|
||||||
|
String key, DeclarativeConfigProperties declarativeConfigProperties) {
|
||||||
|
return declarativeConfigProperties.getDouble(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private static Object getStringList(
|
||||||
|
String key, DeclarativeConfigProperties declarativeConfigProperties) {
|
||||||
|
return declarativeConfigProperties.getScalarList(key, String.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private static Object getBooleanList(
|
||||||
|
String key, DeclarativeConfigProperties declarativeConfigProperties) {
|
||||||
|
return declarativeConfigProperties.getScalarList(key, Boolean.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private static Object getLongList(
|
||||||
|
String key, DeclarativeConfigProperties declarativeConfigProperties) {
|
||||||
|
return declarativeConfigProperties.getScalarList(key, Long.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private static Object getDoubleList(
|
||||||
|
String key, DeclarativeConfigProperties declarativeConfigProperties) {
|
||||||
|
return declarativeConfigProperties.getScalarList(key, Double.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private static Object getStructuredList(
|
||||||
|
String key, DeclarativeConfigProperties declarativeConfigProperties) {
|
||||||
|
return Optional.ofNullable(declarativeConfigProperties.getStructuredList(key))
|
||||||
|
.map(list -> list.stream().map(DeclarativeConfigPropertyUtil::toMap).collect(toList()))
|
||||||
|
.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private static Object getStructured(
|
||||||
|
String key, DeclarativeConfigProperties declarativeConfigProperties) {
|
||||||
|
return Optional.ofNullable(declarativeConfigProperties.getStructured(key))
|
||||||
|
.map(DeclarativeConfigPropertyUtil::toMap)
|
||||||
|
.orElse(null);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.api.incubator.config;
|
||||||
|
|
||||||
|
import io.opentelemetry.common.ComponentLoader;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
/** Empty instance of {@link DeclarativeConfigProperties}. */
|
||||||
|
final class EmptyDeclarativeConfigProperties implements DeclarativeConfigProperties {
|
||||||
|
|
||||||
|
private static final EmptyDeclarativeConfigProperties INSTANCE =
|
||||||
|
new EmptyDeclarativeConfigProperties();
|
||||||
|
private static final ComponentLoader COMPONENT_LOADER =
|
||||||
|
ComponentLoader.forClassLoader(EmptyDeclarativeConfigProperties.class.getClassLoader());
|
||||||
|
|
||||||
|
private EmptyDeclarativeConfigProperties() {}
|
||||||
|
|
||||||
|
static EmptyDeclarativeConfigProperties getInstance() {
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public String getString(String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Boolean getBoolean(String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Integer getInt(String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Long getLong(String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Double getDouble(String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public <T> List<T> getScalarList(String name, Class<T> scalarType) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public DeclarativeConfigProperties getStructured(String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public List<DeclarativeConfigProperties> getStructuredList(String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<String> getPropertyKeys() {
|
||||||
|
return Collections.emptySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ComponentLoader getComponentLoader() {
|
||||||
|
return COMPONENT_LOADER;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.api.incubator.config;
|
||||||
|
|
||||||
|
import io.opentelemetry.api.GlobalOpenTelemetry;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides a temporary global accessor for {@link ConfigProvider} until the
|
||||||
|
* instrumentation config API is marked stable. It will eventually be merged into {@link
|
||||||
|
* GlobalOpenTelemetry}.
|
||||||
|
*/
|
||||||
|
// We intentionally assign to be used for error reporting.
|
||||||
|
@SuppressWarnings("StaticAssignmentOfThrowable")
|
||||||
|
public final class GlobalConfigProvider {
|
||||||
|
|
||||||
|
private static final AtomicReference<ConfigProvider> instance =
|
||||||
|
new AtomicReference<>(ConfigProvider.noop());
|
||||||
|
|
||||||
|
@SuppressWarnings("NonFinalStaticField")
|
||||||
|
@Nullable
|
||||||
|
private static volatile Throwable setInstanceCaller;
|
||||||
|
|
||||||
|
private GlobalConfigProvider() {}
|
||||||
|
|
||||||
|
/** Returns the globally registered {@link ConfigProvider}. */
|
||||||
|
// instance cannot be set to null
|
||||||
|
@SuppressWarnings("NullAway")
|
||||||
|
public static ConfigProvider get() {
|
||||||
|
return instance.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the global {@link ConfigProvider}. Future calls to {@link #get()} will return the provided
|
||||||
|
* {@link ConfigProvider} instance. This should be called once as early as possible in your
|
||||||
|
* application initialization logic.
|
||||||
|
*
|
||||||
|
* @throws IllegalStateException when called more than once
|
||||||
|
*/
|
||||||
|
public static void set(ConfigProvider configProvider) {
|
||||||
|
boolean changed = instance.compareAndSet(ConfigProvider.noop(), configProvider);
|
||||||
|
if (!changed && (configProvider != ConfigProvider.noop())) {
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"GlobalConfigProvider.set has already been called. GlobalConfigProvider.set "
|
||||||
|
+ "must be called only once before any calls to GlobalConfigProvider.get. "
|
||||||
|
+ "Previous invocation set to cause of this exception.",
|
||||||
|
setInstanceCaller);
|
||||||
|
}
|
||||||
|
setInstanceCaller = new Throwable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unsets the global {@link ConfigProvider}. This is only meant to be used from tests which need
|
||||||
|
* to reconfigure {@link ConfigProvider}.
|
||||||
|
*/
|
||||||
|
public static void resetForTest() {
|
||||||
|
instance.set(ConfigProvider.noop());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,197 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.api.incubator.config;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A collection of convenience methods to extract instrumentation config from {@link
|
||||||
|
* ConfigProvider#getInstrumentationConfig()}.
|
||||||
|
*/
|
||||||
|
public class InstrumentationConfigUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a map representation of the peer service map entries in {@code
|
||||||
|
* .instrumentation.general.peer.service_mapping}, or null if none is configured.
|
||||||
|
*
|
||||||
|
* @throws DeclarativeConfigException if an unexpected type is encountered accessing the property
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public static Map<String, String> peerServiceMapping(ConfigProvider configProvider) {
|
||||||
|
List<DeclarativeConfigProperties> serviceMappingList =
|
||||||
|
getOrNull(
|
||||||
|
configProvider,
|
||||||
|
config -> config.getStructuredList("service_mapping"),
|
||||||
|
"general",
|
||||||
|
"peer");
|
||||||
|
if (serviceMappingList == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Map<String, String> serviceMapping = new LinkedHashMap<>();
|
||||||
|
serviceMappingList.forEach(
|
||||||
|
entry -> {
|
||||||
|
String peer = entry.getString("peer");
|
||||||
|
String service = entry.getString("service");
|
||||||
|
if (peer != null && service != null) {
|
||||||
|
serviceMapping.put(peer, service);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return serviceMapping.isEmpty() ? null : serviceMapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return {@code .instrumentation.general.http.client.request_captured_headers}, or null if none
|
||||||
|
* is configured.
|
||||||
|
*
|
||||||
|
* @throws DeclarativeConfigException if an unexpected type is encountered accessing the property
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public static List<String> httpClientRequestCapturedHeaders(ConfigProvider configProvider) {
|
||||||
|
return getOrNull(
|
||||||
|
configProvider,
|
||||||
|
config -> config.getScalarList("request_captured_headers", String.class),
|
||||||
|
"general",
|
||||||
|
"http",
|
||||||
|
"client");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return {@code .instrumentation.general.http.client.response_captured_headers}, or null if none
|
||||||
|
* is configured.
|
||||||
|
*
|
||||||
|
* @throws DeclarativeConfigException if an unexpected type is encountered accessing the property
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public static List<String> httpClientResponseCapturedHeaders(ConfigProvider configProvider) {
|
||||||
|
return getOrNull(
|
||||||
|
configProvider,
|
||||||
|
config -> config.getScalarList("response_captured_headers", String.class),
|
||||||
|
"general",
|
||||||
|
"http",
|
||||||
|
"client");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return {@code .instrumentation.general.http.server.request_captured_headers}, or null if none
|
||||||
|
* is configured.
|
||||||
|
*
|
||||||
|
* @throws DeclarativeConfigException if an unexpected type is encountered accessing the property
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public static List<String> httpServerRequestCapturedHeaders(ConfigProvider configProvider) {
|
||||||
|
return getOrNull(
|
||||||
|
configProvider,
|
||||||
|
config -> config.getScalarList("request_captured_headers", String.class),
|
||||||
|
"general",
|
||||||
|
"http",
|
||||||
|
"server");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return {@code .instrumentation.general.http.server.response_captured_headers}, or null if none
|
||||||
|
* is configured.
|
||||||
|
*
|
||||||
|
* @throws DeclarativeConfigException if an unexpected type is encountered accessing the property
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public static List<String> httpServerResponseCapturedHeaders(ConfigProvider configProvider) {
|
||||||
|
return getOrNull(
|
||||||
|
configProvider,
|
||||||
|
config -> config.getScalarList("response_captured_headers", String.class),
|
||||||
|
"general",
|
||||||
|
"http",
|
||||||
|
"server");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return {@code .instrumentation.java.<instrumentationName>}, or null if none is configured.
|
||||||
|
*
|
||||||
|
* @throws DeclarativeConfigException if an unexpected type is encountered accessing the property
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public static DeclarativeConfigProperties javaInstrumentationConfig(
|
||||||
|
ConfigProvider configProvider, String instrumentationName) {
|
||||||
|
return getOrNull(configProvider, config -> config.getStructured(instrumentationName), "java");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Walk down the {@code segments} of {@link ConfigProvider#getInstrumentationConfig()} and call
|
||||||
|
* {@code accessor} on the terminal node. Returns null if {@link
|
||||||
|
* ConfigProvider#getInstrumentationConfig()} is null, or if null is encountered walking the
|
||||||
|
* {@code segments}, or if {@code accessor} returns null.
|
||||||
|
*
|
||||||
|
* <p>See other methods in {@link InstrumentationConfigUtil} for usage examples.
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public static <T> T getOrNull(
|
||||||
|
ConfigProvider configProvider,
|
||||||
|
Function<DeclarativeConfigProperties, T> accessor,
|
||||||
|
String... segments) {
|
||||||
|
DeclarativeConfigProperties config = configProvider.getInstrumentationConfig();
|
||||||
|
if (config == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (String segment : segments) {
|
||||||
|
config = config.getStructured(segment);
|
||||||
|
if (config == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return accessor.apply(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
private InstrumentationConfigUtil() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return {@code .instrumentation.java.<instrumentationName>}, after converting it to the {@code
|
||||||
|
* modelType} using the {@code objectMapper}. If no configuration exists for the {@code
|
||||||
|
* instrumentationName}, returns {@code null}.
|
||||||
|
*
|
||||||
|
* <p>This method is a convenience method for a common instrumentation library workflow:
|
||||||
|
*
|
||||||
|
* <ul>
|
||||||
|
* <li>During initialization, an instrumentation library is given an {@link ConfigProvider} and
|
||||||
|
* must initialize according to the relevant config
|
||||||
|
* <li>It checks if the user has provided configuration for it, and if so...
|
||||||
|
* <li>It converts the configuration to an in-memory model representing all of its relevant
|
||||||
|
* properties
|
||||||
|
* <li>It initializes using the strongly typed in-memory model
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* <p>Conversion is done using {@link ObjectMapper#convertValue(Object, Class)} from {@code
|
||||||
|
* com.fasterxml.jackson.databind}, and assumes the {@code modelType} is a POJO written /
|
||||||
|
* annotated to support jackson databinding.
|
||||||
|
*
|
||||||
|
* <p>NOTE: callers MUST add their own dependency on {@code
|
||||||
|
* com.fasterxml.jackson.core:jackson-databind}. This module's dependency is {@code compileOnly}
|
||||||
|
* since jackson is a large dependency that many users will not require. It's very possible to
|
||||||
|
* convert between {@link DeclarativeConfigProperties} (or a map representation from {@link
|
||||||
|
* DeclarativeConfigProperties#toMap(DeclarativeConfigProperties)}) and a target model type
|
||||||
|
* without jackson. This method is provided as an optional convenience method.
|
||||||
|
*
|
||||||
|
* @throws IllegalArgumentException if conversion fails. See {@link
|
||||||
|
* ObjectMapper#convertValue(Object, Class)} for details.
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public static <T> T getInstrumentationConfigModel(
|
||||||
|
ConfigProvider configProvider,
|
||||||
|
String instrumentationName,
|
||||||
|
ObjectMapper objectMapper,
|
||||||
|
Class<T> modelType) {
|
||||||
|
DeclarativeConfigProperties properties =
|
||||||
|
javaInstrumentationConfig(configProvider, instrumentationName);
|
||||||
|
if (properties == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Map<String, Object> configPropertiesMap = DeclarativeConfigProperties.toMap(properties);
|
||||||
|
return objectMapper.convertValue(configPropertiesMap, modelType);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,67 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright The OpenTelemetry Authors
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.opentelemetry.api.incubator.events;
|
|
||||||
|
|
||||||
import io.opentelemetry.api.common.Attributes;
|
|
||||||
import io.opentelemetry.api.common.Value;
|
|
||||||
import io.opentelemetry.api.logs.Severity;
|
|
||||||
import io.opentelemetry.context.Context;
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
class DefaultEventLogger implements EventLogger {
|
|
||||||
|
|
||||||
private static final EventLogger INSTANCE = new DefaultEventLogger();
|
|
||||||
|
|
||||||
private DefaultEventLogger() {}
|
|
||||||
|
|
||||||
static EventLogger getInstance() {
|
|
||||||
return INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EventBuilder builder(String eventName) {
|
|
||||||
return NoOpEventBuilder.INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class NoOpEventBuilder implements EventBuilder {
|
|
||||||
|
|
||||||
public static final EventBuilder INSTANCE = new NoOpEventBuilder();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EventBuilder put(String key, Value<?> value) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EventBuilder setTimestamp(long timestamp, TimeUnit unit) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EventBuilder setTimestamp(Instant instant) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EventBuilder setContext(Context context) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EventBuilder setSeverity(Severity severity) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EventBuilder setAttributes(Attributes attributes) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void emit() {}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright The OpenTelemetry Authors
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.opentelemetry.api.incubator.events;
|
|
||||||
|
|
||||||
class DefaultEventLoggerProvider implements EventLoggerProvider {
|
|
||||||
|
|
||||||
private static final EventLoggerProvider INSTANCE = new DefaultEventLoggerProvider();
|
|
||||||
private static final EventLoggerBuilder NOOP_EVENT_LOGGER_BUILDER = new NoopEventLoggerBuilder();
|
|
||||||
|
|
||||||
private DefaultEventLoggerProvider() {}
|
|
||||||
|
|
||||||
static EventLoggerProvider getInstance() {
|
|
||||||
return INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EventLoggerBuilder eventLoggerBuilder(String instrumentationScopeName) {
|
|
||||||
return NOOP_EVENT_LOGGER_BUILDER;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class NoopEventLoggerBuilder implements EventLoggerBuilder {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EventLoggerBuilder setSchemaUrl(String schemaUrl) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EventLoggerBuilder setInstrumentationVersion(String instrumentationVersion) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EventLogger build() {
|
|
||||||
return DefaultEventLogger.getInstance();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,153 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright The OpenTelemetry Authors
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.opentelemetry.api.incubator.events;
|
|
||||||
|
|
||||||
import static java.util.stream.Collectors.toList;
|
|
||||||
|
|
||||||
import io.opentelemetry.api.common.AttributeKey;
|
|
||||||
import io.opentelemetry.api.common.Attributes;
|
|
||||||
import io.opentelemetry.api.common.Value;
|
|
||||||
import io.opentelemetry.api.logs.Severity;
|
|
||||||
import io.opentelemetry.context.Context;
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/** The EventBuilder is used to {@link #emit()} events. */
|
|
||||||
public interface EventBuilder {
|
|
||||||
|
|
||||||
/** Put the given {@code key} and {@code value} in the payload. */
|
|
||||||
default EventBuilder put(String key, String value) {
|
|
||||||
return put(key, Value.of(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Put the given {@code key} and {@code value} in the payload. */
|
|
||||||
default EventBuilder put(String key, long value) {
|
|
||||||
return put(key, Value.of(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Put the given {@code key} and {@code value} in the payload. */
|
|
||||||
default EventBuilder put(String key, double value) {
|
|
||||||
return put(key, Value.of(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Put the given {@code key} and {@code value} in the payload. */
|
|
||||||
default EventBuilder put(String key, boolean value) {
|
|
||||||
return put(key, Value.of(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Put the given {@code key} and {@code value} in the payload. */
|
|
||||||
default EventBuilder put(String key, String... value) {
|
|
||||||
List<Value<?>> values = new ArrayList<>(value.length);
|
|
||||||
for (String val : value) {
|
|
||||||
values.add(Value.of(val));
|
|
||||||
}
|
|
||||||
return put(key, Value.of(values));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Put the given {@code key} and {@code value} in the payload. */
|
|
||||||
default EventBuilder put(String key, long... value) {
|
|
||||||
List<Value<?>> values = new ArrayList<>(value.length);
|
|
||||||
for (long val : value) {
|
|
||||||
values.add(Value.of(val));
|
|
||||||
}
|
|
||||||
return put(key, Value.of(values));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Put the given {@code key} and {@code value} in the payload. */
|
|
||||||
default EventBuilder put(String key, double... value) {
|
|
||||||
List<Value<?>> values = new ArrayList<>(value.length);
|
|
||||||
for (double val : value) {
|
|
||||||
values.add(Value.of(val));
|
|
||||||
}
|
|
||||||
return put(key, Value.of(values));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Put the given {@code key} and {@code value} in the payload. */
|
|
||||||
default EventBuilder put(String key, boolean... value) {
|
|
||||||
List<Value<?>> values = new ArrayList<>(value.length);
|
|
||||||
for (boolean val : value) {
|
|
||||||
values.add(Value.of(val));
|
|
||||||
}
|
|
||||||
return put(key, Value.of(values));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Put the given key and value in the payload.
|
|
||||||
*
|
|
||||||
* <p>NOTE: The key value pair is NOT added to the event attributes. Setting event attributes is
|
|
||||||
* less common than adding entries to the event payload. Use {@link #setAttributes(Attributes)} if
|
|
||||||
* intending the data to be set in attributes instead of the payload.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
default <T> EventBuilder put(AttributeKey<T> key, T value) {
|
|
||||||
switch (key.getType()) {
|
|
||||||
case STRING:
|
|
||||||
return put(key.getKey(), (String) value);
|
|
||||||
case BOOLEAN:
|
|
||||||
return put(key.getKey(), (boolean) value);
|
|
||||||
case LONG:
|
|
||||||
return put(key.getKey(), (long) value);
|
|
||||||
case DOUBLE:
|
|
||||||
return put(key.getKey(), (double) value);
|
|
||||||
case STRING_ARRAY:
|
|
||||||
return put(
|
|
||||||
key.getKey(),
|
|
||||||
Value.of(((List<String>) value).stream().map(Value::of).collect(toList())));
|
|
||||||
case BOOLEAN_ARRAY:
|
|
||||||
return put(
|
|
||||||
key.getKey(),
|
|
||||||
Value.of(((List<Boolean>) value).stream().map(Value::of).collect(toList())));
|
|
||||||
case LONG_ARRAY:
|
|
||||||
return put(
|
|
||||||
key.getKey(), Value.of(((List<Long>) value).stream().map(Value::of).collect(toList())));
|
|
||||||
case DOUBLE_ARRAY:
|
|
||||||
return put(
|
|
||||||
key.getKey(),
|
|
||||||
Value.of(((List<Double>) value).stream().map(Value::of).collect(toList())));
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Put the given {@code key} and {@code value} in the payload. */
|
|
||||||
EventBuilder put(String key, Value<?> value);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the epoch {@code timestamp}, using the timestamp and unit.
|
|
||||||
*
|
|
||||||
* <p>The {@code timestamp} is the time at which the event occurred. If unset, it will be set to
|
|
||||||
* the current time when {@link #emit()} is called.
|
|
||||||
*/
|
|
||||||
EventBuilder setTimestamp(long timestamp, TimeUnit unit);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the epoch {@code timestamp}, using the instant.
|
|
||||||
*
|
|
||||||
* <p>The {@code timestamp} is the time at which the event occurred. If unset, it will be set to
|
|
||||||
* the current time when {@link #emit()} is called.
|
|
||||||
*/
|
|
||||||
EventBuilder setTimestamp(Instant instant);
|
|
||||||
|
|
||||||
/** Set the context. */
|
|
||||||
EventBuilder setContext(Context context);
|
|
||||||
|
|
||||||
/** Set the severity. */
|
|
||||||
EventBuilder setSeverity(Severity severity);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the attributes.
|
|
||||||
*
|
|
||||||
* <p>Event {@link io.opentelemetry.api.common.Attributes} provide additional details about the
|
|
||||||
* Event which are not part of the well-defined {@link Value} payload. Setting event attributes is
|
|
||||||
* less common than adding entries to the event payload. Most users will want to call one of the
|
|
||||||
* {@code #put(String, ?)} methods instead.
|
|
||||||
*/
|
|
||||||
EventBuilder setAttributes(Attributes attributes);
|
|
||||||
|
|
||||||
/** Emit an event. */
|
|
||||||
void emit();
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright The OpenTelemetry Authors
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.opentelemetry.api.incubator.events;
|
|
||||||
|
|
||||||
import javax.annotation.concurrent.ThreadSafe;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A {@link EventLogger} is the entry point into an event pipeline.
|
|
||||||
*
|
|
||||||
* <p>Example usage emitting events:
|
|
||||||
*
|
|
||||||
* <pre>{@code
|
|
||||||
* class MyClass {
|
|
||||||
* private final EventLogger eventLogger = eventLoggerProvider
|
|
||||||
* .eventLoggerBuilder("scope-name")
|
|
||||||
* .build();
|
|
||||||
*
|
|
||||||
* void doWork() {
|
|
||||||
* eventLogger.builder("my-namespace.my-event")
|
|
||||||
* .put("key1", "value1")
|
|
||||||
* .put("key2", "value2")
|
|
||||||
* .emit();
|
|
||||||
* // do work
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }</pre>
|
|
||||||
*/
|
|
||||||
@ThreadSafe
|
|
||||||
public interface EventLogger {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a {@link EventBuilder} to emit an event.
|
|
||||||
*
|
|
||||||
* @param eventName the event name, which identifies the class or type of event. Event with the
|
|
||||||
* same name are structurally similar to one another. Event names are subject to the same
|
|
||||||
* naming rules as attribute names. Notably, they are namespaced to avoid collisions. See <a
|
|
||||||
* href="https://opentelemetry.io/docs/specs/semconv/general/events/">event.name semantic
|
|
||||||
* conventions</a> for more details.
|
|
||||||
*/
|
|
||||||
EventBuilder builder(String eventName);
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright The OpenTelemetry Authors
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.opentelemetry.api.incubator.events;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builder class for creating {@link EventLogger} instances.
|
|
||||||
*
|
|
||||||
* <p>{@link EventLogger}s are identified by their scope name, version, and schema URL. These
|
|
||||||
* identifying fields, along with attributes, combine to form the instrumentation scope, which is
|
|
||||||
* attached to all events produced by the {@link EventLogger}.
|
|
||||||
*/
|
|
||||||
public interface EventLoggerBuilder {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the scope schema URL of the resulting {@link EventLogger}. Schema URL is part of {@link
|
|
||||||
* EventLogger} identity.
|
|
||||||
*
|
|
||||||
* @param schemaUrl The schema URL.
|
|
||||||
* @return this
|
|
||||||
*/
|
|
||||||
EventLoggerBuilder setSchemaUrl(String schemaUrl);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the instrumentation scope version of the resulting {@link EventLogger}. Version is part of
|
|
||||||
* {@link EventLogger} identity.
|
|
||||||
*
|
|
||||||
* @param instrumentationScopeVersion The instrumentation scope version.
|
|
||||||
* @return this
|
|
||||||
*/
|
|
||||||
EventLoggerBuilder setInstrumentationVersion(String instrumentationScopeVersion);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets or creates a {@link EventLogger} instance.
|
|
||||||
*
|
|
||||||
* @return a {@link EventLogger} instance configured with the provided options.
|
|
||||||
*/
|
|
||||||
EventLogger build();
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright The OpenTelemetry Authors
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.opentelemetry.api.incubator.events;
|
|
||||||
|
|
||||||
import javax.annotation.concurrent.ThreadSafe;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A registry for creating scoped {@link EventLogger}s. The name <i>Provider</i> is for consistency
|
|
||||||
* with other languages and it is <b>NOT</b> loaded using reflection.
|
|
||||||
*
|
|
||||||
* @see EventLogger
|
|
||||||
*/
|
|
||||||
@ThreadSafe
|
|
||||||
public interface EventLoggerProvider {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets or creates a named {@link EventLogger} instance.
|
|
||||||
*
|
|
||||||
* @param instrumentationScopeName A name uniquely identifying the instrumentation scope, such as
|
|
||||||
* the instrumentation library, package, or fully qualified class name. Must not be null.
|
|
||||||
* @return a Logger instance.
|
|
||||||
*/
|
|
||||||
default EventLogger get(String instrumentationScopeName) {
|
|
||||||
return eventLoggerBuilder(instrumentationScopeName).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a LoggerBuilder for a named {@link EventLogger} instance.
|
|
||||||
*
|
|
||||||
* @param instrumentationScopeName A name uniquely identifying the instrumentation scope, such as
|
|
||||||
* the instrumentation library, package, or fully qualified class name. Must not be null.
|
|
||||||
* @return a LoggerBuilder instance.
|
|
||||||
*/
|
|
||||||
EventLoggerBuilder eventLoggerBuilder(String instrumentationScopeName);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a no-op {@link EventLoggerProvider} which provides Loggers which do not record or emit.
|
|
||||||
*/
|
|
||||||
static EventLoggerProvider noop() {
|
|
||||||
return DefaultEventLoggerProvider.getInstance();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright The OpenTelemetry Authors
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.opentelemetry.api.incubator.events;
|
|
||||||
|
|
||||||
import io.opentelemetry.api.GlobalOpenTelemetry;
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class provides a temporary global accessor for {@link EventLoggerProvider} until the event
|
|
||||||
* API is marked stable. It will eventually be merged into {@link GlobalOpenTelemetry}.
|
|
||||||
*/
|
|
||||||
// We intentionally assign to be used for error reporting.
|
|
||||||
@SuppressWarnings("StaticAssignmentOfThrowable")
|
|
||||||
public final class GlobalEventLoggerProvider {
|
|
||||||
|
|
||||||
private static final AtomicReference<EventLoggerProvider> instance =
|
|
||||||
new AtomicReference<>(EventLoggerProvider.noop());
|
|
||||||
|
|
||||||
@SuppressWarnings("NonFinalStaticField")
|
|
||||||
@Nullable
|
|
||||||
private static volatile Throwable setInstanceCaller;
|
|
||||||
|
|
||||||
private GlobalEventLoggerProvider() {}
|
|
||||||
|
|
||||||
/** Returns the globally registered {@link EventLoggerProvider}. */
|
|
||||||
// instance cannot be set to null
|
|
||||||
@SuppressWarnings("NullAway")
|
|
||||||
public static EventLoggerProvider get() {
|
|
||||||
return instance.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the global {@link EventLoggerProvider}. Future calls to {@link #get()} will return the
|
|
||||||
* provided {@link EventLoggerProvider} instance. This should be called once as early as possible
|
|
||||||
* in your application initialization logic.
|
|
||||||
*/
|
|
||||||
public static void set(EventLoggerProvider eventLoggerProvider) {
|
|
||||||
boolean changed = instance.compareAndSet(EventLoggerProvider.noop(), eventLoggerProvider);
|
|
||||||
if (!changed && (eventLoggerProvider != EventLoggerProvider.noop())) {
|
|
||||||
throw new IllegalStateException(
|
|
||||||
"GlobalEventLoggerProvider.set has already been called. GlobalEventLoggerProvider.set "
|
|
||||||
+ "must be called only once before any calls to GlobalEventLoggerProvider.get. "
|
|
||||||
+ "Previous invocation set to cause of this exception.",
|
|
||||||
setInstanceCaller);
|
|
||||||
}
|
|
||||||
setInstanceCaller = new Throwable();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unsets the global {@link EventLoggerProvider}. This is only meant to be used from tests which
|
|
||||||
* need to reconfigure {@link EventLoggerProvider}.
|
|
||||||
*/
|
|
||||||
public static void resetForTest() {
|
|
||||||
instance.set(EventLoggerProvider.noop());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,178 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.api.incubator.internal;
|
||||||
|
|
||||||
|
import io.opentelemetry.api.common.AttributeKey;
|
||||||
|
import io.opentelemetry.api.common.AttributeType;
|
||||||
|
import io.opentelemetry.api.incubator.common.ExtendedAttributeKey;
|
||||||
|
import io.opentelemetry.api.incubator.common.ExtendedAttributeType;
|
||||||
|
import io.opentelemetry.api.internal.InternalAttributeKeyImpl;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
|
||||||
|
* any time.
|
||||||
|
*/
|
||||||
|
public final class InternalExtendedAttributeKeyImpl<T> implements ExtendedAttributeKey<T> {
|
||||||
|
|
||||||
|
private final ExtendedAttributeType type;
|
||||||
|
private final String key;
|
||||||
|
private final int hashCode;
|
||||||
|
|
||||||
|
@Nullable private byte[] keyUtf8;
|
||||||
|
@Nullable private AttributeKey<T> attributeKey;
|
||||||
|
|
||||||
|
private InternalExtendedAttributeKeyImpl(ExtendedAttributeType type, String key) {
|
||||||
|
if (type == null) {
|
||||||
|
throw new NullPointerException("Null type");
|
||||||
|
}
|
||||||
|
this.type = type;
|
||||||
|
if (key == null) {
|
||||||
|
throw new NullPointerException("Null key");
|
||||||
|
}
|
||||||
|
this.key = key;
|
||||||
|
this.hashCode = buildHashCode(type, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ExtendedAttributeKey<T> create(
|
||||||
|
@Nullable String key, ExtendedAttributeType type) {
|
||||||
|
return new InternalExtendedAttributeKeyImpl<>(type, key != null ? key : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExtendedAttributeType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public AttributeKey<T> asAttributeKey() {
|
||||||
|
if (attributeKey == null) {
|
||||||
|
attributeKey = toAttributeKey(this);
|
||||||
|
}
|
||||||
|
return attributeKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns the key, encoded as UTF-8 bytes. */
|
||||||
|
public byte[] getKeyUtf8() {
|
||||||
|
byte[] keyUtf8 = this.keyUtf8;
|
||||||
|
if (keyUtf8 == null) {
|
||||||
|
keyUtf8 = key.getBytes(StandardCharsets.UTF_8);
|
||||||
|
this.keyUtf8 = keyUtf8;
|
||||||
|
}
|
||||||
|
return keyUtf8;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(@Nullable Object o) {
|
||||||
|
if (o == this) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o instanceof InternalExtendedAttributeKeyImpl) {
|
||||||
|
InternalExtendedAttributeKeyImpl<?> that = (InternalExtendedAttributeKeyImpl<?>) o;
|
||||||
|
return this.type.equals(that.getType()) && this.key.equals(that.getKey());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return hashCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
// this method exists to make EqualsVerifier happy
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private int buildHashCode() {
|
||||||
|
return buildHashCode(type, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int buildHashCode(ExtendedAttributeType type, String key) {
|
||||||
|
int result = 1;
|
||||||
|
result *= 1000003;
|
||||||
|
result ^= type.hashCode();
|
||||||
|
result *= 1000003;
|
||||||
|
result ^= key.hashCode();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the equivalent {@link AttributeKey} for the {@link ExtendedAttributeKey}, or {@code
|
||||||
|
* null} if the {@link #getType()} has no equivalent {@link
|
||||||
|
* io.opentelemetry.api.common.AttributeType}.
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public static <T> AttributeKey<T> toAttributeKey(ExtendedAttributeKey<T> extendedAttributeKey) {
|
||||||
|
switch (extendedAttributeKey.getType()) {
|
||||||
|
case STRING:
|
||||||
|
return InternalAttributeKeyImpl.create(extendedAttributeKey.getKey(), AttributeType.STRING);
|
||||||
|
case BOOLEAN:
|
||||||
|
return InternalAttributeKeyImpl.create(
|
||||||
|
extendedAttributeKey.getKey(), AttributeType.BOOLEAN);
|
||||||
|
case LONG:
|
||||||
|
return InternalAttributeKeyImpl.create(extendedAttributeKey.getKey(), AttributeType.LONG);
|
||||||
|
case DOUBLE:
|
||||||
|
return InternalAttributeKeyImpl.create(extendedAttributeKey.getKey(), AttributeType.DOUBLE);
|
||||||
|
case STRING_ARRAY:
|
||||||
|
return InternalAttributeKeyImpl.create(
|
||||||
|
extendedAttributeKey.getKey(), AttributeType.STRING_ARRAY);
|
||||||
|
case BOOLEAN_ARRAY:
|
||||||
|
return InternalAttributeKeyImpl.create(
|
||||||
|
extendedAttributeKey.getKey(), AttributeType.BOOLEAN_ARRAY);
|
||||||
|
case LONG_ARRAY:
|
||||||
|
return InternalAttributeKeyImpl.create(
|
||||||
|
extendedAttributeKey.getKey(), AttributeType.LONG_ARRAY);
|
||||||
|
case DOUBLE_ARRAY:
|
||||||
|
return InternalAttributeKeyImpl.create(
|
||||||
|
extendedAttributeKey.getKey(), AttributeType.DOUBLE_ARRAY);
|
||||||
|
case EXTENDED_ATTRIBUTES:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Unrecognized extendedAttributeKey type: " + extendedAttributeKey.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Return the equivalent {@link ExtendedAttributeKey} for the {@link AttributeKey}. */
|
||||||
|
public static <T> ExtendedAttributeKey<T> toExtendedAttributeKey(AttributeKey<T> attributeKey) {
|
||||||
|
switch (attributeKey.getType()) {
|
||||||
|
case STRING:
|
||||||
|
return InternalExtendedAttributeKeyImpl.create(
|
||||||
|
attributeKey.getKey(), ExtendedAttributeType.STRING);
|
||||||
|
case BOOLEAN:
|
||||||
|
return InternalExtendedAttributeKeyImpl.create(
|
||||||
|
attributeKey.getKey(), ExtendedAttributeType.BOOLEAN);
|
||||||
|
case LONG:
|
||||||
|
return InternalExtendedAttributeKeyImpl.create(
|
||||||
|
attributeKey.getKey(), ExtendedAttributeType.LONG);
|
||||||
|
case DOUBLE:
|
||||||
|
return InternalExtendedAttributeKeyImpl.create(
|
||||||
|
attributeKey.getKey(), ExtendedAttributeType.DOUBLE);
|
||||||
|
case STRING_ARRAY:
|
||||||
|
return InternalExtendedAttributeKeyImpl.create(
|
||||||
|
attributeKey.getKey(), ExtendedAttributeType.STRING_ARRAY);
|
||||||
|
case BOOLEAN_ARRAY:
|
||||||
|
return InternalExtendedAttributeKeyImpl.create(
|
||||||
|
attributeKey.getKey(), ExtendedAttributeType.BOOLEAN_ARRAY);
|
||||||
|
case LONG_ARRAY:
|
||||||
|
return InternalExtendedAttributeKeyImpl.create(
|
||||||
|
attributeKey.getKey(), ExtendedAttributeType.LONG_ARRAY);
|
||||||
|
case DOUBLE_ARRAY:
|
||||||
|
return InternalExtendedAttributeKeyImpl.create(
|
||||||
|
attributeKey.getKey(), ExtendedAttributeType.DOUBLE_ARRAY);
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Unrecognized attributeKey type: " + attributeKey.getType());
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,17 +7,19 @@ package io.opentelemetry.api.incubator.logs;
|
||||||
|
|
||||||
import io.opentelemetry.api.common.AttributeKey;
|
import io.opentelemetry.api.common.AttributeKey;
|
||||||
import io.opentelemetry.api.common.Value;
|
import io.opentelemetry.api.common.Value;
|
||||||
import io.opentelemetry.api.logs.LogRecordBuilder;
|
import io.opentelemetry.api.incubator.common.ExtendedAttributeKey;
|
||||||
import io.opentelemetry.api.logs.Logger;
|
import io.opentelemetry.api.logs.Logger;
|
||||||
import io.opentelemetry.api.logs.Severity;
|
import io.opentelemetry.api.logs.Severity;
|
||||||
import io.opentelemetry.context.Context;
|
import io.opentelemetry.context.Context;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
class ExtendedDefaultLogger implements ExtendedLogger {
|
class ExtendedDefaultLogger implements ExtendedLogger {
|
||||||
|
|
||||||
private static final Logger INSTANCE = new ExtendedDefaultLogger();
|
private static final Logger INSTANCE = new ExtendedDefaultLogger();
|
||||||
private static final LogRecordBuilder NOOP_LOG_RECORD_BUILDER = new NoopLogRecordBuilder();
|
private static final ExtendedLogRecordBuilder NOOP_LOG_RECORD_BUILDER =
|
||||||
|
new NoopExtendedLogRecordBuilder();
|
||||||
|
|
||||||
private ExtendedDefaultLogger() {}
|
private ExtendedDefaultLogger() {}
|
||||||
|
|
||||||
|
@ -26,61 +28,81 @@ class ExtendedDefaultLogger implements ExtendedLogger {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LogRecordBuilder logRecordBuilder() {
|
public boolean isEnabled(Severity severity, Context context) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExtendedLogRecordBuilder logRecordBuilder() {
|
||||||
return NOOP_LOG_RECORD_BUILDER;
|
return NOOP_LOG_RECORD_BUILDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class NoopLogRecordBuilder implements ExtendedLogRecordBuilder {
|
private static final class NoopExtendedLogRecordBuilder implements ExtendedLogRecordBuilder {
|
||||||
|
|
||||||
private NoopLogRecordBuilder() {}
|
private NoopExtendedLogRecordBuilder() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LogRecordBuilder setTimestamp(long timestamp, TimeUnit unit) {
|
public ExtendedLogRecordBuilder setEventName(String eventName) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LogRecordBuilder setTimestamp(Instant instant) {
|
public ExtendedLogRecordBuilder setException(Throwable throwable) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LogRecordBuilder setObservedTimestamp(long timestamp, TimeUnit unit) {
|
public <T> ExtendedLogRecordBuilder setAttribute(ExtendedAttributeKey<T> key, T value) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LogRecordBuilder setObservedTimestamp(Instant instant) {
|
public <T> ExtendedLogRecordBuilder setAttribute(AttributeKey<T> key, @Nullable T value) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LogRecordBuilder setContext(Context context) {
|
public ExtendedLogRecordBuilder setTimestamp(long timestamp, TimeUnit unit) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LogRecordBuilder setSeverity(Severity severity) {
|
public ExtendedLogRecordBuilder setTimestamp(Instant instant) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LogRecordBuilder setSeverityText(String severityText) {
|
public ExtendedLogRecordBuilder setObservedTimestamp(long timestamp, TimeUnit unit) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LogRecordBuilder setBody(String body) {
|
public ExtendedLogRecordBuilder setObservedTimestamp(Instant instant) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LogRecordBuilder setBody(Value<?> body) {
|
public ExtendedLogRecordBuilder setContext(Context context) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> LogRecordBuilder setAttribute(AttributeKey<T> key, T value) {
|
public ExtendedLogRecordBuilder setSeverity(Severity severity) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExtendedLogRecordBuilder setSeverityText(String severityText) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExtendedLogRecordBuilder setBody(String body) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExtendedLogRecordBuilder setBody(Value<?> body) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,134 @@
|
||||||
|
|
||||||
package io.opentelemetry.api.incubator.logs;
|
package io.opentelemetry.api.incubator.logs;
|
||||||
|
|
||||||
|
import io.opentelemetry.api.common.AttributeKey;
|
||||||
|
import io.opentelemetry.api.common.Attributes;
|
||||||
|
import io.opentelemetry.api.common.Value;
|
||||||
|
import io.opentelemetry.api.incubator.common.ExtendedAttributeKey;
|
||||||
|
import io.opentelemetry.api.incubator.common.ExtendedAttributes;
|
||||||
import io.opentelemetry.api.logs.LogRecordBuilder;
|
import io.opentelemetry.api.logs.LogRecordBuilder;
|
||||||
|
import io.opentelemetry.api.logs.Severity;
|
||||||
|
import io.opentelemetry.context.Context;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/** Extended {@link LogRecordBuilder} with experimental APIs. */
|
/** Extended {@link LogRecordBuilder} with experimental APIs. */
|
||||||
public interface ExtendedLogRecordBuilder extends LogRecordBuilder {
|
public interface ExtendedLogRecordBuilder extends LogRecordBuilder {
|
||||||
|
|
||||||
// Nothing at the moment, but experimental methods may be added in the future.
|
// keep this class even if it is empty, since experimental methods may be added in the future.
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
ExtendedLogRecordBuilder setTimestamp(long timestamp, TimeUnit unit);
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
ExtendedLogRecordBuilder setTimestamp(Instant instant);
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
ExtendedLogRecordBuilder setObservedTimestamp(long timestamp, TimeUnit unit);
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
ExtendedLogRecordBuilder setObservedTimestamp(Instant instant);
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
ExtendedLogRecordBuilder setContext(Context context);
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
ExtendedLogRecordBuilder setSeverity(Severity severity);
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
ExtendedLogRecordBuilder setSeverityText(String severityText);
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
ExtendedLogRecordBuilder setBody(String body);
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
default ExtendedLogRecordBuilder setBody(Value<?> body) {
|
||||||
|
setBody(body.asString());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the event name, which identifies the class / type of the Event.
|
||||||
|
*
|
||||||
|
* <p>This name should uniquely identify the event structure (both attributes and body). A log
|
||||||
|
* record with a non-empty event name is an Event.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
ExtendedLogRecordBuilder setEventName(String eventName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*
|
||||||
|
* <p>NOTE: all standard {@link AttributeKey}-value pairs can also be represented as {@link
|
||||||
|
* ExtendedAttributeKey}-value pairs, but not all {@link ExtendedAttributeKey}-value pairs can be
|
||||||
|
* represented as standard {@link AttributeKey}-value pairs. From the standpoint of the emitted
|
||||||
|
* log record, there is no difference between adding attributes using the standard or extended
|
||||||
|
* attribute APIs.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
default ExtendedLogRecordBuilder setAllAttributes(Attributes attributes) {
|
||||||
|
if (attributes == null || attributes.isEmpty()) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
attributes.forEach(
|
||||||
|
(attributeKey, value) -> setAttribute((AttributeKey<Object>) attributeKey, value));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets attributes. If the {@link LogRecordBuilder} previously contained a mapping for any of the
|
||||||
|
* keys, the old values are replaced by the specified values.
|
||||||
|
*
|
||||||
|
* <p>NOTE: all standard {@link AttributeKey}-value pairs can also be represented as {@link
|
||||||
|
* ExtendedAttributeKey}-value pairs, but not all {@link ExtendedAttributeKey}-value pairs can be
|
||||||
|
* represented as standard {@link AttributeKey}-value pairs. From the standpoint of the emitted
|
||||||
|
* log record, there is no difference between adding attributes using the standard or extended
|
||||||
|
* attribute APIs.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
default ExtendedLogRecordBuilder setAllAttributes(ExtendedAttributes attributes) {
|
||||||
|
if (attributes == null || attributes.isEmpty()) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
attributes.forEach(
|
||||||
|
(attributeKey, value) -> setAttribute((ExtendedAttributeKey<Object>) attributeKey, value));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*
|
||||||
|
* <p>NOTE: all standard {@link AttributeKey}-value pairs can also be represented as {@link
|
||||||
|
* ExtendedAttributeKey}-value pairs, but not all {@link ExtendedAttributeKey}-value pairs can be
|
||||||
|
* represented as standard {@link AttributeKey}-value pairs. From the standpoint of the emitted
|
||||||
|
* log record, there is no difference between adding attributes using the standard or extended
|
||||||
|
* attribute APIs.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
<T> ExtendedLogRecordBuilder setAttribute(AttributeKey<T> key, @Nullable T value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an attribute.
|
||||||
|
*
|
||||||
|
* <p>NOTE: all standard {@link AttributeKey}-value pairs can also be represented as {@link
|
||||||
|
* ExtendedAttributeKey}-value pairs, but not all {@link ExtendedAttributeKey}-value pairs can be
|
||||||
|
* represented as standard {@link AttributeKey}-value pairs. From the standpoint of the emitted
|
||||||
|
* log record, there is no difference between adding attributes using the standard or extended
|
||||||
|
* attribute APIs.
|
||||||
|
*/
|
||||||
|
<T> ExtendedLogRecordBuilder setAttribute(ExtendedAttributeKey<T> key, T value);
|
||||||
|
|
||||||
|
/** Set standard {@code exception.*} attributes based on the {@code throwable}. */
|
||||||
|
ExtendedLogRecordBuilder setException(Throwable throwable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,18 +6,41 @@
|
||||||
package io.opentelemetry.api.incubator.logs;
|
package io.opentelemetry.api.incubator.logs;
|
||||||
|
|
||||||
import io.opentelemetry.api.logs.Logger;
|
import io.opentelemetry.api.logs.Logger;
|
||||||
|
import io.opentelemetry.api.logs.Severity;
|
||||||
|
import io.opentelemetry.context.Context;
|
||||||
|
|
||||||
/** Extended {@link Logger} with experimental APIs. */
|
/** Extended {@link Logger} with experimental APIs. */
|
||||||
public interface ExtendedLogger extends Logger {
|
public interface ExtendedLogger extends Logger {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns {@code true} if the logger is enabled.
|
* Returns {@code true} if the logger is enabled for the given {@code context} and {@code
|
||||||
|
* severity}.
|
||||||
*
|
*
|
||||||
* <p>This allows callers to avoid unnecessary compute when nothing is consuming the data. Because
|
* <p>This allows callers to avoid unnecessary compute when nothing is consuming the data. Because
|
||||||
* the response is subject to change over the application, callers should call this before each
|
* the response is subject to change over the application, callers should call this before each
|
||||||
* call to {@link #logRecordBuilder()}.
|
* call to {@link #logRecordBuilder()}.
|
||||||
*/
|
*/
|
||||||
default boolean isEnabled() {
|
default boolean isEnabled(Severity severity, Context context) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Overload of {@link #isEnabled(Severity, Context)} assuming {@link Context#current()}. */
|
||||||
|
default boolean isEnabled(Severity severity) {
|
||||||
|
return isEnabled(severity, Context.current());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overload of {@link #isEnabled(Severity, Context)} assuming {@link
|
||||||
|
* Severity#UNDEFINED_SEVERITY_NUMBER} and {@link Context#current()}.
|
||||||
|
*
|
||||||
|
* @deprecated for removal after 1.55.0. Use {@link #isEnabled(Severity, Context)} or {@link
|
||||||
|
* #isEnabled(Severity)} instead.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
default boolean isEnabled() {
|
||||||
|
return isEnabled(Severity.UNDEFINED_SEVERITY_NUMBER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
ExtendedLogRecordBuilder logRecordBuilder();
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,6 +94,11 @@ class ExtendedDefaultMeter implements Meter {
|
||||||
private ExtendedDefaultMeter() {}
|
private ExtendedDefaultMeter() {}
|
||||||
|
|
||||||
private static class NoopLongCounter implements ExtendedLongCounter {
|
private static class NoopLongCounter implements ExtendedLongCounter {
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(long value, Attributes attributes, Context context) {}
|
public void add(long value, Attributes attributes, Context context) {}
|
||||||
|
|
||||||
|
@ -105,6 +110,11 @@ class ExtendedDefaultMeter implements Meter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class NoopDoubleCounter implements ExtendedDoubleCounter {
|
private static class NoopDoubleCounter implements ExtendedDoubleCounter {
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(double value, Attributes attributes, Context context) {}
|
public void add(double value, Attributes attributes, Context context) {}
|
||||||
|
|
||||||
|
@ -186,6 +196,11 @@ class ExtendedDefaultMeter implements Meter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class NoopLongUpDownCounter implements ExtendedLongUpDownCounter {
|
private static class NoopLongUpDownCounter implements ExtendedLongUpDownCounter {
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(long value, Attributes attributes, Context context) {}
|
public void add(long value, Attributes attributes, Context context) {}
|
||||||
|
|
||||||
|
@ -197,6 +212,11 @@ class ExtendedDefaultMeter implements Meter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class NoopDoubleUpDownCounter implements ExtendedDoubleUpDownCounter {
|
private static class NoopDoubleUpDownCounter implements ExtendedDoubleUpDownCounter {
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(double value, Attributes attributes, Context context) {}
|
public void add(double value, Attributes attributes, Context context) {}
|
||||||
|
|
||||||
|
@ -281,6 +301,11 @@ class ExtendedDefaultMeter implements Meter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class NoopDoubleHistogram implements ExtendedDoubleHistogram {
|
private static class NoopDoubleHistogram implements ExtendedDoubleHistogram {
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void record(double value, Attributes attributes, Context context) {}
|
public void record(double value, Attributes attributes, Context context) {}
|
||||||
|
|
||||||
|
@ -292,6 +317,11 @@ class ExtendedDefaultMeter implements Meter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class NoopLongHistogram implements ExtendedLongHistogram {
|
private static class NoopLongHistogram implements ExtendedLongHistogram {
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void record(long value, Attributes attributes, Context context) {}
|
public void record(long value, Attributes attributes, Context context) {}
|
||||||
|
|
||||||
|
@ -385,6 +415,11 @@ class ExtendedDefaultMeter implements Meter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class NoopDoubleGauge implements ExtendedDoubleGauge {
|
private static class NoopDoubleGauge implements ExtendedDoubleGauge {
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void set(double value) {}
|
public void set(double value) {}
|
||||||
|
|
||||||
|
@ -426,6 +461,11 @@ class ExtendedDefaultMeter implements Meter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class NoopLongGauge implements ExtendedLongGauge {
|
private static class NoopLongGauge implements ExtendedLongGauge {
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void set(long value) {}
|
public void set(long value) {}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ import io.opentelemetry.api.common.Attributes;
|
||||||
import io.opentelemetry.api.incubator.propagation.ExtendedContextPropagators;
|
import io.opentelemetry.api.incubator.propagation.ExtendedContextPropagators;
|
||||||
import io.opentelemetry.api.internal.ApiUsageLogger;
|
import io.opentelemetry.api.internal.ApiUsageLogger;
|
||||||
import io.opentelemetry.api.trace.Span;
|
import io.opentelemetry.api.trace.Span;
|
||||||
import io.opentelemetry.api.trace.SpanBuilder;
|
|
||||||
import io.opentelemetry.api.trace.SpanContext;
|
import io.opentelemetry.api.trace.SpanContext;
|
||||||
import io.opentelemetry.api.trace.SpanKind;
|
import io.opentelemetry.api.trace.SpanKind;
|
||||||
import io.opentelemetry.api.trace.Tracer;
|
import io.opentelemetry.api.trace.Tracer;
|
||||||
|
@ -33,7 +32,12 @@ final class ExtendedDefaultTracer implements ExtendedTracer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SpanBuilder spanBuilder(String spanName) {
|
public boolean isEnabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExtendedSpanBuilder spanBuilder(String spanName) {
|
||||||
return NoopSpanBuilder.create();
|
return NoopSpanBuilder.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,4 +20,7 @@ public interface ExtendedTracer extends Tracer {
|
||||||
default boolean isEnabled() {
|
default boolean isEnabled() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
ExtendedSpanBuilder spanBuilder(String spanName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.api.incubator;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import io.opentelemetry.api.incubator.config.ConfigProvider;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
class ConfigProviderTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void noopEquality() {
|
||||||
|
ConfigProvider noop = ConfigProvider.noop();
|
||||||
|
assertThat(ConfigProvider.noop()).isSameAs(noop);
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,7 +7,6 @@ package io.opentelemetry.api.incubator;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
import io.opentelemetry.api.AbstractOpenTelemetryTest;
|
|
||||||
import io.opentelemetry.api.OpenTelemetry;
|
import io.opentelemetry.api.OpenTelemetry;
|
||||||
import io.opentelemetry.api.incubator.logs.ExtendedDefaultLoggerProvider;
|
import io.opentelemetry.api.incubator.logs.ExtendedDefaultLoggerProvider;
|
||||||
import io.opentelemetry.api.incubator.logs.ExtendedLogger;
|
import io.opentelemetry.api.incubator.logs.ExtendedLogger;
|
||||||
|
@ -17,6 +16,7 @@ import io.opentelemetry.api.incubator.trace.ExtendedDefaultTracerProvider;
|
||||||
import io.opentelemetry.api.incubator.trace.ExtendedTracer;
|
import io.opentelemetry.api.incubator.trace.ExtendedTracer;
|
||||||
import io.opentelemetry.api.logs.LoggerProvider;
|
import io.opentelemetry.api.logs.LoggerProvider;
|
||||||
import io.opentelemetry.api.metrics.MeterProvider;
|
import io.opentelemetry.api.metrics.MeterProvider;
|
||||||
|
import io.opentelemetry.api.testing.internal.AbstractOpenTelemetryTest;
|
||||||
import io.opentelemetry.api.trace.TracerProvider;
|
import io.opentelemetry.api.trace.TracerProvider;
|
||||||
import io.opentelemetry.context.propagation.ContextPropagators;
|
import io.opentelemetry.context.propagation.ContextPropagators;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.api.incubator.common;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import io.opentelemetry.api.common.AttributeKey;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
|
|
||||||
|
public class ExtendedAttributeKeyTest {
|
||||||
|
|
||||||
|
@ParameterizedTest
|
||||||
|
@MethodSource("attributeKeyArgs")
|
||||||
|
void test(
|
||||||
|
ExtendedAttributeKey<?> key,
|
||||||
|
String expectedKey,
|
||||||
|
ExtendedAttributeType expectedType,
|
||||||
|
@Nullable AttributeKey<?> expectedAttributeKey) {
|
||||||
|
assertThat(key.getKey()).isEqualTo(expectedKey);
|
||||||
|
assertThat(key.getType()).isEqualTo(expectedType);
|
||||||
|
assertThat(key.asAttributeKey()).isEqualTo(expectedAttributeKey);
|
||||||
|
|
||||||
|
if (expectedAttributeKey != null) {
|
||||||
|
ExtendedAttributeKey<?> extendedAttributeKey =
|
||||||
|
ExtendedAttributeKey.fromAttributeKey(expectedAttributeKey);
|
||||||
|
assertThat(extendedAttributeKey).isEqualTo(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Stream<Arguments> attributeKeyArgs() {
|
||||||
|
return Stream.of(
|
||||||
|
Arguments.of(
|
||||||
|
ExtendedAttributeKey.stringKey("key"),
|
||||||
|
"key",
|
||||||
|
ExtendedAttributeType.STRING,
|
||||||
|
AttributeKey.stringKey("key")),
|
||||||
|
Arguments.of(
|
||||||
|
ExtendedAttributeKey.booleanKey("key"),
|
||||||
|
"key",
|
||||||
|
ExtendedAttributeType.BOOLEAN,
|
||||||
|
AttributeKey.booleanKey("key")),
|
||||||
|
Arguments.of(
|
||||||
|
ExtendedAttributeKey.longKey("key"),
|
||||||
|
"key",
|
||||||
|
ExtendedAttributeType.LONG,
|
||||||
|
AttributeKey.longKey("key")),
|
||||||
|
Arguments.of(
|
||||||
|
ExtendedAttributeKey.doubleKey("key"),
|
||||||
|
"key",
|
||||||
|
ExtendedAttributeType.DOUBLE,
|
||||||
|
AttributeKey.doubleKey("key")),
|
||||||
|
Arguments.of(
|
||||||
|
ExtendedAttributeKey.stringArrayKey("key"),
|
||||||
|
"key",
|
||||||
|
ExtendedAttributeType.STRING_ARRAY,
|
||||||
|
AttributeKey.stringArrayKey("key")),
|
||||||
|
Arguments.of(
|
||||||
|
ExtendedAttributeKey.booleanArrayKey("key"),
|
||||||
|
"key",
|
||||||
|
ExtendedAttributeType.BOOLEAN_ARRAY,
|
||||||
|
AttributeKey.booleanArrayKey("key")),
|
||||||
|
Arguments.of(
|
||||||
|
ExtendedAttributeKey.longArrayKey("key"),
|
||||||
|
"key",
|
||||||
|
ExtendedAttributeType.LONG_ARRAY,
|
||||||
|
AttributeKey.longArrayKey("key")),
|
||||||
|
Arguments.of(
|
||||||
|
ExtendedAttributeKey.doubleArrayKey("key"),
|
||||||
|
"key",
|
||||||
|
ExtendedAttributeType.DOUBLE_ARRAY,
|
||||||
|
AttributeKey.doubleArrayKey("key")),
|
||||||
|
Arguments.of(
|
||||||
|
ExtendedAttributeKey.extendedAttributesKey("key"),
|
||||||
|
"key",
|
||||||
|
ExtendedAttributeType.EXTENDED_ATTRIBUTES,
|
||||||
|
null));
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue