Documentation navigation

GraphQL Examples

Here are some of the query examples to get you started. You the use the GraphQL explorer here to run these queries.

Fetch deployments

Query

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
query MarkersIndexQuery($appId: String!, $limit: Int, $offset: Int, $start: DateTime, $end: DateTime) {
  app(id: $appId) {
    id
    deployMarkers(limit: $limit, offset: $offset, start: $start, end: $end) {
      id
      createdAt
      shortRevision
      revision
      gitCompareUrl
      user
      liveForInWords
      liveFor
      exceptionCount
      exceptionRate
      __typename
    }
    __typename
  }
}

Query variables

1
2
3
4
{
  "appId": "YOUR-APP-ID",
  "limit": 25
}

Fetch incidents by deployments

Query

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
query ExceptionIncidentsQuery($appId: String!, $namespaces: [String], $markerId: String, $limit: Int, $offset: Int, $state: IncidentStateEnum, $order: IncidentOrderEnum) {
  app(id: $appId) {
    id
    exceptionIncidents(namespaces: $namespaces, marker: $markerId, limit: $limit, state: $state, offset: $offset, order: $order) {
      ...ExceptionIncidentRow
      __typename
    }
    __typename
  }
}

fragment ExceptionIncidentRow on ExceptionIncident {
  id
  number
  count
  perMarkerCount(marker: $markerId)
  lastOccurredAt
  actionNames
  exceptionName
  state
  namespace
  firstBacktraceLine
  errorGroupingStrategy
  severity
}

Query variables

1
2
3
4
5
{
  "appId": "YOUR-APP-ID",
  "markerId": "YOUR-DEPLOY-MARKER-ID",
  "limit": 200
}

Search incidents by tag

Query

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
uery Search(
    $organizationSlug: String!
    $query: String
    $namespace: String
    $sampleType: SampleTypeEnum
  ) {
    organization(slug: $organizationSlug) {
      search(
        query: $query
        namespace: $namespace
        sampleType: $sampleType
      ) {
        ... on ExceptionSample {
          id
          time
          action
          namespace
          overview {
            key
            value
          }
          exception {
            name
            message
          }
          incident {
            ... on ExceptionIncident {
              number
            }
          }
          app {
            name
            environment
            id
          }
        }
        ... on PerformanceSample {
          id
          appId
          time
          action
          namespace
          duration
          overview {
            key
            value
          }
          incident {
            ... on PerformanceIncident {
              number
            }
          }
          app {
            name
            environment
            id
          }
        }
      }
    }
  }

Query variables

1
2
3
4
5
{
  "organizationSlug":"APPLICATION-SLUG" // taken from the URL of the application,
  "sampleType":"EXCEPTION",
  "query": "tag:value" // replace the word value with the values you are searching for
}

Fetch error count

Query

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
query MetricsListQuery($appId: String!, $start: DateTime, $end: DateTime, $timeframe: TimeframeEnum, $query: [MetricAggregation!]!) {
    app(id: $appId) {
      id
      metrics {
        list(start: $start, end: $end, query: $query, timeframe: $timeframe) {
          start
          end
          rows {
            name
            tags {
              key
              value
            }
            fields {
              key
              value
            }
          }
        }
      }
    }
  }

Query variables

1
2
3
4
5
6
7
8
9
10
11
12
{
  "appId": "YOUR-APP-ID",
  "start": "2021-06-04T13:00:00.000Z", // change this to the date of your preference
  "end": "2021-12-21T14:00:00.000Z",   // change this to the date of your preference
  "query": [
    {
    "name": "transaction_exception_count",
    "tags": [{ "key": "namespace", "value": "*" }],
    "fields": [{ "field": "COUNTER", "aggregate": "SUM" }]
    }
  ]
}

Fetch Mean (timeseries)

Query

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
query MetricTimeseriesQuery($appId: String!, $start: DateTime, $end: DateTime, $timeframe: TimeframeEnum, $query: [MetricTimeseries]) {
  app(id: $appId) {
    id
    metrics {
      timeseries(start: $start, end: $end, timeframe: $timeframe, query: $query) {
        start
        end
        resolution
        keys {
          name
          fields
          tags {
            key
            value
          }
        }
        points {
          timestamp
          values {
            value
          }
        }
      }
    }
  }
}

Query variables

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
  "appId": "YOUR-APP-ID",
  "start": "2022-01-10T11:00:00Z", // Start data and time you want to fetch the Mean for
  "end": "2022-01-10T11:05:00Z",   // End data and time you want to fetch the Mean for
  "query": [
    {
      "name": "transaction_duration",
      "tags": [ // You can add more namespaces here, this example just fetches the Mean for web namespace.
        {
          "key": "namespace",
          "value": "web"
        }
      ],
      "fields": [
        {
          "field": "MEAN"
        }
      ]
    }
  ]
}

Fetch Mean (aggregated)

Query

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
query MetricAggregationQuery($appId: String!, $start: DateTime, $end: DateTime, $timeframe: TimeframeEnum, $query: [MetricAggregation!]!) {
  app(id: $appId) {
    id
    metrics {
      list(start: $start, end: $end, timeframe: $timeframe, query: $query) {
        start
        end
        rows {
          name
          tags {
            key
            value
          }
          fields {
            key
            value
          }
        }
      }
    }
  }
}

Query variables

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
  "appId": "YOUR-APP-ID",
  "start": "2022-01-10T11:00:00Z", // Start data and time you want to fetch the Mean for
  "end": "2022-01-10T11:05:00Z",   // End data and time you want to fetch the Mean for
  "query": [
    {
      "name": "transaction_duration",
      "tags": [ // You can add more namespaces here, this example just fetches the Mean for web namespace.
        {
          "key": "namespace",
          "value": "web"
        }
      ],
      "fields": [
        {"field":"mean","aggregate":"AVG"}
      ]
    }
  ]
}

We'd like to set cookies, read why.