Skip to content

Commit

Permalink
consolidate ESreceiver's cluster state update metric into one
Browse files Browse the repository at this point in the history
  • Loading branch information
davidji99 committed Aug 29, 2022
1 parent 7e0ae59 commit 99a4e61
Show file tree
Hide file tree
Showing 9 changed files with 2,099 additions and 1,224 deletions.
12 changes: 4 additions & 8 deletions receiver/elasticsearchreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@ These are the metrics available for this scraper.
| **elasticsearch.cluster.published_states.full** | Number of published cluster states. | 1 | Sum(Int) | <ul> </ul> |
| **elasticsearch.cluster.shards** | The number of shards in the cluster. | {shards} | Sum(Int) | <ul> <li>shard_state</li> </ul> |
| **elasticsearch.cluster.state_queue** | Number of cluster states in queue. | 1 | Sum(Int) | <ul> <li>cluster_state_queue_state</li> </ul> |
| **elasticsearch.cluster.state_update.commit_time** | The cumulative amount of time spent waiting for a cluster state update to commit. | 1 | Sum(Int) | <ul> <li>cluster_state_update_type</li> </ul> |
| **elasticsearch.cluster.state_update.completion_time** | The cumulative amount of time spent waiting for a cluster state update to complete. | 1 | Sum(Int) | <ul> <li>cluster_state_update_type</li> </ul> |
| **elasticsearch.cluster.state_update.computation_time** | The cumulative amount of time spent computing cluster state updates since the node started. | 1 | Sum(Int) | <ul> <li>cluster_state_update_type</li> </ul> |
| **elasticsearch.cluster.state_update.context_construction_time** | The cumulative amount of time spent constructing a publication context since the node started. | 1 | Sum(Int) | <ul> <li>cluster_state_update_type</li> </ul> |
| **elasticsearch.cluster.state_update.count** | The number of cluster state update attempts that changed the cluster state since the node started. | 1 | Sum(Int) | <ul> <li>cluster_state_update_type</li> </ul> |
| **elasticsearch.cluster.state_update.master_apply_time** | The cumulative amount of time spent applying cluster state updates on the elected master since the node started. | 1 | Sum(Int) | <ul> <li>cluster_state_update_type</li> </ul> |
| **elasticsearch.cluster.state_update.notification_time** | The cumulative amount of time spent notifying listeners of a cluster state update since the node started. | 1 | Sum(Int) | <ul> <li>cluster_state_update_type</li> </ul> |
| **elasticsearch.cluster.state_update.count** | The number of cluster state update attempts that changed the cluster state since the node started. | 1 | Sum(Int) | <ul> <li>cluster_state_update_state</li> </ul> |
| **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.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 Expand Up @@ -102,7 +97,8 @@ metrics:
| circuit_breaker_name (name) | The name of circuit breaker. | |
| cluster_published_difference_state (state) | State of the published differences | incompatible, compatible |
| cluster_state_queue_state (state) | State of the published differences | pending, committed |
| cluster_state_update_type (status) | Type of cluster state update | unchanged, success, failure |
| cluster_state_update_state (state) | State of cluster state update | |
| cluster_state_update_type (type) | Type of cluster state update | computation, context_construction, commit, completion, master_apply, notification |
| collector_name (name) | The name of the garbage collector. | |
| direction | The direction of network data. | received, sent |
| document_state (state) | The state of the document. | active, deleted |
Expand Down
410 changes: 49 additions & 361 deletions receiver/elasticsearchreceiver/internal/metadata/generated_metrics.go

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions receiver/elasticsearchreceiver/internal/model/nodestats.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
// limitations under the License.

package model // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/elasticsearchreceiver/internal/model"
import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/elasticsearchreceiver/internal/metadata"
)

// NodeStats represents a response from elasticsearch's /_nodes/stats endpoint.
// The struct is not exhaustive; It does not provide all values returned by elasticsearch,
Expand Down Expand Up @@ -66,10 +63,10 @@ type IngestPipelineTotalStats struct {
}

type Discovery struct {
ClusterStateQueue DiscoveryClusterStateQueue `json:"cluster_state_queue"`
SerializedClusterStates map[string]DiscoverySerializedClusterStatesStats `json:"serialized_cluster_states"`
PublishedClusterStates DiscoveryPublishedClusterStates `json:"published_cluster_states"`
ClusterStateUpdate map[metadata.AttributeClusterStateUpdateType]DiscoveryClusterStateUpdateStatsAll `json:"cluster_state_update"`
ClusterStateQueue DiscoveryClusterStateQueue `json:"cluster_state_queue"`
SerializedClusterStates map[string]DiscoverySerializedClusterStatesStats `json:"serialized_cluster_states"`
PublishedClusterStates DiscoveryPublishedClusterStates `json:"published_cluster_states"`
ClusterStateUpdate map[string]DiscoveryClusterStateUpdateStatsAll `json:"cluster_state_update"`
}

