@@ -114,28 +114,36 @@ public void testHttpJob() throws InterruptedException {
114114 assertThat (span .getKind ()).isEqualTo (SpanKind .INTERNAL );
115115 assertThat (span .getAttributes ().get (AttributeKey .stringKey ("job.system" )))
116116 .isEqualTo ("elasticjob" );
117- assertThat (span .getAttributes ().get (AttributeKey .stringKey ("scheduling.apache-elasticjob.job.name" )))
117+ assertThat (
118+ span .getAttributes ()
119+ .get (AttributeKey .stringKey ("scheduling.apache-elasticjob.job.name" )))
118120 .isEqualTo ("javaHttpJob" );
119121 assertThat (
120122 span .getAttributes ()
121123 .get (AttributeKey .longKey ("scheduling.apache-elasticjob.sharding.total.count" )))
122124 .isEqualTo (3L );
123125 assertThat (
124126 span .getAttributes ()
125- .get (AttributeKey .stringKey ("scheduling.apache-elasticjob.sharding.item.parameters" )))
127+ .get (
128+ AttributeKey .stringKey (
129+ "scheduling.apache-elasticjob.sharding.item.parameters" )))
126130 .isEqualTo ("{0=Beijing, 1=Shanghai, 2=Guangzhou}" );
127131
128- assertThat (span .getAttributes ().get (AttributeKey .longKey ("scheduling.apache-elasticjob.item" )))
132+ assertThat (
133+ span .getAttributes ().get (AttributeKey .longKey ("scheduling.apache-elasticjob.item" )))
129134 .isIn (0L , 1L , 2L );
130- assertThat (span .getAttributes ().get (AttributeKey .stringKey ("scheduling.apache-elasticjob.task.id" )))
135+ assertThat (
136+ span .getAttributes ()
137+ .get (AttributeKey .stringKey ("scheduling.apache-elasticjob.task.id" )))
131138 .contains ("javaHttpJob" );
132139 }
133140
134141 Set <Long > shardItems =
135142 spans .stream ()
136143 .map (
137144 span ->
138- span .getAttributes ().get (AttributeKey .longKey ("scheduling.apache-elasticjob.item" )))
145+ span .getAttributes ()
146+ .get (AttributeKey .longKey ("scheduling.apache-elasticjob.item" )))
139147 .collect (Collectors .toSet ());
140148 assertThat (shardItems ).containsExactlyInAnyOrder (0L , 1L , 2L );
141149 }
@@ -170,7 +178,9 @@ public void testSimpleJob() throws InterruptedException {
170178 assertThat (span .getKind ()).isEqualTo (SpanKind .INTERNAL );
171179 assertThat (span .getAttributes ().get (AttributeKey .stringKey ("job.system" )))
172180 .isEqualTo ("elasticjob" );
173- assertThat (span .getAttributes ().get (AttributeKey .stringKey ("scheduling.apache-elasticjob.job.name" )))
181+ assertThat (
182+ span .getAttributes ()
183+ .get (AttributeKey .stringKey ("scheduling.apache-elasticjob.job.name" )))
174184 .isEqualTo ("simpleElasticJob" );
175185 assertThat (
176186 span .getAttributes ()
@@ -181,17 +191,21 @@ public void testSimpleJob() throws InterruptedException {
181191 assertThat (span .getAttributes ().get (AttributeKey .stringKey ("code.namespace" )))
182192 .isEqualTo (
183193 "io.opentelemetry.javaagent.instrumentation.apacheelasticjob.v3_0.ElasticJobTest$SynchronizedTestSimpleJob" );
184- assertThat (span .getAttributes ().get (AttributeKey .longKey ("scheduling.apache-elasticjob.item" )))
194+ assertThat (
195+ span .getAttributes ().get (AttributeKey .longKey ("scheduling.apache-elasticjob.item" )))
185196 .isIn (0L , 1L );
186- assertThat (span .getAttributes ().get (AttributeKey .stringKey ("scheduling.apache-elasticjob.task.id" )))
197+ assertThat (
198+ span .getAttributes ()
199+ .get (AttributeKey .stringKey ("scheduling.apache-elasticjob.task.id" )))
187200 .contains ("simpleElasticJob" );
188201 }
189202
190203 Set <Long > shardItems =
191204 spans .stream ()
192205 .map (
193206 span ->
194- span .getAttributes ().get (AttributeKey .longKey ("scheduling.apache-elasticjob.item" )))
207+ span .getAttributes ()
208+ .get (AttributeKey .longKey ("scheduling.apache-elasticjob.item" )))
195209 .collect (Collectors .toSet ());
196210 assertThat (shardItems ).containsExactlyInAnyOrder (0L , 1L );
197211 }
@@ -226,7 +240,9 @@ public void testDataflowJob() throws InterruptedException {
226240 assertThat (span .getKind ()).isEqualTo (SpanKind .INTERNAL );
227241 assertThat (span .getAttributes ().get (AttributeKey .stringKey ("job.system" )))
228242 .isEqualTo ("elasticjob" );
229- assertThat (span .getAttributes ().get (AttributeKey .stringKey ("scheduling.apache-elasticjob.job.name" )))
243+ assertThat (
244+ span .getAttributes ()
245+ .get (AttributeKey .stringKey ("scheduling.apache-elasticjob.job.name" )))
230246 .isEqualTo ("dataflowElasticJob" );
231247 assertThat (
232248 span .getAttributes ()
@@ -237,17 +253,21 @@ public void testDataflowJob() throws InterruptedException {
237253 assertThat (span .getAttributes ().get (AttributeKey .stringKey ("code.namespace" )))
238254 .isEqualTo (
239255 "io.opentelemetry.javaagent.instrumentation.apacheelasticjob.v3_0.ElasticJobTest$SynchronizedTestDataflowJob" );
240- assertThat (span .getAttributes ().get (AttributeKey .longKey ("scheduling.apache-elasticjob.item" )))
256+ assertThat (
257+ span .getAttributes ().get (AttributeKey .longKey ("scheduling.apache-elasticjob.item" )))
241258 .isIn (0L , 1L );
242- assertThat (span .getAttributes ().get (AttributeKey .stringKey ("scheduling.apache-elasticjob.task.id" )))
259+ assertThat (
260+ span .getAttributes ()
261+ .get (AttributeKey .stringKey ("scheduling.apache-elasticjob.task.id" )))
243262 .contains ("dataflowElasticJob" );
244263 }
245264
246265 Set <Long > shardItems =
247266 spans .stream ()
248267 .map (
249268 span ->
250- span .getAttributes ().get (AttributeKey .longKey ("scheduling.apache-elasticjob.item" )))
269+ span .getAttributes ()
270+ .get (AttributeKey .longKey ("scheduling.apache-elasticjob.item" )))
251271 .collect (Collectors .toSet ());
252272 assertThat (shardItems ).containsExactlyInAnyOrder (0L , 1L );
253273 }
@@ -267,9 +287,12 @@ public void testScriptJob() throws IOException {
267287 .hasAttributesSatisfyingExactly (
268288 equalTo (AttributeKey .stringKey ("job.system" ), "elasticjob" ),
269289 equalTo (
270- AttributeKey .stringKey ("scheduling.apache-elasticjob.job.name" ),
290+ AttributeKey .stringKey (
291+ "scheduling.apache-elasticjob.job.name" ),
271292 "scriptElasticJob" ),
272- equalTo (AttributeKey .longKey ("scheduling.apache-elasticjob.item" ), 0L ),
293+ equalTo (
294+ AttributeKey .longKey ("scheduling.apache-elasticjob.item" ),
295+ 0L ),
273296 equalTo (
274297 AttributeKey .longKey (
275298 "scheduling.apache-elasticjob.sharding.total.count" ),
@@ -279,7 +302,8 @@ public void testScriptJob() throws IOException {
279302 "scheduling.apache-elasticjob.sharding.item.parameters" ),
280303 "{0=null}" ),
281304 satisfies (
282- AttributeKey .stringKey ("scheduling.apache-elasticjob.task.id" ),
305+ AttributeKey .stringKey (
306+ "scheduling.apache-elasticjob.task.id" ),
283307 taskId -> taskId .contains ("scriptElasticJob" )))));
284308 } finally {
285309 bootstrap .shutdown ();
@@ -317,7 +341,9 @@ public void testFailedJob() throws InterruptedException {
317341 assertThat (span .getStatus ().getStatusCode ()).isEqualTo (StatusCode .ERROR );
318342 assertThat (span .getAttributes ().get (AttributeKey .stringKey ("job.system" )))
319343 .isEqualTo ("elasticjob" );
320- assertThat (span .getAttributes ().get (AttributeKey .stringKey ("scheduling.apache-elasticjob.job.name" )))
344+ assertThat (
345+ span .getAttributes ()
346+ .get (AttributeKey .stringKey ("scheduling.apache-elasticjob.job.name" )))
321347 .isEqualTo ("failedElasticJob" );
322348 assertThat (span .getAttributes ().get (AttributeKey .longKey ("scheduling.apache-elasticjob.item" )))
323349 .isEqualTo (0L );
@@ -327,7 +353,9 @@ public void testFailedJob() throws InterruptedException {
327353 .isEqualTo (1L );
328354 assertThat (
329355 span .getAttributes ()
330- .get (AttributeKey .stringKey ("scheduling.apache-elasticjob.sharding.item.parameters" )))
356+ .get (
357+ AttributeKey .stringKey (
358+ "scheduling.apache-elasticjob.sharding.item.parameters" )))
331359 .isEqualTo ("failed" );
332360 assertThat (span .getAttributes ().get (AttributeKey .stringKey ("code.function" )))
333361 .isEqualTo ("execute" );
0 commit comments