Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 771 Bytes

Readme.md

File metadata and controls

26 lines (19 loc) · 771 Bytes

GIN Monitoring Middlewares

It is middleware for send metrics about API to Telegraf

Message format

raw-api-requests-updates,request_name=GET-/api/v1/info,response_name=GET-/api/v1/info,error_code=200 timing=3 1498226123268
raw-api-requests-updates,request_name=GET-/api/v1/info,response_name=GET-/api/v1/info,error_code=200 timing=4 1498226123648

Usage

    mm := ginmm.NewMetricMiddleware(MetricParams{
        Service:         "updates",
        UdpAddres:       "localhost:12345",
        FlushBufferSize: DEFAULT_BUFFER_SIZE,
        FlushTimeout:    DEFAULT_FLUSH_TIMEOUT,
    })
    
    // Creates a router without any middleware by default
    r := gin.New()
    
    // Setup global middleware
    r.Use(mm.Middleware())
    // ...