File tree Expand file tree Collapse file tree 4 files changed +66
-3
lines changed
main/java/org/compuscene/metrics/prometheus
yamlRestTest/resources/rest-api-spec/test Expand file tree Collapse file tree 4 files changed +66
-3
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,13 @@ To disable exporting cluster settings use:
145145prometheus.cluster.settings: false
146146```
147147
148+ #### Snapshot metrics
149+
150+ To enable exporting snapshot metrics use:
151+ ```
152+ prometheus.snapshots: true
153+ ```
154+
148155#### Nodes filter
149156
150157Metrics include statistics about individual OpenSearch nodes.
Original file line number Diff line number Diff line change 1+ import org.opensearch.gradle.PropertyNormalization
12import org.opensearch.gradle.test.RestIntegTestTask
23
34import java.util.regex.Matcher
@@ -124,8 +125,13 @@ tasks.named("check").configure { dependsOn(integTest) }
124125// Temporary disable task :testingConventions
125126testingConventions. enabled = false
126127
128+ // Directory for snapshot repository
129+ File repositoryDir = new File (project. buildDir, " shared-repository" )
130+
127131testClusters. all {
128132 numberOfNodes = 2
133+ // Configuring repo path for 'fs' type snapshot repository
134+ setting ' path.repo' , " ${ repositoryDir.absolutePath} " , PropertyNormalization . IGNORE_VALUE
129135
130136 // It seems cluster name can not be customized here. It gives an error:
131137 // Testclusters does not allow the following settings to be changed:[cluster.name] for node{::yamlRestTest-0}
Original file line number Diff line number Diff line change @@ -55,23 +55,23 @@ public enum INDEX_FILTER_OPTIONS {
5555 static String PROMETHEUS_SELECTED_OPTION_KEY = "prometheus.indices_filter.selected_option" ;
5656
5757 /**
58- * This setting is used configure weather to expose cluster settings metrics or not. The default value is true.
58+ * This setting is used configure whether to expose cluster settings metrics or not. The default value is true.
5959 * Can be configured in opensearch.yml file or update dynamically under key {@link #PROMETHEUS_CLUSTER_SETTINGS_KEY}.
6060 */
6161 public static final Setting <Boolean > PROMETHEUS_CLUSTER_SETTINGS =
6262 Setting .boolSetting (PROMETHEUS_CLUSTER_SETTINGS_KEY , true ,
6363 Setting .Property .Dynamic , Setting .Property .NodeScope );
6464
6565 /**
66- * This setting is used configure weather to expose low level index metrics or not. The default value is true.
66+ * This setting is used configure whether to expose low level index metrics or not. The default value is true.
6767 * Can be configured in opensearch.yml file or update dynamically under key {@link #PROMETHEUS_INDICES_KEY}.
6868 */
6969 public static final Setting <Boolean > PROMETHEUS_INDICES =
7070 Setting .boolSetting (PROMETHEUS_INDICES_KEY , true ,
7171 Setting .Property .Dynamic , Setting .Property .NodeScope );
7272
7373 /**
74- * This setting is used configure weather to expose snapshot metrics or not. The default value is false.
74+ * This setting is used configure whether to expose snapshot metrics or not. The default value is false.
7575 * Can be configured in opensearch.yml file or update dynamically under key {@link #PROMETHEUS_SNAPSHOTS_KEY}.
7676 */
7777 public static final Setting <Boolean > PROMETHEUS_SNAPSHOTS =
Original file line number Diff line number Diff line change 1+ ---
2+ " Verify snapshots metrics enabled " :
3+
4+ # Create 'fs' snapshot repository
5+ - do :
6+ snapshot.create_repository :
7+ repository : test_repo_get_1
8+ body :
9+ type : fs
10+ settings :
11+ location : " test_repo_get_1_loc"
12+
13+ - do :
14+ snapshot.get_repository : { }
15+
16+ - is_true : test_repo_get_1
17+
18+ # Enable snapshots metrics
19+ - do :
20+ cluster.put_settings :
21+ body :
22+ persistent :
23+ prometheus.snapshots : " true"
24+ flat_settings : true
25+
26+ - match : { persistent: { prometheus.snapshots: "true" } }
27+
28+ # Create snapshot
29+ - do :
30+ snapshot.create :
31+ repository : test_repo_get_1
32+ snapshot : test_snapshot_1
33+ wait_for_completion : true
34+
35+ - match : { snapshot.snapshot: test_snapshot_1 }
36+ - match : { snapshot.state : SUCCESS }
37+
38+ # Fetch and verify metrics
39+ - do :
40+ prometheus.metrics : {}
41+
42+ - match :
43+ $body : |
44+ /.*
45+ \# \s* HELP \s+ opensearch_min_snapshot_age \s+.*\n
46+ \# \s* TYPE \s+ opensearch_min_snapshot_age \s+ gauge\n
47+ opensearch_min_snapshot_age\{
48+ cluster="yamlRestTest",sm_policy="adhoc",
49+ \}\s+\d+\.\d+\n
50+ .*/
You can’t perform that action at this time.
0 commit comments