From 694652242c0da8467329712cca848de89f161f12 Mon Sep 17 00:00:00 2001 From: jdpgrailsdev Date: Fri, 4 Nov 2022 10:23:34 -0400 Subject: [PATCH] Handle potential NPE --- .../src/main/java/io/airbyte/metrics/lib/MetricTags.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/airbyte-metrics/metrics-lib/src/main/java/io/airbyte/metrics/lib/MetricTags.java b/airbyte-metrics/metrics-lib/src/main/java/io/airbyte/metrics/lib/MetricTags.java index 6299963478cc..6378b0c12fcd 100644 --- a/airbyte-metrics/metrics-lib/src/main/java/io/airbyte/metrics/lib/MetricTags.java +++ b/airbyte-metrics/metrics-lib/src/main/java/io/airbyte/metrics/lib/MetricTags.java @@ -22,17 +22,18 @@ public class MetricTags { public static final String WORKFLOW_TYPE = "workflow_type"; public static final String ATTEMPT_QUEUE = "attempt_queue"; public static final String GEOGRAPHY = "geography"; + public static final String UNKNOWN = "unknown"; public static String getReleaseStage(final ReleaseStage stage) { - return stage.getLiteral(); + return stage != null ? stage.getLiteral() : UNKNOWN; } public static String getFailureOrigin(final FailureOrigin origin) { - return origin.value(); + return origin != null ? origin.value() : UNKNOWN; } public static String getJobStatus(final JobStatus status) { - return status.getLiteral(); + return status != null ? status.getLiteral() : UNKNOWN; } }