Die GraphQL-API gibt keine Traces zurück. Sie verwaltet Modelle wie Apps, Incidents, Dashboards und Alerts. Traces lesen Sie über die
REST-API (V2), zum Beispiel Traces auflisten.Das Lesen von Metriken und Logs über die GraphQL-API ist veraltet. Verwenden Sie stattdessen Metriken und Logsuche in der REST-API (V2). Die GraphQL-API kann keine Log-Zeilen durchsuchen. Die Metrik-Beispiele auf
dieser Seite bleiben für bestehende Integrationen erhalten.
Deployments abrufen
Query
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-Variablen
{
"appId": "YOUR-APP-ID",
"limit": 25
}
Incidents für ein Deploy abrufen
Query
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-Variablen
{
"appId": "YOUR-APP-ID",
"markerId": "YOUR-DEPLOY-MARKER-ID",
"limit": 200
}
Fehleranzahl abrufen
Dieses Beispiel verwendet die veraltete GraphQL-Metrik-API. Für neue
Integrationen verwenden Sie stattdessen den REST-Endpunkt Metrikliste.
Query
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-Variablen
{
"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": "error_count",
"tags": [{ "key": "namespace", "value": "*" }],
"fields": [{ "field": "COUNTER", "aggregate": "SUM" }]
}
]
}
Mittelwert abrufen (Zeitreihe)
Dieses Beispiel verwendet die veraltete GraphQL-Metrik-API. Für neue
Integrationen verwenden Sie stattdessen den REST-Endpunkt Metrik-Zeitreihe.
Query
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-Variablen
{
"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": "trace_duration",
"tags": [ // You can add more namespaces here, this example just fetches the Mean for web namespace.
{
"key": "namespace",
"value": "web"
}
],
"fields": [
{
"field": "MEAN"
}
]
}
]
}
Mittelwert abrufen (aggregiert)
Dieses Beispiel verwendet die veraltete GraphQL-Metrik-API. Für neue
Integrationen verwenden Sie stattdessen den REST-Endpunkt Metrikliste.
Query
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-Variablen
{
"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": "trace_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"}
]
}
]
}
Incident abrufen
Query
query IncidentQuery($appId: String!, $incidentNumber: Int!) {
app(id: $appId) {
id
incident(incidentNumber: $incidentNumber) {
... on ExceptionIncident {
...ExceptionIncident
}
... on PerformanceIncident {
...PerformanceIncident
}
}
}
}
fragment ExceptionIncident on ExceptionIncident {
id
number
lastOccurredAt
actionNames
exceptionName
notificationFrequency
state
namespace
firstBacktraceLine
errorGroupingStrategy
}
fragment PerformanceIncident on PerformanceIncident {
id
number
lastOccurredAt
actionNames
state
notificationFrequency
notificationThreshold
namespace
description
severity
__typename
}
Query-Variablen
{
"appId": "YOUR-APP-ID",
"incidentNumber": 42
}
Uptime-Monitore und ihre Alerts abrufen
Query
query uptimeMonitorsQuery($appId: String!) {
app(id: $appId) {
id
uptimeMonitors {
...UptimeMonitor
}
}
}
fragment UptimeMonitor on UptimeMonitor {
id
name
url
description
notifierIds
warmupDuration
checkBodyContent
regions
headers {
key
value
}
alerts {
...Alert
}
statusPages {
...StatusPage
}
}
fragment Alert on Alert {
id
state
message
metricDigest
createdAt
openedAt
resolvedAt
closedAt
timeframeStartAt
timeframeEndAt
lastValue
peakValue
mean
tags {
key
value
}
}
fragment StatusPage on StatusPage {
id
title
subdomain
hostname
description
threshold
uptimeMonitorIds
}
Query-Variablen
{
"appId": "YOUR-APP-ID"
}
Status von Uptime-Monitoren abrufen
Die veraltete GraphQL-Metrik-API gibt keine Uptime monitoring-Metriken aus dem aktuellen Metrikspeicher zurück. Verwenden Sie den V2-Endpunkt für die Metrik-Zeitreihe, um diese Daten abzurufen.
Query
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 {
digest
name
fields
tags {
key
value
}
}
points {
timestamp
values {
key
value
}
}
}
}
}
}
Query-Variablen
{
"appId": "YOUR-APP-ID",
"timeframe": "R1H", // for example: R1H, R4H, R8H, R12H, R24H, R48H, R7D, or R30D
"query": [
{
"name": "uptime_monitor_error_count",
"tags": [
{
"key": "name",
"value": "NAME-OF-UPTIME-MONITOR"
},
{
"key": "region",
"value": "*" // You can filter this to a specific region.
}
],
"fields": [
{
"field": "COUNTER"
}
]
}
]
}