Skip to content

make appropriate changes into graphQL service to support iso duration in avg_rate function #314

@kotharironak

Description

@kotharironak

Existing graphql Query:

{
  entities(
    scope: "BACKEND"
    limit: 1
    between: {startTime: "2021-09-28T06:21:19.729Z", endTime: "2021-09-28T07:21:19.729Z"}
    filterBy: [{operator: EQUALS, value: "27857c9c-f6fa-30fe-ac1d-48fd07374775", type: ID, idType: BACKEND}]
    includeInactive: true
  ) {
    results {
      id
      errorCount: metric(key: "errorCount") {
        avgrate_sec: avgrate(units: SECONDS, size: 1) {
          value
          __typename
        }
      }
    }
    __typename
  }
}

Current translation to gateway service:

entity_type: "BACKEND"
start_time_millis: 1632810079729
end_time_millis: 1632813679729
filter {
  operator: AND
  childFilter {
    lhs {
      columnIdentifier {
        columnName: "BACKEND.id"
      }
    }
    operator: EQ
    rhs {
      literal {
        value {
          valueType: STRING
          string: "27857c9c-f6fa-30fe-ac1d-48fd07374775"
        }
      }
    }
  }
}
selection {
  columnIdentifier {
    columnName: "BACKEND.id"
    alias: "BACKEND.id"
  }
}
selection {
  function {
    function: AVGRATE
    arguments {
      columnIdentifier {
        columnName: "BACKEND.errorCount"
      }
    }
    arguments {
      literal {
        value {
          valueType: "LONG"
          long: 1
        }
      }
    }
    alias: "AVGRATE_BACKEND.errorCount_[1]"
  }
}
incoming_interactions {
}
outgoing_interactions {
}
limit: 1
include_non_live_entities: true

Support iso duration translation:

entity_type: "BACKEND"
start_time_millis: 1632810079729
end_time_millis: 1632813679729
filter {
  operator: AND
  childFilter {
    lhs {
      columnIdentifier {
        columnName: "BACKEND.id"
      }
    }
    operator: EQ
    rhs {
      literal {
        value {
          valueType: STRING
          string: "27857c9c-f6fa-30fe-ac1d-48fd07374775"
        }
      }
    }
  }
}
selection {
  columnIdentifier {
    columnName: "BACKEND.id"
    alias: "BACKEND.id"
  }
}
selection {
  function {
    function: AVGRATE
    arguments {
      columnIdentifier {
        columnName: "BACKEND.errorCount"
      }
    }
    arguments {
      literal {
        value {
          valueType: "STRING"
          string: "PT1S"
        }
      }
    }
    alias: "AVGRATE_BACKEND.errorCount_[1]"
  }
}
incoming_interactions {
}
outgoing_interactions {
}
limit: 1
include_non_live_entities: true

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions