phet commented on code in PR #3933:
URL: https://github.com/apache/gobblin/pull/3933#discussion_r1578437228


##########
gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/OpenTelemetryMetrics.java:
##########
@@ -60,9 +63,12 @@ protected MetricExporter initializeMetricExporter(State 
state) {
         "OpenTelemetry endpoint must be provided");
     OtlpHttpMetricExporterBuilder httpExporterBuilder = 
OtlpHttpMetricExporter.builder();
     
httpExporterBuilder.setEndpoint(state.getProp(ConfigurationKeys.METRICS_REPORTING_OPENTELEMETRY_ENDPOINT));
-    if 
(state.contains(ConfigurationKeys.METRICS_REPORTING_OPENTELEMETRY_HEADER_KEY) 
&& 
state.contains(ConfigurationKeys.METRICS_REPORTING_OPENTELEMETRY_HEADER_VALUE)) 
{
-      
httpExporterBuilder.addHeader(state.getProp(ConfigurationKeys.METRICS_REPORTING_OPENTELEMETRY_HEADER_KEY),
-          
state.getProp(ConfigurationKeys.METRICS_REPORTING_OPENTELEMETRY_HEADER_VALUE));
+
+    if 
(state.contains(ConfigurationKeys.METRICS_REPORTING_OPENTELEMETRY_HEADERS)) {
+      Map<String, String> headers = 
parseHttpHeaders(state.getProp(ConfigurationKeys.METRICS_REPORTING_OPENTELEMETRY_HEADERS));

Review Comment:
   looks like this might not safely handle `null`, no?
   
   e.g.:
   ```
   Optional.ofNullable(state.getProp(...)).ifPresent(headersMap ->
     headersMap.entrySet().forEach(header ->
       heb.addHeader(...)
     ));
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to