Backend for ClusterCockpit Monitoring Framework. GitHub Mirror
Go to file
2021-04-14 18:53:18 +02:00
graph started implementing support for tags 2021-04-14 18:53:18 +02:00
utils Introduce new golang job-archive backend 2021-03-31 07:23:48 +02:00
.gitignore Serve job metric data via GraphQL 2021-04-07 09:19:21 +02:00
go.mod Fix path errors. Fix data schema. 2021-03-31 08:50:53 +02:00
go.sum Introduce new golang job-archive backend 2021-03-31 07:23:48 +02:00
gqlgen.yml started implementing support for tags 2021-04-14 18:53:18 +02:00
LICENSE Initial checkin. 2019-04-29 10:21:48 +02:00
README.md Serve job metric data via GraphQL 2021-04-07 09:19:21 +02:00
server.go remove JobData, add hasProfile, rename Job-Metrics-Query 2021-04-12 14:01:59 +02:00

Run server

  • The server expects the SQLite Job database in job.db.
  • The metric data as JSON is expected in job-data/.../.../{data.json|meta.json}
  • Run go run server.go
  • The GraphQL backend is located at http://localhost:8080/query/ .

Debugging and Testing

There is a GraphQL PLayground for testing queries at http://localhost:8080/ .

Example Query:

query($filter: JobFilterList!, $sorting: OrderByInput!, $paging: PageRequest!) {
  jobs(
    filter: $filter
    order: $sorting
    page: $paging
  ) {
    count
    items {
      id
      jobId
      userId
      startTime
      duration
    }
  }
}

Using the Query variables:

{
  "filter": { "list": [
    {"userId": {"contains": "unrz"}},
    {"duration": {"from": 60, "to": 1000}},
    {"startTime": {"from": "2019-06-01T00:00:00.00Z", "to": "2019-10-01T00:00:00.00Z"}}]},
  "sorting": { "field": "start_time", "order": "ASC" },
  "paging": { "itemsPerPage": 20, "page": 1 }
}

Changing the GraphQL schema

  • Edit ./graph/schema.graphqls
  • Regenerate code: gqlgen generate
  • Implement callbacks in graph/resolvers.go