-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Sqlserver Input Plugin Writing Tags That Should Be Fields #7525
Comments
What do you mean exactly with The above metrics are written as Tags by default? (all those are tag values, not tag keys) I agree with the fact that the cardinality and also the number of points will be lower if the tag "counter_name" gets pivoted and turned into a field, but the current structure does not prevent you from querying those points, it just takes more work to do so since you have to use a query that filters only one "counter_name" at a time (so you need multiple queries) or in other cases you need to include "counter_name" in the group by. Just to add some info, the "sqlserver_performance" measurement has the following structure.
Where the column "value" is the only field. The telegraf measurement has the same structure of the table returned by SQL Server. In order to obtain what is asked the pivot function can be used in the query itself but it can also be applied in telegraf using the pivot processor |
Depending on how you measure cardinality it is the same either way. You trade a unique tag value for a new field key. In the end there is the same number of series in the database. Normally we avoid this naming style though, it can be more expensive to transmit the data due to duplication of measurements+tags+timestamp, and it doesn't give you room to grow with additional fields. The field key should contain a descriptive name of the item, so this doesn't follow best practices in that respect. We would like to always use tags and fields consistently across plugins and this doesn't meet those criteria either. That said, this was discussed back in #3233 and there is rationale for allowing it in this case there. We can keep track of the issue in case we redesign this query in the future and would like to change the layout, but I don't think its worth the disruption to make modifications only for this reason. |
@Trovalo That's fair. What I thought I saw (unable to reproduce as I don't have access to a SQL server, myself) was that things (what I would consider a metric) like this, |
Expected behavior:
These metrics (names after
SQLServer:<Measurement\
) should be written as Fields:Actual behavior:
The above metrics are written as Tags by default.
Additional info:
The above metrics being written as Tags means a) extremely high cardinality with metrics like
Disk Write Bytes/sec
orUsed memory
(and many others) and b) no InfluxQL operations can be done on them.The text was updated successfully, but these errors were encountered: