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 2020/09/03 07:48:42 UTC

[GitHub] [skywalking] wu-sheng commented on a change in pull request #5416: Support segment status based on entry/first span only

wu-sheng commented on a change in pull request #5416:
URL: https://github.com/apache/skywalking/pull/5416#discussion_r482771773



##########
File path: oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/trace/parser/SegmentStatusStrategy.java
##########
@@ -0,0 +1,41 @@
+/*
+ * 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.analyzer.provider.trace.parser;
+
+import lombok.Getter;
+import org.apache.skywalking.oap.server.analyzer.provider.trace.parser.listener.strategy.AnySpanSegmentStatusAnalyzer;
+import org.apache.skywalking.oap.server.analyzer.provider.trace.parser.listener.strategy.FirstSpanSegmentStatusAnalyzer;
+import org.apache.skywalking.oap.server.analyzer.provider.trace.parser.listener.strategy.SegmentStatusAnalyzer;
+
+/**
+ * define the strategy to analysis segment status

Review comment:
       ```suggestion
    * Define the available strategies for analysis segment status analysis.
   ```

##########
File path: oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/trace/parser/SegmentStatusStrategy.java
##########
@@ -0,0 +1,41 @@
+/*
+ * 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.analyzer.provider.trace.parser;
+
+import lombok.Getter;
+import org.apache.skywalking.oap.server.analyzer.provider.trace.parser.listener.strategy.AnySpanSegmentStatusAnalyzer;
+import org.apache.skywalking.oap.server.analyzer.provider.trace.parser.listener.strategy.FirstSpanSegmentStatusAnalyzer;
+import org.apache.skywalking.oap.server.analyzer.provider.trace.parser.listener.strategy.SegmentStatusAnalyzer;
+
+/**
+ * define the strategy to analysis segment status
+ */
+public enum SegmentStatusStrategy {
+    FROM_SPAN_STATUS(new AnySpanSegmentStatusAnalyzer()),
+
+    FROM_FIRST_SPAN_STATUS(new FirstSpanSegmentStatusAnalyzer());
+
+    @Getter
+    private final SegmentStatusAnalyzer exceptionAnalyzer;
+
+    SegmentStatusStrategy(final SegmentStatusAnalyzer exceptionAnalyzer) {
+        this.exceptionAnalyzer = exceptionAnalyzer;
+    }

Review comment:
       Use Lombok to replace this.

##########
File path: oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/trace/parser/listener/strategy/AnySpanSegmentStatusAnalyzer.java
##########
@@ -0,0 +1,29 @@
+/*
+ * 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.analyzer.provider.trace.parser.listener.strategy;
+
+import org.apache.skywalking.apm.network.language.agent.v3.SpanObject;
+
+public class AnySpanSegmentStatusAnalyzer implements SegmentStatusAnalyzer {

Review comment:
       ```suggestion
   public class FromSpanStatus implements SegmentStatusAnalyzer {
   ```

##########
File path: oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/trace/parser/listener/strategy/FirstSpanSegmentStatusAnalyzer.java
##########
@@ -0,0 +1,29 @@
+/*
+ * 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.analyzer.provider.trace.parser.listener.strategy;
+
+import org.apache.skywalking.apm.network.language.agent.v3.SpanObject;
+
+public class FirstSpanSegmentStatusAnalyzer extends AnySpanSegmentStatusAnalyzer {

Review comment:
       ```suggestion
   public class FromEntrySpan extends AnySpanSegmentStatusAnalyzer {
   ```
   
   I think don't the first span makes sense. Usually, the entry span represents the RPC incoming call status.

##########
File path: oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/trace/parser/listener/strategy/SegmentStatusAnalyzer.java
##########
@@ -0,0 +1,31 @@
+/*
+ * 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.analyzer.provider.trace.parser.listener.strategy;
+
+import org.apache.skywalking.apm.network.language.agent.v3.SpanObject;
+
+/**
+ * judge the status of spanObject

Review comment:
       ```suggestion
    * The SegmentStatusAnalyzer implementations provide different strategies for determining the segment status from the status of spans.
   ```

##########
File path: docs/en/setup/backend/configuration-vocabulary.md
##########
@@ -137,6 +137,7 @@ core|default|role|Option values, `Mixed/Receiver/Aggregator`. **Receiver** mode
 | - | -| sampleRate|Sampling rate for receiving trace. The precision is 1/10000. 10000 means 100% sample in default.|SW_TRACE_SAMPLE_RATE|10000|
 | - | - |slowDBAccessThreshold|The slow database access thresholds. Unit ms.|SW_SLOW_DB_THRESHOLD|default:200,mongodb:100|
 | - | - |forceSampleErrorSegment|When sampling mechanism activated, this config would make the error status segment sampled, ignoring the sampling rate.|SW_FORCE_SAMPLE_ERROR_SEGMENT|true|
+| - | - |segmentStatusAnalysisStrategy|Extract the final segment status from span collection in segment. Logic or operation is as default within all span status.|SW_SEGMENT_STATUS_ANALYSIS_STRATEGY|FROM_SPAN_STATUS|

Review comment:
       ```suggestion
   | - | - |segmentStatusAnalysisStrategy|Determine the final segment status from the status of spans. Available values are `FROM_SPAN_STATUS` and `FROM_ENTRY_SPAN`. `FROM_SPAN_STATUS` represents the segment status would be error if any span is in error status. `FROM_ENTRY_SPAN` means the segment status would be determined by the status of entry spans only.|SW_SEGMENT_STATUS_ANALYSIS_STRATEGY|FROM_SPAN_STATUS|
   ```
   
   NOTICE, the document is for end-users, you need to adjust the way of expression for them, rather than writing document from a developer.




----------------------------------------------------------------
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:
users@infra.apache.org