Skip to content

Commit 9cfd5fb

Browse files
authored
Validated GeoIP Stats API (#392)
1 parent 7eb7257 commit 9cfd5fb

File tree

5 files changed

+204
-60
lines changed

5 files changed

+204
-60
lines changed

output/schema/schema.json

Lines changed: 150 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -93079,39 +93079,15 @@
9307993079
}
9308093080
},
9308193081
{
93082-
"attachedBehaviors": [
93083-
"CommonQueryParameters"
93084-
],
93085-
"body": {
93086-
"kind": "properties",
93087-
"properties": [
93088-
{
93089-
"name": "stub_c",
93090-
"required": true,
93091-
"type": {
93092-
"kind": "instance_of",
93093-
"type": {
93094-
"name": "integer",
93095-
"namespace": "_types"
93096-
}
93097-
}
93098-
}
93099-
]
93100-
},
93101-
"inherits": {
93102-
"type": {
93103-
"name": "RequestBase",
93104-
"namespace": "_types"
93105-
}
93106-
},
93107-
"kind": "request",
93082+
"kind": "interface",
9310893083
"name": {
93109-
"name": "Request",
93084+
"name": "GeoIpDownloadStatistics",
9311093085
"namespace": "ingest.geo_ip_stats"
9311193086
},
93112-
"path": [
93087+
"properties": [
9311393088
{
93114-
"name": "stub_b",
93089+
"description": "Total number of successful database downloads.",
93090+
"name": "successful_downloads",
9311593091
"required": true,
9311693092
"type": {
9311793093
"kind": "instance_of",
@@ -93120,11 +93096,46 @@
9312093096
"namespace": "_types"
9312193097
}
9312293098
}
93123-
}
93124-
],
93125-
"query": [
93099+
},
9312693100
{
93127-
"name": "stub_a",
93101+
"description": "Total number of failed database downloads.",
93102+
"name": "failed_downloads",
93103+
"required": true,
93104+
"type": {
93105+
"kind": "instance_of",
93106+
"type": {
93107+
"name": "integer",
93108+
"namespace": "_types"
93109+
}
93110+
}
93111+
},
93112+
{
93113+
"description": "Total milliseconds spent downloading databases.",
93114+
"name": "total_download_time",
93115+
"required": true,
93116+
"type": {
93117+
"kind": "instance_of",
93118+
"type": {
93119+
"name": "integer",
93120+
"namespace": "_types"
93121+
}
93122+
}
93123+
},
93124+
{
93125+
"description": "Current number of databases available for use.",
93126+
"name": "database_count",
93127+
"required": true,
93128+
"type": {
93129+
"kind": "instance_of",
93130+
"type": {
93131+
"name": "integer",
93132+
"namespace": "_types"
93133+
}
93134+
}
93135+
},
93136+
{
93137+
"description": "Total number of database updates skipped.",
93138+
"name": "skipped_updates",
9312893139
"required": true,
9312993140
"type": {
9313093141
"kind": "instance_of",
@@ -93136,18 +93147,121 @@
9313693147
}
9313793148
]
9313893149
},
93150+
{
93151+
"kind": "interface",
93152+
"name": {
93153+
"name": "GeoIpNodeDatabaseName",
93154+
"namespace": "ingest.geo_ip_stats"
93155+
},
93156+
"properties": [
93157+
{
93158+
"description": "Name of the database.",
93159+
"name": "name",
93160+
"required": true,
93161+
"type": {
93162+
"kind": "instance_of",
93163+
"type": {
93164+
"name": "Name",
93165+
"namespace": "_types"
93166+
}
93167+
}
93168+
}
93169+
]
93170+
},
93171+
{
93172+
"description": "Downloaded databases for the node. The field key is the node ID.",
93173+
"kind": "interface",
93174+
"name": {
93175+
"name": "GeoIpNodeDatabases",
93176+
"namespace": "ingest.geo_ip_stats"
93177+
},
93178+
"properties": [
93179+
{
93180+
"description": "Downloaded databases for the node.",
93181+
"name": "databases",
93182+
"required": true,
93183+
"type": {
93184+
"kind": "array_of",
93185+
"value": {
93186+
"kind": "instance_of",
93187+
"type": {
93188+
"name": "GeoIpNodeDatabaseName",
93189+
"namespace": "ingest.geo_ip_stats"
93190+
}
93191+
}
93192+
}
93193+
},
93194+
{
93195+
"description": "Downloaded database files, including related license files. Elasticsearch stores these files in the node’s temporary directory: $ES_TMPDIR/geoip-databases/<node_id>.",
93196+
"name": "files_in_temp",
93197+
"required": true,
93198+
"type": {
93199+
"kind": "array_of",
93200+
"value": {
93201+
"kind": "instance_of",
93202+
"type": {
93203+
"name": "string",
93204+
"namespace": "internal"
93205+
}
93206+
}
93207+
}
93208+
}
93209+
]
93210+
},
93211+
{
93212+
"attachedBehaviors": [
93213+
"CommonQueryParameters"
93214+
],
93215+
"inherits": {
93216+
"type": {
93217+
"name": "RequestBase",
93218+
"namespace": "_types"
93219+
}
93220+
},
93221+
"kind": "request",
93222+
"name": {
93223+
"name": "Request",
93224+
"namespace": "ingest.geo_ip_stats"
93225+
},
93226+
"path": [],
93227+
"query": []
93228+
},
9313993229
{
9314093230
"body": {
9314193231
"kind": "properties",
9314293232
"properties": [
9314393233
{
93144-
"name": "stub",
93234+
"description": "Download statistics for all GeoIP2 databases.",
93235+
"name": "stats",
9314593236
"required": true,
9314693237
"type": {
9314793238
"kind": "instance_of",
9314893239
"type": {
93149-
"name": "integer",
93150-
"namespace": "_types"
93240+
"name": "GeoIpDownloadStatistics",
93241+
"namespace": "ingest.geo_ip_stats"
93242+
}
93243+
}
93244+
},
93245+
{
93246+
"description": "Downloaded GeoIP2 databases for each node.",
93247+
"name": "nodes",
93248+
"required": true,
93249+
"type": {
93250+
"key": {
93251+
"kind": "instance_of",
93252+
"type": {
93253+
"name": "Id",
93254+
"namespace": "_types"
93255+
}
93256+
},
93257+
"kind": "dictionary_of",
93258+
"singleKey": false,
93259+
"value": {
93260+
"kind": "instance_of",
93261+
"type": {
93262+
"name": "GeoIpNodeDatabases",
93263+
"namespace": "ingest.geo_ip_stats"
93264+
}
9315193265
}
9315293266
}
9315393267
}

output/schema/validation-errors.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -492,12 +492,6 @@
492492
],
493493
"response": []
494494
},
495-
"ingest.geo_ip_stats": {
496-
"request": [
497-
"Endpoint has \"@stability: TODO"
498-
],
499-
"response": []
500-
},
501495
"license.post_start_trial": {
502496
"request": [
503497
"Endpoint has \"@stability: TODO"

output/typescript/types.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9343,16 +9343,29 @@ export interface IngestDeletePipelineRequest extends RequestBase {
93439343

93449344
export interface IngestDeletePipelineResponse extends AcknowledgedResponseBase {}
93459345

9346+
export interface IngestGeoIpStatsGeoIpDownloadStatistics {
9347+
successful_downloads: integer
9348+
failed_downloads: integer
9349+
total_download_time: integer
9350+
database_count: integer
9351+
skipped_updates: integer
9352+
}
9353+
9354+
export interface IngestGeoIpStatsGeoIpNodeDatabaseName {
9355+
name: Name
9356+
}
9357+
9358+
export interface IngestGeoIpStatsGeoIpNodeDatabases {
9359+
databases: IngestGeoIpStatsGeoIpNodeDatabaseName[]
9360+
files_in_temp: string[]
9361+
}
9362+
93469363
export interface IngestGeoIpStatsRequest extends RequestBase {
9347-
stub_b: integer
9348-
stub_a: integer
9349-
body?: {
9350-
stub_c: integer
9351-
}
93529364
}
93539365

93549366
export interface IngestGeoIpStatsResponse {
9355-
stub: integer
9367+
stats: IngestGeoIpStatsGeoIpDownloadStatistics
9368+
nodes: Record<Id, IngestGeoIpStatsGeoIpNodeDatabases>
93569369
}
93579370

93589371
export interface IngestGetPipelineRequest extends RequestBase {

specification/ingest/geo_ip_stats/IngestGeoIpStatsRequest.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,4 @@ import { integer } from '@_types/Numeric'
2525
* @since 7.13.0
2626
* @stability TODO
2727
*/
28-
export interface Request extends RequestBase {
29-
path_parts?: {
30-
stub_b: integer
31-
}
32-
query_parameters?: {
33-
stub_a: integer
34-
}
35-
body?: {
36-
stub_c: integer
37-
}
38-
}
28+
export interface Request extends RequestBase {}

specification/ingest/geo_ip_stats/IngestGeoIpStatsResponse.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,41 @@
1717
* under the License.
1818
*/
1919

20+
import { Dictionary } from '@spec_utils/Dictionary'
21+
import { Id, Name } from '@_types/common'
2022
import { integer } from '@_types/Numeric'
2123

2224
export class Response {
23-
body: { stub: integer }
25+
body: {
26+
/** Download statistics for all GeoIP2 databases. */
27+
stats: GeoIpDownloadStatistics
28+
/** Downloaded GeoIP2 databases for each node. */
29+
nodes: Dictionary<Id, GeoIpNodeDatabases>
30+
}
31+
}
32+
33+
export class GeoIpDownloadStatistics {
34+
/** Total number of successful database downloads. */
35+
successful_downloads: integer
36+
/** Total number of failed database downloads. */
37+
failed_downloads: integer
38+
/** Total milliseconds spent downloading databases. */
39+
total_download_time: integer
40+
/** Current number of databases available for use. */
41+
database_count: integer
42+
/** Total number of database updates skipped. */
43+
skipped_updates: integer
44+
}
45+
46+
/** Downloaded databases for the node. The field key is the node ID. */
47+
export class GeoIpNodeDatabases {
48+
/** Downloaded databases for the node. */
49+
databases: GeoIpNodeDatabaseName[]
50+
/** Downloaded database files, including related license files. Elasticsearch stores these files in the node’s temporary directory: $ES_TMPDIR/geoip-databases/<node_id>. */
51+
files_in_temp: string[]
52+
}
53+
54+
export class GeoIpNodeDatabaseName {
55+
/** Name of the database. */
56+
name: Name
2457
}

0 commit comments

Comments
 (0)