elasticgraph-health_check 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/elastic_graph/health_check/config.rb +61 -30
- data/lib/elastic_graph/health_check/health_checker.rb +1 -1
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c745b703ae5f69a79db84741b912eb0113edf50164a2cf939dc737b42ff8f40b
|
4
|
+
data.tar.gz: 3a5b721cae159a75bb29a86bcaaf2649f372ea1b7866c74e48431475ea6481d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 456184d3ef41a91c6291edc745c93ec4b972a4802e8f0eba0ff64a1e5891641d8f2a45b742bee4c777fa3be1f2397d708f51b4b6c133c018385e888f2976c43e
|
7
|
+
data.tar.gz: 03a2c9179d38d9db02b4222d56925ebfd748d9a097fc5beaa2fe9b93846936def5e82b5af9f7df6ab5ab7ae9de4027077aa217baebbe0e3c046c6a8c1b72b565
|
@@ -6,43 +6,74 @@
|
|
6
6
|
#
|
7
7
|
# frozen_string_literal: true
|
8
8
|
|
9
|
+
require "elastic_graph/support/config"
|
10
|
+
|
9
11
|
module ElasticGraph
|
10
12
|
module HealthCheck
|
11
|
-
class Config < ::
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
13
|
+
class Config < Support::Config.define(:clusters_to_consider, :data_recency_checks)
|
14
|
+
json_schema at: "health_check",
|
15
|
+
optional: true,
|
16
|
+
description: "Configuration for health checks used by `elasticgraph-health_check`.",
|
17
|
+
properties: {
|
18
|
+
clusters_to_consider: {
|
19
|
+
description: "The list of clusters to perform datastore status health checks on. A `green` status maps to `healthy`, a " \
|
20
|
+
"`yellow` status maps to `degraded`, and a `red` status maps to `unhealthy`. The returned status is the minimum " \
|
21
|
+
"status from all clusters in the list (a `yellow` cluster and a `green` cluster will result in a `degraded` status).",
|
22
|
+
type: "array",
|
23
|
+
items: {type: "string", minLength: 1},
|
24
|
+
default: [], # : untyped
|
25
|
+
examples: [
|
26
|
+
[], # : untyped
|
27
|
+
["cluster-one", "cluster-two"]
|
28
|
+
]
|
29
|
+
},
|
30
|
+
data_recency_checks: {
|
31
|
+
description: "A map of types to perform recency checks on. If no new records for that type have been indexed within the specified " \
|
32
|
+
"period, a `degraded` status will be returned.",
|
33
|
+
type: "object",
|
34
|
+
patternProperties: {/^[A-Z]\w*$/.source => {
|
35
|
+
type: "object",
|
36
|
+
description: "Configuration for data recency checks on a specific type.",
|
37
|
+
examples: [{"timestamp_field" => "createdAt", "expected_max_recency_seconds" => 30}],
|
38
|
+
properties: {
|
39
|
+
expected_max_recency_seconds: {
|
40
|
+
type: "integer",
|
41
|
+
minimum: 0,
|
42
|
+
description: "The maximum number of seconds since the last record was indexed for this type before considering it stale.",
|
43
|
+
examples: [30, 300, 3600]
|
44
|
+
},
|
45
|
+
timestamp_field: {
|
46
|
+
type: "string",
|
47
|
+
minLength: 1,
|
48
|
+
description: "The name of the timestamp field to use for recency checks.",
|
49
|
+
examples: ["createdAt", "updatedAt"]
|
50
|
+
}
|
51
|
+
},
|
52
|
+
required: ["expected_max_recency_seconds", "timestamp_field"]
|
53
|
+
}},
|
54
|
+
default: {}, # : untyped
|
55
|
+
examples: [
|
56
|
+
{}, # : untyped
|
57
|
+
{"Widget" => {"timestamp_field" => "createdAt", "expected_max_recency_seconds" => 30}}
|
58
|
+
]
|
59
|
+
}
|
60
|
+
}
|
25
61
|
|
26
|
-
|
27
|
-
config_hash = config_hash.fetch("health_check") { return EMPTY }
|
62
|
+
private
|
28
63
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
64
|
+
def convert_values(clusters_to_consider:, data_recency_checks:)
|
65
|
+
{
|
66
|
+
clusters_to_consider: clusters_to_consider,
|
67
|
+
data_recency_checks: data_recency_checks.transform_values do |value_hash|
|
68
|
+
DataRecencyCheck.new(
|
69
|
+
expected_max_recency_seconds: value_hash.fetch("expected_max_recency_seconds"),
|
70
|
+
timestamp_field: value_hash.fetch("timestamp_field")
|
71
|
+
)
|
33
72
|
end
|
34
|
-
|
73
|
+
}
|
35
74
|
end
|
36
75
|
|
37
|
-
DataRecencyCheck = ::Data.define(:expected_max_recency_seconds, :timestamp_field)
|
38
|
-
# @implements DataRecencyCheck
|
39
|
-
def self.from(config_hash)
|
40
|
-
new(
|
41
|
-
expected_max_recency_seconds: config_hash.fetch("expected_max_recency_seconds"),
|
42
|
-
timestamp_field: config_hash.fetch("timestamp_field")
|
43
|
-
)
|
44
|
-
end
|
45
|
-
end
|
76
|
+
DataRecencyCheck = ::Data.define(:expected_max_recency_seconds, :timestamp_field)
|
46
77
|
end
|
47
78
|
end
|
48
79
|
end
|
@@ -21,7 +21,7 @@ module ElasticGraph
|
|
21
21
|
def self.build_from(graphql)
|
22
22
|
new(
|
23
23
|
schema: graphql.schema,
|
24
|
-
config: HealthCheck::Config.from_parsed_yaml(graphql.config.extension_settings),
|
24
|
+
config: HealthCheck::Config.from_parsed_yaml(graphql.config.extension_settings) || HealthCheck::Config.new,
|
25
25
|
datastore_search_router: graphql.datastore_search_router,
|
26
26
|
datastore_query_builder: graphql.datastore_query_builder,
|
27
27
|
datastore_clients_by_name: graphql.datastore_core.clients_by_name,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticgraph-health_check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Myron Marston
|
@@ -17,112 +17,112 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.0.
|
20
|
+
version: 1.0.1
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - '='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.0.
|
27
|
+
version: 1.0.1
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: elasticgraph-graphql
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - '='
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.0.
|
34
|
+
version: 1.0.1
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - '='
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 1.0.
|
41
|
+
version: 1.0.1
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: elasticgraph-support
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - '='
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 1.0.
|
48
|
+
version: 1.0.1
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - '='
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.0.
|
55
|
+
version: 1.0.1
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: elasticgraph-admin
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - '='
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 1.0.
|
62
|
+
version: 1.0.1
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - '='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 1.0.
|
69
|
+
version: 1.0.1
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: elasticgraph-elasticsearch
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - '='
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: 1.0.
|
76
|
+
version: 1.0.1
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - '='
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 1.0.
|
83
|
+
version: 1.0.1
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: elasticgraph-indexer
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - '='
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: 1.0.
|
90
|
+
version: 1.0.1
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - '='
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: 1.0.
|
97
|
+
version: 1.0.1
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: elasticgraph-opensearch
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - '='
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: 1.0.
|
104
|
+
version: 1.0.1
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - '='
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: 1.0.
|
111
|
+
version: 1.0.1
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: elasticgraph-schema_definition
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
116
|
- - '='
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: 1.0.
|
118
|
+
version: 1.0.1
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
123
|
- - '='
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: 1.0.
|
125
|
+
version: 1.0.1
|
126
126
|
email:
|
127
127
|
- myron@squareup.com
|
128
128
|
executables: []
|
@@ -142,10 +142,10 @@ licenses:
|
|
142
142
|
- MIT
|
143
143
|
metadata:
|
144
144
|
bug_tracker_uri: https://github.com/block/elasticgraph/issues
|
145
|
-
changelog_uri: https://github.com/block/elasticgraph/releases/tag/v1.0.
|
146
|
-
documentation_uri: https://block.github.io/elasticgraph/api-docs/v1.0.
|
145
|
+
changelog_uri: https://github.com/block/elasticgraph/releases/tag/v1.0.1
|
146
|
+
documentation_uri: https://block.github.io/elasticgraph/api-docs/v1.0.1/
|
147
147
|
homepage_uri: https://block.github.io/elasticgraph/
|
148
|
-
source_code_uri: https://github.com/block/elasticgraph/tree/v1.0.
|
148
|
+
source_code_uri: https://github.com/block/elasticgraph/tree/v1.0.1/elasticgraph-health_check
|
149
149
|
gem_category: extension
|
150
150
|
rdoc_options: []
|
151
151
|
require_paths:
|