Matias Godoy

    Matias Godoy

    1 year ago
    Hello everyone! Hope you are all ok. I am trying to use the GraphQL API to get some information about our flow_runs. Basically what I need is some information about every flow_run and how long they took to finish (or has taken since creation until now for the case of the ones still running). The thing is that I'm very new to GraphQL and I'm not sure what I want is doable. It should be something like this:
    query{
      flow_run{
        name,
        created,
        state,
        flow_id,
    	duration: <here goes the flow_run execution duration>
      }
    }
    Ideally I could do something like
    duration = end_time - start_time
    , but I think GraphQL does not allow operations like these? I also checked the
    flow_run_aggregate
    query, but it does not contain such information. The real problem is that I want to consume this data from Grafana, so I have nowhere to run these calculations and the data should come already calculated in the response. Any ideas on how could I do this? Thanks a lot!
    Bouke Krom

    Bouke Krom

    1 year ago
    Hmm tricky, I don't think you can make such computations in the graph query. Can you solve it by visualizing the difference between two metrics in Grafana maybe?
    Kevin Kho

    Kevin Kho

    1 year ago
    Hey @Matias Godoy, it’s right that GraphQL doesn’t support operations like this. On our end this is something we calculate when displaying the info in the UI. Not so familiar with Grafana, but does it query directly? or is it a Python script that pushes to Grafana?
    Matias Godoy

    Matias Godoy

    1 year ago
    Thanks for your replies! Yes, I'm using the official Grafana plugin that makes GraphQL queries directly:https://grafana.com/grafana/plugins/fifemon-graphql-datasource/
    So it's what I was afraid of. Thanks for clarifying 🙂 I'll se if I can solve it with @Bouke Krom s proposal, or maybe a lambda function that parses the data first.
    Thanks a lot!