You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "kezhenxu94 (via GitHub)" <gi...@apache.org> on 2023/01/21 06:14:17 UTC

[GitHub] [skywalking] kezhenxu94 commented on a diff in pull request #10300: Add aws-firehousr-receiver to support collecting AWS CloudWatch metric(OpenTelemetry format)

kezhenxu94 commented on code in PR #10300:
URL: https://github.com/apache/skywalking/pull/10300#discussion_r1083249580


##########
oap-server/server-receiver-plugin/aws-firehose-receiver/pom.xml:
##########
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ 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.
+  ~
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.skywalking</groupId>
+        <artifactId>server-receiver-plugin</artifactId>
+        <version>9.4.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>aws-firehose-receiver</artifactId>

Review Comment:
   ```suggestion
       <artifactId>aws-firehouse-receiver</artifactId>
   ```
   



##########
oap-server/server-receiver-plugin/otel-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/otel/OtelMetricReceiverProvider.java:
##########
@@ -72,12 +82,10 @@ public void start() throws ServiceNotProvidedException, ModuleStartException {
             .provider()
             .getService(GRPCHandlerRegister.class);
         final MeterSystem meterSystem = getManager().find(CoreModule.NAME).provider().getService(MeterSystem.class);
-        final List<Handler> handlers =
-            Handler.all().stream()
-                .filter(h -> config.getEnabledHandlers().contains(h.type()))
-                .collect(toList());
-        for (Handler h : handlers) {
-            h.active(config, meterSystem, grpcHandlerRegister);
+        for (Handler handler : this.handlers) {
+            if (config.getEnabledHandlers().contains(handler.type())) {
+                handler.active(config, meterSystem, grpcHandlerRegister);
+            }

Review Comment:
   Why do you need this change? This is a breaking change that cause user-defined handlers not to work anymore 



##########
oap-server/server-receiver-plugin/aws-firehose-receiver/src/main/java/org/apache/skywalking/oap/server/receiver/aws/firehose/FirehoseHTTPHandler.java:
##########
@@ -0,0 +1,86 @@
+/*
+ * 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.skywalking.oap.server.receiver.aws.firehose;
+
+import com.linecorp.armeria.server.annotation.ConsumesJson;
+import com.linecorp.armeria.server.annotation.Post;
+import com.linecorp.armeria.server.annotation.ProducesJson;
+import io.grpc.stub.StreamObserver;
+import io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;
+import io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;
+import io.opentelemetry.proto.metrics.v1.ResourceMetrics;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Base64;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.skywalking.oap.server.receiver.otel.otlp.OpenTelemetryMetricHandlerExporter;
+
+@Slf4j
+public class FirehoseHTTPHandler {
+
+    private final OpenTelemetryMetricHandlerExporter openTelemetryMetricHandlerExporter;
+
+    private static final StreamObserver<ExportMetricsServiceResponse> STREAM_OBSERVER = new StreamObserver<ExportMetricsServiceResponse>() {
+        @Override
+        public void onNext(final ExportMetricsServiceResponse exportMetricsServiceResponse) {
+        }
+
+        @Override
+        public void onError(final Throwable throwable) {
+        }
+
+        @Override
+        public void onCompleted() {
+        }
+    };
+
+    public FirehoseHTTPHandler(final OpenTelemetryMetricHandlerExporter openTelemetryMetricHandlerExporter) {
+        this.openTelemetryMetricHandlerExporter = openTelemetryMetricHandlerExporter;
+    }

Review Comment:
   Use Lombok annotation to replace this constructor



##########
docs/en/setup/backend/aws-firehouse-receiver.md:
##########
@@ -0,0 +1,21 @@
+# AWS Firehouse receiver
+
+AWS Firehouse receiver provides a HTTP Endpoint that follows [Amazon Kinesis Data Firehose Delivery Stream HTTP Endpoint Delivery Specifications](https://docs.aws.amazon.com/firehose/latest/dev/httpdeliveryrequestresponse.html).

Review Comment:
   ```suggestion
   AWS Firehouse receiver provides an HTTP Endpoint that follows [Amazon Kinesis Data Firehose Delivery Stream HTTP Endpoint Delivery Specifications](https://docs.aws.amazon.com/firehose/latest/dev/httpdeliveryrequestresponse.html).
   ```
   



-- 
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: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org