Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
dashpole committed Sep 22, 2023
1 parent 374c497 commit 528f845
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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]

Expand Down

0 comments on commit 528f845

Please sign in to comment.