diff --git a/common/graphql/introspection.json b/common/graphql/introspection.json new file mode 100644 index 0000000000000..3ebb95e26da8d --- /dev/null +++ b/common/graphql/introspection.json @@ -0,0 +1,2650 @@ +{ + "__schema": { + "queryType": { "name": "Query" }, + "mutationType": null, + "subscriptionType": null, + "types": [ + { + "kind": "OBJECT", + "name": "Query", + "description": "", + "fields": [ + { + "name": "allPings", + "description": "Get a list of all recorded pings for all monitors", + "args": [ + { + "name": "sort", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "size", + "description": "", + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "defaultValue": null + }, + { + "name": "monitorId", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "status", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "dateRangeStart", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "dateRangeEnd", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "Ping", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "getDocCount", + "description": "Gets the number of documents in the target index", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "DocCount", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "getMonitors", + "description": "", + "args": [ + { + "name": "dateRangeStart", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "dateRangeEnd", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "filters", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + } + ], + "type": { "kind": "OBJECT", "name": "LatestMonitorsResult", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "getSnapshot", + "description": "", + "args": [ + { + "name": "dateRangeStart", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "dateRangeEnd", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "downCount", + "description": "", + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "defaultValue": null + }, + { + "name": "windowSize", + "description": "", + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "defaultValue": null + }, + { + "name": "filters", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + } + ], + "type": { "kind": "OBJECT", "name": "Snapshot", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "getMonitorChartsData", + "description": "", + "args": [ + { + "name": "monitorId", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "dateRangeStart", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "dateRangeEnd", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "OBJECT", "name": "MonitorChartEntry", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "getLatestMonitors", + "description": "", + "args": [ + { + "name": "dateRangeStart", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "dateRangeEnd", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "monitorId", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "Ping", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "getFilterBar", + "description": "", + "args": [ + { + "name": "dateRangeStart", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "dateRangeEnd", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + } + ], + "type": { "kind": "OBJECT", "name": "FilterBar", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "getErrorsList", + "description": "", + "args": [ + { + "name": "dateRangeStart", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "dateRangeEnd", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "filters", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "OBJECT", "name": "ErrorListItem", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "String", + "description": "The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "Int", + "description": "The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1. ", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "UnsignedInteger", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Ping", + "description": "A request sent from a monitor to a host", + "fields": [ + { + "name": "timestamp", + "description": "The timestamp of the ping's creation", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "beat", + "description": "The agent that recorded the ping", + "args": [], + "type": { "kind": "OBJECT", "name": "Beat", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "docker", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Docker", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "error", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Error", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "host", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Host", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "http", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "HTTP", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "icmp", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "ICMP", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "kubernetes", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Kubernetes", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "meta", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Meta", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "monitor", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Monitor", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resolve", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Resolve", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "socks5", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Socks5", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "tags", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "tcp", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "TCP", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "tls", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "TLS", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Beat", + "description": "An agent for recording a beat", + "fields": [ + { + "name": "hostname", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timezone", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Docker", + "description": "", + "fields": [ + { + "name": "id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "image", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Error", + "description": "", + "fields": [ + { + "name": "code", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "message", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Host", + "description": "", + "fields": [ + { + "name": "architecture", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ip", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mac", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "os", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "OS", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "OS", + "description": "", + "fields": [ + { + "name": "family", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "kernel", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "platform", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "version", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "HTTP", + "description": "", + "fields": [ + { + "name": "response", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "StatusCode", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "rtt", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "HttpRTT", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "StatusCode", + "description": "", + "fields": [ + { + "name": "status_code", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "HttpRTT", + "description": "", + "fields": [ + { + "name": "content", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Duration", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "response_header", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Duration", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "total", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Duration", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "validate", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Duration", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "validate_body", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Duration", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "write_request", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Duration", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Duration", + "description": "The monitor's status for a ping", + "fields": [ + { + "name": "us", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ICMP", + "description": "", + "fields": [ + { + "name": "requests", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "rtt", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Kubernetes", + "description": "", + "fields": [ + { + "name": "container", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "KubernetesContainer", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "namespace", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "KubernetesNode", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pod", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "KubernetesPod", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "KubernetesContainer", + "description": "", + "fields": [ + { + "name": "image", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "KubernetesNode", + "description": "", + "fields": [ + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "KubernetesPod", + "description": "", + "fields": [ + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uid", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Meta", + "description": "", + "fields": [ + { + "name": "cloud", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "MetaCloud", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MetaCloud", + "description": "", + "fields": [ + { + "name": "availability_zone", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "instance_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "instance_name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "machine_type", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "project_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "provider", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "region", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Monitor", + "description": "", + "fields": [ + { + "name": "duration", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Duration", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "host", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": "The id of the monitor", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ip", + "description": "The IP pinged by the monitor", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The name of the protocol being monitored", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "scheme", + "description": "The protocol scheme of the monitored host", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "status", + "description": "The status of the monitored host", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": "The type of host being monitored", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Resolve", + "description": "", + "fields": [ + { + "name": "host", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ip", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "rtt", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Duration", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Socks5", + "description": "", + "fields": [ + { + "name": "rtt", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "RTT", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RTT", + "description": "", + "fields": [ + { + "name": "connect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Duration", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "handshake", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Duration", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "validate", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Duration", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TCP", + "description": "", + "fields": [ + { + "name": "port", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "rtt", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "RTT", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TLS", + "description": "", + "fields": [ + { + "name": "certificate_not_valid_after", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "certificate_not_valid_before", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "certificates", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "rtt", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "RTT", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DocCount", + "description": "", + "fields": [ + { + "name": "count", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "LatestMonitorsResult", + "description": "", + "fields": [ + { + "name": "monitors", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "OBJECT", "name": "LatestMonitor", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "LatestMonitor", + "description": "", + "fields": [ + { + "name": "key", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "MonitorKey", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ping", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Ping", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "upSeries", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "OBJECT", "name": "MonitorSeriesPoint", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "downSeries", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "OBJECT", "name": "MonitorSeriesPoint", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MonitorKey", + "description": "", + "fields": [ + { + "name": "id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "port", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MonitorSeriesPoint", + "description": "", + "fields": [ + { + "name": "x", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "y", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Snapshot", + "description": "", + "fields": [ + { + "name": "up", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "down", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "trouble", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "total", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "histogram", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "OBJECT", "name": "HistogramSeries", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "HistogramSeries", + "description": "", + "fields": [ + { + "name": "monitorId", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "data", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "OBJECT", "name": "HistogramDataPoint", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "HistogramDataPoint", + "description": "", + "fields": [ + { + "name": "upCount", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "downCount", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "x", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "x0", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "y", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MonitorChartEntry", + "description": "", + "fields": [ + { + "name": "maxContent", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "DataPoint", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "maxResponse", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "DataPoint", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "maxValidate", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "DataPoint", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "maxTotal", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "DataPoint", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "maxWriteRequest", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "DataPoint", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "maxTcpRtt", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "DataPoint", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "maxDuration", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "DataPoint", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "minDuration", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "DataPoint", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "avgDuration", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "DataPoint", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "status", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "StatusData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DataPoint", + "description": "", + "fields": [ + { + "name": "x", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "y", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "Float", + "description": "The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point). ", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "StatusData", + "description": "", + "fields": [ + { + "name": "x", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "up", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "down", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "total", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "FilterBar", + "description": "", + "fields": [ + { + "name": "id", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "port", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Int", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "scheme", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "status", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ErrorListItem", + "description": "", + "fields": [ + { + "name": "latestMessage", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "monitorId", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "count", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "statusCode", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timestamp", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Schema", + "description": "A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.", + "fields": [ + { + "name": "types", + "description": "A list of all types supported by this server.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "queryType", + "description": "The type that query operations will be rooted at.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mutationType", + "description": "If this server supports mutation, the type that mutation operations will be rooted at.", + "args": [], + "type": { "kind": "OBJECT", "name": "__Type", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscriptionType", + "description": "If this server support subscription, the type that subscription operations will be rooted at.", + "args": [], + "type": { "kind": "OBJECT", "name": "__Type", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "directives", + "description": "A list of all directives supported by this server.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Directive", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Type", + "description": "The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name and description, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.", + "fields": [ + { + "name": "kind", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "__TypeKind", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fields", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "defaultValue": "false" + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Field", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "interfaces", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "possibleTypes", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "enumValues", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "defaultValue": "false" + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__EnumValue", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inputFields", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__InputValue", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ofType", + "description": null, + "args": [], + "type": { "kind": "OBJECT", "name": "__Type", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "__TypeKind", + "description": "An enum describing what kind of type a given `__Type` is.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "SCALAR", + "description": "Indicates this type is a scalar.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OBJECT", + "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INTERFACE", + "description": "Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNION", + "description": "Indicates this type is a union. `possibleTypes` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM", + "description": "Indicates this type is an enum. `enumValues` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_OBJECT", + "description": "Indicates this type is an input object. `inputFields` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LIST", + "description": "Indicates this type is a list. `ofType` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NON_NULL", + "description": "Indicates this type is a non-null. `ofType` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "Boolean", + "description": "The `Boolean` scalar type represents `true` or `false`.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Field", + "description": "Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "args", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__InputValue", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDeprecated", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deprecationReason", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__InputValue", + "description": "Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "defaultValue", + "description": "A GraphQL-formatted string representing the default value for this input value.", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__EnumValue", + "description": "One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDeprecated", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deprecationReason", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Directive", + "description": "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "locations", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "__DirectiveLocation", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "args", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__InputValue", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "onOperation", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "isDeprecated": true, + "deprecationReason": "Use `locations`." + }, + { + "name": "onFragment", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "isDeprecated": true, + "deprecationReason": "Use `locations`." + }, + { + "name": "onField", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "isDeprecated": true, + "deprecationReason": "Use `locations`." + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "__DirectiveLocation", + "description": "A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "QUERY", + "description": "Location adjacent to a query operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MUTATION", + "description": "Location adjacent to a mutation operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SUBSCRIPTION", + "description": "Location adjacent to a subscription operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FIELD", + "description": "Location adjacent to a field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FRAGMENT_DEFINITION", + "description": "Location adjacent to a fragment definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FRAGMENT_SPREAD", + "description": "Location adjacent to a fragment spread.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INLINE_FRAGMENT", + "description": "Location adjacent to an inline fragment.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SCHEMA", + "description": "Location adjacent to a schema definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SCALAR", + "description": "Location adjacent to a scalar definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OBJECT", + "description": "Location adjacent to an object type definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FIELD_DEFINITION", + "description": "Location adjacent to a field definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ARGUMENT_DEFINITION", + "description": "Location adjacent to an argument definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INTERFACE", + "description": "Location adjacent to an interface definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNION", + "description": "Location adjacent to a union definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM", + "description": "Location adjacent to an enum definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM_VALUE", + "description": "Location adjacent to an enum value definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_OBJECT", + "description": "Location adjacent to an input object type definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_FIELD_DEFINITION", + "description": "Location adjacent to an input object field definition.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + } + ], + "directives": [ + { + "name": "skip", + "description": "Directs the executor to skip this field or fragment when the `if` argument is true.", + "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], + "args": [ + { + "name": "if", + "description": "Skipped when true.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "defaultValue": null + } + ] + }, + { + "name": "include", + "description": "Directs the executor to include this field or fragment only when the `if` argument is true.", + "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], + "args": [ + { + "name": "if", + "description": "Included when true.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "defaultValue": null + } + ] + }, + { + "name": "deprecated", + "description": "Marks an element of a GraphQL schema as no longer supported.", + "locations": ["FIELD_DEFINITION", "ENUM_VALUE"], + "args": [ + { + "name": "reason", + "description": "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted in [Markdown](https://daringfireball.net/projects/markdown/).", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": "\"No longer supported\"" + } + ] + } + ] + } +} diff --git a/x-pack/plugins/uptime/common/domain_types/monitors.ts b/x-pack/plugins/uptime/common/domain_types/monitors.ts index 51fb4f72cd5d0..7f5699eb7e8a4 100644 --- a/x-pack/plugins/uptime/common/domain_types/monitors.ts +++ b/x-pack/plugins/uptime/common/domain_types/monitors.ts @@ -5,6 +5,6 @@ */ export interface UMGqlRange { - dateRangeStart: number; - dateRangeEnd: number; + dateRangeStart: string; + dateRangeEnd: string; } diff --git a/x-pack/plugins/uptime/common/graphql/introspection.json b/x-pack/plugins/uptime/common/graphql/introspection.json index d17a16e9d8068..5ed6e8bf14a91 100644 --- a/x-pack/plugins/uptime/common/graphql/introspection.json +++ b/x-pack/plugins/uptime/common/graphql/introspection.json @@ -43,7 +43,7 @@ "type": { "kind": "NON_NULL", "name": null, - "ofType": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null } + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } }, "defaultValue": null }, @@ -53,7 +53,7 @@ "type": { "kind": "NON_NULL", "name": null, - "ofType": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null } + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } }, "defaultValue": null } @@ -88,7 +88,7 @@ "type": { "kind": "NON_NULL", "name": null, - "ofType": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null } + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } }, "defaultValue": null }, @@ -98,7 +98,7 @@ "type": { "kind": "NON_NULL", "name": null, - "ofType": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null } + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } }, "defaultValue": null }, @@ -120,25 +120,41 @@ { "name": "dateRangeStart", "description": "", - "type": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null }, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, "defaultValue": null }, { "name": "dateRangeEnd", "description": "", - "type": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null }, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, "defaultValue": null }, { "name": "downCount", "description": "", - "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Int", "ofType": null } + }, "defaultValue": null }, { "name": "windowSize", "description": "", - "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Int", "ofType": null } + }, "defaultValue": null }, { @@ -159,19 +175,31 @@ { "name": "monitorId", "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, "defaultValue": null }, { "name": "dateRangeStart", "description": "", - "type": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null }, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, "defaultValue": null }, { "name": "dateRangeEnd", "description": "", - "type": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null }, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, "defaultValue": null } ], @@ -193,7 +221,7 @@ "type": { "kind": "NON_NULL", "name": null, - "ofType": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null } + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } }, "defaultValue": null }, @@ -203,7 +231,7 @@ "type": { "kind": "NON_NULL", "name": null, - "ofType": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null } + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } }, "defaultValue": null }, @@ -240,7 +268,7 @@ "type": { "kind": "NON_NULL", "name": null, - "ofType": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null } + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } }, "defaultValue": null }, @@ -250,7 +278,7 @@ "type": { "kind": "NON_NULL", "name": null, - "ofType": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null } + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } }, "defaultValue": null } @@ -269,7 +297,7 @@ "type": { "kind": "NON_NULL", "name": null, - "ofType": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null } + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } }, "defaultValue": null }, @@ -279,7 +307,7 @@ "type": { "kind": "NON_NULL", "name": null, - "ofType": { "kind": "SCALAR", "name": "UnsignedInteger", "ofType": null } + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } }, "defaultValue": null }, @@ -324,16 +352,6 @@ "enumValues": null, "possibleTypes": null }, - { - "kind": "SCALAR", - "name": "UnsignedInteger", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, { "kind": "OBJECT", "name": "PingResults", @@ -1372,6 +1390,16 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "SCALAR", + "name": "UnsignedInteger", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "LatestMonitorsResult", diff --git a/x-pack/plugins/uptime/common/graphql/types.ts b/x-pack/plugins/uptime/common/graphql/types.ts index 7b4cc41392b90..11df21da41a15 100644 --- a/x-pack/plugins/uptime/common/graphql/types.ts +++ b/x-pack/plugins/uptime/common/graphql/types.ts @@ -399,51 +399,51 @@ export interface AllPingsQueryArgs { status?: string | null; - dateRangeStart: UnsignedInteger; + dateRangeStart: string; - dateRangeEnd: UnsignedInteger; + dateRangeEnd: string; } export interface GetMonitorsQueryArgs { - dateRangeStart: UnsignedInteger; + dateRangeStart: string; - dateRangeEnd: UnsignedInteger; + dateRangeEnd: string; filters?: string | null; } export interface GetSnapshotQueryArgs { - dateRangeStart?: UnsignedInteger | null; + dateRangeStart: string; - dateRangeEnd?: UnsignedInteger | null; + dateRangeEnd: string; - downCount?: number | null; + downCount: number; - windowSize?: number | null; + windowSize: number; filters?: string | null; } export interface GetMonitorChartsDataQueryArgs { - monitorId?: string | null; + monitorId: string; - dateRangeStart?: UnsignedInteger | null; + dateRangeStart: string; - dateRangeEnd?: UnsignedInteger | null; + dateRangeEnd: string; } export interface GetLatestMonitorsQueryArgs { - dateRangeStart: UnsignedInteger; + dateRangeStart: string; - dateRangeEnd: UnsignedInteger; + dateRangeEnd: string; monitorId?: string | null; } export interface GetFilterBarQueryArgs { - dateRangeStart: UnsignedInteger; + dateRangeStart: string; - dateRangeEnd: UnsignedInteger; + dateRangeEnd: string; } export interface GetErrorsListQueryArgs { - dateRangeStart: UnsignedInteger; + dateRangeStart: string; - dateRangeEnd: UnsignedInteger; + dateRangeEnd: string; filters?: string | null; } diff --git a/x-pack/plugins/uptime/public/components/queries/empty_state/empty_state.tsx b/x-pack/plugins/uptime/public/components/queries/empty_state/empty_state.tsx index efc71a5bfdc22..f8b0951969f3a 100644 --- a/x-pack/plugins/uptime/public/components/queries/empty_state/empty_state.tsx +++ b/x-pack/plugins/uptime/public/components/queries/empty_state/empty_state.tsx @@ -9,22 +9,19 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import React, { Fragment } from 'react'; import { Query } from 'react-apollo'; +import { UptimeCommonProps } from '../../../uptime_app'; import { getDocCountQuery } from './get_doc_count'; interface EmptyStateProps { - autorefreshInterval: number; - autorefreshEnabled: boolean; children: JSX.Element[]; } -export const EmptyState = ({ - autorefreshInterval, - autorefreshEnabled, - children, -}: EmptyStateProps) => ( +type Props = EmptyStateProps & UptimeCommonProps; + +export const EmptyState = ({ autorefreshInterval, autorefreshIsPaused, children }: Props) => ( {({ loading, error, data }) => { if (loading) { diff --git a/x-pack/plugins/uptime/public/components/queries/error_list/error_list.tsx b/x-pack/plugins/uptime/public/components/queries/error_list/error_list.tsx index d43ec8173d6e4..55bf75cda6ac9 100644 --- a/x-pack/plugins/uptime/public/components/queries/error_list/error_list.tsx +++ b/x-pack/plugins/uptime/public/components/queries/error_list/error_list.tsx @@ -12,16 +12,27 @@ import moment from 'moment'; import React, { Fragment } from 'react'; import { Query } from 'react-apollo'; import { Link } from 'react-router-dom'; +import { UptimeCommonProps } from '../../../uptime_app'; import { getErrorListQuery } from './get_error_list'; interface ErrorListProps { - dateRangeStart: number; - dateRangeEnd: number; filters?: string; } -export const ErrorList = ({ dateRangeStart, dateRangeEnd, filters }: ErrorListProps) => ( - +type Props = ErrorListProps & UptimeCommonProps; + +export const ErrorList = ({ + dateRangeStart, + dateRangeEnd, + filters, + autorefreshInterval, + autorefreshIsPaused, +}: Props) => ( + {({ loading, error, data }) => { if (error) { return i18n.translate('xpack.uptime.errorList.errorMessage', { diff --git a/x-pack/plugins/uptime/public/components/queries/error_list/get_error_list.ts b/x-pack/plugins/uptime/public/components/queries/error_list/get_error_list.ts index 645dca2b18d88..9c83efee7ff4a 100644 --- a/x-pack/plugins/uptime/public/components/queries/error_list/get_error_list.ts +++ b/x-pack/plugins/uptime/public/components/queries/error_list/get_error_list.ts @@ -7,11 +7,7 @@ import gql from 'graphql-tag'; export const getErrorListQuery = gql` - query ErrorList( - $dateRangeStart: UnsignedInteger! - $dateRangeEnd: UnsignedInteger! - $filters: String - ) { + query ErrorList($dateRangeStart: String!, $dateRangeEnd: String!, $filters: String) { errorList: getErrorsList( dateRangeStart: $dateRangeStart dateRangeEnd: $dateRangeEnd diff --git a/x-pack/plugins/uptime/public/components/queries/filter_bar/filter_bar.tsx b/x-pack/plugins/uptime/public/components/queries/filter_bar/filter_bar.tsx index b9306428d0d53..f92b3d9c4ad56 100644 --- a/x-pack/plugins/uptime/public/components/queries/filter_bar/filter_bar.tsx +++ b/x-pack/plugins/uptime/public/components/queries/filter_bar/filter_bar.tsx @@ -10,19 +10,20 @@ import { i18n } from '@kbn/i18n'; import { take } from 'lodash'; import React from 'react'; import { Query } from 'react-apollo'; +import { UptimeCommonProps } from '../../../uptime_app'; import { getFilterBarQuery } from './get_filter_bar'; import { filterBarSearchSchema } from './search_schema'; interface FilterBarProps { - dateRangeStart: number; - dateRangeEnd: number; updateQuery: (query: object | undefined) => void; } +type Props = FilterBarProps & UptimeCommonProps; + const MAX_SELECTION_LENGTH = 20; const SEARCH_THRESHOLD = 2; -export const FilterBar = ({ dateRangeEnd, dateRangeStart, updateQuery }: FilterBarProps) => ( +export const FilterBar = ({ dateRangeEnd, dateRangeStart, updateQuery }: Props) => ( {({ loading, error, data }) => { if (loading) { diff --git a/x-pack/plugins/uptime/public/components/queries/filter_bar/get_filter_bar.ts b/x-pack/plugins/uptime/public/components/queries/filter_bar/get_filter_bar.ts index 5ea5095a007df..bb6e756818624 100644 --- a/x-pack/plugins/uptime/public/components/queries/filter_bar/get_filter_bar.ts +++ b/x-pack/plugins/uptime/public/components/queries/filter_bar/get_filter_bar.ts @@ -7,7 +7,7 @@ import gql from 'graphql-tag'; export const getFilterBarQuery = gql` - query FilterBar($dateRangeStart: UnsignedInteger!, $dateRangeEnd: UnsignedInteger!) { + query FilterBar($dateRangeStart: String!, $dateRangeEnd: String!) { filterBar: getFilterBar(dateRangeStart: $dateRangeStart, dateRangeEnd: $dateRangeEnd) { status port diff --git a/x-pack/plugins/uptime/public/components/queries/monitor_charts/get_monitor_charts.ts b/x-pack/plugins/uptime/public/components/queries/monitor_charts/get_monitor_charts.ts index 95f9a6f73d20e..dd901d011f20b 100644 --- a/x-pack/plugins/uptime/public/components/queries/monitor_charts/get_monitor_charts.ts +++ b/x-pack/plugins/uptime/public/components/queries/monitor_charts/get_monitor_charts.ts @@ -7,11 +7,7 @@ import gql from 'graphql-tag'; export const createGetMonitorChartsQuery = gql` - query MonitorCharts( - $dateRangeStart: UnsignedInteger! - $dateRangeEnd: UnsignedInteger! - $monitorId: String - ) { + query MonitorCharts($dateRangeStart: String!, $dateRangeEnd: String!, $monitorId: String!) { monitorChartsData: getMonitorChartsData( monitorId: $monitorId dateRangeStart: $dateRangeStart diff --git a/x-pack/plugins/uptime/public/components/queries/monitor_charts/monitor_charts.tsx b/x-pack/plugins/uptime/public/components/queries/monitor_charts/monitor_charts.tsx index 6278d219ac125..a7dfc0938d66c 100644 --- a/x-pack/plugins/uptime/public/components/queries/monitor_charts/monitor_charts.tsx +++ b/x-pack/plugins/uptime/public/components/queries/monitor_charts/monitor_charts.tsx @@ -25,25 +25,24 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import React, { Fragment } from 'react'; import { Query } from 'react-apollo'; +import { UptimeCommonProps } from '../../../uptime_app'; import { createGetMonitorChartsQuery } from './get_monitor_charts'; interface MonitorChartsProps { - dateRangeStart: number; - dateRangeEnd: number; monitorId: string; - autorefreshInterval: number; - autorefreshEnabled: boolean; } +type Props = MonitorChartsProps & UptimeCommonProps; + export const MonitorCharts = ({ dateRangeStart, dateRangeEnd, monitorId, - autorefreshEnabled, + autorefreshIsPaused, autorefreshInterval, -}: MonitorChartsProps) => ( +}: Props) => ( @@ -73,6 +72,7 @@ export const MonitorCharts = ({ const downSeries: any[] = []; const upSeries: any[] = []; const checksSeries: any[] = []; + const maxRtt: any[] = []; monitorChartsData.forEach( ({ maxWriteRequest, @@ -85,6 +85,13 @@ export const MonitorCharts = ({ minDuration, status, }: any) => { + // We're summing these values because we need to know what the max value of the RTT + // fields are in order to provide an accurate domain size for the RTT combination series. + maxRtt.push({ + x: maxWriteRequest.x, + y: maxWriteRequest.y + maxValidate.y + maxContent.y + maxResponse.y + maxTcpRtt.y, + }); + // TODO: these types of computations should take place on the server and be reflected in the GQL schema rttWriteRequestSeries.push(maxWriteRequest); rttValidateSeries.push(maxValidate); rttContentSeries.push(maxContent); @@ -98,6 +105,16 @@ export const MonitorCharts = ({ } ); + // As above, we are building a domain size for the chart to use. + // Without this code the chart could render data outside of the field. + const checksDomain = upSeries.concat(downSeries).map(({ y }) => y); + const domainLimits = [Math.min(...checksDomain), Math.max(...checksDomain)]; + const durationDomain = avgDurationSeries.concat(areaRttSeries); + const durationLimits = [0, Math.max(...durationDomain.map(({ y }) => y))]; + + // find the greatest y-value for rtt chart + const rttLimits = [0, Math.max(...maxRtt.map(({ y }) => y))]; + return ( @@ -118,6 +135,7 @@ export const MonitorCharts = ({ xType={EuiSeriesChartUtils.SCALE.TIME} width={500} height={200} + yDomain={rttLimits} > ( +}: Props) => ( diff --git a/x-pack/plugins/uptime/public/components/queries/monitor_select/get_latest_monitors.ts b/x-pack/plugins/uptime/public/components/queries/monitor_select/get_latest_monitors.ts index 37463f54130c5..20bb0b8a93d98 100644 --- a/x-pack/plugins/uptime/public/components/queries/monitor_select/get_latest_monitors.ts +++ b/x-pack/plugins/uptime/public/components/queries/monitor_select/get_latest_monitors.ts @@ -7,7 +7,7 @@ import gql from 'graphql-tag'; export const createGetLatestMonitorsQuery = gql` - query GetLatestMonitorQuery($dateRangeStart: UnsignedInteger!, $dateRangeEnd: UnsignedInteger!) { + query GetLatestMonitorQuery($dateRangeStart: String!, $dateRangeEnd: String!) { latestMonitors: getLatestMonitors( dateRangeStart: $dateRangeStart dateRangeEnd: $dateRangeEnd diff --git a/x-pack/plugins/uptime/public/components/queries/monitor_select/monitor_select.tsx b/x-pack/plugins/uptime/public/components/queries/monitor_select/monitor_select.tsx index 9034de4507ccf..979deab4fff98 100644 --- a/x-pack/plugins/uptime/public/components/queries/monitor_select/monitor_select.tsx +++ b/x-pack/plugins/uptime/public/components/queries/monitor_select/monitor_select.tsx @@ -7,30 +7,29 @@ // @ts-ignore No typing for EuiSuperSelect import { EuiHealth, EuiSuperSelect } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import React from 'react'; +import React, { Fragment } from 'react'; import { Query } from 'react-apollo'; import { Monitor } from '../../../../common/graphql/types'; +import { UptimeCommonProps } from '../../../uptime_app'; import { createGetLatestMonitorsQuery } from './get_latest_monitors'; interface MonitorSelectProps { - dateRangeStart: number; - dateRangeEnd: number; valueOfSelectedMonitor?: string; - autorefreshInterval: number; - autorefreshEnabled: boolean; onChange: (path: string, state: object) => void; } +type Props = MonitorSelectProps & UptimeCommonProps; + export const MonitorSelect = ({ dateRangeStart, dateRangeEnd, valueOfSelectedMonitor, autorefreshInterval, - autorefreshEnabled, + autorefreshIsPaused, onChange, -}: MonitorSelectProps) => ( +}: Props) => ( @@ -59,11 +58,18 @@ export const MonitorSelect = ({ ), })); return ( - onChange(`/monitor/${e}`, {})} - /> + + {options.length > 0 && ( + onChange(`/monitor/${e}`, {})} + /> + )} + {options.length === 0 && ( +

There is no monitor data available for the selected time range

+ )} +
); }}
diff --git a/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/get_monitor_status_bar.ts b/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/get_monitor_status_bar.ts index 0eca6693ac84c..747e80b0413d3 100644 --- a/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/get_monitor_status_bar.ts +++ b/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/get_monitor_status_bar.ts @@ -7,11 +7,7 @@ import gql from 'graphql-tag'; export const createGetMonitorStatusBarQuery = gql` - query MonitorStatus( - $dateRangeStart: UnsignedInteger! - $dateRangeEnd: UnsignedInteger! - $monitorId: String - ) { + query MonitorStatus($dateRangeStart: String!, $dateRangeEnd: String!, $monitorId: String) { monitorStatus: getLatestMonitors( dateRangeStart: $dateRangeStart dateRangeEnd: $dateRangeEnd diff --git a/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/monitor_status_bar.tsx b/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/monitor_status_bar.tsx index 53f9577306ada..4af44b72dceb3 100644 --- a/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/monitor_status_bar.tsx +++ b/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/monitor_status_bar.tsx @@ -10,25 +10,24 @@ import { FormattedMessage } from '@kbn/i18n/react'; import moment from 'moment'; import React from 'react'; import { Query } from 'react-apollo'; +import { UptimeCommonProps } from '../../../uptime_app'; import { createGetMonitorStatusBarQuery } from './get_monitor_status_bar'; interface MonitorStatusBarProps { - dateRangeStart: number; - dateRangeEnd: number; monitorId: string; - autorefreshInterval: number; - autorefreshEnabled: boolean; } +type Props = MonitorStatusBarProps & UptimeCommonProps; + export const MonitorStatusBar = ({ dateRangeStart, dateRangeEnd, monitorId, - autorefreshEnabled, + autorefreshIsPaused, autorefreshInterval, -}: MonitorStatusBarProps) => ( +}: Props) => ( diff --git a/x-pack/plugins/uptime/public/components/queries/ping_list/get_pings.ts b/x-pack/plugins/uptime/public/components/queries/ping_list/get_pings.ts index f464b68312b35..d69a6501b205f 100644 --- a/x-pack/plugins/uptime/public/components/queries/ping_list/get_pings.ts +++ b/x-pack/plugins/uptime/public/components/queries/ping_list/get_pings.ts @@ -8,8 +8,8 @@ import gql from 'graphql-tag'; export const getPingsQuery = gql` query PingList( - $dateRangeStart: UnsignedInteger! - $dateRangeEnd: UnsignedInteger! + $dateRangeStart: String! + $dateRangeEnd: String! $monitorId: String $status: String $sort: String diff --git a/x-pack/plugins/uptime/public/components/queries/ping_list/ping_list.tsx b/x-pack/plugins/uptime/public/components/queries/ping_list/ping_list.tsx index 77f6eeca0ac34..c6061989a648b 100644 --- a/x-pack/plugins/uptime/public/components/queries/ping_list/ping_list.tsx +++ b/x-pack/plugins/uptime/public/components/queries/ping_list/ping_list.tsx @@ -27,26 +27,25 @@ import React, { Fragment } from 'react'; import { Query } from 'react-apollo'; import { UMPingSortDirectionArg } from '../../../../common/domain_types'; import { Ping } from '../../../../common/graphql/types'; +import { UptimeCommonProps } from '../../../uptime_app'; import { getPingsQuery } from './get_pings'; interface PingListProps { monitorId?: string; - dateRangeStart: number; - dateRangeEnd: number; - autorefreshInterval: number; - autorefreshEnabled: boolean; sort?: UMPingSortDirectionArg; size?: number; } +type Props = PingListProps & UptimeCommonProps; + interface PingListState { statusOptions: EuiComboBoxOptionProps[]; selectedOption: EuiComboBoxOptionProps; maxSearchSize: number; } -export class Pings extends React.Component { - constructor(props: PingListProps) { +export class Pings extends React.Component { + constructor(props: Props) { super(props); const statusOptions = [ @@ -80,7 +79,7 @@ export class Pings extends React.Component { monitorId, dateRangeStart, dateRangeEnd, - autorefreshEnabled, + autorefreshIsPaused, autorefreshInterval, sort, size, @@ -88,7 +87,7 @@ export class Pings extends React.Component { const { statusOptions, selectedOption } = this.state; return ( ( +}: Props) => ( void; -} - -export class DatePickerInput extends React.Component { - public render() { - return ( - - {moment(this.props.date || new Date()).format('MMM D YYYY HH:mm')} - - ); - } -} diff --git a/x-pack/plugins/uptime/public/components/utility/date_range/date_range_picker.tsx b/x-pack/plugins/uptime/public/components/utility/date_range/date_range_picker.tsx deleted file mode 100644 index fc9c3443cdc2a..0000000000000 --- a/x-pack/plugins/uptime/public/components/utility/date_range/date_range_picker.tsx +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { - EuiButton, - EuiButtonEmpty, - EuiDatePicker, - EuiFlexGroup, - EuiFlexItem, - EuiFormRow, - EuiPopover, - EuiTitle, -} from '@elastic/eui'; -import moment, { Moment } from 'moment'; -import React from 'react'; -import { DatePickerInput } from './date_picker_input'; -import { options } from './option_definitions'; -import { DateSelection } from './types'; - -interface UMDateRangePickerProps { - selection: DateSelection; - updateDateRange: ( - kind: 'relative' | 'absolute', - relative?: { value: number; unit: string }, - absolute?: { start: Date; end: Date } - ) => void; -} - -interface UMDateRangePickerState { - showPopover: boolean; -} - -export class UMDateRangePicker extends React.Component< - UMDateRangePickerProps, - UMDateRangePickerState -> { - constructor(props: UMDateRangePickerProps) { - super(props); - this.state = { - showPopover: false, - }; - } - - public render() { - const { - updateDateRange, - selection: { kind, absoluteStart, absoluteEnd, relativeSpanValue, relativeSpanUnit }, - } = this.props; - // move to constant - // const formatString = 'YYYY MMM DD HH:mm:SS'; - return ( - - {kind === 'absolute' - ? `${moment(absoluteStart).format('MMM-DD-YYYY HH:mm')} - ${moment( - absoluteEnd - ).format('MMM-DD-YYYY HH:mm')}` - : `${relativeSpanValue}${relativeSpanUnit} - now`} - - } - isOpen={this.state.showPopover} - closePopover={this.hidePopover} - > - - - -
Relative
-
- - {options.map(option => ( - - { - const { unit, value } = option.getRange(); - updateDateRange('relative', { unit, value }); - }} - > - {option.title} - - - ))} - -
- - -
Absolute
-
- - - - } - // @ts-ignore multiple definitions for type Moment - maxDate={moment(absoluteEnd)} - onChange={(e: Moment | null) => { - if (e !== null) { - updateDateRange('absolute', undefined, { - start: e.toDate(), - end: absoluteEnd, - }); - } - }} - selected={moment(absoluteStart)} - showTimeSelect={true} - /> - - - - - } - onChange={(e: Moment | null) => { - if (e !== null) { - updateDateRange('absolute', undefined, { - start: absoluteStart, - end: e.toDate(), - }); - } - }} - selected={moment(absoluteEnd)} - showTimeSelect={true} - /> - - - -
-
-
- ); - } - - private togglePopover = () => this.setState({ showPopover: !this.state.showPopover }); - private hidePopover = () => this.setState({ showPopover: false }); -} diff --git a/x-pack/plugins/uptime/public/components/utility/date_range/index.ts b/x-pack/plugins/uptime/public/components/utility/date_range/index.ts deleted file mode 100644 index 549476254dcb7..0000000000000 --- a/x-pack/plugins/uptime/public/components/utility/date_range/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -export { DateSelection } from './types'; -export { UMDateRangePicker } from './date_range_picker'; diff --git a/x-pack/plugins/uptime/public/components/utility/date_range/option_definitions.ts b/x-pack/plugins/uptime/public/components/utility/date_range/option_definitions.ts deleted file mode 100644 index 5492ce5e5269f..0000000000000 --- a/x-pack/plugins/uptime/public/components/utility/date_range/option_definitions.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -export interface DateRangeOption { - id: string; - title: string; - getRange: () => { unit: string; value: number }; -} - -export const options: DateRangeOption[] = [ - { - id: '24hrs', - title: 'Last 24 Hours', - getRange: () => ({ - unit: 'h', - value: 24, - }), - }, - { - id: '12hr', - title: 'Last 12 Hours', - getRange: () => ({ - unit: 'h', - value: 12, - }), - }, - { - id: '2d', - title: 'Last 2 Days', - getRange: () => ({ - unit: 'd', - value: 2, - }), - }, - { - id: 'lastWeek', - title: 'Past week', - getRange: () => ({ - unit: 'w', - value: 1, - }), - }, -]; diff --git a/x-pack/plugins/uptime/public/components/utility/date_range/types.ts b/x-pack/plugins/uptime/public/components/utility/date_range/types.ts deleted file mode 100644 index aed3d8a81b82a..0000000000000 --- a/x-pack/plugins/uptime/public/components/utility/date_range/types.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -export interface DateSelection { - kind: 'relative' | 'absolute'; - relativeSpanValue: number; - relativeSpanUnit: string; - absoluteStart: Date; - absoluteEnd: Date; -} diff --git a/x-pack/plugins/uptime/public/lib/adapters/framework/kibana_framework_adapter.ts b/x-pack/plugins/uptime/public/lib/adapters/framework/kibana_framework_adapter.ts index 36b2156efc28b..8fc62f5afbbfa 100644 --- a/x-pack/plugins/uptime/public/lib/adapters/framework/kibana_framework_adapter.ts +++ b/x-pack/plugins/uptime/public/lib/adapters/framework/kibana_framework_adapter.ts @@ -4,13 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import moment from 'moment'; import ReactDOM from 'react-dom'; import { unmountComponentAtNode } from 'react-dom'; import chrome from 'ui/chrome'; import { PLUGIN } from '../../../../common/constants'; import { UMBreadcrumb } from '../../../breadcrumbs'; -import { UptimePersistedState } from '../../../uptime_app'; +import { UptimeCommonProps } from '../../../uptime_app'; import { BootstrapUptimeApp, UMFrameworkAdapter } from '../../lib'; import { CreateGraphQLClient } from './framework_adapter_types'; @@ -18,11 +17,25 @@ export class UMKibanaFrameworkAdapter implements UMFrameworkAdapter { private uiRoutes: any; private xsrfHeader: string; private uriPath: string; + private defaultDateRangeStart: string; + private defaultDateRangeEnd: string; + private defaultAutorefreshInterval: number; + private defaultAutorefreshIsPaused: boolean; - constructor(uiRoutes: any) { + constructor( + uiRoutes: any, + dateRangeStart?: string, + dateRangeEnd?: string, + autorefreshInterval?: number, + autorefreshIsPaused?: boolean + ) { this.uiRoutes = uiRoutes; this.xsrfHeader = chrome.getXsrfToken(); this.uriPath = `${chrome.getBasePath()}/api/uptime/graphql`; + this.defaultDateRangeStart = dateRangeStart || 'now-15m'; + this.defaultDateRangeEnd = dateRangeEnd || 'now'; + this.defaultAutorefreshInterval = autorefreshInterval || 60 * 1000; + this.defaultAutorefreshIsPaused = autorefreshIsPaused || true; } public render = ( @@ -49,7 +62,7 @@ export class UMKibanaFrameworkAdapter implements UMFrameworkAdapter { : basePath + PLUGIN.ROUTER_BASE_NAME; const persistedState = this.initializePersistedState(); const { - autorefreshEnabled, + autorefreshIsPaused, autorefreshInterval, dateRangeStart, dateRangeEnd, @@ -61,7 +74,7 @@ export class UMKibanaFrameworkAdapter implements UMFrameworkAdapter { kibanaBreadcrumbs, routerBasename, graphQLClient, - initialAutorefreshEnabled: autorefreshEnabled, + initialAutorefreshIsPaused: autorefreshIsPaused, initialAutorefreshInterval: autorefreshInterval, initialDateRangeStart: dateRangeStart, initialDateRangeEnd: dateRangeEnd, @@ -95,29 +108,40 @@ export class UMKibanaFrameworkAdapter implements UMFrameworkAdapter { }); }; - private initializePersistedState = () => { + private initializePersistedState = (): UptimeCommonProps => { const uptimeConfigurationData = window.localStorage.getItem(PLUGIN.LOCAL_STORAGE_KEY); + const defaultState: UptimeCommonProps = { + autorefreshIsPaused: this.defaultAutorefreshIsPaused, + autorefreshInterval: this.defaultAutorefreshInterval, + dateRangeStart: this.defaultDateRangeStart, + dateRangeEnd: this.defaultDateRangeEnd, + }; try { if (uptimeConfigurationData) { - return JSON.parse(uptimeConfigurationData) || {}; - } else { - const initialState: UptimePersistedState = { - autorefreshEnabled: false, - autorefreshInterval: 5000, - dateRangeStart: moment() - .subtract(1, 'day') - .valueOf(), - dateRangeEnd: moment().valueOf(), - }; - this.updatePersistedState(initialState); - return initialState; + const parsed = JSON.parse(uptimeConfigurationData) || {}; + const { dateRangeStart, dateRangeEnd } = parsed; + // TODO: this is defensive code to ensure we don't encounter problems + // when encountering older versions of the localStorage values. + // The old code has never been released, so users don't need it, and this + // code should be removed eventually. + if ( + (dateRangeEnd && typeof dateRangeEnd === 'number') || + (dateRangeStart && typeof dateRangeStart === 'number') + ) { + this.updatePersistedState(defaultState); + return defaultState; + } + return parsed; } } catch (e) { - return {}; + // TODO: this should result in a redirect to error page + throw e; } + this.updatePersistedState(defaultState); + return defaultState; }; - private updatePersistedState = (state: UptimePersistedState) => { + private updatePersistedState = (state: UptimeCommonProps) => { window.localStorage.setItem(PLUGIN.LOCAL_STORAGE_KEY, JSON.stringify(state)); }; } diff --git a/x-pack/plugins/uptime/public/lib/lib.ts b/x-pack/plugins/uptime/public/lib/lib.ts index 7149f76563667..c6b0dd346fb02 100644 --- a/x-pack/plugins/uptime/public/lib/lib.ts +++ b/x-pack/plugins/uptime/public/lib/lib.ts @@ -8,7 +8,7 @@ import { NormalizedCacheObject } from 'apollo-cache-inmemory'; import ApolloClient from 'apollo-client'; import React from 'react'; import { UMBreadcrumb } from '../breadcrumbs'; -import { UptimePersistedState } from '../uptime_app'; +import { UptimeAppProps } from '../uptime_app'; import { CreateGraphQLClient } from './adapters/framework/framework_adapter_types'; export interface UMFrontendLibs { @@ -17,18 +17,7 @@ export interface UMFrontendLibs { export type UMUpdateBreadcrumbs = (breadcrumbs: UMBreadcrumb[]) => void; -export interface UptimeAppProps { - isUsingK7Design: boolean; - updateBreadcrumbs: UMUpdateBreadcrumbs; - kibanaBreadcrumbs: UMBreadcrumb[]; - routerBasename: string; - graphQLClient: ApolloClient; - initialDateRangeStart?: number; - initialDateRangeEnd?: number; - initialAutorefreshInterval?: number; - initialAutorefreshEnabled?: boolean; - persistState(state: UptimePersistedState): void; -} +export type UMGraphQLClient = ApolloClient; // | OtherClientType export type BootstrapUptimeApp = (props: UptimeAppProps) => React.ReactElement; diff --git a/x-pack/plugins/uptime/public/pages/monitor.tsx b/x-pack/plugins/uptime/public/pages/monitor.tsx index 9d5f508c1eb97..2ee4174ad0388 100644 --- a/x-pack/plugins/uptime/public/pages/monitor.tsx +++ b/x-pack/plugins/uptime/public/pages/monitor.tsx @@ -21,20 +21,19 @@ import { MonitorSelect } from '../components/queries/monitor_select'; import { MonitorStatusBar } from '../components/queries/monitor_status_bar'; import { Pings } from '../components/queries/ping_list'; import { UMUpdateBreadcrumbs } from '../lib/lib'; +import { UptimeCommonProps } from '../uptime_app'; interface MonitorPageProps { updateBreadcrumbs: UMUpdateBreadcrumbs; history: { push: any }; location: { pathname: string }; match: { params: { id: string } }; - dateRangeStart: number; - dateRangeEnd: number; - autorefreshEnabled: boolean; - autorefreshInterval: number; } -export class MonitorPage extends React.Component { - constructor(props: MonitorPageProps) { +type Props = MonitorPageProps & UptimeCommonProps; + +export class MonitorPage extends React.Component { + constructor(props: Props) { super(props); } @@ -43,13 +42,7 @@ export class MonitorPage extends React.Component { } public render() { - const { - autorefreshEnabled, - autorefreshInterval, - dateRangeStart, - dateRangeEnd, - history, - } = this.props; + const { history } = this.props; // TODO: this is a hack because the id field's characters mess up react router's // inner params parsing, when we add a synthetic ID for monitors this problem should go away const id = this.props.location.pathname.replace(/^(\/monitor\/)/, ''); @@ -69,40 +62,15 @@ export class MonitorPage extends React.Component { - +
- + - + - +
); } diff --git a/x-pack/plugins/uptime/public/pages/overview.tsx b/x-pack/plugins/uptime/public/pages/overview.tsx index 057c53af6b65b..0a6fc6b74695e 100644 --- a/x-pack/plugins/uptime/public/pages/overview.tsx +++ b/x-pack/plugins/uptime/public/pages/overview.tsx @@ -13,21 +13,20 @@ import { FilterBar } from '../components/queries/filter_bar'; import { MonitorList } from '../components/queries/monitor_list'; import { Snapshot } from '../components/queries/snapshot'; import { UMUpdateBreadcrumbs } from '../lib/lib'; +import { UptimeCommonProps } from '../uptime_app'; interface OverviewPageProps { - autorefreshInterval: number; - autorefreshEnabled: boolean; - dateRangeStart: number; - dateRangeEnd: number; setBreadcrumbs: UMUpdateBreadcrumbs; } +type Props = OverviewPageProps & UptimeCommonProps; + interface OverviewPageState { currentFilterQuery?: string; } -export class OverviewPage extends React.Component { - constructor(props: OverviewPageProps) { +export class OverviewPage extends React.Component { + constructor(props: Props) { super(props); this.state = { currentFilterQuery: undefined, @@ -39,41 +38,20 @@ export class OverviewPage extends React.Component - + { this.setState({ currentFilterQuery: query ? JSON.stringify(query) : query }); }} /> - + - + - + ); diff --git a/x-pack/plugins/uptime/public/uptime_app.tsx b/x-pack/plugins/uptime/public/uptime_app.tsx index 7956251aa7a44..1f181970c8b0a 100644 --- a/x-pack/plugins/uptime/public/uptime_app.tsx +++ b/x-pack/plugins/uptime/public/uptime_app.tsx @@ -5,12 +5,6 @@ */ import { - EuiButton, - EuiComboBox, - EuiDatePicker, - EuiDatePickerRange, - EuiFlexGroup, - EuiFlexItem, EuiHeader, EuiHeaderBreadcrumbs, // @ts-ignore missing typings for EuiHeaderLink @@ -24,36 +18,56 @@ import { EuiHeaderSectionItem, EuiPage, EuiPageContent, - EuiPopover, - EuiSwitch, + // @ts-ignore missing typings for EuiSuperDatePicker + EuiSuperDatePicker, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; -import moment, { Moment } from 'moment'; import React from 'react'; import { ApolloProvider } from 'react-apollo'; import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; import { overviewBreadcrumb, UMBreadcrumb } from './breadcrumbs'; -import { UMUpdateBreadcrumbs, UptimeAppProps } from './lib/lib'; +import { UMGraphQLClient, UMUpdateBreadcrumbs } from './lib/lib'; import { MonitorPage, OverviewPage } from './pages'; -export interface UptimePersistedState { - autorefreshEnabled: boolean; +// TODO: these props are global to this app, we should put them in a context +export interface UptimeCommonProps { + autorefreshIsPaused: boolean; autorefreshInterval: number; - dateRangeStart: number; - dateRangeEnd: number; + dateRangeStart: string; + dateRangeEnd: string; +} + +export interface UptimeAppProps { + isUsingK7Design: boolean; + updateBreadcrumbs: UMUpdateBreadcrumbs; + kibanaBreadcrumbs: UMBreadcrumb[]; + routerBasename: string; + graphQLClient: UMGraphQLClient; + initialDateRangeStart: string; + initialDateRangeEnd: string; + initialAutorefreshInterval: number; + initialAutorefreshIsPaused: boolean; + persistState(state: UptimeCommonProps): void; } interface UptimeAppState { + autorefreshIsPaused: boolean; + autorefreshInterval: number; breadcrumbs: UMBreadcrumb[]; - autorefreshEnabled: boolean; - popoverIsOpen: boolean; - // TODO: these get passed as props to most components in this plugin, - // they can probably be globalized in a context - selectedAutorefresh: any; - autorefreshOptions: any[]; - dateRangeStart: number; - dateRangeEnd: number; + dateRangeStart: string; + dateRangeEnd: string; +} + +// TODO: when EUI exports types for this, this should be replaced +interface SuperDateRangePickerRangeChangedEvent { + start: string; + end: string; +} + +interface SuperDateRangePickerRefreshChangedEvent { + isPaused: boolean; + refreshInterval?: number; } class Application extends React.Component { @@ -65,26 +79,13 @@ class Application extends React.Component { isUsingK7Design, kibanaBreadcrumbs, updateBreadcrumbs, - initialAutorefreshEnabled, - initialAutorefreshInterval, - initialDateRangeStart, - initialDateRangeEnd, + initialAutorefreshIsPaused: autorefreshIsPaused, + initialAutorefreshInterval: autorefreshInterval, + initialDateRangeStart: dateRangeStart, + initialDateRangeEnd: dateRangeEnd, } = props; let initialBreadcrumbs: UMBreadcrumb[]; - const dateRangeStart = - initialDateRangeStart || - moment() - .subtract(1, 'day') - .valueOf(); - // TODO: this will cause the date range to default to being greater than "now" - // when we start using the SuperDatePicker, we'll likely revise this. - const dateRangeEnd = - initialDateRangeEnd && initialDateRangeEnd > moment().valueOf() - ? initialDateRangeEnd - : moment() - .add(1, 'hours') - .valueOf(); if (isUsingK7Design) { this.setBreadcrumbs = updateBreadcrumbs; @@ -94,25 +95,10 @@ class Application extends React.Component { initialBreadcrumbs = [overviewBreadcrumb]; } - const minsToMillis = (mins: number) => mins * 60 * 1000; - const autorefreshOptions = [ - { label: '5s', value: 5000 }, - { label: '15s', value: 15000 }, - { label: '30s', value: 30000 }, - { label: '1m', value: minsToMillis(1) }, - { label: '5m', value: minsToMillis(5) }, - { label: '10m', value: minsToMillis(10) }, - { label: '30m', value: minsToMillis(30) }, - ]; - this.state = { - autorefreshEnabled: initialAutorefreshEnabled || false, + autorefreshIsPaused, + autorefreshInterval, breadcrumbs: initialBreadcrumbs, - popoverIsOpen: false, - autorefreshOptions, - selectedAutorefresh: - autorefreshOptions.find(opt => opt.value === initialAutorefreshInterval) || - autorefreshOptions[0], dateRangeStart, dateRangeEnd, }; @@ -124,7 +110,6 @@ class Application extends React.Component { public render() { const { isUsingK7Design, routerBasename, graphQLClient } = this.props; - const dateRangeIsInvalid = () => this.state.dateRangeStart > this.state.dateRangeEnd; return ( @@ -161,96 +146,41 @@ class Application extends React.Component { -
- { - if (e && e.valueOf() < this.state.dateRangeEnd) { - this.setState({ dateRangeStart: e.valueOf() }, this.persistState); - } - }} - showTimeSelect - /> - } - endDateControl={ - { - if (e && this.state.dateRangeStart < e.valueOf()) { - this.setState({ dateRangeEnd: e.valueOf() }, this.persistState); - } - }} - showTimeSelect - /> - } +
+ { + this.setState( + { dateRangeStart: start, dateRangeEnd: end }, + this.persistState + ); + }} + onRefreshChange={({ + isPaused, + refreshInterval, + }: SuperDateRangePickerRefreshChangedEvent) => { + const autorefreshInterval = + refreshInterval === undefined + ? this.state.autorefreshInterval + : refreshInterval; + this.setState( + { autorefreshIsPaused: isPaused, autorefreshInterval }, + this.persistState + ); + }} />
- - this.setState({ popoverIsOpen: true })} - > - {this.state.autorefreshEnabled - ? i18n.translate('xpack.uptime.autorefreshIntervalSelectedLabel', { - values: { selectedValue: this.state.selectedAutorefresh.label }, - defaultMessage: 'Autorefresh every {selectedValue}', - }) - : i18n.translate('xpack.uptime.autorefreshIntervalDisabledLabel', { - defaultMessage: 'Autorefresh Disabled', - })} - - } - closePopover={() => this.setState({ popoverIsOpen: false })} - isOpen={this.state.popoverIsOpen} - style={{ paddingLeft: '8px', paddingTop: '10px', paddingRight: '8px' }} - > - - - { - this.setState( - { autorefreshEnabled: e.target.checked }, - this.persistState - ); - }} - /> - - - { - this.setState( - { selectedAutorefresh: selectedOptions[0] }, - this.persistState - ); - }} - options={this.state.autorefreshOptions} - isClearable={false} - singleSelection={{ asPlainText: true }} - selectedOptions={[this.state.selectedAutorefresh]} - /> - - - - @@ -281,10 +211,7 @@ class Application extends React.Component { render={props => ( )} @@ -294,11 +221,8 @@ class Application extends React.Component { render={props => ( )} /> @@ -312,20 +236,13 @@ class Application extends React.Component { } private persistState = (): void => { - const { - autorefreshEnabled, - selectedAutorefresh: { value }, + const { autorefreshIsPaused, autorefreshInterval, dateRangeStart, dateRangeEnd } = this.state; + this.props.persistState({ + autorefreshIsPaused, + autorefreshInterval, dateRangeStart, dateRangeEnd, - } = this.state; - if (dateRangeEnd > dateRangeStart) { - this.props.persistState({ - autorefreshEnabled, - autorefreshInterval: value, - dateRangeStart, - dateRangeEnd, - }); - } + }); }; } diff --git a/x-pack/plugins/uptime/server/graphql/monitors/resolvers.ts b/x-pack/plugins/uptime/server/graphql/monitors/resolvers.ts index 16991f5f8e47e..a4c6bd3aa8b35 100644 --- a/x-pack/plugins/uptime/server/graphql/monitors/resolvers.ts +++ b/x-pack/plugins/uptime/server/graphql/monitors/resolvers.ts @@ -6,88 +6,60 @@ import { UMGqlRange } from '../../../common/domain_types'; import { UMResolver } from '../../../common/graphql/resolver_types'; -import { Ping, Snapshot } from '../../../common/graphql/types'; +import { + GetErrorsListQueryArgs, + GetFilterBarQueryArgs, + GetLatestMonitorsQueryArgs, + GetMonitorChartsDataQueryArgs, + GetMonitorsQueryArgs, + GetSnapshotQueryArgs, + Ping, + Snapshot, +} from '../../../common/graphql/types'; import { UMServerLibs } from '../../lib/lib'; import { CreateUMGraphQLResolvers, UMContext } from '../types'; export type UMSnapshotResolver = UMResolver< Snapshot | Promise, any, - GetSnapshotArgs, + GetSnapshotQueryArgs, UMContext >; export type UMMonitorsResolver = UMResolver, any, UMGqlRange, UMContext>; -interface UMLatestMonitorsArgs { - dateRangeStart: number; - dateRangeEnd: number; - monitorId?: string; -} - -interface UMGetMonitorsArgs { - dateRangeStart: number; - dateRangeEnd: number; - filters: string; -} - export type UMGetMonitorsResolver = UMResolver< any | Promise, any, - UMGetMonitorsArgs, + GetMonitorsQueryArgs, UMContext >; export type UMLatestMonitorsResolver = UMResolver< Ping[] | Promise, any, - UMLatestMonitorsArgs, + GetLatestMonitorsQueryArgs, UMContext >; -interface GetSnapshotArgs { - dateRangeStart: number; - dateRangeEnd: number; - downCount: number; - windowSize: number; - filters?: string; -} - -interface UMMonitorChartsArgs { - dateRangeStart: number; - dateRangeEnd: number; - monitorId: string; -} - export type UMGetMonitorChartsResolver = UMResolver< any | Promise, any, - UMMonitorChartsArgs, + GetMonitorChartsDataQueryArgs, UMContext >; -interface UMGetFilterBarArgs { - dateRangeStart: number; - dateRangeEnd: number; -} - export type UMGetFilterBarResolver = UMResolver< any | Promise, any, - UMGetFilterBarArgs, + GetFilterBarQueryArgs, UMContext >; -interface UMGetErrorsList { - dateRangeStart: number; - dateRangeEnd: number; - filters?: string; -} - export type UMGetErrorsListResolver = UMResolver< any | Promise, any, - UMGetErrorsList, + GetErrorsListQueryArgs, UMContext >; @@ -118,7 +90,8 @@ export const createMonitorsResolvers: CreateUMGraphQLResolvers = ( ): Promise { const { up, down, trouble } = await libs.monitors.getSnapshotCount( req, - { dateRangeStart, dateRangeEnd }, + dateRangeStart, + dateRangeEnd, downCount, windowSize, filters @@ -130,7 +103,7 @@ export const createMonitorsResolvers: CreateUMGraphQLResolvers = ( // @ts-ignore TODO update typings and remove this comment trouble, total: up + down + trouble, - histogram: await libs.pings.getHist(req, { dateRangeStart, dateRangeEnd }, filters), + histogram: await libs.pings.getPingHistogram(req, dateRangeStart, dateRangeEnd, filters), }; }, async getMonitorChartsData( diff --git a/x-pack/plugins/uptime/server/graphql/monitors/schema.gql.ts b/x-pack/plugins/uptime/server/graphql/monitors/schema.gql.ts index 2bc702b07b9a3..bba3c0814a9db 100644 --- a/x-pack/plugins/uptime/server/graphql/monitors/schema.gql.ts +++ b/x-pack/plugins/uptime/server/graphql/monitors/schema.gql.ts @@ -92,37 +92,29 @@ export const monitorsSchema = gql` extend type Query { getMonitors( - dateRangeStart: UnsignedInteger! - dateRangeEnd: UnsignedInteger! + dateRangeStart: String! + dateRangeEnd: String! filters: String ): LatestMonitorsResult getSnapshot( - dateRangeStart: UnsignedInteger - dateRangeEnd: UnsignedInteger - downCount: Int - windowSize: Int + dateRangeStart: String! + dateRangeEnd: String! + downCount: Int! + windowSize: Int! filters: String ): Snapshot getMonitorChartsData( - monitorId: String - dateRangeStart: UnsignedInteger - dateRangeEnd: UnsignedInteger + monitorId: String! + dateRangeStart: String! + dateRangeEnd: String! ): [MonitorChartEntry] - getLatestMonitors( - dateRangeStart: UnsignedInteger! - dateRangeEnd: UnsignedInteger! - monitorId: String - ): [Ping!]! + getLatestMonitors(dateRangeStart: String!, dateRangeEnd: String!, monitorId: String): [Ping!]! - getFilterBar(dateRangeStart: UnsignedInteger!, dateRangeEnd: UnsignedInteger!): FilterBar + getFilterBar(dateRangeStart: String!, dateRangeEnd: String!): FilterBar - getErrorsList( - dateRangeStart: UnsignedInteger! - dateRangeEnd: UnsignedInteger! - filters: String - ): [ErrorListItem] + getErrorsList(dateRangeStart: String!, dateRangeEnd: String!, filters: String): [ErrorListItem] } `; diff --git a/x-pack/plugins/uptime/server/graphql/pings/resolvers.ts b/x-pack/plugins/uptime/server/graphql/pings/resolvers.ts index 56bf7c2ceaf4b..fc3dd8765bd0c 100644 --- a/x-pack/plugins/uptime/server/graphql/pings/resolvers.ts +++ b/x-pack/plugins/uptime/server/graphql/pings/resolvers.ts @@ -4,26 +4,16 @@ * you may not use this file except in compliance with the Elastic License. */ -import { UMPingSortDirectionArg } from '../../../common/domain_types'; import { UMResolver } from '../../../common/graphql/resolver_types'; -import { DocCount, PingResults } from '../../../common/graphql/types'; +import { AllPingsQueryArgs, DocCount, PingResults } from '../../../common/graphql/types'; import { UMServerLibs } from '../../lib/lib'; import { UMContext } from '../types'; import { CreateUMGraphQLResolvers } from '../types'; -interface UMAllPingsArgs { - sort: UMPingSortDirectionArg; - size?: number; - monitorId: string; - status: string; - dateRangeStart: number; - dateRangeEnd: number; -} - export type UMAllPingsResolver = UMResolver< PingResults | Promise, any, - UMAllPingsArgs, + AllPingsQueryArgs, UMContext >; diff --git a/x-pack/plugins/uptime/server/graphql/pings/schema.gql.ts b/x-pack/plugins/uptime/server/graphql/pings/schema.gql.ts index b0ca434da881a..f4811986299f3 100644 --- a/x-pack/plugins/uptime/server/graphql/pings/schema.gql.ts +++ b/x-pack/plugins/uptime/server/graphql/pings/schema.gql.ts @@ -23,9 +23,9 @@ export const pingsSchema = gql` size: Int monitorId: String status: String - dateRangeStart: UnsignedInteger! - dateRangeEnd: UnsignedInteger! - ): PingResults! + dateRangeStart: String! + dateRangeEnd: String! + ): [Ping!]! "Gets the number of documents in the target index" getDocCount: DocCount! diff --git a/x-pack/plugins/uptime/server/lib/adapters/monitors/adapter_types.ts b/x-pack/plugins/uptime/server/lib/adapters/monitors/adapter_types.ts index fb0963a1b8d0a..462c55753004c 100644 --- a/x-pack/plugins/uptime/server/lib/adapters/monitors/adapter_types.ts +++ b/x-pack/plugins/uptime/server/lib/adapters/monitors/adapter_types.ts @@ -4,33 +4,32 @@ * you may not use this file except in compliance with the Elastic License. */ -import { UMGqlRange } from '../../../../common/domain_types'; - export interface UMMonitorsAdapter { getMonitorChartsData( request: any, monitorId: string, - dateRangeStart: number, - dateRangeEnd: number + dateRangeStart: string, + dateRangeEnd: string ): Promise; getLatestMonitors( request: any, - dateRangeStart: number, - dateRangeEnd: number, - filters: string + dateRangeStart: string, + dateRangeEnd: string, + filters?: string | null ): Promise; getSnapshotCount( request: any, - range: UMGqlRange, + dateRangeStart: string, + dateRangeEnd: string, downCount: number, windowSize: number, - filters?: string + filters?: string | null ): Promise; - getFilterBar(request: any, dateRangeStart: number, dateRangeEnd: number): Promise; + getFilterBar(request: any, dateRangeStart: string, dateRangeEnd: string): Promise; getErrorsList( request: any, - dateRangeStart: number, - dateRangeEnd: number, - filters?: string + dateRangeStart: string, + dateRangeEnd: string, + filters?: string | null ): Promise; } diff --git a/x-pack/plugins/uptime/server/lib/adapters/monitors/elasticsearch_monitors_adapter.ts b/x-pack/plugins/uptime/server/lib/adapters/monitors/elasticsearch_monitors_adapter.ts index b5d988d2c188b..6ebfb799f139e 100644 --- a/x-pack/plugins/uptime/server/lib/adapters/monitors/elasticsearch_monitors_adapter.ts +++ b/x-pack/plugins/uptime/server/lib/adapters/monitors/elasticsearch_monitors_adapter.ts @@ -6,7 +6,6 @@ import { get, set } from 'lodash'; import { INDEX_NAMES } from '../../../../common/constants'; -import { UMGqlRange } from '../../../../common/domain_types'; import { ErrorListItem } from '../../../../common/graphql/types'; import { DatabaseAdapter } from '../database'; import { UMMonitorsAdapter } from './adapter_types'; @@ -37,7 +36,11 @@ const formatStatusBuckets = (time: any, buckets: any, docCount: any) => { }; }; -const getFilteredQuery = (dateRangeStart: number, dateRangeEnd: number, filters?: string) => { +const getFilteredQuery = ( + dateRangeStart: string, + dateRangeEnd: string, + filters?: string | null +) => { let filtersObj; // TODO: handle bad JSON gracefully filtersObj = filters ? JSON.parse(filters) : undefined; @@ -68,8 +71,8 @@ export class ElasticsearchMonitorsAdapter implements UMMonitorsAdapter { public async getMonitorChartsData( request: any, monitorId: string, - dateRangeStart: number, - dateRangeEnd: number + dateRangeStart: string, + dateRangeEnd: string ): Promise { const query = { bool: { @@ -141,12 +144,12 @@ export class ElasticsearchMonitorsAdapter implements UMMonitorsAdapter { public async getSnapshotCount( request: any, - range: UMGqlRange, + dateRangeStart: string, + dateRangeEnd: string, downCount: number, windowSize: number, - filters: string = '' + filters?: string | null ): Promise { - const { dateRangeStart, dateRangeEnd } = range; const params = { index: INDEX_NAMES.HEARTBEAT, body: { @@ -225,9 +228,9 @@ export class ElasticsearchMonitorsAdapter implements UMMonitorsAdapter { public async getLatestMonitors( request: any, - dateRangeStart: number, - dateRangeEnd: number, - filters: string + dateRangeStart: string, + dateRangeEnd: string, + filters?: string | null ): Promise { const params = { index: INDEX_NAMES.HEARTBEAT, @@ -315,8 +318,8 @@ export class ElasticsearchMonitorsAdapter implements UMMonitorsAdapter { public async getFilterBar( request: any, - dateRangeStart: number, - dateRangeEnd: number + dateRangeStart: string, + dateRangeEnd: string ): Promise { const params = { index: INDEX_NAMES.HEARTBEAT, @@ -369,9 +372,9 @@ export class ElasticsearchMonitorsAdapter implements UMMonitorsAdapter { public async getErrorsList( request: any, - dateRangeStart: number, - dateRangeEnd: number, - filters?: string | undefined + dateRangeStart: string, + dateRangeEnd: string, + filters?: string | null ): Promise { const statusDown = { term: { diff --git a/x-pack/plugins/uptime/server/lib/adapters/monitors/memory_pings_adapter.ts b/x-pack/plugins/uptime/server/lib/adapters/monitors/memory_pings_adapter.ts index 34ccdab6b60b2..52bdeb979e638 100644 --- a/x-pack/plugins/uptime/server/lib/adapters/monitors/memory_pings_adapter.ts +++ b/x-pack/plugins/uptime/server/lib/adapters/monitors/memory_pings_adapter.ts @@ -4,8 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import moment from 'moment'; -import { UMGqlRange } from '../../../../common/domain_types'; import { Ping } from '../../../../common/graphql/types'; import { UMMonitorsAdapter } from './adapter_types'; @@ -18,29 +16,32 @@ export class UMMemoryMonitorsAdapter implements UMMonitorsAdapter { public async getLatestMonitors( request: any, - dateRangeStart: number, - dateRangeEnd: number, - filters: string + dateRangeStart: string, + dateRangeEnd: string, + filters?: string | null ): Promise { return this.monitorsDB.filter(ping => { - const timestamp = moment(ping.timestamp).valueOf(); - return dateRangeStart <= timestamp && timestamp <= dateRangeEnd; + // const timestamp = moment(ping.timestamp).valueOf(); + throw new Error('Method not implemented.'); + // return dateRangeStart <= timestamp && timestamp <= dateRangeEnd; }); } public async getMonitorChartsData( req: any, monitorId: string, - dateRangeStart: number, - dateRangeEnd: number + dateRangeStart: string, + dateRangeEnd: string ): Promise { throw new Error('Method not implemented.'); } public async getSnapshotCount( request: any, - range: UMGqlRange, + dateRangeStart: string, + dateRangeEnd: string, downCount: number, - windowSize: number + windowSize: number, + filters?: string | null ): Promise { throw new Error('Method not implemented.'); } @@ -50,9 +51,9 @@ export class UMMemoryMonitorsAdapter implements UMMonitorsAdapter { public async getErrorsList( request: any, - dateRangeStart: number, - dateRangeEnd: number, - filters?: string | undefined + dateRangeStart: string, + dateRangeEnd: string, + filters?: string | null ): Promise { throw new Error('Method not implemented.'); } diff --git a/x-pack/plugins/uptime/server/lib/adapters/pings/__tests__/elasticsearch_pings_adapter.test.ts b/x-pack/plugins/uptime/server/lib/adapters/pings/__tests__/elasticsearch_pings_adapter.test.ts index 64f9ae42f06b2..39f34aec53cf8 100644 --- a/x-pack/plugins/uptime/server/lib/adapters/pings/__tests__/elasticsearch_pings_adapter.test.ts +++ b/x-pack/plugins/uptime/server/lib/adapters/pings/__tests__/elasticsearch_pings_adapter.test.ts @@ -72,7 +72,7 @@ describe('ElasticsearchPingsAdapter class', () => { body: { query: { bool: { - filter: [{ range: { '@timestamp': { gte: 100, lte: 200 } } }], + filter: [{ range: { '@timestamp': { gte: 'now-1h', lte: 'now' } } }], must: [], }, }, @@ -83,7 +83,15 @@ describe('ElasticsearchPingsAdapter class', () => { }); it('returns data in the appropriate shape', async () => { - const result = await adapter.getAll(serverRequest, 100, 200, undefined, undefined, 'asc', 12); + const result = await adapter.getAll( + serverRequest, + 'now-1h', + 'now', + undefined, + undefined, + 'asc', + 12 + ); const count = 3; expect(result.total).toBe(count); @@ -98,7 +106,7 @@ describe('ElasticsearchPingsAdapter class', () => { it('creates appropriate sort and size parameters', async () => { database.search = getAllSearchMock; - await adapter.getAll(serverRequest, 100, 200, undefined, undefined, 'asc', 12); + await adapter.getAll(serverRequest, 'now-1h', 'now', undefined, undefined, 'asc', 12); expect(database.search).toHaveBeenCalledTimes(1); expect(database.search).toHaveBeenCalledWith(serverRequest, expectedGetAllParams); @@ -106,14 +114,14 @@ describe('ElasticsearchPingsAdapter class', () => { it('omits the sort param when no sort passed', async () => { database.search = getAllSearchMock; - await adapter.getAll(serverRequest, 100, 200, undefined, undefined, undefined, 12); + await adapter.getAll(serverRequest, 'now-1h', 'now', undefined, undefined, undefined, 12); delete expectedGetAllParams.body.sort; expect(database.search).toHaveBeenCalledWith(serverRequest, expectedGetAllParams); }); it('omits the size param when no size passed', async () => { database.search = getAllSearchMock; - await adapter.getAll(serverRequest, 100, 200, undefined, undefined, 'desc'); + await adapter.getAll(serverRequest, 'now-1h', 'now', undefined, undefined, 'desc'); delete expectedGetAllParams.body.size; set(expectedGetAllParams, 'body.sort[0].@timestamp.order', 'desc'); expect(database.search).toHaveBeenCalledWith(serverRequest, expectedGetAllParams); @@ -121,7 +129,7 @@ describe('ElasticsearchPingsAdapter class', () => { it('adds a filter for monitor ID', async () => { database.search = getAllSearchMock; - await adapter.getAll(serverRequest, 100, 200, 'testmonitorid'); + await adapter.getAll(serverRequest, 'now-1h', 'now', 'testmonitorid'); delete expectedGetAllParams.body.size; delete expectedGetAllParams.body.sort; expectedGetAllParams.body.query.bool.must.push({ term: { 'monitor.id': 'testmonitorid' } }); @@ -130,7 +138,7 @@ describe('ElasticsearchPingsAdapter class', () => { it('adds a filter for monitor status', async () => { database.search = getAllSearchMock; - await adapter.getAll(serverRequest, 100, 200, undefined, 'down'); + await adapter.getAll(serverRequest, 'now-1h', 'now', undefined, 'down'); delete expectedGetAllParams.body.size; delete expectedGetAllParams.body.sort; expectedGetAllParams.body.query.bool.must.push({ term: { 'monitor.status': 'down' } }); @@ -152,8 +160,8 @@ describe('ElasticsearchPingsAdapter class', () => { { range: { '@timestamp': { - gte: 100, - lte: 200, + gte: 'now-1h', + lte: 'now', }, }, }, @@ -209,7 +217,12 @@ describe('ElasticsearchPingsAdapter class', () => { it('returns data in expected shape', async () => { database.search = getLatestSearchMock; - const result = await adapter.getLatestMonitorDocs(serverRequest, 100, 200, 'testmonitor'); + const result = await adapter.getLatestMonitorDocs( + serverRequest, + 'now-1h', + 'now', + 'testmonitor' + ); expect(result).toHaveLength(1); expect(result[0].timestamp).toBe(123456); expect(result[0].monitor).not.toBeFalsy(); diff --git a/x-pack/plugins/uptime/server/lib/adapters/pings/adapter_types.ts b/x-pack/plugins/uptime/server/lib/adapters/pings/adapter_types.ts index ff739c01532f9..103ee9228c9d1 100644 --- a/x-pack/plugins/uptime/server/lib/adapters/pings/adapter_types.ts +++ b/x-pack/plugins/uptime/server/lib/adapters/pings/adapter_types.ts @@ -4,31 +4,31 @@ * you may not use this file except in compliance with the Elastic License. */ -import { UMGqlRange, UMPingSortDirectionArg } from '../../../../common/domain_types'; import { DocCount, HistogramSeries, Ping, PingResults } from '../../../../common/graphql/types'; export interface UMPingsAdapter { getAll( request: any, - dateRangeStart: number, - dateRangeEnd: number, - monitorId?: string, - status?: string, - sort?: UMPingSortDirectionArg, - size?: number + dateRangeStart: string, + dateRangeEnd: string, + monitorId?: string | null, + status?: string | null, + sort?: string | null, + size?: number | null ): Promise; getLatestMonitorDocs( request: any, - dateRangeStart: number, - dateRangeEnd: number, - monitorId?: string + dateRangeStart: string, + dateRangeEnd: string, + monitorId?: string | null ): Promise; getPingHistogram( request: any, - range: UMGqlRange, - filters?: string + dateRangeStart: string, + dateRangeEnd: string, + filters?: string | null ): Promise; getDocCount(request: any): Promise; diff --git a/x-pack/plugins/uptime/server/lib/adapters/pings/elasticsearch_pings_adapter.ts b/x-pack/plugins/uptime/server/lib/adapters/pings/elasticsearch_pings_adapter.ts index 5d1099d37230b..bb502bfc39d5a 100644 --- a/x-pack/plugins/uptime/server/lib/adapters/pings/elasticsearch_pings_adapter.ts +++ b/x-pack/plugins/uptime/server/lib/adapters/pings/elasticsearch_pings_adapter.ts @@ -6,12 +6,15 @@ import { get } from 'lodash'; import { INDEX_NAMES } from '../../../../common/constants'; -import { UMGqlRange, UMPingSortDirectionArg } from '../../../../common/domain_types'; import { DocCount, HistogramSeries, Ping, PingResults } from '../../../../common/graphql/types'; import { DatabaseAdapter } from '../database'; import { UMPingsAdapter } from './adapter_types'; -const getFilteredQuery = (dateRangeStart: number, dateRangeEnd: number, filters?: string) => { +const getFilteredQuery = ( + dateRangeStart: string, + dateRangeEnd: string, + filters?: string | null +) => { let filtersObj; // TODO: handle bad JSON gracefully filtersObj = filters ? JSON.parse(filters) : undefined; @@ -43,12 +46,12 @@ export class ElasticsearchPingsAdapter implements UMPingsAdapter { public async getAll( request: any, - dateRangeStart: number, - dateRangeEnd: number, - monitorId?: string, - status?: string, - sort?: UMPingSortDirectionArg, - size?: number + dateRangeStart: string, + dateRangeEnd: string, + monitorId?: string | null, + status?: string | null, + sort?: string | null, + size?: number | null ): Promise { const sortParam = sort ? { sort: [{ '@timestamp': { order: sort } }] } : undefined; const sizeParam = size ? { size } : undefined; @@ -90,9 +93,9 @@ export class ElasticsearchPingsAdapter implements UMPingsAdapter { public async getLatestMonitorDocs( request: any, - dateRangeStart: number, - dateRangeEnd: number, - monitorId?: string + dateRangeStart: string, + dateRangeEnd: string, + monitorId?: string | null ): Promise { const must: any[] = []; if (monitorId) { @@ -147,10 +150,10 @@ export class ElasticsearchPingsAdapter implements UMPingsAdapter { public async getPingHistogram( request: any, - range: UMGqlRange, - filters?: string + dateRangeStart: string, + dateRangeEnd: string, + filters?: string | null ): Promise { - const { dateRangeStart, dateRangeEnd } = range; const params = { index: INDEX_NAMES.HEARTBEAT, body: { diff --git a/x-pack/plugins/uptime/server/lib/adapters/pings/memory_pings_adapter.ts b/x-pack/plugins/uptime/server/lib/adapters/pings/memory_pings_adapter.ts index 1f992f19ec551..75fdf14ed0c9f 100644 --- a/x-pack/plugins/uptime/server/lib/adapters/pings/memory_pings_adapter.ts +++ b/x-pack/plugins/uptime/server/lib/adapters/pings/memory_pings_adapter.ts @@ -5,11 +5,10 @@ */ import { take } from 'lodash'; -import { UMPingSortDirectionArg } from '../../../../common/domain_types'; import { DocCount, HistogramSeries, Ping, PingResults } from '../../../../common/graphql/types'; import { UMPingsAdapter } from './adapter_types'; -const sortPings = (sort: UMPingSortDirectionArg) => +const sortPings = (sort: string) => sort === 'asc' ? (a: Ping, b: Ping) => (Date.parse(a.timestamp) > Date.parse(b.timestamp) ? 1 : 0) : (a: Ping, b: Ping) => (Date.parse(a.timestamp) > Date.parse(b.timestamp) ? 0 : 1); @@ -23,12 +22,12 @@ export class MemoryPingsAdapter implements UMPingsAdapter { public async getAll( request: any, - dateRangeStart: number, - dateRangeEnd: number, - monitorId?: string, - status?: string, - sort?: UMPingSortDirectionArg, - size?: number + dateRangeStart: string, + dateRangeEnd: string, + monitorId?: string | null, + status?: string | null, + sort?: string | null, + size?: number | null ): Promise { let pings = this.pingsDB; if (monitorId) { @@ -42,21 +41,28 @@ export class MemoryPingsAdapter implements UMPingsAdapter { }; } - // TODO implement - public async getLatestMonitorDocs( + // TODO: implement + public getLatestMonitorDocs( request: any, - dateRangeStart: number, - dateRangeEnd: number, - monitorId?: string + dateRangeStart: string, + dateRangeEnd: string, + monitorId?: string | null ): Promise { throw new Error('Method not implemented.'); } - // TODO implement - public async getPingHistogram(request: any): Promise { + + // TODO: implement + public getPingHistogram( + request: any, + dateRangeStart: string, + dateRangeEnd: string, + filters?: string | null | undefined + ): Promise { throw new Error('Method not implemented.'); } - public async getDocCount(request: any): Promise { + // TODO: implement + public getDocCount(request: any): Promise { throw new Error('Method not implemented.'); } } diff --git a/x-pack/plugins/uptime/server/lib/domains/__tests__/pings.test.ts b/x-pack/plugins/uptime/server/lib/domains/__tests__/pings.test.ts index 398479f279ada..362e12b4746e7 100644 --- a/x-pack/plugins/uptime/server/lib/domains/__tests__/pings.test.ts +++ b/x-pack/plugins/uptime/server/lib/domains/__tests__/pings.test.ts @@ -45,8 +45,8 @@ describe('Pings domain lib', () => { const request: any = {}; const apiResponse = await libs.pings.getAll( request, - 100, - 200, + 'now-1h', + 'now', undefined, undefined, 'asc', @@ -61,8 +61,8 @@ describe('Pings domain lib', () => { it('should sort desc and take a range', async () => { const apiResponse = await libs.pings.getAll( undefined, - 100, - 200, + 'now-1h', + 'now', undefined, undefined, 'desc', @@ -77,8 +77,8 @@ describe('Pings domain lib', () => { it('should take range without sort', async () => { const apiResponse = await libs.pings.getAll( undefined, - 100, - 200, + 'now-1h', + 'now', undefined, undefined, undefined, @@ -93,8 +93,8 @@ describe('Pings domain lib', () => { it('should sort without range', async () => { const apiResponse = await libs.pings.getAll( undefined, - 100, - 200, + 'now-1h', + 'now', undefined, undefined, 'desc', @@ -110,8 +110,8 @@ describe('Pings domain lib', () => { it('should return unsorted, with default size of 10', async () => { const apiResponse = await libs.pings.getAll( undefined, - 100, - 200, + 'now-1h', + 'now', undefined, undefined, undefined, diff --git a/x-pack/plugins/uptime/server/lib/domains/monitors.ts b/x-pack/plugins/uptime/server/lib/domains/monitors.ts index d4679ffe322f7..45c54a73d296d 100644 --- a/x-pack/plugins/uptime/server/lib/domains/monitors.ts +++ b/x-pack/plugins/uptime/server/lib/domains/monitors.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import { UMGqlRange } from '../../../common/domain_types'; import { UMMonitorsAdapter } from '../adapters/monitors'; export class UMMonitorsDomain { @@ -15,44 +14,52 @@ export class UMMonitorsDomain { public async getMonitorChartsData( request: any, monitorId: string, - dateRangeStart: number, - dateRangeEnd: number + dateRangeStart: string, + dateRangeEnd: string ): Promise { return this.adapter.getMonitorChartsData(request, monitorId, dateRangeStart, dateRangeEnd); } public async getMonitors( request: any, - dateRangeStart: number, - dateRangeEnd: number, - filters: string + dateRangeStart: string, + dateRangeEnd: string, + filters?: string | null ): Promise { return this.adapter.getLatestMonitors(request, dateRangeStart, dateRangeEnd, filters); } public async getSnapshotCount( request: any, - range: UMGqlRange, + dateRangeStart: string, + dateRangeEnd: string, downCount: number, windowSize: number, - filters?: string + filters?: string | null ): Promise { - return this.adapter.getSnapshotCount(request, range, downCount, windowSize, filters); + return this.adapter.getSnapshotCount( + request, + dateRangeStart, + dateRangeEnd, + downCount, + windowSize, + filters + ); } public async getFilterBar( request: any, - dateRangeStart: number, - dateRangeEnd: number + dateRangeStart: string, + dateRangeEnd: string ): Promise { return this.adapter.getFilterBar(request, dateRangeStart, dateRangeEnd); } public async getErrorsList( request: any, - dateRangeStart: number, - dateRangeEnd: number, - filters?: string + dateRangeStart: string, + dateRangeEnd: string, + filters?: string | null ): Promise { return this.adapter.getErrorsList(request, dateRangeStart, dateRangeEnd, filters); } diff --git a/x-pack/plugins/uptime/server/lib/domains/pings.ts b/x-pack/plugins/uptime/server/lib/domains/pings.ts index b3443d11f6629..a7716bd8e4aeb 100644 --- a/x-pack/plugins/uptime/server/lib/domains/pings.ts +++ b/x-pack/plugins/uptime/server/lib/domains/pings.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import { UMGqlRange, UMPingSortDirectionArg } from '../../../common/domain_types'; import { DocCount, HistogramSeries, Ping, PingResults } from '../../../common/graphql/types'; import { UMPingsAdapter } from '../adapters/pings'; @@ -15,12 +14,12 @@ export class UMPingsDomain { public async getAll( request: any, - dateRangeStart: number, - dateRangeEnd: number, - monitorId?: string, - status?: string, - sort?: UMPingSortDirectionArg, - size?: number + dateRangeStart: string, + dateRangeEnd: string, + monitorId?: string | null, + status?: string | null, + sort?: string | null, + size?: number | null ): Promise { return this.adapter.getAll( request, @@ -35,19 +34,20 @@ export class UMPingsDomain { public async getLatestMonitorDocs( request: any, - dateRangeStart: number, - dateRangeEnd: number, - monitorId?: string + dateRangeStart: string, + dateRangeEnd: string, + monitorId?: string | null ): Promise { return this.adapter.getLatestMonitorDocs(request, dateRangeStart, dateRangeEnd, monitorId); } - public async getHist( + public async getPingHistogram( request: any, - range: UMGqlRange, - filters?: string + dateRangeStart: string, + dateRangeEnd: string, + filters?: string | null ): Promise { - return this.adapter.getPingHistogram(request, range, filters); + return this.adapter.getPingHistogram(request, dateRangeStart, dateRangeEnd, filters); } public async getDocCount(request: any): Promise {