instagin

package module
v1.0.1-0...-9bf41b3 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: MIT Imports: 3 Imported by: 0

README

Instana instrumentation for gin framework

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

GoDoc

Installation

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

$ go get github.com/mier85/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.1.0"

Version is the instrumentation module semantic version

Variables

This section is empty.

Functions

func AddMiddleware

func AddMiddleware(sensor *instana.Sensor, 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 tracing default handlers added by the gin.Default() call.

func Default

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

Default is wrapper for gin.Default()

func New

func New(sensor *instana.Sensor) *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