-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Remove types from Monitoring plugin "backend" code #37745
Remove types from Monitoring plugin "backend" code #37745
Conversation
Pinging @elastic/es-core-features |
...ck/plugin/monitoring/src/main/resources/monitoring/watches/elasticsearch_cluster_status.json
Show resolved
Hide resolved
...onitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExportBulk.java
Outdated
Show resolved
Hide resolved
It looks like this may relate to #37442 - does this remove the types from the index templates for the monitoring indices, or just stop using them in the code? It looks like the latter. |
@gwbrown Thanks for linking to that issue. As it stands, this PR just removes types from the code and some watch definitions used by Monitoring. I'm happy to add the template changes to this PR as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ycombinator can you merge master into this PR? There are some test failures. (for example tests expecting a warning about type being used while that is no longer the case and malformed watches / index templates)
@@ -158,7 +158,6 @@ | |||
"add_to_alerts_index": { | |||
"index": { | |||
"index": ".monitoring-alerts-6", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
,
needs to be removed, otherwise this file can't be parsed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incidentally, @pickypg, do you recall why this particular watch doesn't set a document ID whereas all the other cluster alerts watches do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ycombinator It was briefly before the Task Manager stuff began in Kibana (and partly what led to it), but because you could restart multiple nodes in sequence and you didn't want to lose the history of all of them. The goal was if this index ever became a burden to just delete it and recreate it (anecdotally I've never seen the index with >500 documents) or move to index rollover.
.../java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporterResourceIntegTests.java
Outdated
Show resolved
Hide resolved
5a225be
to
ce9b502
Compare
CI failures are legitimate (related to this PR) and I'm able to reproduce them locally. Fixing... |
5ab0b23
to
2c754fa
Compare
@pickypg @martijnvg I’ve managed to make most of the tests pass. However I could use some help/guidance with the 2 monitoring unit tests that are still failing. They both fail with the same error:
As far as I can tell, the test template is structured correctly. If I try to manually create a template with the same structure in Console, it is accepted as valid. So I’m not sure why this error is being thrown. I’m probably overlooking something simple so I could use a second/third set of eyes here, please. Thank you! |
@ycombinator I've pushed a commit that fixes the tests. |
@ycombinator @gwbrown I've started a discussion offline about whether we should update the monitoring templates to be typeless as opposed to using the |
b222d22
to
ab9c7ae
Compare
ed06bac
to
8876abe
Compare
496f703
to
df335e3
Compare
@@ -81,11 +82,14 @@ private static BytesReference generateTemplateSource(final String name, final In | |||
.field("index.number_of_replicas", 0) | |||
.endObject() | |||
.startObject("mappings") | |||
.startObject("doc") | |||
// Still need use type, RestPutIndexTemplateAction#prepareRequestSource has logic that adds type if missing | |||
.startObject(MapperService.SINGLE_MAPPING_NAME) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jtibshirani In your offline discussion you mentioned:
Internal elasticsearch products like monitoring and security have been using 'doc' as a type name, and in particular create index templates using the custom type 'doc'.
Given that, should the argument to startObject
here be MapperService.SINGLE_MAPPING_NAME
, which would evaluate to _doc
or should it be "doc"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for now we should keep it the same as before (using doc
), until we come to a firm conclusion in that discussion to update the monitoring templates.
@pickypg @jtibshirani @martijnvg @jakelandis @gwbrown I think this PR is ready for another round of review now. Thanks! |
@@ -127,7 +126,7 @@ public void testMonitoringBulk() throws Exception { | |||
|
|||
final MonitoringBulkResponse bulkResponse = | |||
new MonitoringBulkRequestBuilder(client()) | |||
.add(system, null, new BytesArray(createBulkEntity().getBytes("UTF-8")), XContentType.JSON, | |||
.add(system, "monitoring_data_type", new BytesArray(createBulkEntity().getBytes("UTF-8")), XContentType.JSON, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why add in a default type here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pickypg can correct me if I'm wrong but I believe this argument is the monitoring data type, e.g. beats_stats
or logstash_state
, etc. that are sent in to the POST _xpack/monitoring/_bulk
API. So I wanted to be more explicit about what the type is, so we don't confuse it in the future with _type
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are. We use that as a mechanism for routing the document to the right index.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, i see now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for doing this !
…-lease-expiration * elastic/master: (24 commits) Add support for API keys to access Elasticsearch (elastic#38291) Add typless client side GetIndexRequest calls and response class (elastic#37778) Limit token expiry to 1 hour maximum (elastic#38244) add docs saying mixed-cluster ILM is not supported (elastic#37954) Skip unsupported languages for tests (elastic#38328) Deprecate `_type` in simulate pipeline requests (elastic#37949) Mute testCannotShrinkLeaderIndex (elastic#38374) Tighten mapping syncing in ccr remote restore (elastic#38071) Add test for `PutFollowAction` on a closed index (elastic#38236) Fix SSLContext pinning to TLSV1.2 in reload tests (elastic#38341) Mute RareClusterStateIT.testDelayedMappingPropagationOnReplica (elastic#38357) Deprecate types in rollover index API (elastic#38039) Types removal - fix FullClusterRestartIT warning expectations (elastic#38310) Fix ILM explain response to allow unknown fields (elastic#38054) Mute testFollowIndexAndCloseNode (elastic#38360) Docs: Drop inline callout from scroll example (elastic#38340) Deprecate HLRC security methods (elastic#37883) Remove types from Monitoring plugin "backend" code (elastic#37745) Add Composite to AggregationBuilders (elastic#38207) Clarify slow cluster-state log messages (elastic#38302) ...
This PR removes the use of document types from the monitoring exporters and template + watches setup code.
It does not remove the notion of types from the monitoring bulk API endpoint "front end" code as that code will eventually just go away in 8.0 and be replaced with Beats as collectors/shippers directly to the monitoring cluster.