選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
Fusl 53842ced4b add prometheus exports for redis 2年前
..
.gitignore add prometheus exports for redis 2年前
LICENSE add prometheus exports for redis 2年前
Makefile add prometheus exports for redis 2年前
README.md add prometheus exports for redis 2年前
hook.go add prometheus exports for redis 2年前
options.go add prometheus exports for redis 2年前

README.md

go-redis-prometheus

go-redis hook that exports Prometheus metrics.

Installation

go get github.com/globocom/go-redis-prometheus

Usage

package main

import (
    "github.com/go-redis/redis/v8"
    "github.com/globocom/go-redis-prometheus"
)

func main() {
    hook := redisprom.NewHook(
        redisprom.WithInstanceName("cache"),
        redisprom.WithNamespace("my_namespace"),
        redisprom.WithDurationBuckets([]float64{.001, .005, .01}),
    )

    client := redis.NewClient(&redis.Options{
        Addr:     "localhost:6379",
        Password: "",
    })
    client.AddHook(hook)

    // run redis commands...
}

Exported metrics

The hook exports the following metrics:

  • Single commands (not pipelined):
    • Histogram of commands: redis_single_commands_bucket{instance="main",command="get"}
    • Counter of errors: redis_single_errors{instance="main",command="get"}
  • Pipelined commands:
    • Counter of commands: redis_pipelined_commands{instance="main",command="get"}
    • Counter of errors: redis_pipelined_errors{instance="main",command="get"}

Note on pipelines

It isn’t possible to measure the duration of individual pipelined commands, but the duration of the pipeline itself is calculated and exported as a pseudo-command called “pipeline” under the single command metric.