Documentation

Overview

    Package gin provides functions to trace the gin-gonic/gin package (https://github.com/gin-gonic/gin).

    Example

      To start tracing requests, add the trace middleware to your Gin router.

      Output:
      
      
      Example (SpanFromContext)
      Output:
      
      

      Index

      Examples

      Constants

      This section is empty.

      Variables

      This section is empty.

      Functions

      func HTML

      func HTML(c *gin.Context, code int, name string, obj interface{})

        HTML will trace the rendering of the template as a child of the span in the given context.

        Example
        Output:
        
        

        func Middleware

        func Middleware(service string, opts ...Option) gin.HandlerFunc

          Middleware returns middleware that will trace incoming requests. If service is empty then the default service name will be used.

          Types

          type Option

          type Option func(*config)

            Option specifies instrumentation configuration options.

            func WithAnalytics

            func WithAnalytics(on bool) Option

              WithAnalytics enables Trace Analytics for all started spans.

              func WithAnalyticsRate

              func WithAnalyticsRate(rate float64) Option

                WithAnalyticsRate sets the sampling rate for Trace Analytics events correlated to started spans.

                func WithResourceNamer

                func WithResourceNamer(namer func(c *gin.Context) string) Option

                  WithResourceNamer specifies a function which will be used to obtain a resource name for a given gin request, using the request's context.