redis/go-redis

Feature request: maximum size for dbStatement in OTEL

Closed this issue · 5 comments

Current Behavior

The OTEL instrumentation has support for DB query tracing:

if th.conf.dbStmtEnabled {

This works well until a large object (a large image, in our case) is inserted into Redis. Then it can clog up the metric exporter.

Possible Solution

Add an option to cut the DB statement to a reasonable size. Something like WithDBStatementMaxSize(n int) that would preserve the initial n/2 and the final n/2 characters from the query.

Hello @Cyberax ,
We are mainly focused on improving the client. If you would like to contribute, feel free to open a PR and we will review it, but at the moment won't be able to address this request for redisotel.

@vmihailenco would you mind if I assign you to issues related to redisotel like this one?

@ndyakov sure, I will take a look at this a bit later

I did some research and it looks like OpenTelemetry already allows to truncate large strings using OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT setting.

Unless there is a compelling reason to have a separate limit for db.statement, I am inclined to say that OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT is enough.

Then it can clog up the metric exporter.

You probably confuse it with tracing exporter, because metrics should not have the db.statement attribute.

based on @vmihailenco response, i am closing this issue.