[ 
https://issues.apache.org/jira/browse/GOBBLIN-2209?focusedWorklogId=974746&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-974746
 ]

ASF GitHub Bot logged work on GOBBLIN-2209:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 16/Jul/25 06:32
            Start Date: 16/Jul/25 06:32
    Worklog Time Spent: 10m 
      Work Description: abhishekmjain commented on code in PR #4118:
URL: https://github.com/apache/gobblin/pull/4118#discussion_r2209395923


##########
gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/opentelemetry/OpenTelemetryHelper.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.gobblin.metrics.opentelemetry;
+
+import java.util.Map;
+
+import lombok.experimental.UtilityClass;
+import org.apache.commons.lang3.StringUtils;
+
+import io.opentelemetry.api.common.Attributes;
+import io.opentelemetry.api.common.AttributesBuilder;
+
+/**
+ * Utility class for OpenTelemetry related operations.
+ *
+ * <p>Provides methods to handle OpenTelemetry attributes, including merging 
multiple
+ * {@link Attributes} instances and converting maps to {@link Attributes}.
+ */
+@UtilityClass
+public class OpenTelemetryHelper {
+
+  private static final String DEFAULT_OPENTELEMETRY_ATTRIBUTE_VALUE = "-";
+
+  /**
+   * Returns the provided attribute value when it is non-null and non-empty;
+   * otherwise returns the default OpenTelemetry attribute placeholder.
+   *
+   * @param value candidate attribute value to check
+   * @return the original value if not empty, or 
DEFAULT_OPENTELEMETRY_ATTRIBUTE_VALUE otherwise
+   */
+  public static String getOrDefaultOpenTelemetryAttrValue(String value) {
+    return StringUtils.isNotEmpty(value) ? value : 
DEFAULT_OPENTELEMETRY_ATTRIBUTE_VALUE;
+  }

Review Comment:
   Can we use `StringUtils.defaultIfBlank(str, 
DEFAULT_OPENTELEMETRY_ATTRIBUTE_VALUE)` instead of creating this function?





Issue Time Tracking
-------------------

    Worklog Id:     (was: 974746)
    Time Spent: 1h  (was: 50m)

> Emit GaaS Executor OTel Metrics
> -------------------------------
>
>                 Key: GOBBLIN-2209
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-2209
>             Project: Apache Gobblin
>          Issue Type: Improvement
>          Components: gobblin-metrics
>            Reporter: Vivek Rai
>            Assignee: Issac Buenrostro
>            Priority: Major
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> Emit GaaS Executor OTel Metrics



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to