hexdigest / gowrap

GoWrap is a command line tool for generating decorators for Go interfaces
MIT License
1.09k stars 82 forks source link

feat: add template for elastic apm traces #57

Closed gvencadze closed 1 year ago

gvencadze commented 1 year ago

Adds support for Elastic APM traces.

(didn't include tests)

hexdigest commented 1 year ago

Hi @gvencadze , please take a look at this template: https://github.com/hexdigest/gowrap/blob/master/templates/elasticapm

maybe it's what you need.

gvencadze commented 1 year ago

@hexdigest o_O, I've created this merge request 3 week earlier.

Btw, there's a bug while call _d.captureError() - we must call Send() method to send error to APM system, otherwise it won't be sent.

Also span type is incorrect - they should have names like "http", "db", "external", "internal" and not interface name, I'll suggest this changes in another MR, okay?

bars43ru commented 1 year ago

Consider the opportunity by the naming of the span, using opt function pattern, which in turn allows you to either use the base type or set the name manually

bars43ru commented 1 year ago

@gvencadze, thanks for the note about the Send() call, I'll fix it now.

gvencadze commented 1 year ago

@bars43ru

image

I'll suggest to avoid setting each parameter from function to labels, better add them via opt function

bars43ru commented 1 year ago

@gvencadze It looks like really use/not use 'SetLable' can be controlled through opt function. This will allow for a more general pattern.

bars43ru commented 1 year ago

a little later I will prepare an MR with the ability to manage the use SetLabel via opt function

gvencadze commented 1 year ago

@bars43ru you can tag me in MR - I've some experience with elastic apm, maybe I'll suggest anything else to make template better