Skip to content

Commit

Permalink
[Uptime] Remove pings graphql (elastic#59392)
Browse files Browse the repository at this point in the history
* WIP replacing GQL with redux/rest.

* Finish implementing migration.

* Introduce new connected component for ping list.

* Replace GraphQL type with io-ts.

* Update some broken tests.

* Add test for new helper function.

* Write test snapshots.

* Migrate api tests from graphql to rest.

* Update fixtures that rely on pings.

* Move ping types to runtime_types folder with rest of io-ts files.

* Update Ping type location and imports, type checking.

* Remove reliance on fixtures for ping functional API tests.

* Fix broken unit tests.

* Fix broken types.

* Remove local state storage from parent components.

* Add functional test to cover Ping List functionality.

* Fix monitor page functional test that was broken by merge conflicts.

* Fix broken tests.

* Fix broken API test.

* Replace a test with a describe block that will pre-navigate all tests.

* Delete unused reducer keys.

* Re-introduce loading to ping list reducer.

* Inroduce code that will cause PingList to re-fetch when refresh button is pressed.

* Update expanded rows to support multiple concurrent expanded rows.

* Modify pingList reducer to have singular optional error field.

* Delete unnecessary helper code.

* Delete unused interface.

* Add runtime_type to parse getPings params, fix pagination index.

* Add dedicated monitor type to runtime_types.

* Fix broken tests.

* Fix broken tests.

* Rename '@timestamp' property to 'timestamp' on Ping type.

* Fix broken type and key pings list table on document ID instead of timestamp.

* Fix broken unit tests.

* Fix broken tests and types.

* Fix broken functional test.
  • Loading branch information
justinkambic committed Apr 15, 2020
1 parent 720d07d commit 5453c11
Show file tree
Hide file tree
Showing 72 changed files with 1,695 additions and 4,196 deletions.
340 changes: 0 additions & 340 deletions x-pack/legacy/plugins/uptime/common/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,294 +15,15 @@ export type UnsignedInteger = any;
// ====================================================

export interface Query {
/** Get a list of all recorded pings for all monitors */
allPings: PingResults;

/** Fetches the current state of Uptime monitors for the given parameters. */
getMonitorStates?: MonitorSummaryResult | null;
}

export interface PingResults {
/** Total number of matching pings */
total: UnsignedInteger;
/** Unique list of all locations the query matched */
locations: string[];
/** List of pings */
pings: Ping[];
}
/** A request sent from a monitor to a host */
export interface Ping {
/** unique ID for this ping */
id: string;
/** The timestamp of the ping's creation */
timestamp: string;
/** The agent that recorded the ping */
beat?: Beat | null;

container?: Container | null;

docker?: Docker | null;

ecs?: Ecs | null;

error?: Error | null;

host?: Host | null;

http?: Http | null;

icmp?: Icmp | null;

kubernetes?: Kubernetes | null;

meta?: Meta | null;

monitor?: Monitor | null;

observer?: Observer | null;

resolve?: Resolve | null;

socks5?: Socks5 | null;

summary?: Summary | null;

tags?: string | null;

tcp?: Tcp | null;

tls?: PingTls | null;

url?: Url | null;
}
/** An agent for recording a beat */
export interface Beat {
hostname?: string | null;

name?: string | null;

timezone?: string | null;

type?: string | null;
}

export interface Container {
id?: string | null;

image?: ContainerImage | null;

name?: string | null;

runtime?: string | null;
}

export interface ContainerImage {
name?: string | null;

tag?: string | null;
}

export interface Docker {
id?: string | null;

image?: string | null;

name?: string | null;
}

export interface Ecs {
version?: string | null;
}

export interface Error {
code?: number | null;

message?: string | null;

type?: string | null;
}

export interface Host {
architecture?: string | null;

id?: string | null;

hostname?: string | null;

ip?: string | null;

mac?: string | null;

name?: string | null;

os?: Os | null;
}

export interface Os {
family?: string | null;

kernel?: string | null;

platform?: string | null;

version?: string | null;

name?: string | null;

build?: string | null;
}

export interface Http {
response?: HttpResponse | null;

rtt?: HttpRtt | null;

url?: string | null;
}

export interface HttpResponse {
status_code?: UnsignedInteger | null;

body?: HttpBody | null;
}

export interface HttpBody {
/** Size of HTTP response body in bytes */
bytes?: UnsignedInteger | null;
/** Hash of the HTTP response body */
hash?: string | null;
/** Response body of the HTTP Response. May be truncated based on client settings. */
content?: string | null;
/** Byte length of the content string, taking into account multibyte chars. */
content_bytes?: UnsignedInteger | null;
}

export interface HttpRtt {
content?: Duration | null;

response_header?: Duration | null;

total?: Duration | null;

validate?: Duration | null;

validate_body?: Duration | null;

write_request?: Duration | null;
}
/** The monitor's status for a ping */
export interface Duration {
us?: UnsignedInteger | null;
}

export interface Icmp {
requests?: number | null;

rtt?: number | null;
}

export interface Kubernetes {
container?: KubernetesContainer | null;

namespace?: string | null;

node?: KubernetesNode | null;

pod?: KubernetesPod | null;
}

export interface KubernetesContainer {
image?: string | null;

name?: string | null;
}

export interface KubernetesNode {
name?: string | null;
}

export interface KubernetesPod {
name?: string | null;

uid?: string | null;
}

export interface Meta {
cloud?: MetaCloud | null;
}

export interface MetaCloud {
availability_zone?: string | null;

instance_id?: string | null;

instance_name?: string | null;

machine_type?: string | null;

project_id?: string | null;

provider?: string | null;

region?: string | null;
}

export interface Monitor {
duration?: Duration | null;

host?: string | null;
/** The id of the monitor */
id?: string | null;
/** The IP pinged by the monitor */
ip?: string | null;
/** The name of the protocol being monitored */
name?: string | null;
/** The protocol scheme of the monitored host */
scheme?: string | null;
/** The status of the monitored host */
status?: string | null;
/** The type of host being monitored */
type?: string | null;

check_group?: string | null;
}
/** Metadata added by a proccessor, which is specified in its configuration. */
export interface Observer {
/** Geolocation data for the agent. */
geo?: Geo | null;
}
/** Geolocation data added via processors to enrich events. */
export interface Geo {
/** Name of the city in which the agent is running. */
city_name?: string | null;
/** The name of the continent on which the agent is running. */
continent_name?: string | null;
/** ISO designation for the agent's country. */
country_iso_code?: string | null;
/** The name of the agent's country. */
country_name?: string | null;
/** The lat/long of the agent. */
location?: string | null;
/** A name for the host's location, e.g. 'us-east-1' or 'LAX'. */
name?: string | null;
/** ISO designation of the agent's region. */
region_iso_code?: string | null;
/** Name of the region hosting the agent. */
region_name?: string | null;
}

export interface Resolve {
host?: string | null;

ip?: string | null;

rtt?: Duration | null;
}

export interface Socks5 {
rtt?: Rtt | null;
}

export interface Rtt {
connect?: Duration | null;

Expand Down Expand Up @@ -331,53 +52,10 @@ export interface Location {
lon?: number | null;
}

export interface Tcp {
port?: number | null;

rtt?: Rtt | null;
}
/** Contains monitor transmission encryption information. */
export interface PingTls {
/** The date and time after which the certificate is invalid. */
certificate_not_valid_after?: string | null;

certificate_not_valid_before?: string | null;

certificates?: string | null;

rtt?: Rtt | null;
}

export interface Url {
full?: string | null;

scheme?: string | null;

domain?: string | null;

port?: number | null;

path?: string | null;

query?: string | null;
}

export interface DocCount {
count: UnsignedInteger;
}

export interface Snapshot {
counts: SnapshotCount;
}

export interface SnapshotCount {
up: number;

down: number;

total: number;
}

/** The primary object returned for monitor states. */
export interface MonitorSummaryResult {
/** Used to go to the next page of results */
Expand Down Expand Up @@ -521,24 +199,6 @@ export interface SummaryHistogramPoint {
down: number;
}

export interface AllPingsQueryArgs {
/** Optional: the direction to sort by. Accepts 'asc' and 'desc'. Defaults to 'desc'. */
sort?: string | null;
/** Optional: the number of results to return. */
size?: number | null;
/** Optional: the monitor ID filter. */
monitorId?: string | null;
/** Optional: the check status to filter by. */
status?: string | null;
/** The lower limit of the date range. */
dateRangeStart: string;
/** The upper limit of the date range. */
dateRangeEnd: string;
/** Optional: agent location to filter by. */
location?: string | null;
page?: number;
}

export interface GetMonitorStatesQueryArgs {
dateRangeStart: string;

Expand Down
6 changes: 6 additions & 0 deletions x-pack/legacy/plugins/uptime/common/runtime_types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ export const StatesIndexStatusType = t.type({
docCount: t.number,
});

export const DateRangeType = t.type({
from: t.string,
to: t.string,
});

export type Summary = t.TypeOf<typeof SummaryType>;
export type CheckGeo = t.TypeOf<typeof CheckGeoType>;
export type Location = t.TypeOf<typeof LocationType>;
export type StatesIndexStatus = t.TypeOf<typeof StatesIndexStatusType>;
export type DateRange = t.TypeOf<typeof DateRangeType>;
1 change: 1 addition & 0 deletions x-pack/legacy/plugins/uptime/common/runtime_types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ export * from './alerts';
export * from './common';
export * from './monitor';
export * from './overview_filters';
export * from './ping';
export * from './snapshot';
export * from './dynamic_settings';
Loading

0 comments on commit 5453c11

Please sign in to comment.