From 528f845bd7cd636e79725e6ca0d16e9591fc7434 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Fri, 22 Sep 2023 16:10:44 +0000 Subject: [PATCH] lint --- .../gcp_resource_detector/_mapping.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/opentelemetry-resourcedetector-gcp/src/opentelemetry/resourcedetector/gcp_resource_detector/_mapping.py b/opentelemetry-resourcedetector-gcp/src/opentelemetry/resourcedetector/gcp_resource_detector/_mapping.py index 6c902f0e..f06f992a 100644 --- a/opentelemetry-resourcedetector-gcp/src/opentelemetry/resourcedetector/gcp_resource_detector/_mapping.py +++ b/opentelemetry-resourcedetector-gcp/src/opentelemetry/resourcedetector/gcp_resource_detector/_mapping.py @@ -173,8 +173,13 @@ def get_monitored_resource( else: # fallback to generic_task if ( - (ResourceAttributes.SERVICE_NAME in attrs or ResourceAttributes.FAAS_NAME in attrs) - and (ResourceAttributes.SERVICE_INSTANCE_ID in attrs or ResourceAttributes.FAAS_INSTANCE in attrs) + ( + ResourceAttributes.SERVICE_NAME in attrs + or ResourceAttributes.FAAS_NAME in attrs + ) and ( + ResourceAttributes.SERVICE_INSTANCE_ID in attrs + or ResourceAttributes.FAAS_INSTANCE in attrs + ) ): mr = _create_monitored_resource(_constants.GENERIC_TASK, attrs) else: @@ -192,11 +197,16 @@ def _create_monitored_resource( for mr_key, map_config in mapping.items(): mr_value = None for otel_key in map_config.otel_keys: - if otel_key in resource_attrs and not str(resource_attrs[otel_key]).startswith(_constants.UNKNOWN_SERVICE_PREFIX): + if otel_key in resource_attrs and not str( + resource_attrs[otel_key] + ).startswith(_constants.UNKNOWN_SERVICE_PREFIX): mr_value = resource_attrs[otel_key] break - if mr_value is None and ResourceAttributes.SERVICE_NAME in map_config.otel_keys: + if ( + mr_value is None + and ResourceAttributes.SERVICE_NAME in map_config.otel_keys + ): # The service name started with unknown_service, and was ignored above. mr_value = resource_attrs[ResourceAttributes.SERVICE_NAME]