Documentation ¶
Index ¶
Constants ¶
const (
TagUser = "user"
)
Span tag names
Variables ¶
This section is empty.
Functions ¶
func Start ¶
func Start(opts ...tracer.StartOption)
Start starts the tracer with the given set of options. The "agent address", "service" and "env" options are provided by default based on the following config entries:
- `app.datadog.agentAddr`
- `app.datadog.service`
- `app.environment`
It will stop and replace any running tracer, meaning that calling it several times will result in a restart of the tracer by replacing the current instance with a new one.
Types ¶
type DatadogUser ¶
type DatadogUser struct { Name string `json:",omitempty"` Email string `json:",omitempty"` ID int64 }
DatadogUser minimal structure to identify a user at the origin of a trace.
func (DatadogUser) String ¶
func (u DatadogUser) String() string
String returns a JSON representation of the structure.
type DatadogUserConverter ¶
type DatadogUserConverter interface {
ToDatadogUser() DatadogUser
}
DatadogUserConverter if be implemented by the user structure, a "user" tag will be added to the span with the returned `DatadogUser` structure as a value.
type Middleware ¶
type Middleware struct { // SpanOption if not nil, this function is executed before finishing the span // associated with the request. This can be used to add custom tags to the span. SpanOption SpanOption }
Middleware substitutes the original response writer with a trace writer wrapper.
func (Middleware) Handle ¶
func (m Middleware) Handle(next goyave.Handler) goyave.Handler
Handle substitutes the original response writer with a trace writer wrapper.
type SpanOption ¶ added in v0.2.0
SpanOption function altering a span before finishing it. This can be used to add custom tags to the span.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer doesn't affect the response but captures information about the request and the response to convert it as tags for a datadog span. The span is finished and reported when `Close()` is called.
func NewWriter ¶
func NewWriter(response *goyave.Response, request *goyave.Request, spanOption SpanOption) *Writer
NewWriter creates a new writer meant for use in a single response. Starts the span right away with the common options (service name, uri, method, route name, span kind and type).
The given `SpanOption` is executed before ending the span (at the end of the request life-cycle) and can be used to add tags to the span. Can be `nil`.
func (*Writer) Close ¶
Close the underlying writer, adds the status, error, and user tags to the span and finishes it.