You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/11/07 12:31:04 UTC

[GitHub] [skywalking] mrproliu opened a new pull request, #9916: Support span attached event concept

mrproliu opened a new pull request, #9916:
URL: https://github.com/apache/skywalking/pull/9916

   Support receiving, storing, and querying the span attached event in tracing.
   
   - [x] If this pull request closes/resolves/fixes an existing issue, replace the issue number. Part of https://github.com/apache/skywalking/issues/9803.
   - [x] Update the [`CHANGES` log](https://github.com/apache/skywalking/blob/master/docs/en/changes/changes.md).
   


-- 
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


[GitHub] [skywalking] wu-sheng commented on a diff in pull request #9916: Support span attached event concept

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #9916:
URL: https://github.com/apache/skywalking/pull/9916#discussion_r1015403484


##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/spanattach/SpanAttachedEventRecord.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * 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.core.analysis.manual.spanattach;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.skywalking.oap.server.core.Const;
+import org.apache.skywalking.oap.server.core.analysis.Stream;
+import org.apache.skywalking.oap.server.core.analysis.record.Record;
+import org.apache.skywalking.oap.server.core.analysis.worker.RecordStreamProcessor;
+import org.apache.skywalking.oap.server.core.source.ScopeDeclaration;
+import org.apache.skywalking.oap.server.core.storage.annotation.BanyanDB;
+import org.apache.skywalking.oap.server.core.storage.annotation.Column;
+import org.apache.skywalking.oap.server.core.storage.type.Convert2Entity;
+import org.apache.skywalking.oap.server.core.storage.type.Convert2Storage;
+import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
+
+import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SPAN_ATTACHED_EVENT;
+
+@Setter
+@Getter
+@ScopeDeclaration(id = SPAN_ATTACHED_EVENT, name = "SpanAttachedEvent")
+@Stream(name = SpanAttachedEventRecord.INDEX_NAME, scopeId = SPAN_ATTACHED_EVENT, builder = SpanAttachedEventRecord.Builder.class, processor = RecordStreamProcessor.class)
+public class SpanAttachedEventRecord extends Record {

Review Comment:
   Are you going to use 100% sampling? This means sampling all events matching the trace header. If so, consider `@SuperDataset`.



-- 
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


[GitHub] [skywalking] wu-sheng commented on a diff in pull request #9916: Support span attached event concept

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #9916:
URL: https://github.com/apache/skywalking/pull/9916#discussion_r1015410210


##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/spanattach/SpanAttachedEventTraceType.java:
##########
@@ -0,0 +1,55 @@
+/*
+ * 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.core.analysis.manual.spanattach;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The {@link SpanAttachedEventRecord} tracing context reference type.
+ */
+public enum SpanAttachedEventTraceType {
+
+    SKYWALKING(0),
+
+    ZIPKIN(1),
+    ;

Review Comment:
   ```suggestion
       ZIPKIN(1);
   ```
   
   Should we use this format?



-- 
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


[GitHub] [skywalking] mrproliu commented on a diff in pull request #9916: Support span attached event concept

Posted by GitBox <gi...@apache.org>.
mrproliu commented on code in PR #9916:
URL: https://github.com/apache/skywalking/pull/9916#discussion_r1016031996


##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/spanattach/SpanAttachedEventRecord.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * 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.core.analysis.manual.spanattach;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.skywalking.oap.server.core.Const;
+import org.apache.skywalking.oap.server.core.analysis.Stream;
+import org.apache.skywalking.oap.server.core.analysis.record.Record;
+import org.apache.skywalking.oap.server.core.analysis.worker.RecordStreamProcessor;
+import org.apache.skywalking.oap.server.core.source.ScopeDeclaration;
+import org.apache.skywalking.oap.server.core.storage.annotation.BanyanDB;
+import org.apache.skywalking.oap.server.core.storage.annotation.Column;
+import org.apache.skywalking.oap.server.core.storage.type.Convert2Entity;
+import org.apache.skywalking.oap.server.core.storage.type.Convert2Storage;
+import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
+
+import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SPAN_ATTACHED_EVENT;
+
+@Setter
+@Getter
+@ScopeDeclaration(id = SPAN_ATTACHED_EVENT, name = "SpanAttachedEvent")
+@Stream(name = SpanAttachedEventRecord.INDEX_NAME, scopeId = SPAN_ATTACHED_EVENT, builder = SpanAttachedEventRecord.Builder.class, processor = RecordStreamProcessor.class)
+public class SpanAttachedEventRecord extends Record {

Review Comment:
   Updated it as super data set.



-- 
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


[GitHub] [skywalking] wu-sheng merged pull request #9916: Support span attached event concept

Posted by GitBox <gi...@apache.org>.
wu-sheng merged PR #9916:
URL: https://github.com/apache/skywalking/pull/9916


-- 
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


[GitHub] [skywalking] wu-sheng commented on a diff in pull request #9916: Support span attached event concept

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #9916:
URL: https://github.com/apache/skywalking/pull/9916#discussion_r1017256700


##########
docs/en/changes/changes.md:
##########
@@ -101,6 +101,7 @@
 * Optimize MQ Topology analysis. Use entry span's peer from the consumer side as source service when no producer instrumentation(no cross-process reference).
 * Refactor JDBC storage implementations to reuse logics.
 * Fix `ClassCastException` in `LoggingConfigWatcher`.
+* Support span attached event concept.

Review Comment:
   ```suggestion
   * Support span attached event concept in Zipkin and SkyWalking trace query.
   * Support span attached events on Zipkin lens UI.
   ```
   
   This doc should be updated as well, https://skywalking.apache.org/docs/main/next/en/setup/backend/zipkin-trace/
   
   Also, we should consider adding a menu here to introduce ebpf besides tracing/logging/metrics.
   <img width="323" alt="image" src="https://user-images.githubusercontent.com/5441976/200705054-8732349e-21a0-43c6-ab60-1c7a5f90072d.png">
   



-- 
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


[GitHub] [skywalking] wu-sheng commented on a diff in pull request #9916: Support span attached event concept

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #9916:
URL: https://github.com/apache/skywalking/pull/9916#discussion_r1015409609


##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/spanattach/SpanAttachedEventRecord.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * 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.core.analysis.manual.spanattach;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.skywalking.oap.server.core.Const;
+import org.apache.skywalking.oap.server.core.analysis.Stream;
+import org.apache.skywalking.oap.server.core.analysis.record.Record;
+import org.apache.skywalking.oap.server.core.analysis.worker.RecordStreamProcessor;
+import org.apache.skywalking.oap.server.core.source.ScopeDeclaration;
+import org.apache.skywalking.oap.server.core.storage.annotation.BanyanDB;
+import org.apache.skywalking.oap.server.core.storage.annotation.Column;
+import org.apache.skywalking.oap.server.core.storage.type.Convert2Entity;
+import org.apache.skywalking.oap.server.core.storage.type.Convert2Storage;
+import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
+
+import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SPAN_ATTACHED_EVENT;
+
+@Setter
+@Getter
+@ScopeDeclaration(id = SPAN_ATTACHED_EVENT, name = "SpanAttachedEvent")
+@Stream(name = SpanAttachedEventRecord.INDEX_NAME, scopeId = SPAN_ATTACHED_EVENT, builder = SpanAttachedEventRecord.Builder.class, processor = RecordStreamProcessor.class)
+public class SpanAttachedEventRecord extends Record {
+
+    public static final String INDEX_NAME = "span_attached_event_record";
+    public static final String START_TIME_SECOND = "start_time_second";
+    public static final String START_TIME_NANOS = "start_time_nanos";
+    public static final String EVENT = "event";
+    public static final String END_TIME_SECOND = "end_time_second";
+    public static final String END_TIME_NANOS = "end_time_nanos";
+    public static final String TRACE_REF_TYPE = "trace_ref_type";
+    public static final String TRACE_ID = "trace_id";
+    public static final String TRACE_SEGMENT_ID = "trace_segment_id";
+    public static final String TRACE_SPAN_ID = "trace_span_id";
+    public static final String DATA_BINARY = "data_binary";
+
+    @Column(columnName = START_TIME_SECOND)
+    private long startTimeSecond;
+    @Column(columnName = START_TIME_NANOS)
+    private int startTimeNanos;
+    @Column(columnName = EVENT)
+    private String event;
+    @Column(columnName = END_TIME_SECOND)
+    private long endTimeSecond;
+    @Column(columnName = END_TIME_NANOS)
+    private int endTimeNanos;
+    @Column(columnName = TRACE_REF_TYPE)
+    private int traceRefType;

Review Comment:
   Should we add a `SpanReferenceType` type field(not a column` in the Record? 



-- 
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


[GitHub] [skywalking] wu-sheng commented on a diff in pull request #9916: Support span attached event concept

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #9916:
URL: https://github.com/apache/skywalking/pull/9916#discussion_r1015404851


##########
oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/handler/v8/grpc/SpanAttachedEventReportServiceHandler.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * 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.trace.provider.handler.v8.grpc;
+
+import io.grpc.Status;
+import io.grpc.stub.StreamObserver;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.skywalking.apm.network.common.v3.Commands;
+import org.apache.skywalking.apm.network.language.agent.v3.SpanAttachedEvent;
+import org.apache.skywalking.apm.network.language.agent.v3.SpanAttachedEventReportServiceGrpc;
+import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
+import org.apache.skywalking.oap.server.core.analysis.manual.spanattach.SpanAttachedEventRecord;
+import org.apache.skywalking.oap.server.core.analysis.worker.RecordStreamProcessor;
+import org.apache.skywalking.oap.server.library.module.ModuleManager;
+import org.apache.skywalking.oap.server.library.server.grpc.GRPCHandler;
+
+import java.util.concurrent.TimeUnit;
+
+@Slf4j
+public class SpanAttachedEventReportServiceHandler extends SpanAttachedEventReportServiceGrpc.SpanAttachedEventReportServiceImplBase implements GRPCHandler {
+    public SpanAttachedEventReportServiceHandler(ModuleManager moduleManager) {
+    }
+
+    @Override
+    public StreamObserver<SpanAttachedEvent> collect(StreamObserver<Commands> responseObserver) {
+        return new StreamObserver<SpanAttachedEvent>() {
+            @Override
+            public void onNext(SpanAttachedEvent event) {
+                if (log.isDebugEnabled()) {
+                    log.debug("receive span attached event is streaming");
+                }
+
+                final SpanAttachedEventRecord record = new SpanAttachedEventRecord();

Review Comment:
   Should we consider HTTP endpoint?



-- 
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


[GitHub] [skywalking] wu-sheng commented on a diff in pull request #9916: Support span attached event concept

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #9916:
URL: https://github.com/apache/skywalking/pull/9916#discussion_r1015413670


##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/TraceQueryService.java:
##########
@@ -244,4 +268,61 @@ private void findChildren(List<Span> spans, Span parentSpan, List<Span> children
             }
         });
     }
+
+    private void appendAttachedEventsToSpan(List<Span> spans, List<SpanAttachedEventRecord> events) throws InvalidProtocolBufferException {
+        if (CollectionUtils.isEmpty(events)) {
+            return;
+        }
+
+        for (SpanAttachedEventRecord record : events) {
+            if (!StringUtils.isNumeric(record.getTraceSpanId())) {
+                continue;
+            }
+
+            // find matches span
+            final int eventSpanId = Integer.parseInt(record.getTraceSpanId());

Review Comment:
   According to this, https://github.com/apache/skywalking-query-protocol/pull/101, we should update the Zipkin query as well. And verify whether we could put this in tags or some places for lens UI?



-- 
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


[GitHub] [skywalking] mrproliu commented on a diff in pull request #9916: Support span attached event concept

Posted by GitBox <gi...@apache.org>.
mrproliu commented on code in PR #9916:
URL: https://github.com/apache/skywalking/pull/9916#discussion_r1016031461


##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/spanattach/SpanAttachedEventRecord.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * 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.core.analysis.manual.spanattach;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.skywalking.oap.server.core.Const;
+import org.apache.skywalking.oap.server.core.analysis.Stream;
+import org.apache.skywalking.oap.server.core.analysis.record.Record;
+import org.apache.skywalking.oap.server.core.analysis.worker.RecordStreamProcessor;
+import org.apache.skywalking.oap.server.core.source.ScopeDeclaration;
+import org.apache.skywalking.oap.server.core.storage.annotation.BanyanDB;
+import org.apache.skywalking.oap.server.core.storage.annotation.Column;
+import org.apache.skywalking.oap.server.core.storage.type.Convert2Entity;
+import org.apache.skywalking.oap.server.core.storage.type.Convert2Storage;
+import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
+
+import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SPAN_ATTACHED_EVENT;
+
+@Setter
+@Getter
+@ScopeDeclaration(id = SPAN_ATTACHED_EVENT, name = "SpanAttachedEvent")
+@Stream(name = SpanAttachedEventRecord.INDEX_NAME, scopeId = SPAN_ATTACHED_EVENT, builder = SpanAttachedEventRecord.Builder.class, processor = RecordStreamProcessor.class)
+public class SpanAttachedEventRecord extends Record {
+
+    public static final String INDEX_NAME = "span_attached_event_record";
+    public static final String START_TIME_SECOND = "start_time_second";
+    public static final String START_TIME_NANOS = "start_time_nanos";
+    public static final String EVENT = "event";
+    public static final String END_TIME_SECOND = "end_time_second";
+    public static final String END_TIME_NANOS = "end_time_nanos";
+    public static final String TRACE_REF_TYPE = "trace_ref_type";
+    public static final String TRACE_ID = "trace_id";
+    public static final String TRACE_SEGMENT_ID = "trace_segment_id";
+    public static final String TRACE_SPAN_ID = "trace_span_id";
+    public static final String DATA_BINARY = "data_binary";
+
+    @Column(columnName = START_TIME_SECOND)
+    private long startTimeSecond;
+    @Column(columnName = START_TIME_NANOS)
+    private int startTimeNanos;
+    @Column(columnName = EVENT)
+    private String event;
+    @Column(columnName = END_TIME_SECOND)
+    private long endTimeSecond;
+    @Column(columnName = END_TIME_NANOS)
+    private int endTimeNanos;
+    @Column(columnName = TRACE_REF_TYPE)
+    private int traceRefType;

Review Comment:
   Updated it as an enum. 



-- 
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


[GitHub] [skywalking] mrproliu commented on a diff in pull request #9916: Support span attached event concept

Posted by GitBox <gi...@apache.org>.
mrproliu commented on code in PR #9916:
URL: https://github.com/apache/skywalking/pull/9916#discussion_r1016031878


##########
oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/handler/v8/grpc/SpanAttachedEventReportServiceHandler.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * 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.trace.provider.handler.v8.grpc;
+
+import io.grpc.Status;
+import io.grpc.stub.StreamObserver;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.skywalking.apm.network.common.v3.Commands;
+import org.apache.skywalking.apm.network.language.agent.v3.SpanAttachedEvent;
+import org.apache.skywalking.apm.network.language.agent.v3.SpanAttachedEventReportServiceGrpc;
+import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
+import org.apache.skywalking.oap.server.core.analysis.manual.spanattach.SpanAttachedEventRecord;
+import org.apache.skywalking.oap.server.core.analysis.worker.RecordStreamProcessor;
+import org.apache.skywalking.oap.server.library.module.ModuleManager;
+import org.apache.skywalking.oap.server.library.server.grpc.GRPCHandler;
+
+import java.util.concurrent.TimeUnit;
+
+@Slf4j
+public class SpanAttachedEventReportServiceHandler extends SpanAttachedEventReportServiceGrpc.SpanAttachedEventReportServiceImplBase implements GRPCHandler {
+    public SpanAttachedEventReportServiceHandler(ModuleManager moduleManager) {
+    }
+
+    @Override
+    public StreamObserver<SpanAttachedEvent> collect(StreamObserver<Commands> responseObserver) {
+        return new StreamObserver<SpanAttachedEvent>() {
+            @Override
+            public void onNext(SpanAttachedEvent event) {
+                if (log.isDebugEnabled()) {
+                    log.debug("receive span attached event is streaming");
+                }
+
+                final SpanAttachedEventRecord record = new SpanAttachedEventRecord();

Review Comment:
   Because there is no need now, so ignore 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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

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


[GitHub] [skywalking] mrproliu commented on a diff in pull request #9916: Support span attached event concept

Posted by GitBox <gi...@apache.org>.
mrproliu commented on code in PR #9916:
URL: https://github.com/apache/skywalking/pull/9916#discussion_r1016031327


##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/TraceQueryService.java:
##########
@@ -244,4 +268,61 @@ private void findChildren(List<Span> spans, Span parentSpan, List<Span> children
             }
         });
     }
+
+    private void appendAttachedEventsToSpan(List<Span> spans, List<SpanAttachedEventRecord> events) throws InvalidProtocolBufferException {
+        if (CollectionUtils.isEmpty(events)) {
+            return;
+        }
+
+        for (SpanAttachedEventRecord record : events) {
+            if (!StringUtils.isNumeric(record.getTraceSpanId())) {
+                continue;
+            }
+
+            // find matches span
+            final int eventSpanId = Integer.parseInt(record.getTraceSpanId());

Review Comment:
   Updated. I have filtered the skywalking events in the query and checked the parent span ID is numeric or not.



-- 
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


[GitHub] [skywalking] wu-sheng commented on a diff in pull request #9916: Support span attached event concept

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #9916:
URL: https://github.com/apache/skywalking/pull/9916#discussion_r1015411815


##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/TraceQueryService.java:
##########
@@ -244,4 +268,61 @@ private void findChildren(List<Span> spans, Span parentSpan, List<Span> children
             }
         });
     }
+
+    private void appendAttachedEventsToSpan(List<Span> spans, List<SpanAttachedEventRecord> events) throws InvalidProtocolBufferException {
+        if (CollectionUtils.isEmpty(events)) {
+            return;
+        }
+
+        for (SpanAttachedEventRecord record : events) {
+            if (!StringUtils.isNumeric(record.getTraceSpanId())) {
+                continue;
+            }
+
+            // find matches span
+            final int eventSpanId = Integer.parseInt(record.getTraceSpanId());

Review Comment:
   I think we should check SpanReferenceType first, then do casting. Otherwise, we may face NPE or cast error, if trace ID actually exists on both sides. Such as Lua agent uses UUID as well.



-- 
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


[GitHub] [skywalking] wu-sheng commented on a diff in pull request #9916: Support span attached event concept

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #9916:
URL: https://github.com/apache/skywalking/pull/9916#discussion_r1017263669


##########
docs/en/changes/changes.md:
##########
@@ -101,6 +101,7 @@
 * Optimize MQ Topology analysis. Use entry span's peer from the consumer side as source service when no producer instrumentation(no cross-process reference).
 * Refactor JDBC storage implementations to reuse logics.
 * Fix `ClassCastException` in `LoggingConfigWatcher`.
+* Support span attached event concept.

Review Comment:
   Let's update the docs for profiling in the next PR.



-- 
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