hong-ke opened a new issue, #13436:
URL: https://github.com/apache/skywalking/issues/13436

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Apache SkyWalking Component
   
   Go Agent (apache/skywalking-go)
   
   ### What happened
   
   After the ignoreSuffix filtering mechanism is triggered, NoopSpan.End() will 
clear the entire TracingContext, making it impossible to obtain the TraceID 
subsequently.
   
   ### What you expected to happen
   
   plugins/core/span_noop.go
   `func (n *NoopSpan) End() {
       n.stackCount--
       if n.stackCount == 0 {
           GetSo11y(n.tracer).MeasureTracingContextCompletion(true)
           if ctx := getTracingContext(); ctx != nil {
               ctx.SaveActiveSpan(nil)  // Key: ActiveSpan cleared!
           }
       }
   }`
   
   ### How to reproduce
   
   Test code
   `package main
   
   import (
        "fmt"
        "net/http"
   
        _ "github.com/apache/skywalking-go"
        "github.com/apache/skywalking-go/toolkit/trace"
        "github.com/gin-gonic/gin"
   )
   
   func main() {
        router := gin.New()
   
        router.GET("/debug", testHandler)
        httpServer := &http.Server{
                Addr:    ":8080",
                Handler: router,
        }
        httpServer.ListenAndServe()
   }
   func testHandler(c *gin.Context) {
        fmt.Printf("testHandler before httpCall traceid: %v\n", 
trace.GetTraceID())
   
        httpCall()
   
        fmt.Printf("testHandler after httpCall traceid: %v\n", 
trace.GetTraceID())
        c.JSON(200, gin.H{
                "traceid": trace.GetTraceID(),
        })
   }
   
   func httpCall() {
        fmt.Printf("before httpCall traceid: %v\n", trace.GetTraceID())
   
        defer func() {
                fmt.Printf("after httpCall traceid: %v\n", trace.GetTraceID())
        }()
   
        _, err := 
http.Get("https://github.githubassets.com/assets/light-6448649c7147.css";)
        if err != nil {
                fmt.Printf("httpCall err: %v\n", err)
        }
   }
   `
   
   ### Anything else
   
   skywalking-go version 0.6.0
   
   ### Are you willing to submit a pull request to fix on your own?
   
   - [ ] Yes I am willing to submit a pull request on my own!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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-unsubscr...@skywalking.apache.org.apache.org

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

Reply via email to