Skip to content

Commit

Permalink
[receiver/elasticsearch]: add store size metric for index level (open…
Browse files Browse the repository at this point in the history
…-telemetry#14925)

feat: add store size metric for index level
  • Loading branch information
aboguszewski-sumo committed Oct 26, 2022
1 parent 67fad2d commit a29fe0f
Show file tree
Hide file tree
Showing 10 changed files with 359 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .chloggen/elasticsearch-store-size.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 store size metric for index level

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

# (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:
1 change: 1 addition & 0 deletions receiver/elasticsearchreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ These are the metrics available for this scraper.
| **elasticsearch.cluster.state_update.time** | The cumulative amount of time updating the cluster state since the node started. | ms | Sum(Int) | <ul> <li>cluster_state_update_state</li> <li>cluster_state_update_type</li> </ul> |
| **elasticsearch.index.operations.completed** | The number of operations completed for an index. | {operations} | Sum(Int) | <ul> <li>operation</li> <li>index_aggregation_type</li> </ul> |
| **elasticsearch.index.operations.time** | Time spent on operations for an index. | ms | Sum(Int) | <ul> <li>operation</li> <li>index_aggregation_type</li> </ul> |
| **elasticsearch.index.shards.size** | The size of the shards assigned to this index. | By | Sum(Int) | <ul> <li>index_aggregation_type</li> </ul> |
| **elasticsearch.indexing_pressure.memory.limit** | Configured memory limit, in bytes, for the indexing requests. | By | Gauge(Int) | <ul> </ul> |
| **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> |
Expand Down

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

9 changes: 9 additions & 0 deletions receiver/elasticsearchreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -758,3 +758,12 @@ metrics:
value_type: int
attributes: [operation, index_aggregation_type]
enabled: true
elasticsearch.index.shards.size:
description: The size of the shards assigned to this index.
unit: By
sum:
monotonic: false
aggregation: cumulative
value_type: int
attributes: [index_aggregation_type]
enabled: true
4 changes: 4 additions & 0 deletions receiver/elasticsearchreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,5 +360,9 @@ func (r *elasticsearchScraper) scrapeOneIndexMetrics(now pcommon.Timestamp, name
now, stats.Total.SearchOperations.QueryTimeInMs, metadata.AttributeOperationQuery, metadata.AttributeIndexAggregationTypeTotal,
)

r.mb.RecordElasticsearchIndexShardsSizeDataPoint(
now, stats.Total.StoreInfo.SizeInBy, metadata.AttributeIndexAggregationTypeTotal,
)

r.mb.EmitForResource(metadata.WithElasticsearchIndexName(name), metadata.WithElasticsearchClusterName(r.clusterName))
}
Original file line number Diff line number Diff line change
Expand Up @@ -2301,6 +2301,30 @@
]
},
"unit": "ms"
},
{
"description": "The size of the shards assigned to this index.",
"name": "elasticsearch.index.shards.size",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"isMonotonic": false,
"dataPoints": [
{
"asInt": "40230884",
"attributes": [
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
"unit": "By"
}
],
"scope": {
Expand Down Expand Up @@ -2427,6 +2451,30 @@
]
},
"unit": "ms"
},
{
"description": "The size of the shards assigned to this index.",
"name": "elasticsearch.index.shards.size",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"isMonotonic": false,
"dataPoints": [
{
"asInt": "40230884",
"attributes": [
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
"unit": "By"
}
],
"scope": {
Expand Down
48 changes: 48 additions & 0 deletions receiver/elasticsearchreceiver/testdata/expected_metrics/full.json
Original file line number Diff line number Diff line change
Expand Up @@ -2494,6 +2494,30 @@
]
},
"unit": "ms"
},
{
"description": "The size of the shards assigned to this index.",
"name": "elasticsearch.index.shards.size",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"isMonotonic": false,
"dataPoints": [
{
"asInt": "40230884",
"attributes": [
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
"unit": "By"
}
],
"scope": {
Expand Down Expand Up @@ -2620,6 +2644,30 @@
]
},
"unit": "ms"
},
{
"description": "The size of the shards assigned to this index.",
"name": "elasticsearch.index.shards.size",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"isMonotonic": false,
"dataPoints": [
{
"asInt": "40230884",
"attributes": [
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
"unit": "By"
}
],
"scope": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,30 @@
]
},
"unit": "ms"
},
{
"description": "The size of the shards assigned to this index.",
"name": "elasticsearch.index.shards.size",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"isMonotonic": false,
"dataPoints": [
{
"asInt": "40230884",
"attributes": [
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
"unit": "By"
}
],
"scope": {
Expand Down Expand Up @@ -436,6 +460,30 @@
]
},
"unit": "ms"
},
{
"description": "The size of the shards assigned to this index.",
"name": "elasticsearch.index.shards.size",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"isMonotonic": false,
"dataPoints": [
{
"asInt": "40230884",
"attributes": [
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
"unit": "By"
}
],
"scope": {
Expand Down
Loading

0 comments on commit a29fe0f

Please sign in to comment.