forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into align-dot-prefix-vali…
…dation-with-serverless
- Loading branch information
Showing
16 changed files
with
408 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 116128 | ||
summary: Add num docs and size to logsdb telemetry | ||
area: Logs | ||
type: enhancement | ||
issues: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
pr: 116259 | ||
summary: Fix `_type` deprecation on simulate pipeline API | ||
area: Ingest Node | ||
type: deprecation | ||
issues: [] | ||
deprecation: | ||
title: Document `_type` deprecated on simulate pipeline API | ||
area: REST API | ||
details: >- | ||
Passing a document with a `_type` property is deprecated in the `/_ingest/pipeline/{id}/_simulate` and | ||
`/_ingest/pipeline/_simulate` APIs. | ||
impact: >- | ||
Users should already have stopped using mapping types, which were deprecated in {es} 7. This deprecation warning | ||
will fire if they specify mapping types on documents pass to the simulate pipeline API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
162 changes: 162 additions & 0 deletions
162
server/src/main/java/org/elasticsearch/monitor/metrics/IndexModeStatsActionType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
package org.elasticsearch.monitor.metrics; | ||
|
||
import org.elasticsearch.action.ActionType; | ||
import org.elasticsearch.action.FailedNodeException; | ||
import org.elasticsearch.action.support.ActionFilters; | ||
import org.elasticsearch.action.support.nodes.BaseNodeResponse; | ||
import org.elasticsearch.action.support.nodes.BaseNodesRequest; | ||
import org.elasticsearch.action.support.nodes.BaseNodesResponse; | ||
import org.elasticsearch.action.support.nodes.TransportNodesAction; | ||
import org.elasticsearch.cluster.ClusterName; | ||
import org.elasticsearch.cluster.node.DiscoveryNode; | ||
import org.elasticsearch.cluster.service.ClusterService; | ||
import org.elasticsearch.common.io.stream.StreamInput; | ||
import org.elasticsearch.common.io.stream.StreamOutput; | ||
import org.elasticsearch.index.IndexMode; | ||
import org.elasticsearch.indices.IndicesService; | ||
import org.elasticsearch.injection.guice.Inject; | ||
import org.elasticsearch.tasks.Task; | ||
import org.elasticsearch.threadpool.ThreadPool; | ||
import org.elasticsearch.transport.TransportRequest; | ||
import org.elasticsearch.transport.TransportService; | ||
|
||
import java.io.IOException; | ||
import java.util.EnumMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public final class IndexModeStatsActionType extends ActionType<IndexModeStatsActionType.StatsResponse> { | ||
public static final IndexModeStatsActionType TYPE = new IndexModeStatsActionType(); | ||
|
||
private IndexModeStatsActionType() { | ||
super("cluster:monitor/nodes/index_mode_stats"); | ||
} | ||
|
||
public static final class StatsRequest extends BaseNodesRequest { | ||
public StatsRequest(String[] nodesIds) { | ||
super(nodesIds); | ||
} | ||
|
||
public StatsRequest(DiscoveryNode... concreteNodes) { | ||
super(concreteNodes); | ||
} | ||
} | ||
|
||
public static final class StatsResponse extends BaseNodesResponse<NodeResponse> { | ||
StatsResponse(ClusterName clusterName, List<NodeResponse> nodes, List<FailedNodeException> failures) { | ||
super(clusterName, nodes, failures); | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
assert false : "must be local"; | ||
throw new UnsupportedOperationException("must be local"); | ||
} | ||
|
||
@Override | ||
protected List<NodeResponse> readNodesFrom(StreamInput in) throws IOException { | ||
assert false : "must be local"; | ||
throw new UnsupportedOperationException("must be local"); | ||
} | ||
|
||
@Override | ||
protected void writeNodesTo(StreamOutput out, List<NodeResponse> nodes) throws IOException { | ||
assert false : "must be local"; | ||
throw new UnsupportedOperationException("must be local"); | ||
} | ||
|
||
public Map<IndexMode, IndexStats> stats() { | ||
final Map<IndexMode, IndexStats> stats = new EnumMap<>(IndexMode.class); | ||
for (IndexMode mode : IndexMode.values()) { | ||
stats.put(mode, new IndexStats()); | ||
} | ||
for (NodeResponse node : getNodes()) { | ||
for (Map.Entry<IndexMode, IndexStats> e : node.stats.entrySet()) { | ||
stats.get(e.getKey()).add(e.getValue()); | ||
} | ||
} | ||
return stats; | ||
} | ||
} | ||
|
||
public static final class NodeRequest extends TransportRequest { | ||
NodeRequest() { | ||
|
||
} | ||
|
||
NodeRequest(StreamInput in) throws IOException { | ||
super(in); | ||
} | ||
} | ||
|
||
public static class NodeResponse extends BaseNodeResponse { | ||
private final Map<IndexMode, IndexStats> stats; | ||
|
||
NodeResponse(DiscoveryNode node, Map<IndexMode, IndexStats> stats) { | ||
super(node); | ||
this.stats = stats; | ||
} | ||
|
||
NodeResponse(StreamInput in, DiscoveryNode node) throws IOException { | ||
super(in, node); | ||
stats = in.readMap(IndexMode::readFrom, IndexStats::new); | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
super.writeTo(out); | ||
out.writeMap(stats, (o, m) -> IndexMode.writeTo(m, o), (o, s) -> s.writeTo(o)); | ||
} | ||
} | ||
|
||
public static class TransportAction extends TransportNodesAction<StatsRequest, StatsResponse, NodeRequest, NodeResponse, Void> { | ||
private final IndicesService indicesService; | ||
|
||
@Inject | ||
public TransportAction( | ||
ClusterService clusterService, | ||
TransportService transportService, | ||
ActionFilters actionFilters, | ||
IndicesService indicesService | ||
) { | ||
super( | ||
TYPE.name(), | ||
clusterService, | ||
transportService, | ||
actionFilters, | ||
NodeRequest::new, | ||
transportService.getThreadPool().executor(ThreadPool.Names.MANAGEMENT) | ||
); | ||
this.indicesService = indicesService; | ||
} | ||
|
||
@Override | ||
protected StatsResponse newResponse(StatsRequest request, List<NodeResponse> nodeResponses, List<FailedNodeException> failures) { | ||
return new StatsResponse(ClusterName.DEFAULT, nodeResponses, failures); | ||
} | ||
|
||
@Override | ||
protected NodeRequest newNodeRequest(StatsRequest request) { | ||
return new NodeRequest(); | ||
} | ||
|
||
@Override | ||
protected NodeResponse newNodeResponse(StreamInput in, DiscoveryNode node) throws IOException { | ||
return new NodeResponse(in, node); | ||
} | ||
|
||
@Override | ||
protected NodeResponse nodeOperation(NodeRequest request, Task task) { | ||
return new NodeResponse(clusterService.localNode(), IndicesMetrics.getStatsWithoutCache(indicesService)); | ||
} | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
server/src/main/java/org/elasticsearch/monitor/metrics/IndexStats.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
package org.elasticsearch.monitor.metrics; | ||
|
||
import org.elasticsearch.common.io.stream.StreamInput; | ||
import org.elasticsearch.common.io.stream.StreamOutput; | ||
import org.elasticsearch.common.io.stream.Writeable; | ||
import org.elasticsearch.index.search.stats.SearchStats; | ||
import org.elasticsearch.index.shard.IndexingStats; | ||
|
||
import java.io.IOException; | ||
|
||
public final class IndexStats implements Writeable { | ||
int numIndices = 0; | ||
long numDocs = 0; | ||
long numBytes = 0; | ||
SearchStats.Stats search = new SearchStats().getTotal(); | ||
IndexingStats.Stats indexing = new IndexingStats().getTotal(); | ||
|
||
IndexStats() { | ||
|
||
} | ||
|
||
IndexStats(StreamInput in) throws IOException { | ||
this.numIndices = in.readVInt(); | ||
this.numDocs = in.readVLong(); | ||
this.numBytes = in.readVLong(); | ||
this.search = SearchStats.Stats.readStats(in); | ||
this.indexing = new IndexingStats.Stats(in); | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
out.writeVInt(numIndices); | ||
out.writeVLong(numDocs); | ||
out.writeVLong(numBytes); | ||
search.writeTo(out); | ||
indexing.writeTo(out); | ||
} | ||
|
||
void add(IndexStats other) { | ||
this.numIndices += other.numIndices; | ||
this.numDocs += other.numDocs; | ||
this.numBytes += other.numBytes; | ||
this.search.add(other.search); | ||
this.indexing.add(other.indexing); | ||
} | ||
|
||
public int numIndices() { | ||
return numIndices; | ||
} | ||
|
||
public long numDocs() { | ||
return numDocs; | ||
} | ||
|
||
public long numBytes() { | ||
return numBytes; | ||
} | ||
} |
Oops, something went wrong.