-
Notifications
You must be signed in to change notification settings - Fork 238
fix(redis): Add instance to Redis DB context in ioredis.js #4858
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
base: main
Are you sure you want to change the base?
Conversation
🤖 GitHub commentsJust comment with:
|
|
we tested this in production and it is working well |
|
any plans to review or land this? what are the missing parts? |
|
Elastic's APM agent spec for Redis spans (https://github.com/elastic/apm/blob/main/specs/agents/tracing-instrumentation-db.md#redis) says that no value should be used for Looking for possible inspiration from OpenTelemetry Semantic Conventions, the span attribute most similar to Elastic APM's The screenshots you showed with "redis" are the dependencies table in Kibana's APM UI? I'm pretty sure that this is from the value of apm-agent-nodejs/lib/instrumentation/span.js Lines 185 to 203 in 2cec62a
Another way to set those Really, I think the feature wanted here is a separation of dependencies by host ( At best we could only add this functionality behind a configuration option. I wonder if using {
"name": "HSET",
"type": "db",
"id": "828356d8e28c47e0",
"transaction_id": "06544993fc6dbbfe",
"parent_id": "06544993fc6dbbfe",
"trace_id": "2373a3a7f65dd27ea537d14c18ab4312",
"subtype": "redis",
"action": "query",
"timestamp": 1763595378528182,
"duration": 0.881,
"context": {
"service": {
"target": {
"type": "redis"
}
},
"destination": {
"address": "localhost",
"port": 6379,
"service": {
"type": "",
"name": "",
"resource": "redis"
}
},
"db": {
"type": "redis"
}
},
"sync": false,
"outcome": "success",
"sample_rate": 1
}So a potential (untested) span filter would be: apm.addSpanFilter(span => {
if (span.type === 'db' && span.context?.service?.target?.type === 'redis') {
const addr = span.context.destination?.address;
if (addr) {
span.context.service.target.name = addr;
}
}
return span;
});Are you able to give that a try? |
|
If that does NOT work, it is possible that I am mistaken that the |
In fact you can see both of those fields having changed in the test failure output: So I think it would be good to have the addSpanFilter function also change the apm.addSpanFilter((span) => {
if (span.type === 'db' && span.context?.service?.target?.type === 'redis') {
const addr = span.context.destination?.address;
if (addr) {
span.context.service.target.name = addr;
const destRes = span.context.destination.service?.resource;
if (destRes) {
span.context.destination.service.resource = destRes + '/' + addr;
}
}
}
return span;
}); |
|
I just copy and paste the mongodb approach |
I may be misunderstanding you, but the mongodb instrumentation is using the MongoDB database name, not the server address/host, for the DB "instance" field. |
|
you are correct but for redis you usually have a single database per redis instance |
solves #4857
Checklist
docs/release-notes/index.md