Skip to content

Commit

Permalink
Add telemetry metrics (#59526)
Browse files Browse the repository at this point in the history
  • Loading branch information
astefan committed Jul 14, 2020
1 parent 59f639a commit cf75299
Show file tree
Hide file tree
Showing 15 changed files with 881 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void writeTo(StreamOutput out) throws IOException {

@Override
public Version getMinimalSupportedVersion() {
return Version.V_7_7_0;
return Version.V_7_9_0;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class DataLoader {
private static final String TEST_DATA = "/test_data.json";
private static final String MAPPING = "/mapping-default.json";
static final String indexPrefix = "endgame";
static final String testIndexName = indexPrefix + "-1.4.0";
public static final String testIndexName = indexPrefix + "-1.4.0";

public static void main(String[] args) throws IOException {
try (RestClient client = RestClient.builder(new HttpHost("localhost", 9200)).build()) {
Expand All @@ -52,15 +52,23 @@ public static void main(String[] args) throws IOException {
}
}

@SuppressWarnings("unchecked")
protected static void loadDatasetIntoEs(RestHighLevelClient client,
public static void loadDatasetIntoEs(RestHighLevelClient client,
CheckedBiFunction<XContent, InputStream, XContentParser, IOException> p) throws IOException {

createTestIndex(client);
loadData(client, p);
}

private static void createTestIndex(RestHighLevelClient client) throws IOException {
CreateIndexRequest request = new CreateIndexRequest(testIndexName)
.mapping(Streams.readFully(DataLoader.class.getResourceAsStream(MAPPING)), XContentType.JSON);

client.indices().create(request, RequestOptions.DEFAULT);
}

@SuppressWarnings("unchecked")
private static void loadData(RestHighLevelClient client, CheckedBiFunction<XContent, InputStream, XContentParser, IOException> p)
throws IOException {
BulkRequest bulk = new BulkRequest();
bulk.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* 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.
*/

package org.elasticsearch.test.eql.stats;

import java.util.Locale;

public enum FeatureMetric {
SEQUENCE,
JOIN,
EVENT,
SEQUENCE_MAXSPAN,
SEQUENCE_UNTIL,
SEQUENCE_QUERIES_TWO,
SEQUENCE_QUERIES_THREE,
SEQUENCE_QUERIES_FOUR,
SEQUENCE_QUERIES_FIVE_OR_MORE,
JOIN_QUERIES_TWO,
JOIN_QUERIES_THREE,
JOIN_QUERIES_FOUR,
JOIN_QUERIES_FIVE_OR_MORE,
JOIN_UNTIL,
JOIN_KEYS_ONE,
JOIN_KEYS_TWO,
JOIN_KEYS_THREE,
JOIN_KEYS_FOUR,
JOIN_KEYS_FIVE_OR_MORE,
PIPE_HEAD,
PIPE_TAIL;

@Override
public String toString() {
return this.name().toLowerCase(Locale.ROOT);
}
}

0 comments on commit cf75299

Please sign in to comment.