Skip to content

Add returned doc count metric#925

Open
shivamg2017 wants to merge 1 commit intoopensearch-project:mainfrom
shivamg2017:avg-doc-size
Open

Add returned doc count metric#925
shivamg2017 wants to merge 1 commit intoopensearch-project:mainfrom
shivamg2017:avg-doc-size

Conversation

@shivamg2017
Copy link

This will emit metric for doc count returned for a search query when script query is made.

Sample Metric

[2026-03-18T13:18:07,399][WARN ][stderr ] [dev-dsk-gshhivam-1a-f8b252b1.eu-west-1.amazon.com] INFO: metric: ImmutableMetricData{resource=Resource{schemaUrl=null, attributes={service.name="OpenSearch"}}, instrumentationScopeInfo=InstrumentationScopeInfo{name=org.opensearch.telemetry, version=null, schemaUrl=null, attributes={}}, name=search_returned_doc_count, description=Actual number of documents returned per search response, unit=count, type=EXPONENTIAL_HISTOGRAM, data=ImmutableExponentialHistogramData{aggregationTemporality=DELTA, points=[ImmutableExponentialHistogramPointData{getStartEpochNanos=1773839827386629596, getEpochNanos=1773839887386622217, getAttributes={}, getScale=20, getSum=10.0, getCount=1, getZeroCount=0, hasMin=true, getMin=10.0, hasMax=true, getMax=10.0, getPositiveBuckets=DoubleExponentialHistogramBuckets{scale: 20, offset: 3483294, counts: {3483294=1} }, getNegativeBuckets=EmptyExponentialHistogramBuckets{scale=20, offset=0, bucketCounts=[], totalCount=0}, getExemplars=[]}]}}

ActionListener<Response> listener,
ActionFilterChain<Request, Response> chain) {

if (request instanceof SearchRequest
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we add this metric also in the QueryInsights plugin?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants