Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] Monitor go-redis with https://github.com/alibaba/opentelemetry-go-auto-instrumentation #3205

Open
123liuziming opened this issue Dec 11, 2024 · 8 comments

Comments

@123liuziming
Copy link

I found that go-redis doesn't have the ability to integrate tracing and metrics by default and there doesn't seem to be a best practice in the documentation on how to monitor go-redis applications. Our project(https://github.com/alibaba/opentelemetry-go-auto-instrumentation) allows tracing and metrics(will be supported later) to be collected and reported on the go-redis app without making changes to user code. I was wondering if it would be possible for me to add an observable subsection to the official documentation for this project that describes best practices for observing the go-redis application. Thanks!

@123liuziming 123liuziming changed the title [Proposal] Monitor gin with https://github.com/alibaba/opentelemetry-go-auto-instrumentation [Proposal] Monitor go-redis with https://github.com/alibaba/opentelemetry-go-auto-instrumentation Dec 11, 2024
@nikolaydubina
Copy link
Contributor

nikolaydubina commented Dec 11, 2024

why this does not work for you?

github.com/redis/go-redis/extra/redisotel/v9

but yeah, need to mention it more prominently

@123liuziming
Copy link
Author

why this does not work for you?

github.com/redis/go-redis/extra/redisotel/v9

but yeah, need to mention it more prominently

github.com/redis/go-redis/extra/redisotel/v9 need to add hook manually in user's code. We want to provide a zero-code-modification way to do that. I wanna add a document to mention the two ways more prominently

@nikolaydubina
Copy link
Contributor

hm, adding hook single time in main.go is not too much trouble. and probably better than pre-compile source code modification by very large code-processing tool.

anw, I am not a fan of that tool, and github.com/redis/go-redis/extra/redisotel/v9 looks ok to me (despite it having couple bugs)

but good point redis docs should mention more directly somewhere how to enable instrumentation. it took me a couple google searches to find out that this code exist in this repo!

@ndyakov
Copy link
Collaborator

ndyakov commented Mar 21, 2025

@nikolaydubina would you like to prepare a guide / document on enabling redisotel ?

@nikolaydubina
Copy link
Contributor

nikolaydubina commented Mar 21, 2025

not sure there is anything more to document. this is literally one line in main.go

in my case I do this:

package main

import (
	"github.com/redis/go-redis/extra/redisotel/v9"
	"github.com/redis/go-redis/v9"
)

func main() {
        ...
        rdb := redis(&redis.Options{...}))
	if err := errors.Join(redisotel.InstrumentTracing(rdb), redisotel.InstrumentMetrics(rdb)); err != nil {
		log.Fatalln(err)
	}

and the guys who made redisotel also mention it in their readme: https://github.com/redis/go-redis/tree/master/extra/redisotel

so not sure how to document more. maybe we can add it to main README of whole client? github.com/redis/go-redis/v9/README.md?

so how to use it is super simple. it is just hard to find maybe for people. so good to mention maybe not how to use it, but where to look for how to use it?

@nikolaydubina
Copy link
Contributor

raised PR for main README: #3316

@ndyakov
Copy link
Collaborator

ndyakov commented Mar 25, 2025

@123liuziming if you have a working example feel free to append it in the README. Sounds like we can extract the monitoring information in a separate MONITORING.md or something like that.

@123liuziming
Copy link
Author

@123liuziming if you have a working example feel free to append it in the README. Sounds like we can extract the monitoring information in a separate MONITORING.md or something like that.
For sure, thanks for reminding me~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants