Skip to content

Commit

Permalink
feat: add refresh metrics on index level
Browse files Browse the repository at this point in the history
  • Loading branch information
aboguszewski-sumo committed Oct 24, 2022
1 parent 66dd4e5 commit 5a4d919
Show file tree
Hide file tree
Showing 7 changed files with 427 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .chloggen/elasticsearch-refresh.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 refresh operation metrics on 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:
8 changes: 7 additions & 1 deletion receiver/elasticsearchreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func (r *elasticsearchScraper) scrapeIndicesMetrics(ctx context.Context, now pco
indexStats, err := r.client.IndexStats(ctx, r.cfg.Indices)

if err != nil {
errs.AddPartial(4, err)
errs.AddPartial(6, err)
return
}

Expand All @@ -352,13 +352,19 @@ func (r *elasticsearchScraper) scrapeOneIndexMetrics(now pcommon.Timestamp, name
r.mb.RecordElasticsearchIndexOperationsCompletedDataPoint(
now, stats.Total.SearchOperations.QueryTotal, metadata.AttributeOperationQuery, metadata.AttributeIndexAggregationTypeTotal,
)
r.mb.RecordElasticsearchIndexOperationsCompletedDataPoint(
now, stats.Total.RefreshOperations.Total, metadata.AttributeOperationRefresh, metadata.AttributeIndexAggregationTypeTotal,
)

r.mb.RecordElasticsearchIndexOperationsTimeDataPoint(
now, stats.Total.SearchOperations.FetchTimeInMs, metadata.AttributeOperationFetch, metadata.AttributeIndexAggregationTypeTotal,
)
r.mb.RecordElasticsearchIndexOperationsTimeDataPoint(
now, stats.Total.SearchOperations.QueryTimeInMs, metadata.AttributeOperationQuery, metadata.AttributeIndexAggregationTypeTotal,
)
r.mb.RecordElasticsearchIndexOperationsTimeDataPoint(
now, stats.Total.RefreshOperations.TotalTimeInMs, metadata.AttributeOperationRefresh, metadata.AttributeIndexAggregationTypeTotal,
)

r.mb.EmitForResource(metadata.WithElasticsearchIndexName(name), metadata.WithElasticsearchClusterName(r.clusterName))
}
Original file line number Diff line number Diff line change
Expand Up @@ -2248,6 +2248,25 @@
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
},
{
"asInt": "10",
"attributes": [
{
"key": "operation",
"value": {
"stringValue": "refresh"
}
},
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
Expand Down Expand Up @@ -2297,6 +2316,25 @@
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
},
{
"asInt": "169",
"attributes": [
{
"key": "operation",
"value": {
"stringValue": "refresh"
}
},
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
Expand Down Expand Up @@ -2374,6 +2412,25 @@
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
},
{
"asInt": "10",
"attributes": [
{
"key": "operation",
"value": {
"stringValue": "refresh"
}
},
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
Expand Down Expand Up @@ -2423,6 +2480,25 @@
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
},
{
"asInt": "169",
"attributes": [
{
"key": "operation",
"value": {
"stringValue": "refresh"
}
},
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
Expand Down
76 changes: 76 additions & 0 deletions receiver/elasticsearchreceiver/testdata/expected_metrics/full.json
Original file line number Diff line number Diff line change
Expand Up @@ -2441,6 +2441,25 @@
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
},
{
"asInt": "10",
"attributes": [
{
"key": "operation",
"value": {
"stringValue": "refresh"
}
},
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
Expand Down Expand Up @@ -2490,6 +2509,25 @@
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
},
{
"asInt": "169",
"attributes": [
{
"key": "operation",
"value": {
"stringValue": "refresh"
}
},
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
Expand Down Expand Up @@ -2567,6 +2605,25 @@
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
},
{
"asInt": "10",
"attributes": [
{
"key": "operation",
"value": {
"stringValue": "refresh"
}
},
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
Expand Down Expand Up @@ -2616,6 +2673,25 @@
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
},
{
"asInt": "169",
"attributes": [
{
"key": "operation",
"value": {
"stringValue": "refresh"
}
},
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,25 @@
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
},
{
"asInt": "10",
"attributes": [
{
"key": "operation",
"value": {
"stringValue": "refresh"
}
},
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
Expand Down Expand Up @@ -306,6 +325,25 @@
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
},
{
"asInt": "169",
"attributes": [
{
"key": "operation",
"value": {
"stringValue": "refresh"
}
},
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
Expand Down Expand Up @@ -383,6 +421,25 @@
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
},
{
"asInt": "10",
"attributes": [
{
"key": "operation",
"value": {
"stringValue": "refresh"
}
},
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
Expand Down Expand Up @@ -432,6 +489,25 @@
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
},
{
"asInt": "169",
"attributes": [
{
"key": "operation",
"value": {
"stringValue": "refresh"
}
},
{
"key": "aggregation",
"value": {
"stringValue": "total"
}
}
],
"startTimeUnixNano": "1661811689941624000",
"timeUnixNano": "1661811689943245000"
}
]
},
Expand Down
Loading

0 comments on commit 5a4d919

Please sign in to comment.