instagin

package module
v1.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 3 Imported by: 1

README

Instana instrumentation for gin framework

This module contains middleware to instrument HTTP services written with github.com/gin-gonic/gin.

GoDoc

Compatibility

  • Starting at version 1.6.0 of instagin, gin v1.9.0 is used, which requires Go v1.18 or higher

Installation

To add the module to your go.mod file run the following command in your project directory:

$ go get github.com/instana/go-sensor/instrumentation/instagin

Usage

// init gin engine
engine := gin.Default()

// create a sensor
sensor := instana.NewSensor("gin-sensor")

// add middleware to the gin handlers
instagin.AddMiddleware(sensor, engine)

// define API
engine.GET("/api", func(c *gin.Context) {}
...

Full example

Documentation

Index

Constants

View Source
const Version = "1.21.0"

Version is the instrumentation module semantic version

Variables

This section is empty.

Functions

func AddMiddleware

func AddMiddleware(sensor instana.TracerLogger, engine *gin.Engine)

AddMiddleware adds the tracing middleware to the list of Gin handlers. Unlike the gin.Use method, it puts the middleware to the beginning of the list, to allow the tracing of default handlers added by the gin.Default() call.

func Default added in v1.1.0

func Default(sensor instana.TracerLogger) *gin.Engine

Default is wrapper for gin.Default()

func New added in v1.1.0

func New(sensor instana.TracerLogger) *gin.Engine

New is wrapper for gin.New()

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL