[GitHub] [skywalking] dmsolr commented on a change in pull request #4847: [WIP]Provide kafka as collector/reporter

2020-07-01 Thread GitBox


dmsolr commented on a change in pull request #4847:
URL: https://github.com/apache/skywalking/pull/4847#discussion_r448542089



##
File path: 
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
##
@@ -140,6 +140,25 @@
  * Get profile task list interval
  */
 public static int GET_PROFILE_TASK_INTERVAL = 20;
+
+public static class Kafka {
+
+public static String BOOTSTRAP_SERVERS;
+
+public static int BATCH_SIZE = 1000;
+
+public static String ACKS = "1";
+
+public static String TOPIC_METRICS = "skywalking-metrics";
+
+public static String TOPIC_PROFILING = "skywalking-profiling";
+
+public static String TOPIC_SEGMENT = "skywalking-segment";
+
+public static String TOPIC_MANAGEMENT = "skywalking-management";

Review comment:
   If the topic not exists, Kafka will create it by itself.





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.

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




[GitHub] [skywalking] dmsolr commented on a change in pull request #4847: [WIP]Provide kafka as collector/reporter

2020-06-22 Thread GitBox


dmsolr commented on a change in pull request #4847:
URL: https://github.com/apache/skywalking/pull/4847#discussion_r443930241



##
File path: 
oap-server/server-receiver-plugin/skywalking-mq-receiver-plugins/kafka-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/kafka/provider/dispatcher/JVMSourceDispatcher.java
##
@@ -0,0 +1,179 @@
+/*
+ * 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.kafka.provider.dispatcher;
+
+import java.util.List;
+import org.apache.skywalking.apm.network.common.v3.CPU;
+import org.apache.skywalking.apm.network.language.agent.v3.GC;
+import org.apache.skywalking.apm.network.language.agent.v3.JVMMetric;
+import org.apache.skywalking.apm.network.language.agent.v3.Memory;
+import org.apache.skywalking.apm.network.language.agent.v3.MemoryPool;
+import org.apache.skywalking.oap.server.core.CoreModule;
+import org.apache.skywalking.oap.server.core.analysis.IDManager;
+import org.apache.skywalking.oap.server.core.analysis.NodeType;
+import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
+import org.apache.skywalking.oap.server.core.source.GCPhrase;
+import org.apache.skywalking.oap.server.core.source.MemoryPoolType;
+import org.apache.skywalking.oap.server.core.source.ServiceInstanceJVMCPU;
+import org.apache.skywalking.oap.server.core.source.ServiceInstanceJVMGC;
+import org.apache.skywalking.oap.server.core.source.ServiceInstanceJVMMemory;
+import 
org.apache.skywalking.oap.server.core.source.ServiceInstanceJVMMemoryPool;
+import org.apache.skywalking.oap.server.core.source.SourceReceiver;
+import org.apache.skywalking.oap.server.library.module.ModuleManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Copy from other receiver

Review comment:
   Got it

##
File path: 
oap-server/server-receiver-plugin/skywalking-mq-receiver-plugins/kafka-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/kafka/provider/KafkaReceiverProvider.java
##
@@ -0,0 +1,116 @@
+/*
+ * 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.kafka.provider;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.skywalking.oap.server.configuration.api.ConfigurationModule;
+import org.apache.skywalking.oap.server.core.CoreModule;
+import org.apache.skywalking.oap.server.core.cluster.ClusterModule;
+import org.apache.skywalking.oap.server.library.module.ModuleConfig;
+import org.apache.skywalking.oap.server.library.module.ModuleDefine;
+import org.apache.skywalking.oap.server.library.module.ModuleProvider;
+import org.apache.skywalking.oap.server.library.module.ModuleStartException;
+import 
org.apache.skywalking.oap.server.library.module.ServiceNotProvidedException;
+import 
org.apache.skywalking.oap.server.receiver.kafka.KafkaReceiveHandlerRegister;
+import 
org.apache.skywalking.oap.server.receiver.kafka.module.KafkaReceiverConfig;
+import 
org.apache.skywalking.oap.server.receiver.kafka.provider.handler.JVMMetricsReceiveHandler;
+import 
org.apache.skywalking.oap.server.receiver.kafka.provider.handler.KafkaManagementReceiveHandler;
+import 
org.apache.skywalking.oap.server.receiver.kafka.provider.handler.TraceSegmentReceiveHandler;
+import org.apache.skywalking.oap.server.receiver.mq.ReceiveHandlerRegister;
+import 
org.apache.skywalking.oap.server.receiver.mq.module.MessageQueueReceiverModule;

[GitHub] [skywalking] dmsolr commented on a change in pull request #4847: [WIP]Provide kafka as collector/reporter

2020-06-22 Thread GitBox


dmsolr commented on a change in pull request #4847:
URL: https://github.com/apache/skywalking/pull/4847#discussion_r443929097



##
File path: 
apm-sniffer/optional-producer-plugins/kafka-producer-plugin/src/main/java/org/apache/skywalking/apm/agent/core/kafka/KafkaProfileTaskService.java
##
@@ -0,0 +1,105 @@
+/*
+ * 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.apm.agent.core.kafka;
+
+import java.util.ArrayList;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import org.apache.kafka.clients.producer.KafkaProducer;
+import org.apache.kafka.clients.producer.ProducerRecord;
+import org.apache.kafka.common.utils.Bytes;
+import org.apache.skywalking.apm.agent.core.boot.DefaultNamedThreadFactory;
+import org.apache.skywalking.apm.agent.core.boot.OverrideImplementor;
+import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
+import org.apache.skywalking.apm.agent.core.conf.Config;
+import org.apache.skywalking.apm.agent.core.logging.api.ILog;
+import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
+import org.apache.skywalking.apm.agent.core.profile.ProfileTaskChannelService;
+import org.apache.skywalking.apm.agent.core.profile.TracingThreadSnapshot;
+import org.apache.skywalking.apm.agent.core.remote.GRPCChannelManager;
+import org.apache.skywalking.apm.network.language.profile.v3.ThreadSnapshot;
+import org.apache.skywalking.apm.util.RunnableWithExceptionProtection;
+
+/**
+ * Considering that MessageQueue belongs to a decoupled architecture, 
therefore we do not support this. The MQ is not
+ * good for real-time interactive. It will be implemented through Rest API.

Review comment:
   Ignore it, note for myself. I forgot to remove it. 





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.

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




[GitHub] [skywalking] dmsolr commented on a change in pull request #4847: [WIP]Provide kafka as collector/reporter

2020-06-20 Thread GitBox


dmsolr commented on a change in pull request #4847:
URL: https://github.com/apache/skywalking/pull/4847#discussion_r443145596



##
File path: 
apm-sniffer/optional-producer-plugins/kafka-producer-plugin/src/main/java/org/apache/skywalking/apm/agent/core/kafka/KafkaTraceSegmentService.java
##
@@ -0,0 +1,79 @@
+/*
+ * 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.apm.agent.core.kafka;
+
+import org.apache.kafka.clients.producer.KafkaProducer;
+import org.apache.kafka.clients.producer.ProducerRecord;
+import org.apache.kafka.common.utils.Bytes;
+import org.apache.skywalking.apm.agent.core.boot.BootService;
+import org.apache.skywalking.apm.agent.core.boot.OverrideImplementor;
+import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
+import org.apache.skywalking.apm.agent.core.conf.Config;
+import org.apache.skywalking.apm.agent.core.context.TracingContext;
+import org.apache.skywalking.apm.agent.core.context.TracingContextListener;
+import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
+import org.apache.skywalking.apm.agent.core.logging.api.ILog;
+import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
+import org.apache.skywalking.apm.agent.core.remote.TraceSegmentServiceClient;
+import org.apache.skywalking.apm.network.language.agent.v3.SegmentObject;
+
+@OverrideImplementor(TraceSegmentServiceClient.class)
+public class KafkaTraceSegmentService implements BootService, 
TracingContextListener {
+private static final ILog logger = 
LogManager.getLogger(KafkaTraceSegmentService.class);
+
+private String topic;
+private KafkaProducer producer;
+
+@Override
+public void prepare() throws Throwable {
+topic = Config.Collector.Kafka.TOPIC_SEGMENT;
+}
+
+@Override
+public void boot() throws Throwable {
+producer = 
ServiceManager.INSTANCE.findService(MessageQueueServiceManagement.class).getProducer(topic);
+}
+
+@Override
+public void onComplete() throws Throwable {
+TracingContext.ListenerManager.add(this);
+}
+
+@Override
+public void shutdown() throws Throwable {
+TracingContext.ListenerManager.remove(this);
+}
+
+@Override

Review comment:
   Yes, it will be released in 8.1.0 :)





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.

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




[GitHub] [skywalking] dmsolr commented on a change in pull request #4847: [WIP]Provide kafka as collector/reporter

2020-06-05 Thread GitBox


dmsolr commented on a change in pull request #4847:
URL: https://github.com/apache/skywalking/pull/4847#discussion_r435805183



##
File path: 
apm-sniffer/optional-producer-plugins/kafka-producer-plugin/src/main/java/org/apache/skywalking/apm/agent/core/kafka/KafkaTraceSegmentService.java
##
@@ -0,0 +1,79 @@
+/*
+ * 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.apm.agent.core.kafka;
+
+import org.apache.kafka.clients.producer.KafkaProducer;
+import org.apache.kafka.clients.producer.ProducerRecord;
+import org.apache.kafka.common.utils.Bytes;
+import org.apache.skywalking.apm.agent.core.boot.BootService;
+import org.apache.skywalking.apm.agent.core.boot.OverrideImplementor;
+import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
+import org.apache.skywalking.apm.agent.core.conf.Config;
+import org.apache.skywalking.apm.agent.core.context.TracingContext;
+import org.apache.skywalking.apm.agent.core.context.TracingContextListener;
+import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
+import org.apache.skywalking.apm.agent.core.logging.api.ILog;
+import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
+import org.apache.skywalking.apm.agent.core.remote.TraceSegmentServiceClient;
+import org.apache.skywalking.apm.network.language.agent.v3.SegmentObject;
+
+@OverrideImplementor(TraceSegmentServiceClient.class)
+public class KafkaTraceSegmentService implements BootService, 
TracingContextListener {
+private static final ILog logger = 
LogManager.getLogger(KafkaTraceSegmentService.class);
+
+private String topic;
+private KafkaProducer producer;
+
+@Override
+public void prepare() throws Throwable {
+topic = Config.Collector.Kafka.TOPIC_SEGMENT;
+}
+
+@Override
+public void boot() throws Throwable {
+producer = 
ServiceManager.INSTANCE.findService(MessageQueueServiceManagement.class).getProducer(topic);
+}
+
+@Override
+public void onComplete() throws Throwable {
+TracingContext.ListenerManager.add(this);
+}
+
+@Override
+public void shutdown() throws Throwable {
+TracingContext.ListenerManager.remove(this);
+}
+
+@Override

Review comment:
   Thanks for your suggestions. 
   Yes, we have to catch the exception.
   





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.

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