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

High cardinality when using SqlRequests query due to statement_text tag #6678

Closed
danielnelson opened this issue Nov 19, 2019 · 5 comments · Fixed by #6852
Closed

High cardinality when using SqlRequests query due to statement_text tag #6678

danielnelson opened this issue Nov 19, 2019 · 5 comments · Fixed by #6852
Labels
area/sqlserver bug unexpected problem or unintended behavior

Comments

@danielnelson
Copy link
Contributor

danielnelson commented Nov 19, 2019

Relevant telegraf.conf:

[[inputs.sqlserver]]
  servers = ["..."]
  query_version = 2

System info:

Telegraf 1.12.5

Steps to reproduce:

  1. Run input plugin without excluding the SqlRequests query.
  2. Monitor cardinality

Expected behavior:

Smaller/finite number of series are created.

Actual behavior:

I believe a new series are created for each unique query due to the statement_text tag, depending on the query pattern, this can grow quite rapidly.

Additional info:

Small selection of example output: input-filter.txt

Community Post

@danielnelson danielnelson added bug unexpected problem or unintended behavior area/sqlserver labels Nov 19, 2019
@danielnelson
Copy link
Contributor Author

@denzilribeiro @m82labs This is a pretty large issue for this query I think, can you verify if this query works as I'm understanding: that a new tag value is created for each unique query.

@denzilribeiro
Copy link
Contributor

Are all strings by default a tag? Yes statements could be unique and there could be a lot of them. But without the statement this whole SqlRequests collector is in a way useless

@danielnelson
Copy link
Contributor Author

Right now this plugin does add all strings as tags but that could be changed. I notice that the query_hash is a field, I assume it is being converted to a []byte in the sql driver.

If the goal is to track specific queries over time, I think there is no way around the query having the cardinality of the number of unique queries that are run. This is similar to issues we have in container monitoring where each time the container runs it is identified by a UUID.

This may or may not be an issue, depending on your workload and your retention policy. I think that the fix for this is better documentation on how to use the query and manage the database cardinality.

@sawo1337
Copy link

sawo1337 commented Feb 4, 2020

I believe statement_text should have the option to be a field, rather than a tag. Depending on use cases, you may want to monitor for slow queries, for example, you don't need the statement to be a tag there.

@danielnelson
Copy link
Contributor Author

I can see one possibly wanting it either way, I'm not entirely sure we should make this switch. I think for now the best course is to use the converter processor to switch it to a string field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/sqlserver bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants