File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
src/main/java/br/com/grupo63/techchallenge/common/config Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ package br .com .grupo63 .techchallenge .common .config ;
2
+
3
+ import org .springframework .beans .factory .annotation .Value ;
4
+ import org .springframework .boot .actuate .info .Info ;
5
+ import org .springframework .boot .actuate .info .InfoContributor ;
6
+ import org .springframework .stereotype .Component ;
7
+
8
+ import java .util .Arrays ;
9
+ import java .util .List ;
10
+
11
+ @ Component
12
+ public class ECSTaskIdInfoContributor implements InfoContributor {
13
+
14
+ @ Value ("${info.ecs_metadata_url_v4:unknown}" )
15
+ String ecsMetadataUrlV4 ;
16
+
17
+ @ Override
18
+ public void contribute (Info .Builder builder ) {
19
+ try {
20
+ List <String > parts = Arrays .asList (ecsMetadataUrlV4 .split ("/v4/" ));
21
+ String taskId = parts .get (1 ).split ("-" )[0 ];
22
+ builder .withDetail ("ecs_task_id" , taskId );
23
+ } catch (RuntimeException ignored ) {
24
+ builder .withDetail ("ecs_task_id" , "unknown" );
25
+ }
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments