https://prefect.io logo
m

Marwan Sarieddine

02/11/2021, 11:58 PM
Hi folks, I am trying to construct a graphql query to aggregate the total number of successful task runs that we had in the past month but I am noticing that it is not so trivial to form the query so I was wondering if someone else might have already done so and is willing to share the query they used. I imagine given the intended update in prefect’s pricing that others will also want to run similar queries (in case these analytics aren’t shown somewhere on the prefect cloud UI) to track their usage.
one thing I figured is an overall aggregate
Copy code
query{
 task_run_aggregate{
  aggregate{
    count
  }
}
    
}
c

Chris White

02/12/2021, 1:30 AM
Hey Marwan - this is an interesting topic; as a public API, we have some fairly standard limits on users’ query usage, including limits on depth, size, duration, etc. of a given query. In my experience, most (if not all) aggregate queries using the user-facing GraphQL API against the task run / task run state routes will violate one of those limits. That being said, we will definitely be exposing usage trackers in the UI for billing purposes and we definitely recognize the need for more custom analytics, so we’re working on some new analytics features for this purpose -- stay tuned!
m

Marwan Sarieddine

02/12/2021, 1:37 AM
I see - thanks for elaborating on this. Usage trackers on the UI would definitely be helpful, but it is also nice/helpful to be able to programmatically pull some analytics for past and current usage ..
c

Chris White

02/12/2021, 1:43 AM
Yea definitely agree — just curious, what sorts of analytics questions would you like to answer? I can keep that in mind as we design the feature
m

Marwan Sarieddine

02/12/2021, 1:47 AM
I guess my most basic use case is to see how many task runs we had for a particular project over a certain amount of time, so I could extrapolate what our total usage would be and estimate costs accordingly
c

Chris White

02/12/2021, 1:50 AM
makes sense, noted
m

Marwan Sarieddine

02/12/2021, 1:50 AM
(thanks)
👍 1
2 Views