mrproliu commented on code in PR #104:
URL: https://github.com/apache/skywalking-go/pull/104#discussion_r1335150162


##########
go.sum:
##########
@@ -3,6 +3,8 @@ cloud.google.com/go v0.34.0/go.mod 
h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
 github.com/BurntSushi/toml v0.3.1/go.mod 
h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
 github.com/OneOfOne/xxhash v1.2.2/go.mod 
h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
 github.com/antihax/optional v1.0.0/go.mod 
h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
+github.com/apache/skywalking-go/plugins/core 
v0.0.0-20230918115826-b3e0cf3c66e3 
h1:eKd+lMBXKPxrDQ/OJ/JZ26YsaSSBgFt8vJHANfsn1LA=

Review Comment:
   Please delete this package in the sum file. 



##########
plugins/core/tracer.go:
##########
@@ -65,6 +65,10 @@ func (t *Tracer) Init(entity *reporter.Entity, rep 
reporter.Reporter, samp Sampl
        t.Reporter.Boot(entity, t.cdsWatchers)
        t.initFlag = 1
        t.initMetricsCollect(meterCollectSecond)
+       t.correlation = &CorrelationConfig{

Review Comment:
   Can we make it configurable?



##########
plugins/trace-activation/capture_intercepter.go:
##########
@@ -0,0 +1,35 @@
+// Licensed to 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. Apache Software Foundation (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 traceactivation
+
+import (
+       "github.com/apache/skywalking-go/plugins/core/operator"
+       "github.com/apache/skywalking-go/plugins/core/tracing"
+)
+
+type CaptureContextInterceptor struct {
+}
+
+func (h *CaptureContextInterceptor) BeforeInvoke(invocation 
operator.Invocation) error {
+       return nil
+}
+
+func (h *CaptureContextInterceptor) AfterInvoke(invocation 
operator.Invocation, result ...interface{}) error {
+       invocation.DefineReturnValues(tracing.CaptureContext())

Review Comment:
   Please define the result in the beforeMethod. 



##########
plugins/core/tracing.go:
##########
@@ -293,3 +331,11 @@ func saveSpanToActiveIfNotError(ctx *TracingContext, span 
interface{}, err error
        ctx.SaveActiveSpan(span.(TracingSpan))
        SetGLS(ctx)
 }
+
+func getTracer() *Tracer {

Review Comment:
   If this method doesn't need, please remove it. 



##########
plugins/core/tracing.go:
##########
@@ -175,6 +175,44 @@ func (t *Tracer) CleanContext() {
        SetGLS(nil)
 }
 
+func (t *Tracer) GetCorrelationContextValue(key string) string {
+       tracer := getTracer()

Review Comment:
   You have already get the tracer reference, why you need to get tracer again?



##########
plugins/core/tracing.go:
##########
@@ -175,6 +175,44 @@ func (t *Tracer) CleanContext() {
        SetGLS(nil)
 }
 
+func (t *Tracer) GetCorrelationContextValue(key string) string {
+       tracer := getTracer()
+       if tracer == nil {
+               return ""
+       }
+       span := tracer.ActiveSpan()
+       if span == nil {
+               return ""
+       }
+       reportedSpan, ok := span.(*RootSegmentSpan)
+       if !ok {
+               return ""
+       }
+       return reportedSpan.Context().GetCorrelationContextValue(key)
+}
+
+func (t *Tracer) SetCorrelationContextValue(key, value string) {
+       tracer := getTracer()

Review Comment:
   Same here. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to