gin

command module
v0.0.0-...-316a413 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: BSD-2-Clause Imports: 9 Imported by: 0

README

Gin OpenTelemetry instrumentation example

PkgGoDev

Quickstart

Install otelgin instrumentation:

go get go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin

Then install the OpenTelemetry middleware:

router := gin.Default()
router.Use(otelgin.Middleware("service-name"))

To propagate active span through the app, use context.Context from the http.Request (not gin.Context). To measure HTML template rendering, use otelgin.HTML helper.

Example

To run this example:

UPTRACE_DSN="https://<token>@api.uptrace.dev/<project_id>" go run main.go

Then open http://localhost:9999

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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