-
Notifications
You must be signed in to change notification settings - Fork 896
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
Add semantic conventions for redis receiver #2145
Conversation
<!-- semconv redis --> | ||
| Attribute | Type | Description | Examples | Required | | ||
|---|---|---|---|---| | ||
| `redis.instance` | string | Reported name of the redis instance | `localhost:6379` | No | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @manang-splunk! Could you please elaborate on how this attribute would be used?
As this is a resource attribute, it would have to be populated by the Redis instance itself, i.e., an OpenTelemetry instrumentation built into Redis server directly. If this is your intention, please clarify it accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redis.instance
attribute would be used as a resource attribute whose value is configurable by user. This attribute was missing from redis metrics so we added it as resource attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arminru Please share your thoughts on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@manang-splunk With Redis metrics you are referring to @codeboten's open PR #2070 and this collector plugin, right?
https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/redisreceiver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reference @manang-splunk, now it makes more sense to me!
I wonder if the service.name
and service.instance.id
resource attributes defined here and suggested by @bogdandrutu on your PR would be sufficient or not, have you looked into these? They would be used to describe a "logical" name for the service and are expected to be provided by users.
If the value is supposed to describe the host on which the Redis instance is running like you indicate in your example, the host.name
attribute defined here could be suitable but having the port in there might be unexpected, even if the definition says "or another name specified by the user".
@bogdandrutu WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @arminru ,
CC: @bogdandrutu
The current task is to add a resource attribute in the Redis Receiver similar to what is existing in the SignalFx agent Collectd/Redis monitor.
The SignalFx agent Collectd/Redis monitor has a plugin_instance attribute which expects a value in the format of {host}:{port}
or a normal string. This helps to label the metrics with user-configured values. Similar functionality does not exist today in the Redis receiver and needs to be implemented as a part of the current task.
To implement this functionality, we have the below two possibilities :
-
Option 1 - We can leverage existing resource attributes in the Redis receiver such that it can accommodate the value of both the formats
{host}:{port}
or a normal string based on the above requirements. We have three attributes, service.name, service.instance.id and host.name but if{host}:{port}
format of value gets populated within these existing attributes, then it would seem unexpected as the data format{host}:{port}
is more like an endpoint type of data rather than service-name-related, service-instance-id-related or only host-name-related data. Hence, this option is not suggested. -
Option 2 - We can introduce a new resource attribute called
redis.instance
which can accommodate both these formats{host}:{port}
or a normal string. Hence, this option is suggested and this logical workflow is implemented as a part of this task.
Please let us know your inputs or queries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation.
I looked at service.instance.id
again and agree that it is not really suitable as it is intended to distinguish multiple instances of the same service, so this would only be applicable for Redis cluster nodes.
Having just the form host:port
for service.name
is not ideal indeed as this does not correspond well with the definition of a logical service name. If we'd add redis.instance
, which service.name
would the Redis receiver set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm open for adding redis.instance
if we don't see a good fit with the existing attributes but would like to get more opinions from the other @open-telemetry/specs-approvers. This would be the first technology/framework-specific resource attribute to be added and I wonder if we were already able to cover similar cases with the existing, generic attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The usage of service.name
attribute is user specific. Based on the observed data of the Redis server, there is no service-name-related data and as per our usecase host:port
doesn't fit with service.name
. Hence, we are not setting the service.name
attribute. I have attached the sample data we observed from the Redis server (data.txt).
<!-- semconv redis --> | ||
| Attribute | Type | Description | Examples | Required | | ||
|---|---|---|---|---| | ||
| `redis.instance` | string | Reported name of the redis instance | `localhost:6379` | No | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation.
I looked at service.instance.id
again and agree that it is not really suitable as it is intended to distinguish multiple instances of the same service, so this would only be applicable for Redis cluster nodes.
Having just the form host:port
for service.name
is not ideal indeed as this does not correspond well with the definition of a logical service name. If we'd add redis.instance
, which service.name
would the Redis receiver set?
- id: instance | ||
type: string | ||
brief: > | ||
Reported name of the redis instance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reported name of the redis instance | |
Reported name of the Redis instance. This can be in the form `{host}:{port}` or any other name provided manually when setting up the instrumentation. |
Not yet happy with my suggestion but this lacks clarification. I'm open for better suggestions :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, added an appropriate description.
We have conventions for databases: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/database.md which uses prefix Side note: I am not sure it is a good idea to have |
Hello @tigrannajaryan, Please let us know your thoughts. |
I do not see any reason to limit This raises a good question though: how do we define semantic conventions for attributes that may be recorded both at the Resource level and at the Span or Metric level? I don't think Otel spec has a good answer for this and we have an open issue about that #1367 To make progress on this I suggest the following. Change this PR to use |
We tried to add
Is there something that we are missing from our end? |
@manang-splunk I am not sure what the problem is, perhaps the semantic convention generator has limitations that prevent having the same namespace for resources and traces. This may require fixing the generator first. @open-telemetry/build-tools-approvers any thoughts? |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
@manang-splunk can you create an issue describing the limitation of the semantic convention generator tool, along with a proposal of how to fix it (if you have one)? |
7fd7a95
to
0ad251c
Compare
@tigrannajaryan As we were setting group id as “db.redis” and it was already used at trace level we were getting error that “db.redis” is already there. So we used different group id as “redis” for this. Now we are able to add the “db.redis.instance” as a resource semantic convention. We have pushed the changes accordingly can you please review it? As it is a type of database, we have created a folder “db” (semantic_conventions/resource/db) and kept conventions of Redis under that. Any other database conventions can be added under that in future. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The namespace and the name of the new attribute look good to me.
I do not know much of Redis to tell if the attribute value is what we want to record. I would like others to chime in too.
@open-telemetry/specs-approvers @open-telemetry/instr-wg please review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with the Redis receiver but I went through the PRs and I think this makes sense. Just some editorial suggestions and a question about the structure of the convention.
@@ -0,0 +1,14 @@ | |||
groups: | |||
- id: redis | |||
prefix: db.redis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I quickly searched and I didn't find another convention where the id
is at a "different level" than the prefix
. I'm not sure if this is a problem though, just something that stand up for me.
I guess you will also get a conflict if you have a structure like this: id: db > id: db.redis > attributes > id: instance
? Similar to this
- id: db.mssql |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was getting conflicts while using id as db
and db.redis
.
As we already have db
and db.redis
as id value in database attributes, we cannot use the same here. Therefore we have kept id as redis
.
- id: instance | ||
type: string | ||
brief: > | ||
Reported name of the Redis instance. This can be in the form |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reported name of the Redis instance. This can be in the form | |
The reported name of the Redis instance. This can be in the form of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed the changes accordingly.
brief: > | ||
Reported name of the Redis instance. This can be in the form | ||
`{host}:{port}` or any other name provided manually while configuring | ||
the instrumentation and defaults to the `endpoint` value provided in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the sentence is a bit too long and hard to follow. A suggestion would be maybe ending the sentence in the instrumentation.
and starting a new one with. The default value is the endpoint...
or When not provided, the default value is...
. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed the changes accordingly.
@@ -0,0 +1,13 @@ | |||
# Redis | |||
|
|||
**Status**: [Experimental](../../document-status.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link is missing one more level I think (that's why the docfx check is failing)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed the changes accordingly.
Sorry for the back and forth, but I'm not sure the current solution (due to the conflict in the namespace) is the best. As @tigrannajaryan mentioned, we might need to change the build-tool or how we invoke it. I tried something quickly and I managed to call the id: db.redis
prefix: db.redis
... Then running the # Generate markdown tables from YAML definitions
.PHONY: table-generation
table-generation:
docker run --rm -v $(PWD)/semantic_conventions/resource:/source -v $(PWD)/specification/resource:/spec \
otel/semconvgen:$(SEMCONVGEN_VERSION) -f /source markdown -md /spec This will generate the table on I'm not sure if this is a feasible solution though. Maybe @Oberon00 can chime in and share what he thinks about it. Maybe we will really need to change the generator. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Changes
Added new resource attribute
redis.instance
for redis receiver.