Module org.elasticsearch.compute
Class MetricsInfoOperator
java.lang.Object
org.elasticsearch.compute.operator.MetricsInfoOperator
- All Implemented Interfaces:
Closeable,AutoCloseable,Operator,org.elasticsearch.core.Releasable
Operator for the ESQL
METRICS_INFO command.
Operates in two modes, mirroring the two-phase INITIAL/FINAL pattern used by aggregations:
- INITIAL (data nodes) – created via
MetricsInfoOperator.Factory. Expects deduplicated input (one row per_tsid) from an upstreamDistinctByOperator, with blocks for_timeseries_metadataand_index. Groups metrics by (metricName, dataStreamName) so that different backing indices of the same data stream share one entry. Conflicting unit/metric_type/field_type values across backing indices become multi-valued. Dimension keys are assigned only to the metrics that actually appeared in each tsid's metadata. Produces one row per distinct metric signature within the local shards. - FINAL (coordinator) – created via
MetricsInfoOperator.FinalFactory. Receives the 6-column output pages produced by INITIAL instances on each data node and merges rows that share the sameMetricsInfoOperator.MetricSignature, unioning multi-valued fields (data_stream,dimension_fields, etc.).
Output columns (both modes)
metric_name– keyword (single-valued)data_stream– keyword (multi-valued); data stream names that have this metric with the same signature (backing index names are resolved to their parent data stream)unit– keyword (multi-valued when backing indices differ; may be null)metric_type– keyword (multi-valued when definitions differ across data)field_type– keyword (multi-valued when definitions differ across data)dimension_fields– keyword (multi-valued); union of dimension keys for this row
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordFactory for INITIAL mode (data nodes): extracts metric metadata from shards.static final recordFactory for FINAL mode (coordinator): merges 6-column pages from multiple data nodes.static interfaceLooks up metric field metadata on demand.static enumstatic final recordNested classes/interfaces inherited from interface org.elasticsearch.compute.operator.Operator
Operator.OperatorFactory -
Field Summary
FieldsFields inherited from interface org.elasticsearch.compute.operator.Operator
MIN_TARGET_PAGE_SIZE, NOT_BLOCKED, TARGET_PAGE_SIZE -
Method Summary
Modifier and TypeMethodDescriptionvoidadds an input page to the operator.booleanReturns true if the operator can produce more output pages without requiring additional input pages.voidclose()notifies the operator that it won't be used anymore (i.e.voidfinish()notifies the operator that it won't receive any more input pagesreturns non-null if output page available.booleanwhether the operator has finished processing all input pages and made the corresponding output pages availablebooleanwhether the given operator can accept more input pagesstatus()The status of the operator.toString()
-
Field Details
-
NUM_BLOCKS
public static final int NUM_BLOCKS- See Also:
-
-
Method Details
-
needsInput
public boolean needsInput()Description copied from interface:Operatorwhether the given operator can accept more input pages- Specified by:
needsInputin interfaceOperator
-
addInput
Description copied from interface:Operatoradds an input page to the operator. only called when needsInput() == true and isFinished() == false -
finish
public void finish()Description copied from interface:Operatornotifies the operator that it won't receive any more input pages -
isFinished
public boolean isFinished()Description copied from interface:Operatorwhether the operator has finished processing all input pages and made the corresponding output pages available- Specified by:
isFinishedin interfaceOperator
-
canProduceMoreDataWithoutExtraInput
public boolean canProduceMoreDataWithoutExtraInput()Description copied from interface:OperatorReturns true if the operator can produce more output pages without requiring additional input pages. This is useful for operators that buffer data or have internal state that can produce multiple output pages.Operators that do not buffer data should return
false- they cannot produce pages out of thin air. Examples of operators that may returntrue:- Operators with internal buffers (e.g.,
AsyncOperatorwith pending results) - Operators processing a single input page into multiple output pages
- Aggregation operators that buffer partial results
- Specified by:
canProduceMoreDataWithoutExtraInputin interfaceOperator- Returns:
trueif the operator has buffered data that can produce output,falseotherwise
- Operators with internal buffers (e.g.,
-
getOutput
Description copied from interface:Operatorreturns non-null if output page available. Only called when isFinished() == false -
close
public void close()Description copied from interface:Operatornotifies the operator that it won't be used anymore (i.e. none of the other methods called), and its resources can be cleaned up -
status
Description copied from interface:OperatorThe status of the operator. -
toString
-