[Questions Questions] Telegraf Aggregate

Hi everyone,

I have some data, collected from jira using telegraf prometheus plugin v2. Previous Topic Here

Example data:

ira_issue_update_count{projectKey="Project1",eventType="Issue Updated",username="user1",} 6.0
jira_issue_update_count{projectKey="Project1",eventType="Issue Updated",username="user2",} 5.0
jira_issue_update_count{projectKey="Project1",eventType="Generic Event",username="user3",} 5.0
jira_issue_update_count{projectKey="Project1",eventType="Generic Event",username="user4",} 15.0
jira_issue_update_count{projectKey="Project2",eventType="Issue Assigned",username="user5",} 1.0
jira_issue_update_count{projectKey="Project3",eventType="Issue Created",username="user0",} 1.0
jira_issue_update_count{projectKey="Project1",eventType="Generic Event",username="user6",} 3.0
jira_issue_update_count{projectKey="Project4",eventType="Issue Updated",username="user7",} 1.0
jira_issue_update_count{projectKey="Projet4",eventType="Issue Created",username="user8",} 3.0
jira_issue_update_count{projectKey="Project1",eventType="Generic Event",username="user9",} 3.0
jira_issue_update_count{projectKey="Project1",eventType="Generic Event",username="user10",} 6.0
jira_issue_update_count{projectKey="Project1",eventType="Issue Updated",username="user11",} 121.0

I collect this data everyone 10 seconds. I don’t need user_name, eventType and ProjectKey.
I want to know how many times an issue updated for a time interval.

This is the query I use in grafana:

SELECT non_negative_derivative(sum("jira_issue_update_count"), 10s) AS "Issue Update Count" FROM "atlas" WHERE $timeFilter GROUP BY time(10s) fill(previous)

I believe, by sum(“jira_issue_update_count”), it sums up all metric for given GROUP BY time which is 10s. By doing so, we simple ignore those tags username, eventtype, projectkey.

I want to group by time other than 10s but then the query above will sum all wider time range, thus results wrong (?).

Here are my the questions:

- Should group by time (x) and derivative(x) time be the same?
- How can I aggregate this data on telegraf. Drop those tags, then send only aggregated data to Influx?
- Should I use subqueries instead of aggregating on telegraf when you think about performance ?

I’ve used the above query as subquery:

SELECT mean("Issue Update Count") FROM (SELECT non_negative_derivative(sum("jira_issue_update_count"), 10s) AS "Issue Update Count" FROM "atlas" WHERE $timeFilter GROUP BY time(10s) fill(previous)) GROUP BY time($sampling_interval)

One more question, about grafana this time. (: Can I call query B inside query A instead of copy paste it?

Thansk for your patience (:,