Documentation

Overview

    Package beego provides functions to instrument the github.com/astaxie/beego package (https://github.com/astaxie/beego).

    Index

    Examples

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func NewOTelBeegoMiddleWare

    func NewOTelBeegoMiddleWare(service string, options ...Option) beego.MiddleWare

      NewOTelBeegoMiddleWare creates a MiddleWare that provides OpenTelemetry tracing and metrics to a Beego web app. Parameter service should describe the name of the (virtual) server handling the request. The OTelBeegoMiddleWare can be configured using the provided Options.

      func Render

      func Render(c *beego.Controller) error

        Render traces beego.Controller.Render. Use this function if you want to add a child span for the rendering of a template file. Disable autorender before use, and call this function explicitly.

        Example
        Output:
        
        

        func RenderBytes

        func RenderBytes(c *beego.Controller) ([]byte, error)

          RenderBytes traces beego.Controller.RenderBytes. Use this function if you want to add a child span for the rendering of a template file to its byte representation. Disable autorender before use, and call this function explicitly.

          func RenderString

          func RenderString(c *beego.Controller) (string, error)

            RenderString traces beego.Controller.RenderString. Use this function if you want to add a child span for the rendering of a template file to its string representation. Disable autorender before use, and call this function explicitly.

            func Template

            func Template(name string) label.KeyValue

              Template returns the template name as a KeyValue pair.

              Types

              type Config

              type Config struct {
              	// contains filtered or unexported fields
              }

                Config provides configuration for the beego OpenTelemetry middleware. Configuration is modified using the provided Options.

                type Filter

                type Filter func(*http.Request) bool

                  Filter returns true if the request should be traced.

                  type OTelBeegoHandler

                  type OTelBeegoHandler struct {
                  	http.Handler
                  }

                    OTelBeegoHandler implements the http.Handler interface and provides trace and metrics to beego web apps.

                    func (*OTelBeegoHandler) ServeHTTP

                    func (o *OTelBeegoHandler) ServeHTTP(rr http.ResponseWriter, req *http.Request)

                      ServerHTTP calls the configured handler to serve HTTP for req to rr.

                      type Option

                      type Option interface {
                      	Apply(*Config)
                      }

                        Option applies a configuration to the given Config.

                        type OptionFunc

                        type OptionFunc func(c *Config)

                          OptionFunc is a function type that applies a particular configuration to the beego middleware in question.

                          func WithFilter

                          func WithFilter(f Filter) OptionFunc

                            WithFilter adds the given filter for use in the middleware. Defaults to no filters.

                            func WithMeterProvider

                            func WithMeterProvider(provider metric.Provider) OptionFunc

                              WithMeterProvider sets the meter provider to be used to create a meter by the middleware. Defaults to calling global.MeterProvider(). Meter name is set to "go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego".

                              func WithPropagators

                              func WithPropagators(propagators propagation.Propagators) OptionFunc

                                WithPropagators sets the propagators used in the middleware. Defaults to global.Propagators().

                                func WithSpanNameFormatter

                                func WithSpanNameFormatter(f SpanNameFormatter) OptionFunc

                                  WithSpanNameFormatter sets the formatter to be used to format span names. Defaults to the path template.

                                  func WithTraceProvider

                                  func WithTraceProvider(provider trace.Provider) OptionFunc

                                    WithTraceProvider sets the trace provider to be used by the middleware to create a tracer for the spans. Defaults to calling global.TraceProvider(). Tracer name is set to "go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego".

                                    func (OptionFunc) Apply

                                    func (o OptionFunc) Apply(c *Config)

                                      Apply will apply the option to the Config, c.

                                      type SpanNameFormatter

                                      type SpanNameFormatter func(operation string, req *http.Request) string

                                        SpanNameFormatter creates a custom span name from the operation and request object.

                                        Directories

                                        Path Synopsis
                                        otelbeego module