Git Product home page Git Product logo

Comments (7)

Logic0 avatar Logic0 commented on July 21, 2024 1

if we have a handler like:
func doSomething( c *gin.Context ) {...}

then register 2 handler:

eg = gin.New()
eg.Use( Middleware(eg, tracer) )
eg.POST( "/api/v1/m1", doSomething )
eg.POST( "/api/v1/m2", doSomething )

according to the code in go2sky gin plugin:
mm[r.Handler] = routeInfo{ operationName: fmt.Sprintf("/%s%s", r.Method, r.Path), }

the mm will be:

mm['doSomething'] = "/POST/api/v1/m1"         // will be overwrited by m2
mm['doSomething'] = "/POST/api/v1/m2"

all the request from "/POST/api/v1/m1" will be recognized as "/POST/api/v1/m2", as it's overwrited.

hope this helps.

from go2sky.

arugal avatar arugal commented on July 21, 2024

Hi @Logic0
Glad to receive your feedback. I don't quite understand what you said. Could you give me an example :)

from go2sky.

arugal avatar arugal commented on July 21, 2024

Thank you. It does happen. Let me see how to solve it.

from go2sky.

arugal avatar arugal commented on July 21, 2024

Hi @Logic0, If use http.Request.Method + http.Request.URL.Path as the operation name, so /user/:name will generate multiple operation name, I will keep the current solution until there is a better solution.

from go2sky.

wu-sheng avatar wu-sheng commented on July 21, 2024

We did a discussion, this should be plugin FAQ.

from go2sky.

wu-sheng avatar wu-sheng commented on July 21, 2024

@Logic0 As you have known the logic behind this, I recommend using a method wrapper to make this conflict gone. I have talked with @arugal, my suggestion would like to add a FAQ document with an example.

from go2sky.

arugal avatar arugal commented on July 21, 2024

Hi @Logic0 https://github.com/SkyAPM/go2sky-plugins/tree/master/gin/v3 We provide a new version, welcome to use.

from go2sky.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.