-
Notifications
You must be signed in to change notification settings - Fork 701
Metrics instrumentation redis #1148
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
Comments
Hi @srikanthccv ! I'd like to contribute to the project, however i might need some help. May I take on this problem? |
Ask any question here you need help with. |
Hi @srikanthccv ! I do have a couple of questions regarding this problem. I hope they aren't too obvious. I'm taking as reference MR:1110 on the requests library to get some guidance.
On the example on the requests library, I see we're testing against this:
linking it back to the specification, would the metrics required need to be something like this?
Refering back again to the Requests library instrumentation tests, I see that we're testing against what seems to be the default provider:
|
|
Thanks a lot for taking the time @srikanthccv, I have an idea but let me know if this is heading the correct direction: I'm thinking for the first value that's required in the semconv for DB "db.client.connections.usage" to wrap a "CLIENT LIST" query to Redis, since we can't infer the rest of the data directly from simply doing a get or set operation, as opposed to the requests.get() for example. For more clarity, on the requests library, we're asserting the following attributes:
all of those could get inferred (or most of them) by parsing the URL that we're consuming, in this case http://examplehost:8000/status/200 As opposed to that, Redis will create a connection pool, and only when we send command will the Redis client actually retrieve a connection from the connection pool, so we can't simply derive that value - I think. The CLIENT LIST operation returns information and statistics about the client connections:
Now... the reason I'm not sure if this is the correct path forward, is because we would need to make that extra call, do you think that this is correct? |
Does it include all client connections or just this client? Even if it's just the client at hand, I don't think we should make a call to server and parse the data. I haven't really looked at the redis library but from the quick search there is definitely some information we can get from connection pool class https://redis-py.readthedocs.io/en/stable/connections.html#connectionpool. You might want to dig into the lib and see what all can be derived. |
Oh awesome ! That's great. Thanks again for taking the time :). I'll review this docs and come back with more questions. |
By the way @srikanthccv, forgot to mention but the client_list will include all the connections made from a given connection pool, for example:
I think this one is more accurate though:
|
So summarizing, for the ConnectionPool class we can get the following attributes:
And for each of those Connections we can get the following attributes:
I believe this way we can get the first value db.client.connections.usage, but not sure if we can get the db.client.connections.usage.state 🤔. |
@dbgoytia let's aim for what can be achieved with the present information. We do not have provide all the attributes mentioned in sem conv except the required attributes. |
Hey @srikanthccv, I'd like to get an early review on the feature to see if I'm heading the right direction: #1194 I do have a coulpe of questions around it though:
An there is one thing, it might sound a bit strange, but on the multiple-connection test, the UpDownCounter is not actually "writing" the correct value, maybe I'm using it wrong! I wrote under a log to see how many connections are available and I can see that the _created_connections is holding the right value:
However, I'm not sure why, but the data_point is actually only showing '1':
Maybe it's my lack of knowledge with the SDK! Can you give me some guidance here? Oh and by the way, the tests are not mocked correctly, just yet, I'm testing locally to see if I'm heading the right direction. |
@srikanthccv pls assign this one to me, i will start soon! |
DB semconv https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/database-metrics.md
The text was updated successfully, but these errors were encountered: