Skip to content

Commit

Permalink
[receiver:elasticsearchreceiver]: Add additional node level metric fo…
Browse files Browse the repository at this point in the history
…r cache count (open-telemetry#14028)

Add additional Elasticsearchreceiver node level metric:

- This new metric tracks the query cache counts for hit & miss
  • Loading branch information
davidji99 authored Sep 12, 2022
1 parent d144d6d commit 971ddb8
Show file tree
Hide file tree
Showing 8 changed files with 235 additions and 0 deletions.
2 changes: 2 additions & 0 deletions receiver/elasticsearchreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ These are the metrics available for this scraper.
| **elasticsearch.indexing_pressure.memory.total.primary_rejections** | Cumulative number of indexing requests rejected in the primary stage. | 1 | Sum(Int) | <ul> </ul> |
| **elasticsearch.indexing_pressure.memory.total.replica_rejections** | Number of indexing requests rejected in the replica stage. | 1 | Sum(Int) | <ul> </ul> |
| **elasticsearch.memory.indexing_pressure** | Memory consumed, in bytes, by indexing requests in the specified stage. | By | Sum(Int) | <ul> <li>indexing_pressure_stage</li> </ul> |
| **elasticsearch.node.cache.count** | Total count of query cache misses across all shards assigned to selected nodes. | {count} | Sum(Int) | <ul> <li>query_cache_count_type</li> </ul> |
| **elasticsearch.node.cache.evictions** | The number of evictions from the cache. | {evictions} | Sum(Int) | <ul> <li>cache_name</li> </ul> |
| **elasticsearch.node.cache.memory.usage** | The size in bytes of the cache. | By | Sum(Int) | <ul> <li>cache_name</li> </ul> |
| **elasticsearch.node.cluster.connections** | The number of open tcp connections for internal cluster communication. | {connections} | Sum(Int) | <ul> </ul> |
Expand Down Expand Up @@ -114,6 +115,7 @@ metrics:
| memory_pool_name (name) | The name of the JVM memory pool. | |
| memory_state (state) | State of the memory | free, used |
| operation (operation) | The type of operation. | index, delete, get, query, fetch, scroll, suggest, merge, refresh, flush, warmer |
| query_cache_count_type (type) | Type of query cache count | hit, miss |
| shard_state (state) | The state of the shard. | active, relocating, initializing, unassigned |
| task_state (state) | The state of the task. | rejected, completed |
| thread_pool_name | The name of the thread pool. | |
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions receiver/elasticsearchreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ attributes:
ingest_pipeline_name:
value: name
description: Name of the ingest pipeline.
query_cache_count_type:
value: type
description: Type of query cache count
enum:
- hit
- miss
metrics:
# these metrics are from /_nodes/stats, and are node level metrics
elasticsearch.breaker.memory.estimated:
Expand Down Expand Up @@ -176,6 +182,15 @@ metrics:
value_type: int
attributes: [cache_name]
enabled: true
elasticsearch.node.cache.count:
description: Total count of query cache misses across all shards assigned to selected nodes.
unit: "{count}"
sum:
monotonic: false
aggregation: cumulative
value_type: int
attributes: [ query_cache_count_type ]
enabled: true
elasticsearch.node.fs.disk.available:
description: The amount of disk space available to the JVM across all file stores for this node. Depending on OS or process level restrictions, this might appear less than free. This is the actual amount of free disk space the Elasticsearch node can utilise.
unit: By
Expand Down
3 changes: 3 additions & 0 deletions receiver/elasticsearchreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ func (r *elasticsearchScraper) scrapeNodeMetrics(ctx context.Context, now pcommo
r.mb.RecordElasticsearchNodeCacheEvictionsDataPoint(now, info.Indices.FieldDataCache.Evictions, metadata.AttributeCacheNameFielddata)
r.mb.RecordElasticsearchNodeCacheEvictionsDataPoint(now, info.Indices.QueryCache.Evictions, metadata.AttributeCacheNameQuery)

r.mb.RecordElasticsearchNodeCacheCountDataPoint(now, info.Indices.QueryCache.HitCount, metadata.AttributeQueryCacheCountTypeHit)
r.mb.RecordElasticsearchNodeCacheCountDataPoint(now, info.Indices.QueryCache.MissCount, metadata.AttributeQueryCacheCountTypeMiss)

r.mb.RecordElasticsearchNodeFsDiskAvailableDataPoint(now, info.FS.Total.AvailableBytes)
r.mb.RecordElasticsearchNodeFsDiskFreeDataPoint(now, info.FS.Total.FreeBytes)
r.mb.RecordElasticsearchNodeFsDiskTotalDataPoint(now, info.FS.Total.TotalBytes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,42 @@
},
"unit": "By"
},
{
"description": "Total count of query cache misses across all shards assigned to selected nodes.",
"name": "elasticsearch.node.cache.count",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
{
"asInt": "333",
"attributes": [
{
"key": "type",
"value": {
"stringValue": "hit"
}
}
],
"startTimeUnixNano": "1662952760849369000",
"timeUnixNano": "1662952760851518000"
},
{
"asInt": "5324",
"attributes": [
{
"key": "type",
"value": {
"stringValue": "miss"
}
}
],
"startTimeUnixNano": "1662952760849369000",
"timeUnixNano": "1662952760851518000"
}
]
},
"unit": "{count}"
},
{
"description": "The number of evictions from the cache.",
"name": "elasticsearch.node.cache.evictions",
Expand Down
36 changes: 36 additions & 0 deletions receiver/elasticsearchreceiver/testdata/expected_metrics/full.json
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,42 @@
},
"unit": "By"
},
{
"description": "Total count of query cache misses across all shards assigned to selected nodes.",
"name": "elasticsearch.node.cache.count",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
{
"asInt": "333",
"attributes": [
{
"key": "type",
"value": {
"stringValue": "hit"
}
}
],
"startTimeUnixNano": "1662952599630580000",
"timeUnixNano": "1662952599632385000"
},
{
"asInt": "5324",
"attributes": [
{
"key": "type",
"value": {
"stringValue": "miss"
}
}
],
"startTimeUnixNano": "1662952599630580000",
"timeUnixNano": "1662952599632385000"
}
]
},
"unit": "{count}"
},
{
"description": "The number of evictions from the cache.",
"name": "elasticsearch.node.cache.evictions",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,42 @@
},
"unit": "By"
},
{
"description": "Total count of query cache misses across all shards assigned to selected nodes.",
"name": "elasticsearch.node.cache.count",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
{
"asInt": "333",
"attributes": [
{
"key": "type",
"value": {
"stringValue": "hit"
}
}
],
"startTimeUnixNano": "1662952651341631000",
"timeUnixNano": "1662952651343244000"
},
{
"asInt": "5324",
"attributes": [
{
"key": "type",
"value": {
"stringValue": "miss"
}
}
],
"startTimeUnixNano": "1662952651341631000",
"timeUnixNano": "1662952651343244000"
}
]
},
"unit": "{count}"
},
{
"description": "The number of evictions from the cache.",
"name": "elasticsearch.node.cache.evictions",
Expand Down
16 changes: 16 additions & 0 deletions unreleased/add-additional-es-node-metric-cache-count.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: elasticsearchreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add additional node metric for cache count

# One or more tracking issues related to the change
issues: [14027]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

0 comments on commit 971ddb8

Please sign in to comment.