type DiscoveryClusterStateQueue struct {
Expand Down
69 changes: 15 additions & 54 deletions receiver/elasticsearchreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,19 @@ attributes:
- coordinating
- primary
- replica
cluster_state_update_state:
value: state
description: State of cluster state update
cluster_state_update_type:
value: status
value: type
description: Type of cluster state update
enum:
- unchanged
- success
- failure
- computation
- context_construction
- commit
- completion
- master_apply
- notification
ingest_pipeline_name:
value: name
description: Name of the ingest pipeline.
Expand Down Expand Up @@ -590,61 +596,16 @@ metrics:
monotonic: true
aggregation: cumulative
value_type: int
attributes: [ cluster_state_update_type ]
enabled: true
elasticsearch.cluster.state_update.computation_time:
description: The cumulative amount of time spent computing cluster state updates since the node started.
unit: 1
sum:
monotonic: true
aggregation: cumulative
value_type: int
attributes: [ cluster_state_update_type ]
enabled: true
elasticsearch.cluster.state_update.context_construction_time:
description: The cumulative amount of time spent constructing a publication context since the node started.
unit: 1
sum:
monotonic: true
aggregation: cumulative
value_type: int
attributes: [ cluster_state_update_type ]
enabled: true
elasticsearch.cluster.state_update.commit_time:
description: The cumulative amount of time spent waiting for a cluster state update to commit.
unit: 1
sum:
monotonic: true
aggregation: cumulative
value_type: int
attributes: [ cluster_state_update_type ]
enabled: true
elasticsearch.cluster.state_update.completion_time:
description: The cumulative amount of time spent waiting for a cluster state update to complete.
unit: 1
sum:
monotonic: true
aggregation: cumulative
value_type: int
attributes: [ cluster_state_update_type ]
attributes: [ cluster_state_update_state ]
enabled: true
elasticsearch.cluster.state_update.master_apply_time:
description: The cumulative amount of time spent applying cluster state updates on the elected master since the node started.
unit: 1
sum:
monotonic: true
aggregation: cumulative
value_type: int
attributes: [ cluster_state_update_type ]
enabled: true
elasticsearch.cluster.state_update.notification_time:
description: The cumulative amount of time spent notifying listeners of a cluster state update since the node started.
unit: 1
elasticsearch.cluster.state_update.time:
description: The cumulative amount of time updating the cluster state since the node started.
unit: ms
sum:
monotonic: true
aggregation: cumulative
value_type: int
attributes: [ cluster_state_update_type ]
attributes: [ cluster_state_update_state, cluster_state_update_type ]
enabled: true
elasticsearch.node.ingest.documents:
description: Total number of documents ingested during the lifetime of this node.
Expand Down
19 changes: 8 additions & 11 deletions receiver/elasticsearchreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,14 @@ func (r *elasticsearchScraper) scrapeNodeMetrics(ctx context.Context, now pcommo
r.mb.RecordElasticsearchClusterPublishedStatesDifferencesDataPoint(now, info.Discovery.PublishedClusterStates.CompatibleDiffs, metadata.AttributeClusterPublishedDifferenceStateCompatible)
r.mb.RecordElasticsearchClusterPublishedStatesDifferencesDataPoint(now, info.Discovery.PublishedClusterStates.IncompatibleDiffs, metadata.AttributeClusterPublishedDifferenceStateIncompatible)

for csuName, csuInfo := range info.Discovery.ClusterStateUpdate {
r.mb.RecordElasticsearchClusterStateUpdateCountDataPoint(now, csuInfo.Count, csuName)
r.mb.RecordElasticsearchClusterStateUpdateComputationTimeDataPoint(now, csuInfo.ComputationTimeMillis, csuName)
r.mb.RecordElasticsearchClusterStateUpdateNotificationTimeDataPoint(now, csuInfo.NotificationTimeMillis, csuName)

if csuName != metadata.AttributeClusterStateUpdateTypeUnchanged {
r.mb.RecordElasticsearchClusterStateUpdateContextConstructionTimeDataPoint(now, csuInfo.ContextConstructionTimeMillis, csuName)
r.mb.RecordElasticsearchClusterStateUpdateCommitTimeDataPoint(now, csuInfo.CommitTimeMillis, csuName)
r.mb.RecordElasticsearchClusterStateUpdateCompletionTimeDataPoint(now, csuInfo.CompletionTimeMillis, csuName)
r.mb.RecordElasticsearchClusterStateUpdateMasterApplyTimeDataPoint(now, csuInfo.MasterApplyTimeMillis, csuName)
}
for cusState, csuInfo := range info.Discovery.ClusterStateUpdate {
r.mb.RecordElasticsearchClusterStateUpdateCountDataPoint(now, csuInfo.Count, cusState)
r.mb.RecordElasticsearchClusterStateUpdateTimeDataPoint(now, csuInfo.ComputationTimeMillis, cusState, metadata.AttributeClusterStateUpdateTypeComputation)
r.mb.RecordElasticsearchClusterStateUpdateTimeDataPoint(now, csuInfo.NotificationTimeMillis, cusState, metadata.AttributeClusterStateUpdateTypeNotification)
r.mb.RecordElasticsearchClusterStateUpdateTimeDataPoint(now, csuInfo.ContextConstructionTimeMillis, cusState, metadata.AttributeClusterStateUpdateTypeContextConstruction)
r.mb.RecordElasticsearchClusterStateUpdateTimeDataPoint(now, csuInfo.CommitTimeMillis, cusState, metadata.AttributeClusterStateUpdateTypeCommit)
r.mb.RecordElasticsearchClusterStateUpdateTimeDataPoint(now, csuInfo.CompletionTimeMillis, cusState, metadata.AttributeClusterStateUpdateTypeCompletion)
r.mb.RecordElasticsearchClusterStateUpdateTimeDataPoint(now, csuInfo.MasterApplyTimeMillis, cusState, metadata.AttributeClusterStateUpdateTypeMasterApply)
}

r.mb.RecordElasticsearchNodeIngestDocumentsDataPoint(now, info.Ingest.Total.Count)
Expand Down
Loading

0 comments on commit 99a4e61

Please sign in to comment.