2525import io .opentelemetry .sdk .autoconfigure .spi .ResourceProvider ;
2626import io .opentelemetry .sdk .resources .Resource ;
2727import io .opentelemetry .semconv .incubating .*;
28-
2928import java .util .Map ;
3029import java .util .Optional ;
3130import java .util .logging .Logger ;
@@ -69,7 +68,9 @@ public Attributes getAttributes() {
6968
7069 // This is running on some sort of GCPCompute - figure out the platform
7170 AttributesBuilder attrBuilder = Attributes .builder ();
72- attrBuilder .put (CloudIncubatingAttributes .CLOUD_PROVIDER , CloudIncubatingAttributes .CloudProviderIncubatingValues .GCP );
71+ attrBuilder .put (
72+ CloudIncubatingAttributes .CLOUD_PROVIDER ,
73+ CloudIncubatingAttributes .CloudProviderIncubatingValues .GCP );
7374 attrBuilder .put (CloudIncubatingAttributes .CLOUD_ACCOUNT_ID , detectedPlatform .getProjectId ());
7475
7576 switch (detectedPlatform .getSupportedPlatform ()) {
@@ -112,7 +113,8 @@ private void addGCEAttributes(AttributesBuilder attrBuilder, Map<String, String>
112113 CloudIncubatingAttributes .CloudPlatformIncubatingValues .GCP_COMPUTE_ENGINE );
113114
114115 Optional .ofNullable (attributesMap .get (GCE_AVAILABILITY_ZONE ))
115- .ifPresent (zone -> attrBuilder .put (CloudIncubatingAttributes .CLOUD_AVAILABILITY_ZONE , zone ));
116+ .ifPresent (
117+ zone -> attrBuilder .put (CloudIncubatingAttributes .CLOUD_AVAILABILITY_ZONE , zone ));
116118 Optional .ofNullable (attributesMap .get (GCE_CLOUD_REGION ))
117119 .ifPresent (region -> attrBuilder .put (CloudIncubatingAttributes .CLOUD_REGION , region ));
118120 Optional .ofNullable (attributesMap .get (GCE_INSTANCE_ID ))
@@ -126,7 +128,8 @@ private void addGCEAttributes(AttributesBuilder attrBuilder, Map<String, String>
126128 Optional .ofNullable (attributesMap .get (GCE_INSTANCE_HOSTNAME ))
127129 .ifPresent (
128130 instanceHostname ->
129- attrBuilder .put (GcpIncubatingAttributes .GCP_GCE_INSTANCE_HOSTNAME , instanceHostname ));
131+ attrBuilder .put (
132+ GcpIncubatingAttributes .GCP_GCE_INSTANCE_HOSTNAME , instanceHostname ));
130133 Optional .ofNullable (attributesMap .get (GCE_MACHINE_TYPE ))
131134 .ifPresent (machineType -> attrBuilder .put (HostIncubatingAttributes .HOST_TYPE , machineType ));
132135 }
@@ -155,7 +158,8 @@ private void addGKEAttributes(AttributesBuilder attrBuilder, Map<String, String>
155158 switch (locationType ) {
156159 case GKE_LOCATION_TYPE_REGION :
157160 attrBuilder .put (
158- CloudIncubatingAttributes .CLOUD_REGION , attributesMap .get (GKE_CLUSTER_LOCATION ));
161+ CloudIncubatingAttributes .CLOUD_REGION ,
162+ attributesMap .get (GKE_CLUSTER_LOCATION ));
159163 break ;
160164 case GKE_LOCATION_TYPE_ZONE :
161165 attrBuilder .put (
@@ -181,7 +185,8 @@ private void addGKEAttributes(AttributesBuilder attrBuilder, Map<String, String>
181185 */
182186 private void addGCRAttributes (AttributesBuilder attrBuilder , Map <String , String > attributesMap ) {
183187 attrBuilder .put (
184- CloudIncubatingAttributes .CLOUD_PLATFORM , CloudIncubatingAttributes .CloudPlatformIncubatingValues .GCP_CLOUD_RUN );
188+ CloudIncubatingAttributes .CLOUD_PLATFORM ,
189+ CloudIncubatingAttributes .CloudPlatformIncubatingValues .GCP_CLOUD_RUN );
185190 addCommonAttributesForServerlessCompute (attrBuilder , attributesMap );
186191 }
187192
@@ -208,20 +213,25 @@ private void addGCFAttributes(AttributesBuilder attrBuilder, Map<String, String>
208213 */
209214 private void addGAEAttributes (AttributesBuilder attrBuilder , Map <String , String > attributesMap ) {
210215 attrBuilder .put (
211- CloudIncubatingAttributes .CLOUD_PLATFORM , CloudIncubatingAttributes .CloudPlatformIncubatingValues .GCP_APP_ENGINE );
216+ CloudIncubatingAttributes .CLOUD_PLATFORM ,
217+ CloudIncubatingAttributes .CloudPlatformIncubatingValues .GCP_APP_ENGINE );
212218 Optional .ofNullable (attributesMap .get (GAE_MODULE_NAME ))
213219 .ifPresent (appName -> attrBuilder .put (FaasIncubatingAttributes .FAAS_NAME , appName ));
214220 Optional .ofNullable (attributesMap .get (GAE_APP_VERSION ))
215- .ifPresent (appVersion -> attrBuilder .put (FaasIncubatingAttributes .FAAS_VERSION , appVersion ));
221+ .ifPresent (
222+ appVersion -> attrBuilder .put (FaasIncubatingAttributes .FAAS_VERSION , appVersion ));
216223 Optional .ofNullable (attributesMap .get (GAE_INSTANCE_ID ))
217224 .ifPresent (
218- appInstanceId -> attrBuilder .put (FaasIncubatingAttributes .FAAS_INSTANCE , appInstanceId ));
225+ appInstanceId ->
226+ attrBuilder .put (FaasIncubatingAttributes .FAAS_INSTANCE , appInstanceId ));
219227 Optional .ofNullable (attributesMap .get (GAE_CLOUD_REGION ))
220- .ifPresent (cloudRegion -> attrBuilder .put (CloudIncubatingAttributes .CLOUD_REGION , cloudRegion ));
228+ .ifPresent (
229+ cloudRegion -> attrBuilder .put (CloudIncubatingAttributes .CLOUD_REGION , cloudRegion ));
221230 Optional .ofNullable (attributesMap .get (GAE_AVAILABILITY_ZONE ))
222231 .ifPresent (
223232 cloudAvailabilityZone ->
224- attrBuilder .put (CloudIncubatingAttributes .CLOUD_AVAILABILITY_ZONE , cloudAvailabilityZone ));
233+ attrBuilder .put (
234+ CloudIncubatingAttributes .CLOUD_AVAILABILITY_ZONE , cloudAvailabilityZone ));
225235 }
226236
227237 /**
@@ -238,9 +248,11 @@ private void addCommonAttributesForServerlessCompute(
238248 Optional .ofNullable (attributesMap .get (SERVERLESS_COMPUTE_REVISION ))
239249 .ifPresent (revision -> attrBuilder .put (FaasIncubatingAttributes .FAAS_VERSION , revision ));
240250 Optional .ofNullable (attributesMap .get (SERVERLESS_COMPUTE_INSTANCE_ID ))
241- .ifPresent (instanceId -> attrBuilder .put (FaasIncubatingAttributes .FAAS_INSTANCE , instanceId ));
251+ .ifPresent (
252+ instanceId -> attrBuilder .put (FaasIncubatingAttributes .FAAS_INSTANCE , instanceId ));
242253 Optional .ofNullable (attributesMap .get (SERVERLESS_COMPUTE_AVAILABILITY_ZONE ))
243- .ifPresent (zone -> attrBuilder .put (CloudIncubatingAttributes .CLOUD_AVAILABILITY_ZONE , zone ));
254+ .ifPresent (
255+ zone -> attrBuilder .put (CloudIncubatingAttributes .CLOUD_AVAILABILITY_ZONE , zone ));
244256 Optional .ofNullable (attributesMap .get (SERVERLESS_COMPUTE_CLOUD_REGION ))
245257 .ifPresent (region -> attrBuilder .put (CloudIncubatingAttributes .CLOUD_REGION , region ));
246258 }
0 commit comments