Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.
/ requestid Public archive

Injects a request ID into the context of each request, middleware for gin, use https://github.com/things-go/gin-contrib instead.

License

Notifications You must be signed in to change notification settings

things-go/requestid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

requestid

GoDoc Go.Dev reference codecov Action Status Go Report Card Licence Tag

requestid is an requestId(traceId) middleware for Gin

Format

`hostname-pid-initrandvalue-sequence`

Installation

    go get github.com/things-go/requestid

Simple Example

package main

import (
	"fmt"

	"github.com/gin-gonic/gin"

	"github.com/things-go/requestid"
)

func main() {
	router := gin.New()
	router.Use(requestid.RequestId())
	router.GET("/", func(c *gin.Context) {
		fmt.Println(requestid.FromRequestId(c.Request.Context()))
		fmt.Println(requestid.GetRequestId(c))
	})
	router.Run(":8080")
}

License

This project is under MIT License. See the LICENSE file for the full license text.

About

Injects a request ID into the context of each request, middleware for gin, use https://github.com/things-go/gin-contrib instead.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages