Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose agg usage in Feature Usage API #55732

Merged
merged 21 commits into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c0a7dd4
Expose agg usage in Feature Usage API
imotov Apr 24, 2020
1cc437c
Refactor to include non value sources aggregations
imotov Apr 24, 2020
9c8510a
Fix reported values source type for parent and children aggs
imotov Apr 27, 2020
f4ab1e7
Merge remote-tracking branch 'elastic/master' into issue-53746-aggs-u…
imotov Apr 27, 2020
6207497
Refactor SearchModule constructor
imotov Apr 27, 2020
b8e7051
Fix subtype in TTest and IPRanges
imotov Apr 27, 2020
530a5dd
Fix more subtypes in aggs that don't register themselves
imotov Apr 27, 2020
39a9bb3
Fix doc tests
imotov Apr 27, 2020
980ca33
Fix docs
imotov Apr 27, 2020
2eae809
Fix ScriptedMetricAggregatorTests
imotov Apr 27, 2020
5c0393a
Merge remote-tracking branch 'elastic/master' into issue-53746-aggs-u…
imotov Apr 28, 2020
4c6b4dd
Fix compilation issues after merge
imotov Apr 28, 2020
4a76f01
Fix merge fallout
imotov Apr 28, 2020
2d0e952
Merge remote-tracking branch 'elastic/master' into issue-53746-aggs-u…
imotov Apr 28, 2020
424884a
This gets stale quickly...
imotov Apr 28, 2020
ca2fb25
Address review comments
imotov Apr 28, 2020
68a2eb5
Fix tests that were missing proper agg registration in the search module
imotov Apr 28, 2020
c9bed39
Fix ScriptedMetricAggregatorTests
imotov Apr 28, 2020
6f0c4fd
Address review comments
imotov Apr 29, 2020
439aada
Merge remote-tracking branch 'elastic/master' into issue-53746-aggs-u…
imotov Apr 29, 2020
b169633
Merge branch 'master' into issue-53746-aggs-usage
elasticmachine Apr 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor SearchModule constructor
  • Loading branch information
imotov committed Apr 27, 2020
commit 62074972fcae3b277cdcd3c7b8ee2d78a0b471a4
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.elasticsearch.usage.UsageService;
import org.junit.AfterClass;
import org.junit.Before;

Expand Down Expand Up @@ -144,7 +145,8 @@ protected interface AsyncMethodNoRequest<Response> {

private static class HighLevelClient extends RestHighLevelClient {
private HighLevelClient(RestClient restClient) {
super(restClient, (client) -> {}, new SearchModule(Settings.EMPTY, Collections.emptyList()).getNamedXContents());
super(restClient, (client) -> {}, new SearchModule(Settings.EMPTY, Collections.emptyList(),
new UsageService()).getNamedXContents());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -1085,7 +1086,7 @@ public void testSetUpgradeMode() {
@Override
protected NamedXContentRegistry xContentRegistry() {
List<NamedXContentRegistry.Entry> namedXContent = new ArrayList<>();
namedXContent.addAll(new SearchModule(Settings.EMPTY, Collections.emptyList()).getNamedXContents());
namedXContent.addAll(new SearchModule(Settings.EMPTY, Collections.emptyList(), new UsageService()).getNamedXContents());
namedXContent.addAll(new MlDataFrameAnalysisNamedXContentProvider().getNamedXContentParsers());
namedXContent.addAll(new MlEvaluationNamedXContentProvider().getNamedXContentParsers());
namedXContent.addAll(new MlInferenceNamedXContentProvider().getNamedXContentParsers());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.util.Collections;
Expand All @@ -60,7 +61,7 @@ public class TransformRequestConvertersTests extends ESTestCase {

@Override
protected NamedXContentRegistry xContentRegistry() {
SearchModule searchModule = new SearchModule(Settings.EMPTY, Collections.emptyList());
SearchModule searchModule = new SearchModule(Settings.EMPTY, Collections.emptyList(), new UsageService());
List<NamedXContentRegistry.Entry> namedXContents = searchModule.getNamedXContents();
namedXContents.addAll(new TransformNamedXContentProvider().getNamedXContentParsers());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.elasticsearch.rest.action.RestActions;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -67,7 +68,7 @@ protected void assertInstances(QueryBuilder serverInstance, CountRequest clientT

@Override
protected NamedXContentRegistry xContentRegistry() {
return new NamedXContentRegistry(new SearchModule(Settings.EMPTY, List.of()).getNamedXContents());
return new NamedXContentRegistry(new SearchModule(Settings.EMPTY, List.of(), new UsageService()).getNamedXContents());
}

public void testIllegalArguments() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.util.List;
Expand Down Expand Up @@ -85,6 +86,6 @@ protected void assertInstances(org.elasticsearch.xpack.eql.action.EqlSearchReque

@Override
protected NamedXContentRegistry xContentRegistry() {
return new NamedXContentRegistry(new SearchModule(Settings.EMPTY, List.of()).getNamedXContents());
return new NamedXContentRegistry(new SearchModule(Settings.EMPTY, List.of(), new UsageService()).getNamedXContents());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.AbstractXContentTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -77,7 +78,7 @@ protected Predicate<String> getRandomFieldsExcludeFilter() {
@Override
protected NamedXContentRegistry xContentRegistry() {
List<NamedXContentRegistry.Entry> namedXContent = new ArrayList<>();
namedXContent.addAll(new SearchModule(Settings.EMPTY, Collections.emptyList()).getNamedXContents());
namedXContent.addAll(new SearchModule(Settings.EMPTY, Collections.emptyList(), new UsageService()).getNamedXContents());
namedXContent.addAll(new MlEvaluationNamedXContentProvider().getNamedXContentParsers());
return new NamedXContentRegistry(namedXContent);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.AbstractXContentTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -67,7 +68,7 @@ protected boolean supportsUnknownFields() {
@Override
protected NamedXContentRegistry xContentRegistry() {
List<NamedXContentRegistry.Entry> namedXContent = new ArrayList<>();
namedXContent.addAll(new SearchModule(Settings.EMPTY, Collections.emptyList()).getNamedXContents());
namedXContent.addAll(new SearchModule(Settings.EMPTY, Collections.emptyList(), new UsageService()).getNamedXContents());
namedXContent.addAll(new MlDataFrameAnalysisNamedXContentProvider().getNamedXContentParsers());
return new NamedXContentRegistry(namedXContent);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
import org.elasticsearch.test.AbstractXContentTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.time.Instant;
Expand Down Expand Up @@ -96,7 +97,7 @@ protected Predicate<String> getRandomFieldsExcludeFilter() {
@Override
protected NamedXContentRegistry xContentRegistry() {
List<NamedXContentRegistry.Entry> namedXContent = new ArrayList<>();
namedXContent.addAll(new SearchModule(Settings.EMPTY, Collections.emptyList()).getNamedXContents());
namedXContent.addAll(new SearchModule(Settings.EMPTY, Collections.emptyList(), new UsageService()).getNamedXContents());
namedXContent.addAll(new MlDataFrameAnalysisNamedXContentProvider().getNamedXContentParsers());
return new NamedXContentRegistry(namedXContent);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
import org.elasticsearch.test.AbstractXContentTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.util.function.Predicate;
Expand Down Expand Up @@ -73,7 +74,7 @@ protected DataFrameAnalyticsSource createTestInstance() {

@Override
protected NamedXContentRegistry xContentRegistry() {
SearchModule searchModule = new SearchModule(Settings.EMPTY, emptyList());
SearchModule searchModule = new SearchModule(Settings.EMPTY, emptyList(), new UsageService());
return new NamedXContentRegistry(searchModule.getNamedXContents());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.AbstractXContentTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;

Expand Down Expand Up @@ -56,7 +57,7 @@ protected boolean supportsUnknownFields() {

@Override
protected NamedXContentRegistry xContentRegistry() {
SearchModule searchModule = new SearchModule(Settings.EMPTY, emptyList());
SearchModule searchModule = new SearchModule(Settings.EMPTY, emptyList(), new UsageService());
return new NamedXContentRegistry(searchModule.getNamedXContents());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -105,7 +106,7 @@ protected NamedXContentRegistry xContentRegistry() {
namedXContent.addAll(Collections.singletonList(new NamedXContentRegistry.Entry(NamedXContentObject.class,
new ParseField("my_named_object"),
(p, c) -> NamedTestObject.PARSER.apply(p, null))));
namedXContent.addAll(new SearchModule(Settings.EMPTY, Collections.emptyList()).getNamedXContents());
namedXContent.addAll(new SearchModule(Settings.EMPTY, Collections.emptyList(), new UsageService()).getNamedXContents());
return new NamedXContentRegistry(namedXContent);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.AbstractXContentTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.time.Instant;
Expand Down Expand Up @@ -91,7 +92,7 @@ protected TrainedModelConfig createTestInstance() {
protected NamedXContentRegistry xContentRegistry() {
List<NamedXContentRegistry.Entry> namedXContent = new ArrayList<>();
namedXContent.addAll(new MlInferenceNamedXContentProvider().getNamedXContentParsers());
namedXContent.addAll(new SearchModule(Settings.EMPTY, Collections.emptyList()).getNamedXContents());
namedXContent.addAll(new SearchModule(Settings.EMPTY, Collections.emptyList(), new UsageService()).getNamedXContents());
return new NamedXContentRegistry(namedXContent);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.AbstractXContentTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -84,7 +85,7 @@ protected TrainedModelDefinition createTestInstance() {
protected NamedXContentRegistry xContentRegistry() {
List<NamedXContentRegistry.Entry> namedXContent = new ArrayList<>();
namedXContent.addAll(new MlInferenceNamedXContentProvider().getNamedXContentParsers());
namedXContent.addAll(new SearchModule(Settings.EMPTY, Collections.emptyList()).getNamedXContents());
namedXContent.addAll(new SearchModule(Settings.EMPTY, Collections.emptyList(), new UsageService()).getNamedXContents());
return new NamedXContentRegistry(namedXContent);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.AbstractXContentTestCase;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -103,7 +104,7 @@ protected Ensemble createTestInstance() {
protected NamedXContentRegistry xContentRegistry() {
List<NamedXContentRegistry.Entry> namedXContent = new ArrayList<>();
namedXContent.addAll(new MlInferenceNamedXContentProvider().getNamedXContentParsers());
namedXContent.addAll(new SearchModule(Settings.EMPTY, Collections.emptyList()).getNamedXContents());
namedXContent.addAll(new SearchModule(Settings.EMPTY, Collections.emptyList(), new UsageService()).getNamedXContents());
return new NamedXContentRegistry(namedXContent);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.AbstractXContentTestCase;
import org.elasticsearch.usage.UsageService;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -256,7 +257,7 @@ private static AnalysisConfig.Builder createValidCategorizationConfig() {

@Override
protected NamedXContentRegistry xContentRegistry() {
SearchModule searchModule = new SearchModule(Settings.EMPTY, Collections.emptyList());
SearchModule searchModule = new SearchModule(Settings.EMPTY, Collections.emptyList(), new UsageService());
return new NamedXContentRegistry(searchModule.getNamedXContents());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.AbstractXContentTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -171,7 +172,7 @@ public static Job createRandomizedJob() {

@Override
protected NamedXContentRegistry xContentRegistry() {
SearchModule searchModule = new SearchModule(Settings.EMPTY, Collections.emptyList());
SearchModule searchModule = new SearchModule(Settings.EMPTY, Collections.emptyList(), new UsageService());
return new NamedXContentRegistry(searchModule.getNamedXContents());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -78,7 +79,7 @@ private static void toXContent(GetTransformResponse response, XContentBuilder bu

@Override
protected NamedXContentRegistry xContentRegistry() {
SearchModule searchModule = new SearchModule(Settings.EMPTY, Collections.emptyList());
SearchModule searchModule = new SearchModule(Settings.EMPTY, Collections.emptyList(), new UsageService());
List<NamedXContentRegistry.Entry> namedXContents = searchModule.getNamedXContents();
namedXContents.addAll(new TransformNamedXContentProvider().getNamedXContentParsers());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.AbstractXContentTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.util.Collections;
Expand Down Expand Up @@ -55,7 +56,7 @@ protected boolean supportsUnknownFields() {

@Override
protected NamedXContentRegistry xContentRegistry() {
SearchModule searchModule = new SearchModule(Settings.EMPTY, Collections.emptyList());
SearchModule searchModule = new SearchModule(Settings.EMPTY, Collections.emptyList(), new UsageService());
List<NamedXContentRegistry.Entry> namedXContents = searchModule.getNamedXContents();
namedXContents.addAll(new TransformNamedXContentProvider().getNamedXContentParsers());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.AbstractXContentTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.util.Collections;
Expand Down Expand Up @@ -71,7 +72,7 @@ protected boolean supportsUnknownFields() {

@Override
protected NamedXContentRegistry xContentRegistry() {
SearchModule searchModule = new SearchModule(Settings.EMPTY, Collections.emptyList());
SearchModule searchModule = new SearchModule(Settings.EMPTY, Collections.emptyList(), new UsageService());
List<NamedXContentRegistry.Entry> namedXContents = searchModule.getNamedXContents();
namedXContents.addAll(new TransformNamedXContentProvider().getNamedXContentParsers());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.util.Collections;
Expand Down Expand Up @@ -54,7 +55,7 @@ private static void toXContent(UpdateTransformResponse response, XContentBuilder

@Override
protected NamedXContentRegistry xContentRegistry() {
SearchModule searchModule = new SearchModule(Settings.EMPTY, Collections.emptyList());
SearchModule searchModule = new SearchModule(Settings.EMPTY, Collections.emptyList(), new UsageService());
List<NamedXContentRegistry.Entry> namedXContents = searchModule.getNamedXContents();
namedXContents.addAll(new TransformNamedXContentProvider().getNamedXContentParsers());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.AbstractXContentTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.util.Collections;
Expand Down Expand Up @@ -69,7 +70,7 @@ protected boolean supportsUnknownFields() {

@Override
protected NamedXContentRegistry xContentRegistry() {
SearchModule searchModule = new SearchModule(Settings.EMPTY, Collections.emptyList());
SearchModule searchModule = new SearchModule(Settings.EMPTY, Collections.emptyList(), new UsageService());
List<NamedXContentRegistry.Entry> namedXContents = searchModule.getNamedXContents();
namedXContents.addAll(new TransformNamedXContentProvider().getNamedXContentParsers());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.AbstractXContentTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;

Expand Down Expand Up @@ -56,7 +57,7 @@ protected boolean supportsUnknownFields() {

@Override
protected NamedXContentRegistry xContentRegistry() {
SearchModule searchModule = new SearchModule(Settings.EMPTY, emptyList());
SearchModule searchModule = new SearchModule(Settings.EMPTY, emptyList(), new UsageService());
return new NamedXContentRegistry(searchModule.getNamedXContents());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.AbstractXContentTestCase;
import org.elasticsearch.usage.UsageService;

import java.io.IOException;
import java.util.function.Predicate;
Expand Down Expand Up @@ -62,7 +63,7 @@ protected SourceConfig createTestInstance() {

@Override
protected NamedXContentRegistry xContentRegistry() {
SearchModule searchModule = new SearchModule(Settings.EMPTY, emptyList());
SearchModule searchModule = new SearchModule(Settings.EMPTY, emptyList(), new UsageService());
return new NamedXContentRegistry(searchModule.getNamedXContents());
}
}
Loading