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

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

                Author: ASF GitHub Bot
            Created on: 30/Apr/24 19:30
            Start Date: 30/Apr/24 19:30
    Worklog Time Spent: 10m 
      Work Description: phet commented on code in PR #3939:
URL: https://github.com/apache/gobblin/pull/3939#discussion_r1585430217


##########
gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/OpenTelemetryMetrics.java:
##########
@@ -86,12 +86,16 @@ protected void initialize(State state) {
     log.info("Initializing OpenTelemetry metrics");
     Properties metricProps = 
PropertiesUtils.extractChildProperties(state.getProperties(),
         ConfigurationKeys.METRICS_REPORTING_OPENTELEMETRY_CONFIGS_PREFIX);
-    AttributesBuilder attributesBuilder = Attributes.builder();
-    for (String key : metricProps.stringPropertyNames()) {
-      attributesBuilder.put(AttributeKey.stringKey(key), 
metricProps.getProperty(key));
+    Resource metricsResource = Resource.empty();
+    if (metricProps.isEmpty()) {
+      log.warn("No OpenTelemetry metrics properties found, sending empty 
resource");
+    } else {
+      AttributesBuilder attributesBuilder = Attributes.builder();
+      for (String key : metricProps.stringPropertyNames()) {
+        attributesBuilder.put(AttributeKey.stringKey(key), 
metricProps.getProperty(key));
+      }
+      metricsResource = 
Resource.getDefault().merge(Resource.create(attributesBuilder.build()));

Review Comment:
   maybe add comment on why better NOT to go ahead w/ using 
`Resource.getDefault()` if no attrs sent.  I might think the default resource 
could be independent of attrs





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

            Worklog Id:     (was: 917068)
    Remaining Estimate: 0h
            Time Spent: 10m

> Send empty config in Otel if no configs are specified
> -----------------------------------------------------
>
>                 Key: GOBBLIN-2059
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-2059
>             Project: Apache Gobblin
>          Issue Type: Bug
>            Reporter: William Lo
>            Priority: Trivial
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Opentelemetry sends empty attributes even though no custom configurations are 
> being specified. We want to just send the empty resource for consistency.



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

Reply via email to