[
https://issues.apache.org/jira/browse/GOBBLIN-2018?focusedWorklogId=910631&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-910631
]
ASF GitHub Bot logged work on GOBBLIN-2018:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 19/Mar/24 21:44
Start Date: 19/Mar/24 21:44
Worklog Time Spent: 10m
Work Description: arjun4084346 commented on code in PR #3881:
URL: https://github.com/apache/gobblin/pull/3881#discussion_r1531154090
##########
gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/OpenTelemetryMetrics.java:
##########
@@ -0,0 +1,90 @@
+/*
+ * 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;
+
+import java.time.Duration;
+import java.util.Properties;
+
+import com.google.common.base.Optional;
+
+import io.opentelemetry.api.common.AttributeKey;
+import io.opentelemetry.api.common.Attributes;
+import io.opentelemetry.api.common.AttributesBuilder;
+import io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporter;
+import
io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporterBuilder;
+import io.opentelemetry.sdk.OpenTelemetrySdk;
+import io.opentelemetry.sdk.metrics.SdkMeterProvider;
+import io.opentelemetry.sdk.metrics.export.MetricExporter;
+import io.opentelemetry.sdk.metrics.export.PeriodicMetricReader;
+import io.opentelemetry.sdk.resources.Resource;
+
+import org.apache.gobblin.configuration.ConfigurationKeys;
+import org.apache.gobblin.configuration.State;
+import org.apache.gobblin.util.PropertiesUtils;
+/**
+ * A metrics reporter wrapper that uses the OpenTelemetry standard to emit
metrics
+ * Currently separated from the legacy codehale metrics as we need to maintain
backwards compatibility, but eventually
+ * can replace the old metrics system with tighter integrations once it's
stable
+ */
+public class OpenTelemetryMetrics extends OpenTelemetryMetricsBase {
+
+ private static OpenTelemetryMetrics GLOBAL_INSTANCE;
+ private static final Long DEFAULT_OPENTELEMETRY_REPORTING_INTERVAL_MILLIS =
10000L;
+ private OpenTelemetryMetrics(State state) {
+ super(state);
+ }
+
+ @Override
+ protected MetricExporter initializeMetricExporter(State state) {
+ OtlpHttpMetricExporterBuilder httpExporterBuilder =
OtlpHttpMetricExporter.builder();
+
httpExporterBuilder.setEndpoint(state.getProp(ConfigurationKeys.METRICS_REPORTING_OPENTELEMETRY_ENDPOINT));
+ return httpExporterBuilder.build();
+ }
+
+ public static OpenTelemetryMetrics getInstance(State state) {
+ if
(state.getPropAsBoolean(ConfigurationKeys.METRICS_REPORTING_OPENTELEMETRY_ENABLED,
ConfigurationKeys.DEFAULT_METRICS_REPORTING_OPENTELEMETRY_ENABLED)) {
Review Comment:
we can combine these two conditions right?
##########
gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/OpenTelemetryMetrics.java:
##########
@@ -0,0 +1,90 @@
+/*
+ * 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;
+
+import java.time.Duration;
+import java.util.Properties;
+
+import com.google.common.base.Optional;
+
+import io.opentelemetry.api.common.AttributeKey;
+import io.opentelemetry.api.common.Attributes;
+import io.opentelemetry.api.common.AttributesBuilder;
+import io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporter;
+import
io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporterBuilder;
+import io.opentelemetry.sdk.OpenTelemetrySdk;
+import io.opentelemetry.sdk.metrics.SdkMeterProvider;
+import io.opentelemetry.sdk.metrics.export.MetricExporter;
+import io.opentelemetry.sdk.metrics.export.PeriodicMetricReader;
+import io.opentelemetry.sdk.resources.Resource;
+
+import org.apache.gobblin.configuration.ConfigurationKeys;
+import org.apache.gobblin.configuration.State;
+import org.apache.gobblin.util.PropertiesUtils;
+/**
Review Comment:
blank line
Issue Time Tracking
-------------------
Worklog Id: (was: 910631)
Time Spent: 20m (was: 10m)
> Use Opentelemetry for sending metrics with GaaS Observability Events
> --------------------------------------------------------------------
>
> Key: GOBBLIN-2018
> URL: https://issues.apache.org/jira/browse/GOBBLIN-2018
> Project: Apache Gobblin
> Issue Type: New Feature
> Components: gobblin-service
> Reporter: William Lo
> Assignee: Abhishek Tiwari
> Priority: Major
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Currently GaaS sends events via Kafka to get insights on flows in aggregate
> and enable the ability for users to create queries and dashboards.
> For alerts, to support metrics based alerting from the same information, we
> want to integrate Opentelemetry for a more modern multi dimensional metrics
> experience that integrates with more backend systems.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)