From 19084870cfae038a77641d3d4ba0e2be82d38acf Mon Sep 17 00:00:00 2001 From: DJ Date: Thu, 14 Jul 2022 22:37:38 +0900 Subject: [PATCH] [receiver/elasticsearch] Add additional metrics (#12176) * Add additional metrics to elasticsearchreceiver. These metrics include: - OS stats - filesystem - shard - etc --- receiver/elasticsearchreceiver/client.go | 2 +- .../elasticsearchreceiver/documentation.md | 17 + .../internal/metadata/generated_metrics_v2.go | 1297 ++++++++++++++--- .../internal/model/nodestats.go | 68 +- receiver/elasticsearchreceiver/metadata.yaml | 134 ++ receiver/elasticsearchreceiver/scraper.go | 23 + .../expected_metrics/clusterSkip.json | 464 ++++++ .../testdata/expected_metrics/full.json | 464 ++++++ .../add-more-elasticsearch-metrics.yaml | 17 + 9 files changed, 2311 insertions(+), 175 deletions(-) create mode 100755 unreleased/add-more-elasticsearch-metrics.yaml diff --git a/receiver/elasticsearchreceiver/client.go b/receiver/elasticsearchreceiver/client.go index 8a32ef7449b7..8ef4ceadd476 100644 --- a/receiver/elasticsearchreceiver/client.go +++ b/receiver/elasticsearchreceiver/client.go @@ -82,7 +82,7 @@ func newElasticsearchClient(settings component.TelemetrySettings, c Config, h co // nodeStatsMetrics is a comma separated list of metrics that will be gathered from NodeStats. // The available metrics are documented here for Elasticsearch 7.9: // https://www.elastic.co/guide/en/elasticsearch/reference/7.9/cluster-nodes-stats.html#cluster-nodes-stats-api-path-params -const nodeStatsMetrics = "indices,process,jvm,thread_pool,transport,http,fs" +const nodeStatsMetrics = "breaker,indices,process,jvm,thread_pool,transport,http,fs" // nodeStatsIndexMetrics is a comma separated list of index metrics that will be gathered from NodeStats. const nodeStatsIndexMetrics = "store,docs,indexing,get,search,merge,refresh,flush,warmer,query_cache,fielddata" diff --git a/receiver/elasticsearchreceiver/documentation.md b/receiver/elasticsearchreceiver/documentation.md index 74571aed717c..4cc836c98cfb 100644 --- a/receiver/elasticsearchreceiver/documentation.md +++ b/receiver/elasticsearchreceiver/documentation.md @@ -8,6 +8,9 @@ These are the metrics available for this scraper. | Name | Description | Unit | Type | Attributes | | ---- | ----------- | ---- | ---- | ---------- | +| **elasticsearch.breaker.memory.estimated** | Estimated memory used for the operation. | By | Gauge(Int) | | +| **elasticsearch.breaker.memory.limit** | Memory limit for the circuit breaker. | By | Sum(Int) | | +| **elasticsearch.breaker.tripped** | Total number of times the circuit breaker has been triggered and prevented an out of memory error. | 1 | Sum(Int) | | | **elasticsearch.cluster.data_nodes** | The number of data nodes in the cluster. | {nodes} | Sum(Int) | | | **elasticsearch.cluster.health** | The health status of the cluster. Health status is based on the state of its primary and replica shards. Green indicates all shards are assigned. Yellow indicates that one or more replica shards are unassigned. Red indicates that one or more primary shards are unassigned, making some data unavailable. | {status} | Sum(Int) | | | **elasticsearch.cluster.nodes** | The total number of nodes in the cluster. | {nodes} | Sum(Int) | | @@ -16,16 +19,28 @@ These are the metrics available for this scraper. | **elasticsearch.node.cache.memory.usage** | The size in bytes of the cache. | By | Sum(Int) | | | **elasticsearch.node.cluster.connections** | The number of open tcp connections for internal cluster communication. | {connections} | Sum(Int) | | | **elasticsearch.node.cluster.io** | The number of bytes sent and received on the network for internal cluster communication. | By | Sum(Int) | | +| **elasticsearch.node.disk.io.read** | The total number of kilobytes read across all file stores for this node. | By | Sum(Int) | | +| **elasticsearch.node.disk.io.write** | The total number of kilobytes written across all file stores for this node. | By | Sum(Int) | | | **elasticsearch.node.documents** | The number of documents on the node. | {documents} | Sum(Int) | | | **elasticsearch.node.fs.disk.available** | The amount of disk space available across all file stores for this node. | By | Sum(Int) | | | **elasticsearch.node.http.connections** | The number of HTTP connections to the node. | {connections} | Sum(Int) | | | **elasticsearch.node.open_files** | The number of open file descriptors held by the node. | {files} | Sum(Int) | | | **elasticsearch.node.operations.completed** | The number of operations completed. | {operations} | Sum(Int) | | | **elasticsearch.node.operations.time** | Time spent on operations. | ms | Sum(Int) | | +| **elasticsearch.node.shards.data_set.size** | Total data set size of all shards assigned to the node. This includes the size of shards not stored fully on the node, such as the cache for partially mounted indices. | By | Sum(Int) | | +| **elasticsearch.node.shards.reserved.size** | A prediction of how much larger the shard stores on this node will eventually grow due to ongoing peer recoveries, restoring snapshots, and similar activities. A value of -1 indicates that this is not available. | By | Sum(Int) | | | **elasticsearch.node.shards.size** | The size of the shards assigned to this node. | By | Sum(Int) | | | **elasticsearch.node.thread_pool.tasks.finished** | The number of tasks finished by the thread pool. | {tasks} | Sum(Int) | | | **elasticsearch.node.thread_pool.tasks.queued** | The number of queued tasks in the thread pool. | {tasks} | Sum(Int) | | | **elasticsearch.node.thread_pool.threads** | The number of threads in the thread pool. | {threads} | Sum(Int) | | +| **elasticsearch.node.translog.operations** | Number of transaction log operations. | {operations} | Sum(Int) | | +| **elasticsearch.node.translog.size** | Size of the transaction log. | By | Sum(Int) | | +| **elasticsearch.node.translog.uncommitted.size** | Size of uncommitted transaction log operations. | By | Sum(Int) | | +| **elasticsearch.os.cpu.load_avg.15m** | Fifteen-minute load average on the system (field is not present if fifteen-minute load average is not available). | 1 | Gauge(Double) | | +| **elasticsearch.os.cpu.load_avg.1m** | One-minute load average on the system (field is not present if one-minute load average is not available). | 1 | Gauge(Double) | | +| **elasticsearch.os.cpu.load_avg.5m** | Five-minute load average on the system (field is not present if five-minute load average is not available). | 1 | Gauge(Double) | | +| **elasticsearch.os.cpu.usage** | Recent CPU usage for the whole system, or -1 if not supported. | % | Gauge(Int) | | +| **elasticsearch.os.memory** | Amount of physical memory. | By | Sum(Int) | | | **jvm.classes.loaded** | The number of loaded classes | 1 | Gauge(Int) | | | **jvm.gc.collections.count** | The total number of garbage collections that have occurred | 1 | Sum(Int) | | | **jvm.gc.collections.elapsed** | The approximate accumulated collection elapsed time | ms | Sum(Int) | | @@ -59,6 +74,7 @@ metrics: | Name | Description | Values | | ---- | ----------- | ------ | | cache_name | The name of cache. | fielddata, query | +| circuit_breaker_name (name) | The name of circuit breaker. | | | collector_name (name) | The name of the garbage collector. | | | direction | The direction of network data. | received, sent | | disk_usage_state (state) | The state of a section of space on disk. | used, free | @@ -66,6 +82,7 @@ metrics: | fs_direction (direction) | The direction of filesystem IO. | read, write | | health_status (status) | The health status of the cluster. | green, yellow, red | | 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 | | shard_state (state) | The state of the shard. | active, relocating, initializing, unassigned | | task_state (state) | The state of the task. | rejected, completed | diff --git a/receiver/elasticsearchreceiver/internal/metadata/generated_metrics_v2.go b/receiver/elasticsearchreceiver/internal/metadata/generated_metrics_v2.go index 08859d126d0d..54933a87be2a 100644 --- a/receiver/elasticsearchreceiver/internal/metadata/generated_metrics_v2.go +++ b/receiver/elasticsearchreceiver/internal/metadata/generated_metrics_v2.go @@ -17,6 +17,9 @@ type MetricSettings struct { // MetricsSettings provides settings for elasticsearchreceiver metrics. type MetricsSettings struct { + ElasticsearchBreakerMemoryEstimated MetricSettings `mapstructure:"elasticsearch.breaker.memory.estimated"` + ElasticsearchBreakerMemoryLimit MetricSettings `mapstructure:"elasticsearch.breaker.memory.limit"` + ElasticsearchBreakerTripped MetricSettings `mapstructure:"elasticsearch.breaker.tripped"` ElasticsearchClusterDataNodes MetricSettings `mapstructure:"elasticsearch.cluster.data_nodes"` ElasticsearchClusterHealth MetricSettings `mapstructure:"elasticsearch.cluster.health"` ElasticsearchClusterNodes MetricSettings `mapstructure:"elasticsearch.cluster.nodes"` @@ -25,16 +28,28 @@ type MetricsSettings struct { ElasticsearchNodeCacheMemoryUsage MetricSettings `mapstructure:"elasticsearch.node.cache.memory.usage"` ElasticsearchNodeClusterConnections MetricSettings `mapstructure:"elasticsearch.node.cluster.connections"` ElasticsearchNodeClusterIo MetricSettings `mapstructure:"elasticsearch.node.cluster.io"` + ElasticsearchNodeDiskIoRead MetricSettings `mapstructure:"elasticsearch.node.disk.io.read"` + ElasticsearchNodeDiskIoWrite MetricSettings `mapstructure:"elasticsearch.node.disk.io.write"` ElasticsearchNodeDocuments MetricSettings `mapstructure:"elasticsearch.node.documents"` ElasticsearchNodeFsDiskAvailable MetricSettings `mapstructure:"elasticsearch.node.fs.disk.available"` ElasticsearchNodeHTTPConnections MetricSettings `mapstructure:"elasticsearch.node.http.connections"` ElasticsearchNodeOpenFiles MetricSettings `mapstructure:"elasticsearch.node.open_files"` ElasticsearchNodeOperationsCompleted MetricSettings `mapstructure:"elasticsearch.node.operations.completed"` ElasticsearchNodeOperationsTime MetricSettings `mapstructure:"elasticsearch.node.operations.time"` + ElasticsearchNodeShardsDataSetSize MetricSettings `mapstructure:"elasticsearch.node.shards.data_set.size"` + ElasticsearchNodeShardsReservedSize MetricSettings `mapstructure:"elasticsearch.node.shards.reserved.size"` ElasticsearchNodeShardsSize MetricSettings `mapstructure:"elasticsearch.node.shards.size"` ElasticsearchNodeThreadPoolTasksFinished MetricSettings `mapstructure:"elasticsearch.node.thread_pool.tasks.finished"` ElasticsearchNodeThreadPoolTasksQueued MetricSettings `mapstructure:"elasticsearch.node.thread_pool.tasks.queued"` ElasticsearchNodeThreadPoolThreads MetricSettings `mapstructure:"elasticsearch.node.thread_pool.threads"` + ElasticsearchNodeTranslogOperations MetricSettings `mapstructure:"elasticsearch.node.translog.operations"` + ElasticsearchNodeTranslogSize MetricSettings `mapstructure:"elasticsearch.node.translog.size"` + ElasticsearchNodeTranslogUncommittedSize MetricSettings `mapstructure:"elasticsearch.node.translog.uncommitted.size"` + ElasticsearchOsCPULoadAvg15m MetricSettings `mapstructure:"elasticsearch.os.cpu.load_avg.15m"` + ElasticsearchOsCPULoadAvg1m MetricSettings `mapstructure:"elasticsearch.os.cpu.load_avg.1m"` + ElasticsearchOsCPULoadAvg5m MetricSettings `mapstructure:"elasticsearch.os.cpu.load_avg.5m"` + ElasticsearchOsCPUUsage MetricSettings `mapstructure:"elasticsearch.os.cpu.usage"` + ElasticsearchOsMemory MetricSettings `mapstructure:"elasticsearch.os.memory"` JvmClassesLoaded MetricSettings `mapstructure:"jvm.classes.loaded"` JvmGcCollectionsCount MetricSettings `mapstructure:"jvm.gc.collections.count"` JvmGcCollectionsElapsed MetricSettings `mapstructure:"jvm.gc.collections.elapsed"` @@ -50,6 +65,15 @@ type MetricsSettings struct { func DefaultMetricsSettings() MetricsSettings { return MetricsSettings{ + ElasticsearchBreakerMemoryEstimated: MetricSettings{ + Enabled: true, + }, + ElasticsearchBreakerMemoryLimit: MetricSettings{ + Enabled: true, + }, + ElasticsearchBreakerTripped: MetricSettings{ + Enabled: true, + }, ElasticsearchClusterDataNodes: MetricSettings{ Enabled: true, }, @@ -74,6 +98,12 @@ func DefaultMetricsSettings() MetricsSettings { ElasticsearchNodeClusterIo: MetricSettings{ Enabled: true, }, + ElasticsearchNodeDiskIoRead: MetricSettings{ + Enabled: true, + }, + ElasticsearchNodeDiskIoWrite: MetricSettings{ + Enabled: true, + }, ElasticsearchNodeDocuments: MetricSettings{ Enabled: true, }, @@ -92,6 +122,12 @@ func DefaultMetricsSettings() MetricsSettings { ElasticsearchNodeOperationsTime: MetricSettings{ Enabled: true, }, + ElasticsearchNodeShardsDataSetSize: MetricSettings{ + Enabled: true, + }, + ElasticsearchNodeShardsReservedSize: MetricSettings{ + Enabled: true, + }, ElasticsearchNodeShardsSize: MetricSettings{ Enabled: true, }, @@ -104,6 +140,30 @@ func DefaultMetricsSettings() MetricsSettings { ElasticsearchNodeThreadPoolThreads: MetricSettings{ Enabled: true, }, + ElasticsearchNodeTranslogOperations: MetricSettings{ + Enabled: true, + }, + ElasticsearchNodeTranslogSize: MetricSettings{ + Enabled: true, + }, + ElasticsearchNodeTranslogUncommittedSize: MetricSettings{ + Enabled: true, + }, + ElasticsearchOsCPULoadAvg15m: MetricSettings{ + Enabled: true, + }, + ElasticsearchOsCPULoadAvg1m: MetricSettings{ + Enabled: true, + }, + ElasticsearchOsCPULoadAvg5m: MetricSettings{ + Enabled: true, + }, + ElasticsearchOsCPUUsage: MetricSettings{ + Enabled: true, + }, + ElasticsearchOsMemory: MetricSettings{ + Enabled: true, + }, JvmClassesLoaded: MetricSettings{ Enabled: true, }, @@ -300,6 +360,32 @@ var MapAttributeHealthStatus = map[string]AttributeHealthStatus{ "red": AttributeHealthStatusRed, } +// AttributeMemoryState specifies the a value memory_state attribute. +type AttributeMemoryState int + +const ( + _ AttributeMemoryState = iota + AttributeMemoryStateFree + AttributeMemoryStateUsed +) + +// String returns the string representation of the AttributeMemoryState. +func (av AttributeMemoryState) String() string { + switch av { + case AttributeMemoryStateFree: + return "free" + case AttributeMemoryStateUsed: + return "used" + } + return "" +} + +// MapAttributeMemoryState is a helper map of string to AttributeMemoryState attribute value. +var MapAttributeMemoryState = map[string]AttributeMemoryState{ + "free": AttributeMemoryStateFree, + "used": AttributeMemoryStateUsed, +} + // AttributeOperation specifies the a value operation attribute. type AttributeOperation int @@ -448,6 +534,163 @@ var MapAttributeThreadState = map[string]AttributeThreadState{ "idle": AttributeThreadStateIdle, } +type metricElasticsearchBreakerMemoryEstimated struct { + data pmetric.Metric // data buffer for generated metric. + settings MetricSettings // metric settings provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills elasticsearch.breaker.memory.estimated metric with initial data. +func (m *metricElasticsearchBreakerMemoryEstimated) init() { + m.data.SetName("elasticsearch.breaker.memory.estimated") + m.data.SetDescription("Estimated memory used for the operation.") + m.data.SetUnit("By") + m.data.SetDataType(pmetric.MetricDataTypeGauge) + m.data.Gauge().DataPoints().EnsureCapacity(m.capacity) +} + +func (m *metricElasticsearchBreakerMemoryEstimated) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, circuitBreakerNameAttributeValue string) { + if !m.settings.Enabled { + return + } + dp := m.data.Gauge().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntVal(val) + dp.Attributes().Insert("name", pcommon.NewValueString(circuitBreakerNameAttributeValue)) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricElasticsearchBreakerMemoryEstimated) updateCapacity() { + if m.data.Gauge().DataPoints().Len() > m.capacity { + m.capacity = m.data.Gauge().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricElasticsearchBreakerMemoryEstimated) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Gauge().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricElasticsearchBreakerMemoryEstimated(settings MetricSettings) metricElasticsearchBreakerMemoryEstimated { + m := metricElasticsearchBreakerMemoryEstimated{settings: settings} + if settings.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +type metricElasticsearchBreakerMemoryLimit struct { + data pmetric.Metric // data buffer for generated metric. + settings MetricSettings // metric settings provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills elasticsearch.breaker.memory.limit metric with initial data. +func (m *metricElasticsearchBreakerMemoryLimit) init() { + m.data.SetName("elasticsearch.breaker.memory.limit") + m.data.SetDescription("Memory limit for the circuit breaker.") + m.data.SetUnit("By") + m.data.SetDataType(pmetric.MetricDataTypeSum) + m.data.Sum().SetIsMonotonic(false) + m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) + m.data.Sum().DataPoints().EnsureCapacity(m.capacity) +} + +func (m *metricElasticsearchBreakerMemoryLimit) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, circuitBreakerNameAttributeValue string) { + if !m.settings.Enabled { + return + } + dp := m.data.Sum().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntVal(val) + dp.Attributes().Insert("name", pcommon.NewValueString(circuitBreakerNameAttributeValue)) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricElasticsearchBreakerMemoryLimit) updateCapacity() { + if m.data.Sum().DataPoints().Len() > m.capacity { + m.capacity = m.data.Sum().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricElasticsearchBreakerMemoryLimit) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricElasticsearchBreakerMemoryLimit(settings MetricSettings) metricElasticsearchBreakerMemoryLimit { + m := metricElasticsearchBreakerMemoryLimit{settings: settings} + if settings.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +type metricElasticsearchBreakerTripped struct { + data pmetric.Metric // data buffer for generated metric. + settings MetricSettings // metric settings provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills elasticsearch.breaker.tripped metric with initial data. +func (m *metricElasticsearchBreakerTripped) init() { + m.data.SetName("elasticsearch.breaker.tripped") + m.data.SetDescription("Total number of times the circuit breaker has been triggered and prevented an out of memory error.") + m.data.SetUnit("1") + m.data.SetDataType(pmetric.MetricDataTypeSum) + m.data.Sum().SetIsMonotonic(true) + m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) + m.data.Sum().DataPoints().EnsureCapacity(m.capacity) +} + +func (m *metricElasticsearchBreakerTripped) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, circuitBreakerNameAttributeValue string) { + if !m.settings.Enabled { + return + } + dp := m.data.Sum().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntVal(val) + dp.Attributes().Insert("name", pcommon.NewValueString(circuitBreakerNameAttributeValue)) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricElasticsearchBreakerTripped) updateCapacity() { + if m.data.Sum().DataPoints().Len() > m.capacity { + m.capacity = m.data.Sum().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricElasticsearchBreakerTripped) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricElasticsearchBreakerTripped(settings MetricSettings) metricElasticsearchBreakerTripped { + m := metricElasticsearchBreakerTripped{settings: settings} + if settings.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + type metricElasticsearchClusterDataNodes struct { data pmetric.Metric // data buffer for generated metric. settings MetricSettings // metric settings provided by user. @@ -830,7 +1073,627 @@ func (m *metricElasticsearchNodeClusterIo) init() { m.data.Sum().DataPoints().EnsureCapacity(m.capacity) } -func (m *metricElasticsearchNodeClusterIo) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, directionAttributeValue string) { +func (m *metricElasticsearchNodeClusterIo) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, directionAttributeValue string) { + if !m.settings.Enabled { + return + } + dp := m.data.Sum().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntVal(val) + dp.Attributes().Insert("direction", pcommon.NewValueString(directionAttributeValue)) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricElasticsearchNodeClusterIo) updateCapacity() { + if m.data.Sum().DataPoints().Len() > m.capacity { + m.capacity = m.data.Sum().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricElasticsearchNodeClusterIo) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricElasticsearchNodeClusterIo(settings MetricSettings) metricElasticsearchNodeClusterIo { + m := metricElasticsearchNodeClusterIo{settings: settings} + if settings.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +type metricElasticsearchNodeDiskIoRead struct { + data pmetric.Metric // data buffer for generated metric. + settings MetricSettings // metric settings provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills elasticsearch.node.disk.io.read metric with initial data. +func (m *metricElasticsearchNodeDiskIoRead) init() { + m.data.SetName("elasticsearch.node.disk.io.read") + m.data.SetDescription("The total number of kilobytes read across all file stores for this node.") + m.data.SetUnit("By") + m.data.SetDataType(pmetric.MetricDataTypeSum) + m.data.Sum().SetIsMonotonic(false) + m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) +} + +func (m *metricElasticsearchNodeDiskIoRead) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { + if !m.settings.Enabled { + return + } + dp := m.data.Sum().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntVal(val) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricElasticsearchNodeDiskIoRead) updateCapacity() { + if m.data.Sum().DataPoints().Len() > m.capacity { + m.capacity = m.data.Sum().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricElasticsearchNodeDiskIoRead) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricElasticsearchNodeDiskIoRead(settings MetricSettings) metricElasticsearchNodeDiskIoRead { + m := metricElasticsearchNodeDiskIoRead{settings: settings} + if settings.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +type metricElasticsearchNodeDiskIoWrite struct { + data pmetric.Metric // data buffer for generated metric. + settings MetricSettings // metric settings provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills elasticsearch.node.disk.io.write metric with initial data. +func (m *metricElasticsearchNodeDiskIoWrite) init() { + m.data.SetName("elasticsearch.node.disk.io.write") + m.data.SetDescription("The total number of kilobytes written across all file stores for this node.") + m.data.SetUnit("By") + m.data.SetDataType(pmetric.MetricDataTypeSum) + m.data.Sum().SetIsMonotonic(false) + m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) +} + +func (m *metricElasticsearchNodeDiskIoWrite) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { + if !m.settings.Enabled { + return + } + dp := m.data.Sum().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntVal(val) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricElasticsearchNodeDiskIoWrite) updateCapacity() { + if m.data.Sum().DataPoints().Len() > m.capacity { + m.capacity = m.data.Sum().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricElasticsearchNodeDiskIoWrite) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricElasticsearchNodeDiskIoWrite(settings MetricSettings) metricElasticsearchNodeDiskIoWrite { + m := metricElasticsearchNodeDiskIoWrite{settings: settings} + if settings.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +type metricElasticsearchNodeDocuments struct { + data pmetric.Metric // data buffer for generated metric. + settings MetricSettings // metric settings provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills elasticsearch.node.documents metric with initial data. +func (m *metricElasticsearchNodeDocuments) init() { + m.data.SetName("elasticsearch.node.documents") + m.data.SetDescription("The number of documents on the node.") + m.data.SetUnit("{documents}") + m.data.SetDataType(pmetric.MetricDataTypeSum) + m.data.Sum().SetIsMonotonic(false) + m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) + m.data.Sum().DataPoints().EnsureCapacity(m.capacity) +} + +func (m *metricElasticsearchNodeDocuments) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, documentStateAttributeValue string) { + if !m.settings.Enabled { + return + } + dp := m.data.Sum().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntVal(val) + dp.Attributes().Insert("state", pcommon.NewValueString(documentStateAttributeValue)) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricElasticsearchNodeDocuments) updateCapacity() { + if m.data.Sum().DataPoints().Len() > m.capacity { + m.capacity = m.data.Sum().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricElasticsearchNodeDocuments) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricElasticsearchNodeDocuments(settings MetricSettings) metricElasticsearchNodeDocuments { + m := metricElasticsearchNodeDocuments{settings: settings} + if settings.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +type metricElasticsearchNodeFsDiskAvailable struct { + data pmetric.Metric // data buffer for generated metric. + settings MetricSettings // metric settings provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills elasticsearch.node.fs.disk.available metric with initial data. +func (m *metricElasticsearchNodeFsDiskAvailable) init() { + m.data.SetName("elasticsearch.node.fs.disk.available") + m.data.SetDescription("The amount of disk space available across all file stores for this node.") + m.data.SetUnit("By") + m.data.SetDataType(pmetric.MetricDataTypeSum) + m.data.Sum().SetIsMonotonic(false) + m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) +} + +func (m *metricElasticsearchNodeFsDiskAvailable) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { + if !m.settings.Enabled { + return + } + dp := m.data.Sum().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntVal(val) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricElasticsearchNodeFsDiskAvailable) updateCapacity() { + if m.data.Sum().DataPoints().Len() > m.capacity { + m.capacity = m.data.Sum().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricElasticsearchNodeFsDiskAvailable) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricElasticsearchNodeFsDiskAvailable(settings MetricSettings) metricElasticsearchNodeFsDiskAvailable { + m := metricElasticsearchNodeFsDiskAvailable{settings: settings} + if settings.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +type metricElasticsearchNodeHTTPConnections struct { + data pmetric.Metric // data buffer for generated metric. + settings MetricSettings // metric settings provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills elasticsearch.node.http.connections metric with initial data. +func (m *metricElasticsearchNodeHTTPConnections) init() { + m.data.SetName("elasticsearch.node.http.connections") + m.data.SetDescription("The number of HTTP connections to the node.") + m.data.SetUnit("{connections}") + m.data.SetDataType(pmetric.MetricDataTypeSum) + m.data.Sum().SetIsMonotonic(false) + m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) +} + +func (m *metricElasticsearchNodeHTTPConnections) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { + if !m.settings.Enabled { + return + } + dp := m.data.Sum().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntVal(val) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricElasticsearchNodeHTTPConnections) updateCapacity() { + if m.data.Sum().DataPoints().Len() > m.capacity { + m.capacity = m.data.Sum().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricElasticsearchNodeHTTPConnections) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricElasticsearchNodeHTTPConnections(settings MetricSettings) metricElasticsearchNodeHTTPConnections { + m := metricElasticsearchNodeHTTPConnections{settings: settings} + if settings.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +type metricElasticsearchNodeOpenFiles struct { + data pmetric.Metric // data buffer for generated metric. + settings MetricSettings // metric settings provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills elasticsearch.node.open_files metric with initial data. +func (m *metricElasticsearchNodeOpenFiles) init() { + m.data.SetName("elasticsearch.node.open_files") + m.data.SetDescription("The number of open file descriptors held by the node.") + m.data.SetUnit("{files}") + m.data.SetDataType(pmetric.MetricDataTypeSum) + m.data.Sum().SetIsMonotonic(false) + m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) +} + +func (m *metricElasticsearchNodeOpenFiles) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { + if !m.settings.Enabled { + return + } + dp := m.data.Sum().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntVal(val) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricElasticsearchNodeOpenFiles) updateCapacity() { + if m.data.Sum().DataPoints().Len() > m.capacity { + m.capacity = m.data.Sum().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricElasticsearchNodeOpenFiles) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricElasticsearchNodeOpenFiles(settings MetricSettings) metricElasticsearchNodeOpenFiles { + m := metricElasticsearchNodeOpenFiles{settings: settings} + if settings.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +type metricElasticsearchNodeOperationsCompleted struct { + data pmetric.Metric // data buffer for generated metric. + settings MetricSettings // metric settings provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills elasticsearch.node.operations.completed metric with initial data. +func (m *metricElasticsearchNodeOperationsCompleted) init() { + m.data.SetName("elasticsearch.node.operations.completed") + m.data.SetDescription("The number of operations completed.") + m.data.SetUnit("{operations}") + m.data.SetDataType(pmetric.MetricDataTypeSum) + m.data.Sum().SetIsMonotonic(true) + m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) + m.data.Sum().DataPoints().EnsureCapacity(m.capacity) +} + +func (m *metricElasticsearchNodeOperationsCompleted) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, operationAttributeValue string) { + if !m.settings.Enabled { + return + } + dp := m.data.Sum().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntVal(val) + dp.Attributes().Insert("operation", pcommon.NewValueString(operationAttributeValue)) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricElasticsearchNodeOperationsCompleted) updateCapacity() { + if m.data.Sum().DataPoints().Len() > m.capacity { + m.capacity = m.data.Sum().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricElasticsearchNodeOperationsCompleted) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricElasticsearchNodeOperationsCompleted(settings MetricSettings) metricElasticsearchNodeOperationsCompleted { + m := metricElasticsearchNodeOperationsCompleted{settings: settings} + if settings.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +type metricElasticsearchNodeOperationsTime struct { + data pmetric.Metric // data buffer for generated metric. + settings MetricSettings // metric settings provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills elasticsearch.node.operations.time metric with initial data. +func (m *metricElasticsearchNodeOperationsTime) init() { + m.data.SetName("elasticsearch.node.operations.time") + m.data.SetDescription("Time spent on operations.") + m.data.SetUnit("ms") + m.data.SetDataType(pmetric.MetricDataTypeSum) + m.data.Sum().SetIsMonotonic(true) + m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) + m.data.Sum().DataPoints().EnsureCapacity(m.capacity) +} + +func (m *metricElasticsearchNodeOperationsTime) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, operationAttributeValue string) { + if !m.settings.Enabled { + return + } + dp := m.data.Sum().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntVal(val) + dp.Attributes().Insert("operation", pcommon.NewValueString(operationAttributeValue)) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricElasticsearchNodeOperationsTime) updateCapacity() { + if m.data.Sum().DataPoints().Len() > m.capacity { + m.capacity = m.data.Sum().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricElasticsearchNodeOperationsTime) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricElasticsearchNodeOperationsTime(settings MetricSettings) metricElasticsearchNodeOperationsTime { + m := metricElasticsearchNodeOperationsTime{settings: settings} + if settings.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +type metricElasticsearchNodeShardsDataSetSize struct { + data pmetric.Metric // data buffer for generated metric. + settings MetricSettings // metric settings provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills elasticsearch.node.shards.data_set.size metric with initial data. +func (m *metricElasticsearchNodeShardsDataSetSize) init() { + m.data.SetName("elasticsearch.node.shards.data_set.size") + m.data.SetDescription("Total data set size of all shards assigned to the node. This includes the size of shards not stored fully on the node, such as the cache for partially mounted indices.") + m.data.SetUnit("By") + m.data.SetDataType(pmetric.MetricDataTypeSum) + m.data.Sum().SetIsMonotonic(false) + m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) +} + +func (m *metricElasticsearchNodeShardsDataSetSize) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { + if !m.settings.Enabled { + return + } + dp := m.data.Sum().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntVal(val) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricElasticsearchNodeShardsDataSetSize) updateCapacity() { + if m.data.Sum().DataPoints().Len() > m.capacity { + m.capacity = m.data.Sum().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricElasticsearchNodeShardsDataSetSize) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricElasticsearchNodeShardsDataSetSize(settings MetricSettings) metricElasticsearchNodeShardsDataSetSize { + m := metricElasticsearchNodeShardsDataSetSize{settings: settings} + if settings.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +type metricElasticsearchNodeShardsReservedSize struct { + data pmetric.Metric // data buffer for generated metric. + settings MetricSettings // metric settings provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills elasticsearch.node.shards.reserved.size metric with initial data. +func (m *metricElasticsearchNodeShardsReservedSize) init() { + m.data.SetName("elasticsearch.node.shards.reserved.size") + m.data.SetDescription("A prediction of how much larger the shard stores on this node will eventually grow due to ongoing peer recoveries, restoring snapshots, and similar activities. A value of -1 indicates that this is not available.") + m.data.SetUnit("By") + m.data.SetDataType(pmetric.MetricDataTypeSum) + m.data.Sum().SetIsMonotonic(false) + m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) +} + +func (m *metricElasticsearchNodeShardsReservedSize) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { + if !m.settings.Enabled { + return + } + dp := m.data.Sum().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntVal(val) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricElasticsearchNodeShardsReservedSize) updateCapacity() { + if m.data.Sum().DataPoints().Len() > m.capacity { + m.capacity = m.data.Sum().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricElasticsearchNodeShardsReservedSize) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricElasticsearchNodeShardsReservedSize(settings MetricSettings) metricElasticsearchNodeShardsReservedSize { + m := metricElasticsearchNodeShardsReservedSize{settings: settings} + if settings.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +type metricElasticsearchNodeShardsSize struct { + data pmetric.Metric // data buffer for generated metric. + settings MetricSettings // metric settings provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills elasticsearch.node.shards.size metric with initial data. +func (m *metricElasticsearchNodeShardsSize) init() { + m.data.SetName("elasticsearch.node.shards.size") + m.data.SetDescription("The size of the shards assigned to this node.") + m.data.SetUnit("By") + m.data.SetDataType(pmetric.MetricDataTypeSum) + m.data.Sum().SetIsMonotonic(false) + m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) +} + +func (m *metricElasticsearchNodeShardsSize) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { + if !m.settings.Enabled { + return + } + dp := m.data.Sum().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntVal(val) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricElasticsearchNodeShardsSize) updateCapacity() { + if m.data.Sum().DataPoints().Len() > m.capacity { + m.capacity = m.data.Sum().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricElasticsearchNodeShardsSize) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricElasticsearchNodeShardsSize(settings MetricSettings) metricElasticsearchNodeShardsSize { + m := metricElasticsearchNodeShardsSize{settings: settings} + if settings.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +type metricElasticsearchNodeThreadPoolTasksFinished struct { + data pmetric.Metric // data buffer for generated metric. + settings MetricSettings // metric settings provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills elasticsearch.node.thread_pool.tasks.finished metric with initial data. +func (m *metricElasticsearchNodeThreadPoolTasksFinished) init() { + m.data.SetName("elasticsearch.node.thread_pool.tasks.finished") + m.data.SetDescription("The number of tasks finished by the thread pool.") + m.data.SetUnit("{tasks}") + m.data.SetDataType(pmetric.MetricDataTypeSum) + m.data.Sum().SetIsMonotonic(true) + m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) + m.data.Sum().DataPoints().EnsureCapacity(m.capacity) +} + +func (m *metricElasticsearchNodeThreadPoolTasksFinished) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, threadPoolNameAttributeValue string, taskStateAttributeValue string) { if !m.settings.Enabled { return } @@ -838,18 +1701,19 @@ func (m *metricElasticsearchNodeClusterIo) recordDataPoint(start pcommon.Timesta dp.SetStartTimestamp(start) dp.SetTimestamp(ts) dp.SetIntVal(val) - dp.Attributes().Insert("direction", pcommon.NewValueString(directionAttributeValue)) + dp.Attributes().Insert("thread_pool_name", pcommon.NewValueString(threadPoolNameAttributeValue)) + dp.Attributes().Insert("state", pcommon.NewValueString(taskStateAttributeValue)) } // updateCapacity saves max length of data point slices that will be used for the slice capacity. -func (m *metricElasticsearchNodeClusterIo) updateCapacity() { +func (m *metricElasticsearchNodeThreadPoolTasksFinished) updateCapacity() { if m.data.Sum().DataPoints().Len() > m.capacity { m.capacity = m.data.Sum().DataPoints().Len() } } // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. -func (m *metricElasticsearchNodeClusterIo) emit(metrics pmetric.MetricSlice) { +func (m *metricElasticsearchNodeThreadPoolTasksFinished) emit(metrics pmetric.MetricSlice) { if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { m.updateCapacity() m.data.MoveTo(metrics.AppendEmpty()) @@ -857,8 +1721,8 @@ func (m *metricElasticsearchNodeClusterIo) emit(metrics pmetric.MetricSlice) { } } -func newMetricElasticsearchNodeClusterIo(settings MetricSettings) metricElasticsearchNodeClusterIo { - m := metricElasticsearchNodeClusterIo{settings: settings} +func newMetricElasticsearchNodeThreadPoolTasksFinished(settings MetricSettings) metricElasticsearchNodeThreadPoolTasksFinished { + m := metricElasticsearchNodeThreadPoolTasksFinished{settings: settings} if settings.Enabled { m.data = pmetric.NewMetric() m.init() @@ -866,24 +1730,24 @@ func newMetricElasticsearchNodeClusterIo(settings MetricSettings) metricElastics return m } -type metricElasticsearchNodeDocuments struct { +type metricElasticsearchNodeThreadPoolTasksQueued struct { data pmetric.Metric // data buffer for generated metric. settings MetricSettings // metric settings provided by user. capacity int // max observed number of data points added to the metric. } -// init fills elasticsearch.node.documents metric with initial data. -func (m *metricElasticsearchNodeDocuments) init() { - m.data.SetName("elasticsearch.node.documents") - m.data.SetDescription("The number of documents on the node.") - m.data.SetUnit("{documents}") +// init fills elasticsearch.node.thread_pool.tasks.queued metric with initial data. +func (m *metricElasticsearchNodeThreadPoolTasksQueued) init() { + m.data.SetName("elasticsearch.node.thread_pool.tasks.queued") + m.data.SetDescription("The number of queued tasks in the thread pool.") + m.data.SetUnit("{tasks}") m.data.SetDataType(pmetric.MetricDataTypeSum) m.data.Sum().SetIsMonotonic(false) m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) m.data.Sum().DataPoints().EnsureCapacity(m.capacity) } -func (m *metricElasticsearchNodeDocuments) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, documentStateAttributeValue string) { +func (m *metricElasticsearchNodeThreadPoolTasksQueued) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, threadPoolNameAttributeValue string) { if !m.settings.Enabled { return } @@ -891,18 +1755,18 @@ func (m *metricElasticsearchNodeDocuments) recordDataPoint(start pcommon.Timesta dp.SetStartTimestamp(start) dp.SetTimestamp(ts) dp.SetIntVal(val) - dp.Attributes().Insert("state", pcommon.NewValueString(documentStateAttributeValue)) + dp.Attributes().Insert("thread_pool_name", pcommon.NewValueString(threadPoolNameAttributeValue)) } // updateCapacity saves max length of data point slices that will be used for the slice capacity. -func (m *metricElasticsearchNodeDocuments) updateCapacity() { +func (m *metricElasticsearchNodeThreadPoolTasksQueued) updateCapacity() { if m.data.Sum().DataPoints().Len() > m.capacity { m.capacity = m.data.Sum().DataPoints().Len() } } // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. -func (m *metricElasticsearchNodeDocuments) emit(metrics pmetric.MetricSlice) { +func (m *metricElasticsearchNodeThreadPoolTasksQueued) emit(metrics pmetric.MetricSlice) { if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { m.updateCapacity() m.data.MoveTo(metrics.AppendEmpty()) @@ -910,8 +1774,8 @@ func (m *metricElasticsearchNodeDocuments) emit(metrics pmetric.MetricSlice) { } } -func newMetricElasticsearchNodeDocuments(settings MetricSettings) metricElasticsearchNodeDocuments { - m := metricElasticsearchNodeDocuments{settings: settings} +func newMetricElasticsearchNodeThreadPoolTasksQueued(settings MetricSettings) metricElasticsearchNodeThreadPoolTasksQueued { + m := metricElasticsearchNodeThreadPoolTasksQueued{settings: settings} if settings.Enabled { m.data = pmetric.NewMetric() m.init() @@ -919,23 +1783,24 @@ func newMetricElasticsearchNodeDocuments(settings MetricSettings) metricElastics return m } -type metricElasticsearchNodeFsDiskAvailable struct { +type metricElasticsearchNodeThreadPoolThreads struct { data pmetric.Metric // data buffer for generated metric. settings MetricSettings // metric settings provided by user. capacity int // max observed number of data points added to the metric. } -// init fills elasticsearch.node.fs.disk.available metric with initial data. -func (m *metricElasticsearchNodeFsDiskAvailable) init() { - m.data.SetName("elasticsearch.node.fs.disk.available") - m.data.SetDescription("The amount of disk space available across all file stores for this node.") - m.data.SetUnit("By") +// init fills elasticsearch.node.thread_pool.threads metric with initial data. +func (m *metricElasticsearchNodeThreadPoolThreads) init() { + m.data.SetName("elasticsearch.node.thread_pool.threads") + m.data.SetDescription("The number of threads in the thread pool.") + m.data.SetUnit("{threads}") m.data.SetDataType(pmetric.MetricDataTypeSum) m.data.Sum().SetIsMonotonic(false) m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) + m.data.Sum().DataPoints().EnsureCapacity(m.capacity) } -func (m *metricElasticsearchNodeFsDiskAvailable) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { +func (m *metricElasticsearchNodeThreadPoolThreads) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, threadPoolNameAttributeValue string, threadStateAttributeValue string) { if !m.settings.Enabled { return } @@ -943,17 +1808,19 @@ func (m *metricElasticsearchNodeFsDiskAvailable) recordDataPoint(start pcommon.T dp.SetStartTimestamp(start) dp.SetTimestamp(ts) dp.SetIntVal(val) + dp.Attributes().Insert("thread_pool_name", pcommon.NewValueString(threadPoolNameAttributeValue)) + dp.Attributes().Insert("state", pcommon.NewValueString(threadStateAttributeValue)) } // updateCapacity saves max length of data point slices that will be used for the slice capacity. -func (m *metricElasticsearchNodeFsDiskAvailable) updateCapacity() { +func (m *metricElasticsearchNodeThreadPoolThreads) updateCapacity() { if m.data.Sum().DataPoints().Len() > m.capacity { m.capacity = m.data.Sum().DataPoints().Len() } } // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. -func (m *metricElasticsearchNodeFsDiskAvailable) emit(metrics pmetric.MetricSlice) { +func (m *metricElasticsearchNodeThreadPoolThreads) emit(metrics pmetric.MetricSlice) { if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { m.updateCapacity() m.data.MoveTo(metrics.AppendEmpty()) @@ -961,8 +1828,8 @@ func (m *metricElasticsearchNodeFsDiskAvailable) emit(metrics pmetric.MetricSlic } } -func newMetricElasticsearchNodeFsDiskAvailable(settings MetricSettings) metricElasticsearchNodeFsDiskAvailable { - m := metricElasticsearchNodeFsDiskAvailable{settings: settings} +func newMetricElasticsearchNodeThreadPoolThreads(settings MetricSettings) metricElasticsearchNodeThreadPoolThreads { + m := metricElasticsearchNodeThreadPoolThreads{settings: settings} if settings.Enabled { m.data = pmetric.NewMetric() m.init() @@ -970,23 +1837,23 @@ func newMetricElasticsearchNodeFsDiskAvailable(settings MetricSettings) metricEl return m } -type metricElasticsearchNodeHTTPConnections struct { +type metricElasticsearchNodeTranslogOperations struct { data pmetric.Metric // data buffer for generated metric. settings MetricSettings // metric settings provided by user. capacity int // max observed number of data points added to the metric. } -// init fills elasticsearch.node.http.connections metric with initial data. -func (m *metricElasticsearchNodeHTTPConnections) init() { - m.data.SetName("elasticsearch.node.http.connections") - m.data.SetDescription("The number of HTTP connections to the node.") - m.data.SetUnit("{connections}") +// init fills elasticsearch.node.translog.operations metric with initial data. +func (m *metricElasticsearchNodeTranslogOperations) init() { + m.data.SetName("elasticsearch.node.translog.operations") + m.data.SetDescription("Number of transaction log operations.") + m.data.SetUnit("{operations}") m.data.SetDataType(pmetric.MetricDataTypeSum) - m.data.Sum().SetIsMonotonic(false) + m.data.Sum().SetIsMonotonic(true) m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) } -func (m *metricElasticsearchNodeHTTPConnections) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { +func (m *metricElasticsearchNodeTranslogOperations) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { if !m.settings.Enabled { return } @@ -997,14 +1864,14 @@ func (m *metricElasticsearchNodeHTTPConnections) recordDataPoint(start pcommon.T } // updateCapacity saves max length of data point slices that will be used for the slice capacity. -func (m *metricElasticsearchNodeHTTPConnections) updateCapacity() { +func (m *metricElasticsearchNodeTranslogOperations) updateCapacity() { if m.data.Sum().DataPoints().Len() > m.capacity { m.capacity = m.data.Sum().DataPoints().Len() } } // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. -func (m *metricElasticsearchNodeHTTPConnections) emit(metrics pmetric.MetricSlice) { +func (m *metricElasticsearchNodeTranslogOperations) emit(metrics pmetric.MetricSlice) { if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { m.updateCapacity() m.data.MoveTo(metrics.AppendEmpty()) @@ -1012,8 +1879,8 @@ func (m *metricElasticsearchNodeHTTPConnections) emit(metrics pmetric.MetricSlic } } -func newMetricElasticsearchNodeHTTPConnections(settings MetricSettings) metricElasticsearchNodeHTTPConnections { - m := metricElasticsearchNodeHTTPConnections{settings: settings} +func newMetricElasticsearchNodeTranslogOperations(settings MetricSettings) metricElasticsearchNodeTranslogOperations { + m := metricElasticsearchNodeTranslogOperations{settings: settings} if settings.Enabled { m.data = pmetric.NewMetric() m.init() @@ -1021,23 +1888,23 @@ func newMetricElasticsearchNodeHTTPConnections(settings MetricSettings) metricEl return m } -type metricElasticsearchNodeOpenFiles struct { +type metricElasticsearchNodeTranslogSize struct { data pmetric.Metric // data buffer for generated metric. settings MetricSettings // metric settings provided by user. capacity int // max observed number of data points added to the metric. } -// init fills elasticsearch.node.open_files metric with initial data. -func (m *metricElasticsearchNodeOpenFiles) init() { - m.data.SetName("elasticsearch.node.open_files") - m.data.SetDescription("The number of open file descriptors held by the node.") - m.data.SetUnit("{files}") +// init fills elasticsearch.node.translog.size metric with initial data. +func (m *metricElasticsearchNodeTranslogSize) init() { + m.data.SetName("elasticsearch.node.translog.size") + m.data.SetDescription("Size of the transaction log.") + m.data.SetUnit("By") m.data.SetDataType(pmetric.MetricDataTypeSum) m.data.Sum().SetIsMonotonic(false) m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) } -func (m *metricElasticsearchNodeOpenFiles) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { +func (m *metricElasticsearchNodeTranslogSize) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { if !m.settings.Enabled { return } @@ -1048,14 +1915,14 @@ func (m *metricElasticsearchNodeOpenFiles) recordDataPoint(start pcommon.Timesta } // updateCapacity saves max length of data point slices that will be used for the slice capacity. -func (m *metricElasticsearchNodeOpenFiles) updateCapacity() { +func (m *metricElasticsearchNodeTranslogSize) updateCapacity() { if m.data.Sum().DataPoints().Len() > m.capacity { m.capacity = m.data.Sum().DataPoints().Len() } } // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. -func (m *metricElasticsearchNodeOpenFiles) emit(metrics pmetric.MetricSlice) { +func (m *metricElasticsearchNodeTranslogSize) emit(metrics pmetric.MetricSlice) { if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { m.updateCapacity() m.data.MoveTo(metrics.AppendEmpty()) @@ -1063,8 +1930,8 @@ func (m *metricElasticsearchNodeOpenFiles) emit(metrics pmetric.MetricSlice) { } } -func newMetricElasticsearchNodeOpenFiles(settings MetricSettings) metricElasticsearchNodeOpenFiles { - m := metricElasticsearchNodeOpenFiles{settings: settings} +func newMetricElasticsearchNodeTranslogSize(settings MetricSettings) metricElasticsearchNodeTranslogSize { + m := metricElasticsearchNodeTranslogSize{settings: settings} if settings.Enabled { m.data = pmetric.NewMetric() m.init() @@ -1072,24 +1939,23 @@ func newMetricElasticsearchNodeOpenFiles(settings MetricSettings) metricElastics return m } -type metricElasticsearchNodeOperationsCompleted struct { +type metricElasticsearchNodeTranslogUncommittedSize struct { data pmetric.Metric // data buffer for generated metric. settings MetricSettings // metric settings provided by user. capacity int // max observed number of data points added to the metric. } -// init fills elasticsearch.node.operations.completed metric with initial data. -func (m *metricElasticsearchNodeOperationsCompleted) init() { - m.data.SetName("elasticsearch.node.operations.completed") - m.data.SetDescription("The number of operations completed.") - m.data.SetUnit("{operations}") +// init fills elasticsearch.node.translog.uncommitted.size metric with initial data. +func (m *metricElasticsearchNodeTranslogUncommittedSize) init() { + m.data.SetName("elasticsearch.node.translog.uncommitted.size") + m.data.SetDescription("Size of uncommitted transaction log operations.") + m.data.SetUnit("By") m.data.SetDataType(pmetric.MetricDataTypeSum) - m.data.Sum().SetIsMonotonic(true) + m.data.Sum().SetIsMonotonic(false) m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) - m.data.Sum().DataPoints().EnsureCapacity(m.capacity) } -func (m *metricElasticsearchNodeOperationsCompleted) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, operationAttributeValue string) { +func (m *metricElasticsearchNodeTranslogUncommittedSize) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { if !m.settings.Enabled { return } @@ -1097,18 +1963,17 @@ func (m *metricElasticsearchNodeOperationsCompleted) recordDataPoint(start pcomm dp.SetStartTimestamp(start) dp.SetTimestamp(ts) dp.SetIntVal(val) - dp.Attributes().Insert("operation", pcommon.NewValueString(operationAttributeValue)) } // updateCapacity saves max length of data point slices that will be used for the slice capacity. -func (m *metricElasticsearchNodeOperationsCompleted) updateCapacity() { +func (m *metricElasticsearchNodeTranslogUncommittedSize) updateCapacity() { if m.data.Sum().DataPoints().Len() > m.capacity { m.capacity = m.data.Sum().DataPoints().Len() } } // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. -func (m *metricElasticsearchNodeOperationsCompleted) emit(metrics pmetric.MetricSlice) { +func (m *metricElasticsearchNodeTranslogUncommittedSize) emit(metrics pmetric.MetricSlice) { if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { m.updateCapacity() m.data.MoveTo(metrics.AppendEmpty()) @@ -1116,8 +1981,8 @@ func (m *metricElasticsearchNodeOperationsCompleted) emit(metrics pmetric.Metric } } -func newMetricElasticsearchNodeOperationsCompleted(settings MetricSettings) metricElasticsearchNodeOperationsCompleted { - m := metricElasticsearchNodeOperationsCompleted{settings: settings} +func newMetricElasticsearchNodeTranslogUncommittedSize(settings MetricSettings) metricElasticsearchNodeTranslogUncommittedSize { + m := metricElasticsearchNodeTranslogUncommittedSize{settings: settings} if settings.Enabled { m.data = pmetric.NewMetric() m.init() @@ -1125,52 +1990,48 @@ func newMetricElasticsearchNodeOperationsCompleted(settings MetricSettings) metr return m } -type metricElasticsearchNodeOperationsTime struct { +type metricElasticsearchOsCPULoadAvg15m struct { data pmetric.Metric // data buffer for generated metric. settings MetricSettings // metric settings provided by user. capacity int // max observed number of data points added to the metric. } -// init fills elasticsearch.node.operations.time metric with initial data. -func (m *metricElasticsearchNodeOperationsTime) init() { - m.data.SetName("elasticsearch.node.operations.time") - m.data.SetDescription("Time spent on operations.") - m.data.SetUnit("ms") - m.data.SetDataType(pmetric.MetricDataTypeSum) - m.data.Sum().SetIsMonotonic(true) - m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) - m.data.Sum().DataPoints().EnsureCapacity(m.capacity) +// init fills elasticsearch.os.cpu.load_avg.15m metric with initial data. +func (m *metricElasticsearchOsCPULoadAvg15m) init() { + m.data.SetName("elasticsearch.os.cpu.load_avg.15m") + m.data.SetDescription("Fifteen-minute load average on the system (field is not present if fifteen-minute load average is not available).") + m.data.SetUnit("1") + m.data.SetDataType(pmetric.MetricDataTypeGauge) } -func (m *metricElasticsearchNodeOperationsTime) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, operationAttributeValue string) { +func (m *metricElasticsearchOsCPULoadAvg15m) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val float64) { if !m.settings.Enabled { return } - dp := m.data.Sum().DataPoints().AppendEmpty() + dp := m.data.Gauge().DataPoints().AppendEmpty() dp.SetStartTimestamp(start) dp.SetTimestamp(ts) - dp.SetIntVal(val) - dp.Attributes().Insert("operation", pcommon.NewValueString(operationAttributeValue)) + dp.SetDoubleVal(val) } // updateCapacity saves max length of data point slices that will be used for the slice capacity. -func (m *metricElasticsearchNodeOperationsTime) updateCapacity() { - if m.data.Sum().DataPoints().Len() > m.capacity { - m.capacity = m.data.Sum().DataPoints().Len() +func (m *metricElasticsearchOsCPULoadAvg15m) updateCapacity() { + if m.data.Gauge().DataPoints().Len() > m.capacity { + m.capacity = m.data.Gauge().DataPoints().Len() } } // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. -func (m *metricElasticsearchNodeOperationsTime) emit(metrics pmetric.MetricSlice) { - if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { +func (m *metricElasticsearchOsCPULoadAvg15m) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Gauge().DataPoints().Len() > 0 { m.updateCapacity() m.data.MoveTo(metrics.AppendEmpty()) m.init() } } -func newMetricElasticsearchNodeOperationsTime(settings MetricSettings) metricElasticsearchNodeOperationsTime { - m := metricElasticsearchNodeOperationsTime{settings: settings} +func newMetricElasticsearchOsCPULoadAvg15m(settings MetricSettings) metricElasticsearchOsCPULoadAvg15m { + m := metricElasticsearchOsCPULoadAvg15m{settings: settings} if settings.Enabled { m.data = pmetric.NewMetric() m.init() @@ -1178,50 +2039,48 @@ func newMetricElasticsearchNodeOperationsTime(settings MetricSettings) metricEla return m } -type metricElasticsearchNodeShardsSize struct { +type metricElasticsearchOsCPULoadAvg1m struct { data pmetric.Metric // data buffer for generated metric. settings MetricSettings // metric settings provided by user. capacity int // max observed number of data points added to the metric. } -// init fills elasticsearch.node.shards.size metric with initial data. -func (m *metricElasticsearchNodeShardsSize) init() { - m.data.SetName("elasticsearch.node.shards.size") - m.data.SetDescription("The size of the shards assigned to this node.") - m.data.SetUnit("By") - m.data.SetDataType(pmetric.MetricDataTypeSum) - m.data.Sum().SetIsMonotonic(false) - m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) +// init fills elasticsearch.os.cpu.load_avg.1m metric with initial data. +func (m *metricElasticsearchOsCPULoadAvg1m) init() { + m.data.SetName("elasticsearch.os.cpu.load_avg.1m") + m.data.SetDescription("One-minute load average on the system (field is not present if one-minute load average is not available).") + m.data.SetUnit("1") + m.data.SetDataType(pmetric.MetricDataTypeGauge) } -func (m *metricElasticsearchNodeShardsSize) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { +func (m *metricElasticsearchOsCPULoadAvg1m) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val float64) { if !m.settings.Enabled { return } - dp := m.data.Sum().DataPoints().AppendEmpty() + dp := m.data.Gauge().DataPoints().AppendEmpty() dp.SetStartTimestamp(start) dp.SetTimestamp(ts) - dp.SetIntVal(val) + dp.SetDoubleVal(val) } // updateCapacity saves max length of data point slices that will be used for the slice capacity. -func (m *metricElasticsearchNodeShardsSize) updateCapacity() { - if m.data.Sum().DataPoints().Len() > m.capacity { - m.capacity = m.data.Sum().DataPoints().Len() +func (m *metricElasticsearchOsCPULoadAvg1m) updateCapacity() { + if m.data.Gauge().DataPoints().Len() > m.capacity { + m.capacity = m.data.Gauge().DataPoints().Len() } } // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. -func (m *metricElasticsearchNodeShardsSize) emit(metrics pmetric.MetricSlice) { - if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { +func (m *metricElasticsearchOsCPULoadAvg1m) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Gauge().DataPoints().Len() > 0 { m.updateCapacity() m.data.MoveTo(metrics.AppendEmpty()) m.init() } } -func newMetricElasticsearchNodeShardsSize(settings MetricSettings) metricElasticsearchNodeShardsSize { - m := metricElasticsearchNodeShardsSize{settings: settings} +func newMetricElasticsearchOsCPULoadAvg1m(settings MetricSettings) metricElasticsearchOsCPULoadAvg1m { + m := metricElasticsearchOsCPULoadAvg1m{settings: settings} if settings.Enabled { m.data = pmetric.NewMetric() m.init() @@ -1229,53 +2088,48 @@ func newMetricElasticsearchNodeShardsSize(settings MetricSettings) metricElastic return m } -type metricElasticsearchNodeThreadPoolTasksFinished struct { +type metricElasticsearchOsCPULoadAvg5m struct { data pmetric.Metric // data buffer for generated metric. settings MetricSettings // metric settings provided by user. capacity int // max observed number of data points added to the metric. } -// init fills elasticsearch.node.thread_pool.tasks.finished metric with initial data. -func (m *metricElasticsearchNodeThreadPoolTasksFinished) init() { - m.data.SetName("elasticsearch.node.thread_pool.tasks.finished") - m.data.SetDescription("The number of tasks finished by the thread pool.") - m.data.SetUnit("{tasks}") - m.data.SetDataType(pmetric.MetricDataTypeSum) - m.data.Sum().SetIsMonotonic(true) - m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) - m.data.Sum().DataPoints().EnsureCapacity(m.capacity) +// init fills elasticsearch.os.cpu.load_avg.5m metric with initial data. +func (m *metricElasticsearchOsCPULoadAvg5m) init() { + m.data.SetName("elasticsearch.os.cpu.load_avg.5m") + m.data.SetDescription("Five-minute load average on the system (field is not present if five-minute load average is not available).") + m.data.SetUnit("1") + m.data.SetDataType(pmetric.MetricDataTypeGauge) } -func (m *metricElasticsearchNodeThreadPoolTasksFinished) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, threadPoolNameAttributeValue string, taskStateAttributeValue string) { +func (m *metricElasticsearchOsCPULoadAvg5m) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val float64) { if !m.settings.Enabled { return } - dp := m.data.Sum().DataPoints().AppendEmpty() + dp := m.data.Gauge().DataPoints().AppendEmpty() dp.SetStartTimestamp(start) dp.SetTimestamp(ts) - dp.SetIntVal(val) - dp.Attributes().Insert("thread_pool_name", pcommon.NewValueString(threadPoolNameAttributeValue)) - dp.Attributes().Insert("state", pcommon.NewValueString(taskStateAttributeValue)) + dp.SetDoubleVal(val) } // updateCapacity saves max length of data point slices that will be used for the slice capacity. -func (m *metricElasticsearchNodeThreadPoolTasksFinished) updateCapacity() { - if m.data.Sum().DataPoints().Len() > m.capacity { - m.capacity = m.data.Sum().DataPoints().Len() +func (m *metricElasticsearchOsCPULoadAvg5m) updateCapacity() { + if m.data.Gauge().DataPoints().Len() > m.capacity { + m.capacity = m.data.Gauge().DataPoints().Len() } } // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. -func (m *metricElasticsearchNodeThreadPoolTasksFinished) emit(metrics pmetric.MetricSlice) { - if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { +func (m *metricElasticsearchOsCPULoadAvg5m) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Gauge().DataPoints().Len() > 0 { m.updateCapacity() m.data.MoveTo(metrics.AppendEmpty()) m.init() } } -func newMetricElasticsearchNodeThreadPoolTasksFinished(settings MetricSettings) metricElasticsearchNodeThreadPoolTasksFinished { - m := metricElasticsearchNodeThreadPoolTasksFinished{settings: settings} +func newMetricElasticsearchOsCPULoadAvg5m(settings MetricSettings) metricElasticsearchOsCPULoadAvg5m { + m := metricElasticsearchOsCPULoadAvg5m{settings: settings} if settings.Enabled { m.data = pmetric.NewMetric() m.init() @@ -1283,52 +2137,48 @@ func newMetricElasticsearchNodeThreadPoolTasksFinished(settings MetricSettings) return m } -type metricElasticsearchNodeThreadPoolTasksQueued struct { +type metricElasticsearchOsCPUUsage struct { data pmetric.Metric // data buffer for generated metric. settings MetricSettings // metric settings provided by user. capacity int // max observed number of data points added to the metric. } -// init fills elasticsearch.node.thread_pool.tasks.queued metric with initial data. -func (m *metricElasticsearchNodeThreadPoolTasksQueued) init() { - m.data.SetName("elasticsearch.node.thread_pool.tasks.queued") - m.data.SetDescription("The number of queued tasks in the thread pool.") - m.data.SetUnit("{tasks}") - m.data.SetDataType(pmetric.MetricDataTypeSum) - m.data.Sum().SetIsMonotonic(false) - m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) - m.data.Sum().DataPoints().EnsureCapacity(m.capacity) +// init fills elasticsearch.os.cpu.usage metric with initial data. +func (m *metricElasticsearchOsCPUUsage) init() { + m.data.SetName("elasticsearch.os.cpu.usage") + m.data.SetDescription("Recent CPU usage for the whole system, or -1 if not supported.") + m.data.SetUnit("%") + m.data.SetDataType(pmetric.MetricDataTypeGauge) } -func (m *metricElasticsearchNodeThreadPoolTasksQueued) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, threadPoolNameAttributeValue string) { +func (m *metricElasticsearchOsCPUUsage) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { if !m.settings.Enabled { return } - dp := m.data.Sum().DataPoints().AppendEmpty() + dp := m.data.Gauge().DataPoints().AppendEmpty() dp.SetStartTimestamp(start) dp.SetTimestamp(ts) dp.SetIntVal(val) - dp.Attributes().Insert("thread_pool_name", pcommon.NewValueString(threadPoolNameAttributeValue)) } // updateCapacity saves max length of data point slices that will be used for the slice capacity. -func (m *metricElasticsearchNodeThreadPoolTasksQueued) updateCapacity() { - if m.data.Sum().DataPoints().Len() > m.capacity { - m.capacity = m.data.Sum().DataPoints().Len() +func (m *metricElasticsearchOsCPUUsage) updateCapacity() { + if m.data.Gauge().DataPoints().Len() > m.capacity { + m.capacity = m.data.Gauge().DataPoints().Len() } } // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. -func (m *metricElasticsearchNodeThreadPoolTasksQueued) emit(metrics pmetric.MetricSlice) { - if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { +func (m *metricElasticsearchOsCPUUsage) emit(metrics pmetric.MetricSlice) { + if m.settings.Enabled && m.data.Gauge().DataPoints().Len() > 0 { m.updateCapacity() m.data.MoveTo(metrics.AppendEmpty()) m.init() } } -func newMetricElasticsearchNodeThreadPoolTasksQueued(settings MetricSettings) metricElasticsearchNodeThreadPoolTasksQueued { - m := metricElasticsearchNodeThreadPoolTasksQueued{settings: settings} +func newMetricElasticsearchOsCPUUsage(settings MetricSettings) metricElasticsearchOsCPUUsage { + m := metricElasticsearchOsCPUUsage{settings: settings} if settings.Enabled { m.data = pmetric.NewMetric() m.init() @@ -1336,24 +2186,24 @@ func newMetricElasticsearchNodeThreadPoolTasksQueued(settings MetricSettings) me return m } -type metricElasticsearchNodeThreadPoolThreads struct { +type metricElasticsearchOsMemory struct { data pmetric.Metric // data buffer for generated metric. settings MetricSettings // metric settings provided by user. capacity int // max observed number of data points added to the metric. } -// init fills elasticsearch.node.thread_pool.threads metric with initial data. -func (m *metricElasticsearchNodeThreadPoolThreads) init() { - m.data.SetName("elasticsearch.node.thread_pool.threads") - m.data.SetDescription("The number of threads in the thread pool.") - m.data.SetUnit("{threads}") +// init fills elasticsearch.os.memory metric with initial data. +func (m *metricElasticsearchOsMemory) init() { + m.data.SetName("elasticsearch.os.memory") + m.data.SetDescription("Amount of physical memory.") + m.data.SetUnit("By") m.data.SetDataType(pmetric.MetricDataTypeSum) m.data.Sum().SetIsMonotonic(false) m.data.Sum().SetAggregationTemporality(pmetric.MetricAggregationTemporalityCumulative) m.data.Sum().DataPoints().EnsureCapacity(m.capacity) } -func (m *metricElasticsearchNodeThreadPoolThreads) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, threadPoolNameAttributeValue string, threadStateAttributeValue string) { +func (m *metricElasticsearchOsMemory) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, memoryStateAttributeValue string) { if !m.settings.Enabled { return } @@ -1361,19 +2211,18 @@ func (m *metricElasticsearchNodeThreadPoolThreads) recordDataPoint(start pcommon dp.SetStartTimestamp(start) dp.SetTimestamp(ts) dp.SetIntVal(val) - dp.Attributes().Insert("thread_pool_name", pcommon.NewValueString(threadPoolNameAttributeValue)) - dp.Attributes().Insert("state", pcommon.NewValueString(threadStateAttributeValue)) + dp.Attributes().Insert("state", pcommon.NewValueString(memoryStateAttributeValue)) } // updateCapacity saves max length of data point slices that will be used for the slice capacity. -func (m *metricElasticsearchNodeThreadPoolThreads) updateCapacity() { +func (m *metricElasticsearchOsMemory) updateCapacity() { if m.data.Sum().DataPoints().Len() > m.capacity { m.capacity = m.data.Sum().DataPoints().Len() } } // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. -func (m *metricElasticsearchNodeThreadPoolThreads) emit(metrics pmetric.MetricSlice) { +func (m *metricElasticsearchOsMemory) emit(metrics pmetric.MetricSlice) { if m.settings.Enabled && m.data.Sum().DataPoints().Len() > 0 { m.updateCapacity() m.data.MoveTo(metrics.AppendEmpty()) @@ -1381,8 +2230,8 @@ func (m *metricElasticsearchNodeThreadPoolThreads) emit(metrics pmetric.MetricSl } } -func newMetricElasticsearchNodeThreadPoolThreads(settings MetricSettings) metricElasticsearchNodeThreadPoolThreads { - m := metricElasticsearchNodeThreadPoolThreads{settings: settings} +func newMetricElasticsearchOsMemory(settings MetricSettings) metricElasticsearchOsMemory { + m := metricElasticsearchOsMemory{settings: settings} if settings.Enabled { m.data = pmetric.NewMetric() m.init() @@ -1949,6 +2798,9 @@ type MetricsBuilder struct { resourceCapacity int // maximum observed number of resource attributes. metricsBuffer pmetric.Metrics // accumulates metrics data before emitting. buildInfo component.BuildInfo // contains version information + metricElasticsearchBreakerMemoryEstimated metricElasticsearchBreakerMemoryEstimated + metricElasticsearchBreakerMemoryLimit metricElasticsearchBreakerMemoryLimit + metricElasticsearchBreakerTripped metricElasticsearchBreakerTripped metricElasticsearchClusterDataNodes metricElasticsearchClusterDataNodes metricElasticsearchClusterHealth metricElasticsearchClusterHealth metricElasticsearchClusterNodes metricElasticsearchClusterNodes @@ -1957,16 +2809,28 @@ type MetricsBuilder struct { metricElasticsearchNodeCacheMemoryUsage metricElasticsearchNodeCacheMemoryUsage metricElasticsearchNodeClusterConnections metricElasticsearchNodeClusterConnections metricElasticsearchNodeClusterIo metricElasticsearchNodeClusterIo + metricElasticsearchNodeDiskIoRead metricElasticsearchNodeDiskIoRead + metricElasticsearchNodeDiskIoWrite metricElasticsearchNodeDiskIoWrite metricElasticsearchNodeDocuments metricElasticsearchNodeDocuments metricElasticsearchNodeFsDiskAvailable metricElasticsearchNodeFsDiskAvailable metricElasticsearchNodeHTTPConnections metricElasticsearchNodeHTTPConnections metricElasticsearchNodeOpenFiles metricElasticsearchNodeOpenFiles metricElasticsearchNodeOperationsCompleted metricElasticsearchNodeOperationsCompleted metricElasticsearchNodeOperationsTime metricElasticsearchNodeOperationsTime + metricElasticsearchNodeShardsDataSetSize metricElasticsearchNodeShardsDataSetSize + metricElasticsearchNodeShardsReservedSize metricElasticsearchNodeShardsReservedSize metricElasticsearchNodeShardsSize metricElasticsearchNodeShardsSize metricElasticsearchNodeThreadPoolTasksFinished metricElasticsearchNodeThreadPoolTasksFinished metricElasticsearchNodeThreadPoolTasksQueued metricElasticsearchNodeThreadPoolTasksQueued metricElasticsearchNodeThreadPoolThreads metricElasticsearchNodeThreadPoolThreads + metricElasticsearchNodeTranslogOperations metricElasticsearchNodeTranslogOperations + metricElasticsearchNodeTranslogSize metricElasticsearchNodeTranslogSize + metricElasticsearchNodeTranslogUncommittedSize metricElasticsearchNodeTranslogUncommittedSize + metricElasticsearchOsCPULoadAvg15m metricElasticsearchOsCPULoadAvg15m + metricElasticsearchOsCPULoadAvg1m metricElasticsearchOsCPULoadAvg1m + metricElasticsearchOsCPULoadAvg5m metricElasticsearchOsCPULoadAvg5m + metricElasticsearchOsCPUUsage metricElasticsearchOsCPUUsage + metricElasticsearchOsMemory metricElasticsearchOsMemory metricJvmClassesLoaded metricJvmClassesLoaded metricJvmGcCollectionsCount metricJvmGcCollectionsCount metricJvmGcCollectionsElapsed metricJvmGcCollectionsElapsed @@ -1992,9 +2856,12 @@ func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption { func NewMetricsBuilder(settings MetricsSettings, buildInfo component.BuildInfo, options ...metricBuilderOption) *MetricsBuilder { mb := &MetricsBuilder{ - startTime: pcommon.NewTimestampFromTime(time.Now()), - metricsBuffer: pmetric.NewMetrics(), - buildInfo: buildInfo, + startTime: pcommon.NewTimestampFromTime(time.Now()), + metricsBuffer: pmetric.NewMetrics(), + buildInfo: buildInfo, + metricElasticsearchBreakerMemoryEstimated: newMetricElasticsearchBreakerMemoryEstimated(settings.ElasticsearchBreakerMemoryEstimated), + metricElasticsearchBreakerMemoryLimit: newMetricElasticsearchBreakerMemoryLimit(settings.ElasticsearchBreakerMemoryLimit), + metricElasticsearchBreakerTripped: newMetricElasticsearchBreakerTripped(settings.ElasticsearchBreakerTripped), metricElasticsearchClusterDataNodes: newMetricElasticsearchClusterDataNodes(settings.ElasticsearchClusterDataNodes), metricElasticsearchClusterHealth: newMetricElasticsearchClusterHealth(settings.ElasticsearchClusterHealth), metricElasticsearchClusterNodes: newMetricElasticsearchClusterNodes(settings.ElasticsearchClusterNodes), @@ -2003,16 +2870,28 @@ func NewMetricsBuilder(settings MetricsSettings, buildInfo component.BuildInfo, metricElasticsearchNodeCacheMemoryUsage: newMetricElasticsearchNodeCacheMemoryUsage(settings.ElasticsearchNodeCacheMemoryUsage), metricElasticsearchNodeClusterConnections: newMetricElasticsearchNodeClusterConnections(settings.ElasticsearchNodeClusterConnections), metricElasticsearchNodeClusterIo: newMetricElasticsearchNodeClusterIo(settings.ElasticsearchNodeClusterIo), + metricElasticsearchNodeDiskIoRead: newMetricElasticsearchNodeDiskIoRead(settings.ElasticsearchNodeDiskIoRead), + metricElasticsearchNodeDiskIoWrite: newMetricElasticsearchNodeDiskIoWrite(settings.ElasticsearchNodeDiskIoWrite), metricElasticsearchNodeDocuments: newMetricElasticsearchNodeDocuments(settings.ElasticsearchNodeDocuments), metricElasticsearchNodeFsDiskAvailable: newMetricElasticsearchNodeFsDiskAvailable(settings.ElasticsearchNodeFsDiskAvailable), metricElasticsearchNodeHTTPConnections: newMetricElasticsearchNodeHTTPConnections(settings.ElasticsearchNodeHTTPConnections), metricElasticsearchNodeOpenFiles: newMetricElasticsearchNodeOpenFiles(settings.ElasticsearchNodeOpenFiles), metricElasticsearchNodeOperationsCompleted: newMetricElasticsearchNodeOperationsCompleted(settings.ElasticsearchNodeOperationsCompleted), metricElasticsearchNodeOperationsTime: newMetricElasticsearchNodeOperationsTime(settings.ElasticsearchNodeOperationsTime), + metricElasticsearchNodeShardsDataSetSize: newMetricElasticsearchNodeShardsDataSetSize(settings.ElasticsearchNodeShardsDataSetSize), + metricElasticsearchNodeShardsReservedSize: newMetricElasticsearchNodeShardsReservedSize(settings.ElasticsearchNodeShardsReservedSize), metricElasticsearchNodeShardsSize: newMetricElasticsearchNodeShardsSize(settings.ElasticsearchNodeShardsSize), metricElasticsearchNodeThreadPoolTasksFinished: newMetricElasticsearchNodeThreadPoolTasksFinished(settings.ElasticsearchNodeThreadPoolTasksFinished), metricElasticsearchNodeThreadPoolTasksQueued: newMetricElasticsearchNodeThreadPoolTasksQueued(settings.ElasticsearchNodeThreadPoolTasksQueued), metricElasticsearchNodeThreadPoolThreads: newMetricElasticsearchNodeThreadPoolThreads(settings.ElasticsearchNodeThreadPoolThreads), + metricElasticsearchNodeTranslogOperations: newMetricElasticsearchNodeTranslogOperations(settings.ElasticsearchNodeTranslogOperations), + metricElasticsearchNodeTranslogSize: newMetricElasticsearchNodeTranslogSize(settings.ElasticsearchNodeTranslogSize), + metricElasticsearchNodeTranslogUncommittedSize: newMetricElasticsearchNodeTranslogUncommittedSize(settings.ElasticsearchNodeTranslogUncommittedSize), + metricElasticsearchOsCPULoadAvg15m: newMetricElasticsearchOsCPULoadAvg15m(settings.ElasticsearchOsCPULoadAvg15m), + metricElasticsearchOsCPULoadAvg1m: newMetricElasticsearchOsCPULoadAvg1m(settings.ElasticsearchOsCPULoadAvg1m), + metricElasticsearchOsCPULoadAvg5m: newMetricElasticsearchOsCPULoadAvg5m(settings.ElasticsearchOsCPULoadAvg5m), + metricElasticsearchOsCPUUsage: newMetricElasticsearchOsCPUUsage(settings.ElasticsearchOsCPUUsage), + metricElasticsearchOsMemory: newMetricElasticsearchOsMemory(settings.ElasticsearchOsMemory), metricJvmClassesLoaded: newMetricJvmClassesLoaded(settings.JvmClassesLoaded), metricJvmGcCollectionsCount: newMetricJvmGcCollectionsCount(settings.JvmGcCollectionsCount), metricJvmGcCollectionsElapsed: newMetricJvmGcCollectionsElapsed(settings.JvmGcCollectionsElapsed), @@ -2090,6 +2969,9 @@ func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption) { ils.Scope().SetName("otelcol/elasticsearchreceiver") ils.Scope().SetVersion(mb.buildInfo.Version) ils.Metrics().EnsureCapacity(mb.metricsCapacity) + mb.metricElasticsearchBreakerMemoryEstimated.emit(ils.Metrics()) + mb.metricElasticsearchBreakerMemoryLimit.emit(ils.Metrics()) + mb.metricElasticsearchBreakerTripped.emit(ils.Metrics()) mb.metricElasticsearchClusterDataNodes.emit(ils.Metrics()) mb.metricElasticsearchClusterHealth.emit(ils.Metrics()) mb.metricElasticsearchClusterNodes.emit(ils.Metrics()) @@ -2098,16 +2980,28 @@ func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption) { mb.metricElasticsearchNodeCacheMemoryUsage.emit(ils.Metrics()) mb.metricElasticsearchNodeClusterConnections.emit(ils.Metrics()) mb.metricElasticsearchNodeClusterIo.emit(ils.Metrics()) + mb.metricElasticsearchNodeDiskIoRead.emit(ils.Metrics()) + mb.metricElasticsearchNodeDiskIoWrite.emit(ils.Metrics()) mb.metricElasticsearchNodeDocuments.emit(ils.Metrics()) mb.metricElasticsearchNodeFsDiskAvailable.emit(ils.Metrics()) mb.metricElasticsearchNodeHTTPConnections.emit(ils.Metrics()) mb.metricElasticsearchNodeOpenFiles.emit(ils.Metrics()) mb.metricElasticsearchNodeOperationsCompleted.emit(ils.Metrics()) mb.metricElasticsearchNodeOperationsTime.emit(ils.Metrics()) + mb.metricElasticsearchNodeShardsDataSetSize.emit(ils.Metrics()) + mb.metricElasticsearchNodeShardsReservedSize.emit(ils.Metrics()) mb.metricElasticsearchNodeShardsSize.emit(ils.Metrics()) mb.metricElasticsearchNodeThreadPoolTasksFinished.emit(ils.Metrics()) mb.metricElasticsearchNodeThreadPoolTasksQueued.emit(ils.Metrics()) mb.metricElasticsearchNodeThreadPoolThreads.emit(ils.Metrics()) + mb.metricElasticsearchNodeTranslogOperations.emit(ils.Metrics()) + mb.metricElasticsearchNodeTranslogSize.emit(ils.Metrics()) + mb.metricElasticsearchNodeTranslogUncommittedSize.emit(ils.Metrics()) + mb.metricElasticsearchOsCPULoadAvg15m.emit(ils.Metrics()) + mb.metricElasticsearchOsCPULoadAvg1m.emit(ils.Metrics()) + mb.metricElasticsearchOsCPULoadAvg5m.emit(ils.Metrics()) + mb.metricElasticsearchOsCPUUsage.emit(ils.Metrics()) + mb.metricElasticsearchOsMemory.emit(ils.Metrics()) mb.metricJvmClassesLoaded.emit(ils.Metrics()) mb.metricJvmGcCollectionsCount.emit(ils.Metrics()) mb.metricJvmGcCollectionsElapsed.emit(ils.Metrics()) @@ -2138,6 +3032,21 @@ func (mb *MetricsBuilder) Emit(rmo ...ResourceMetricsOption) pmetric.Metrics { return metrics } +// RecordElasticsearchBreakerMemoryEstimatedDataPoint adds a data point to elasticsearch.breaker.memory.estimated metric. +func (mb *MetricsBuilder) RecordElasticsearchBreakerMemoryEstimatedDataPoint(ts pcommon.Timestamp, val int64, circuitBreakerNameAttributeValue string) { + mb.metricElasticsearchBreakerMemoryEstimated.recordDataPoint(mb.startTime, ts, val, circuitBreakerNameAttributeValue) +} + +// RecordElasticsearchBreakerMemoryLimitDataPoint adds a data point to elasticsearch.breaker.memory.limit metric. +func (mb *MetricsBuilder) RecordElasticsearchBreakerMemoryLimitDataPoint(ts pcommon.Timestamp, val int64, circuitBreakerNameAttributeValue string) { + mb.metricElasticsearchBreakerMemoryLimit.recordDataPoint(mb.startTime, ts, val, circuitBreakerNameAttributeValue) +} + +// RecordElasticsearchBreakerTrippedDataPoint adds a data point to elasticsearch.breaker.tripped metric. +func (mb *MetricsBuilder) RecordElasticsearchBreakerTrippedDataPoint(ts pcommon.Timestamp, val int64, circuitBreakerNameAttributeValue string) { + mb.metricElasticsearchBreakerTripped.recordDataPoint(mb.startTime, ts, val, circuitBreakerNameAttributeValue) +} + // RecordElasticsearchClusterDataNodesDataPoint adds a data point to elasticsearch.cluster.data_nodes metric. func (mb *MetricsBuilder) RecordElasticsearchClusterDataNodesDataPoint(ts pcommon.Timestamp, val int64) { mb.metricElasticsearchClusterDataNodes.recordDataPoint(mb.startTime, ts, val) @@ -2178,6 +3087,16 @@ func (mb *MetricsBuilder) RecordElasticsearchNodeClusterIoDataPoint(ts pcommon.T mb.metricElasticsearchNodeClusterIo.recordDataPoint(mb.startTime, ts, val, directionAttributeValue.String()) } +// RecordElasticsearchNodeDiskIoReadDataPoint adds a data point to elasticsearch.node.disk.io.read metric. +func (mb *MetricsBuilder) RecordElasticsearchNodeDiskIoReadDataPoint(ts pcommon.Timestamp, val int64) { + mb.metricElasticsearchNodeDiskIoRead.recordDataPoint(mb.startTime, ts, val) +} + +// RecordElasticsearchNodeDiskIoWriteDataPoint adds a data point to elasticsearch.node.disk.io.write metric. +func (mb *MetricsBuilder) RecordElasticsearchNodeDiskIoWriteDataPoint(ts pcommon.Timestamp, val int64) { + mb.metricElasticsearchNodeDiskIoWrite.recordDataPoint(mb.startTime, ts, val) +} + // RecordElasticsearchNodeDocumentsDataPoint adds a data point to elasticsearch.node.documents metric. func (mb *MetricsBuilder) RecordElasticsearchNodeDocumentsDataPoint(ts pcommon.Timestamp, val int64, documentStateAttributeValue AttributeDocumentState) { mb.metricElasticsearchNodeDocuments.recordDataPoint(mb.startTime, ts, val, documentStateAttributeValue.String()) @@ -2208,6 +3127,16 @@ func (mb *MetricsBuilder) RecordElasticsearchNodeOperationsTimeDataPoint(ts pcom mb.metricElasticsearchNodeOperationsTime.recordDataPoint(mb.startTime, ts, val, operationAttributeValue.String()) } +// RecordElasticsearchNodeShardsDataSetSizeDataPoint adds a data point to elasticsearch.node.shards.data_set.size metric. +func (mb *MetricsBuilder) RecordElasticsearchNodeShardsDataSetSizeDataPoint(ts pcommon.Timestamp, val int64) { + mb.metricElasticsearchNodeShardsDataSetSize.recordDataPoint(mb.startTime, ts, val) +} + +// RecordElasticsearchNodeShardsReservedSizeDataPoint adds a data point to elasticsearch.node.shards.reserved.size metric. +func (mb *MetricsBuilder) RecordElasticsearchNodeShardsReservedSizeDataPoint(ts pcommon.Timestamp, val int64) { + mb.metricElasticsearchNodeShardsReservedSize.recordDataPoint(mb.startTime, ts, val) +} + // RecordElasticsearchNodeShardsSizeDataPoint adds a data point to elasticsearch.node.shards.size metric. func (mb *MetricsBuilder) RecordElasticsearchNodeShardsSizeDataPoint(ts pcommon.Timestamp, val int64) { mb.metricElasticsearchNodeShardsSize.recordDataPoint(mb.startTime, ts, val) @@ -2228,6 +3157,46 @@ func (mb *MetricsBuilder) RecordElasticsearchNodeThreadPoolThreadsDataPoint(ts p mb.metricElasticsearchNodeThreadPoolThreads.recordDataPoint(mb.startTime, ts, val, threadPoolNameAttributeValue, threadStateAttributeValue.String()) } +// RecordElasticsearchNodeTranslogOperationsDataPoint adds a data point to elasticsearch.node.translog.operations metric. +func (mb *MetricsBuilder) RecordElasticsearchNodeTranslogOperationsDataPoint(ts pcommon.Timestamp, val int64) { + mb.metricElasticsearchNodeTranslogOperations.recordDataPoint(mb.startTime, ts, val) +} + +// RecordElasticsearchNodeTranslogSizeDataPoint adds a data point to elasticsearch.node.translog.size metric. +func (mb *MetricsBuilder) RecordElasticsearchNodeTranslogSizeDataPoint(ts pcommon.Timestamp, val int64) { + mb.metricElasticsearchNodeTranslogSize.recordDataPoint(mb.startTime, ts, val) +} + +// RecordElasticsearchNodeTranslogUncommittedSizeDataPoint adds a data point to elasticsearch.node.translog.uncommitted.size metric. +func (mb *MetricsBuilder) RecordElasticsearchNodeTranslogUncommittedSizeDataPoint(ts pcommon.Timestamp, val int64) { + mb.metricElasticsearchNodeTranslogUncommittedSize.recordDataPoint(mb.startTime, ts, val) +} + +// RecordElasticsearchOsCPULoadAvg15mDataPoint adds a data point to elasticsearch.os.cpu.load_avg.15m metric. +func (mb *MetricsBuilder) RecordElasticsearchOsCPULoadAvg15mDataPoint(ts pcommon.Timestamp, val float64) { + mb.metricElasticsearchOsCPULoadAvg15m.recordDataPoint(mb.startTime, ts, val) +} + +// RecordElasticsearchOsCPULoadAvg1mDataPoint adds a data point to elasticsearch.os.cpu.load_avg.1m metric. +func (mb *MetricsBuilder) RecordElasticsearchOsCPULoadAvg1mDataPoint(ts pcommon.Timestamp, val float64) { + mb.metricElasticsearchOsCPULoadAvg1m.recordDataPoint(mb.startTime, ts, val) +} + +// RecordElasticsearchOsCPULoadAvg5mDataPoint adds a data point to elasticsearch.os.cpu.load_avg.5m metric. +func (mb *MetricsBuilder) RecordElasticsearchOsCPULoadAvg5mDataPoint(ts pcommon.Timestamp, val float64) { + mb.metricElasticsearchOsCPULoadAvg5m.recordDataPoint(mb.startTime, ts, val) +} + +// RecordElasticsearchOsCPUUsageDataPoint adds a data point to elasticsearch.os.cpu.usage metric. +func (mb *MetricsBuilder) RecordElasticsearchOsCPUUsageDataPoint(ts pcommon.Timestamp, val int64) { + mb.metricElasticsearchOsCPUUsage.recordDataPoint(mb.startTime, ts, val) +} + +// RecordElasticsearchOsMemoryDataPoint adds a data point to elasticsearch.os.memory metric. +func (mb *MetricsBuilder) RecordElasticsearchOsMemoryDataPoint(ts pcommon.Timestamp, val int64, memoryStateAttributeValue AttributeMemoryState) { + mb.metricElasticsearchOsMemory.recordDataPoint(mb.startTime, ts, val, memoryStateAttributeValue.String()) +} + // RecordJvmClassesLoadedDataPoint adds a data point to jvm.classes.loaded metric. func (mb *MetricsBuilder) RecordJvmClassesLoadedDataPoint(ts pcommon.Timestamp, val int64) { mb.metricJvmClassesLoaded.recordDataPoint(mb.startTime, ts, val) diff --git a/receiver/elasticsearchreceiver/internal/model/nodestats.go b/receiver/elasticsearchreceiver/internal/model/nodestats.go index c6314777fd51..c0ecb2123bd8 100644 --- a/receiver/elasticsearchreceiver/internal/model/nodestats.go +++ b/receiver/elasticsearchreceiver/internal/model/nodestats.go @@ -23,15 +23,49 @@ type NodeStats struct { } type NodeStatsNodesInfo struct { - TimestampMsSinceEpoch int64 `json:"timestamp"` - Name string `json:"name"` - Indices NodeStatsNodesInfoIndices `json:"indices"` - ProcessStats ProcessStats `json:"process"` - JVMInfo JVMInfo `json:"jvm"` - ThreadPoolInfo map[string]ThreadPoolStats `json:"thread_pool"` - TransportStats TransportStats `json:"transport"` - HTTPStats HTTPStats `json:"http"` - FS FSStats `json:"fs"` + TimestampMsSinceEpoch int64 `json:"timestamp"` + Name string `json:"name"` + Indices NodeStatsNodesInfoIndices `json:"indices"` + ProcessStats ProcessStats `json:"process"` + JVMInfo JVMInfo `json:"jvm"` + ThreadPoolInfo map[string]ThreadPoolStats `json:"thread_pool"` + TransportStats TransportStats `json:"transport"` + HTTPStats HTTPStats `json:"http"` + CircuitBreakerInfo map[string]CircuitBreakerStats `json:"breakers"` + FS FSStats `json:"fs"` + OS OSStats `json:"os"` +} + +type OSStats struct { + Timestamp int64 `json:"timestamp"` + CPU OSCPUStats `json:"cpu"` + Memory OSCMemoryStats `json:"mem"` +} + +type OSCPUStats struct { + Usage int64 `json:"percent"` + LoadAvg OSCpuLoadAvgStats `json:"load_average"` +} + +type OSCMemoryStats struct { + TotalInBy int64 `json:"total_in_bytes"` + FreeInBy int64 `json:"free_in_bytes"` + UsedInBy int64 `json:"used_in_bytes"` +} + +type OSCpuLoadAvgStats struct { + OneMinute float64 `json:"1m"` + FiveMinutes float64 `json:"5m"` + FifteenMinutes float64 `json:"15m"` +} + +type CircuitBreakerStats struct { + LimitSizeInBytes int64 `json:"limit_size_in_bytes"` + LimitSize string `json:"limit_size"` + EstimatedSizeInBytes int64 `json:"estimated_size_in_bytes"` + EstimatedSize string `json:"estimated_size"` + Overhead float64 `json:"overhead"` + Tripped int64 `json:"tripped"` } type NodeStatsNodesInfoIndices struct { @@ -46,10 +80,19 @@ type NodeStatsNodesInfoIndices struct { WarmerOperations BasicIndexOperation `json:"warmer"` QueryCache BasicCacheInfo `json:"query_cache"` FieldDataCache BasicCacheInfo `json:"fielddata"` + TranslogStats TranslogStats `json:"translog"` +} + +type TranslogStats struct { + Operations int64 `json:"operations"` + SizeInBy int64 `json:"size_in_bytes"` + UncommittedOperationsInBy int64 `json:"uncommitted_size_in_bytes"` } type StoreInfo struct { - SizeInBy int64 `json:"size_in_bytes"` + SizeInBy int64 `json:"size_in_bytes"` + DataSetSizeInBy int64 `json:"total_data_set_size_in_bytes"` + ReservedInBy int64 `json:"reserved_in_bytes"` } type BasicIndexOperation struct { @@ -88,6 +131,7 @@ type DocumentStats struct { type BasicCacheInfo struct { Evictions int64 `json:"evictions"` MemorySizeInBy int64 `json:"memory_size_in_bytes"` + MemorySize int64 `json:"memory_size"` } type JVMInfo struct { @@ -171,6 +215,7 @@ type FSStats struct { type FSTotalStats struct { AvailableBytes int64 `json:"available_in_bytes"` TotalBytes int64 `json:"total_in_bytes"` + FreeBytes int64 `json:"free_in_bytes"` } type IOStats struct { @@ -178,6 +223,9 @@ type IOStats struct { } type IOStatsTotal struct { + Operations int64 `json:"operations"` ReadOperations int64 `json:"read_operations"` WriteOperations int64 `json:"write_operations"` + ReadBytes int64 `json:"read_kilobytes"` + WriteBytes int64 `json:"write_kilobytes"` } diff --git a/receiver/elasticsearchreceiver/metadata.yaml b/receiver/elasticsearchreceiver/metadata.yaml index 44abde74a8ab..e8704a537bef 100644 --- a/receiver/elasticsearchreceiver/metadata.yaml +++ b/receiver/elasticsearchreceiver/metadata.yaml @@ -87,8 +87,42 @@ attributes: - green - yellow - red + circuit_breaker_name: + value: name + description: The name of circuit breaker. + memory_state: + value: state + description: State of the memory + enum: + - free + - used metrics: # these metrics are from /_nodes/stats, and are node level metrics + elasticsearch.breaker.memory.estimated: + description: Estimated memory used for the operation. + unit: By + gauge: + value_type: int + attributes: [circuit_breaker_name] + enabled: true + elasticsearch.breaker.memory.limit: + description: Memory limit for the circuit breaker. + unit: By + sum: + monotonic: false + aggregation: cumulative + value_type: int + attributes: [circuit_breaker_name] + enabled: true + elasticsearch.breaker.tripped: + description: Total number of times the circuit breaker has been triggered and prevented an out of memory error. + unit: 1 + sum: + monotonic: true + aggregation: cumulative + value_type: int + attributes: [circuit_breaker_name] + enabled: true elasticsearch.node.cache.memory.usage: description: The size in bytes of the cache. unit: By @@ -116,6 +150,24 @@ metrics: value_type: int attributes: [] enabled: true + elasticsearch.node.disk.io.read: + description: The total number of kilobytes read across all file stores for this node. + unit: By + sum: + monotonic: false + aggregation: cumulative + value_type: int + attributes: [ ] + enabled: true + elasticsearch.node.disk.io.write: + description: The total number of kilobytes written across all file stores for this node. + unit: By + sum: + monotonic: false + aggregation: cumulative + value_type: int + attributes: [ ] + enabled: true elasticsearch.node.cluster.io: description: The number of bytes sent and received on the network for internal cluster communication. unit: By @@ -170,6 +222,51 @@ metrics: value_type: int attributes: [] enabled: true + elasticsearch.node.shards.data_set.size: + description: Total data set size of all shards assigned to the node. This includes the size of shards not stored fully on the node, such as the cache for partially mounted indices. + unit: By + sum: + monotonic: false + aggregation: cumulative + value_type: int + attributes: [ ] + enabled: true + elasticsearch.node.shards.reserved.size: + description: A prediction of how much larger the shard stores on this node will eventually grow due to ongoing peer recoveries, restoring snapshots, and similar activities. A value of -1 indicates that this is not available. + unit: By + sum: + monotonic: false + aggregation: cumulative + value_type: int + attributes: [ ] + enabled: true + elasticsearch.node.translog.operations: + description: Number of transaction log operations. + unit: "{operations}" + sum: + monotonic: true + aggregation: cumulative + value_type: int + attributes: [ ] + enabled: true + elasticsearch.node.translog.size: + description: Size of the transaction log. + unit: By + sum: + monotonic: false + aggregation: cumulative + value_type: int + attributes: [ ] + enabled: true + elasticsearch.node.translog.uncommitted.size: + description: Size of uncommitted transaction log operations. + unit: By + sum: + monotonic: false + aggregation: cumulative + value_type: int + attributes: [ ] + enabled: true elasticsearch.node.thread_pool.threads: description: The number of threads in the thread pool. unit: "{threads}" @@ -340,3 +437,40 @@ metrics: value_type: int attributes: [health_status] enabled: true + elasticsearch.os.cpu.usage: + description: Recent CPU usage for the whole system, or -1 if not supported. + unit: '%' + gauge: + value_type: int + attributes: [ ] + enabled: true + elasticsearch.os.cpu.load_avg.1m: + description: One-minute load average on the system (field is not present if one-minute load average is not available). + unit: 1.0 + gauge: + value_type: double + attributes: [ ] + enabled: true + elasticsearch.os.cpu.load_avg.5m: + description: Five-minute load average on the system (field is not present if five-minute load average is not available). + unit: 1.0 + gauge: + value_type: double + attributes: [ ] + enabled: true + elasticsearch.os.cpu.load_avg.15m: + description: Fifteen-minute load average on the system (field is not present if fifteen-minute load average is not available). + unit: 1.0 + gauge: + value_type: double + attributes: [ ] + enabled: true + elasticsearch.os.memory: + description: Amount of physical memory. + unit: By + sum: + monotonic: false + aggregation: cumulative + value_type: int + attributes: [memory_state] + enabled: true diff --git a/receiver/elasticsearchreceiver/scraper.go b/receiver/elasticsearchreceiver/scraper.go index 7478ab4a1109..c2e24867d707 100644 --- a/receiver/elasticsearchreceiver/scraper.go +++ b/receiver/elasticsearchreceiver/scraper.go @@ -85,6 +85,9 @@ func (r *elasticsearchScraper) scrapeNodeMetrics(ctx context.Context, now pcommo r.mb.RecordElasticsearchNodeFsDiskAvailableDataPoint(now, info.FS.Total.AvailableBytes) + r.mb.RecordElasticsearchNodeDiskIoReadDataPoint(now, info.FS.IOStats.Total.ReadBytes) + r.mb.RecordElasticsearchNodeDiskIoWriteDataPoint(now, info.FS.IOStats.Total.WriteBytes) + r.mb.RecordElasticsearchNodeClusterIoDataPoint(now, info.TransportStats.ReceivedBytes, metadata.AttributeDirectionReceived) r.mb.RecordElasticsearchNodeClusterIoDataPoint(now, info.TransportStats.SentBytes, metadata.AttributeDirectionSent) @@ -117,6 +120,8 @@ func (r *elasticsearchScraper) scrapeNodeMetrics(ctx context.Context, now pcommo r.mb.RecordElasticsearchNodeOperationsTimeDataPoint(now, info.Indices.WarmerOperations.TotalTimeInMs, metadata.AttributeOperationWarmer) r.mb.RecordElasticsearchNodeShardsSizeDataPoint(now, info.Indices.StoreInfo.SizeInBy) + r.mb.RecordElasticsearchNodeShardsDataSetSizeDataPoint(now, info.Indices.StoreInfo.DataSetSizeInBy) + r.mb.RecordElasticsearchNodeShardsReservedSizeDataPoint(now, info.Indices.StoreInfo.ReservedInBy) for tpName, tpInfo := range info.ThreadPoolInfo { r.mb.RecordElasticsearchNodeThreadPoolThreadsDataPoint(now, tpInfo.ActiveThreads, tpName, metadata.AttributeThreadStateActive) @@ -128,11 +133,29 @@ func (r *elasticsearchScraper) scrapeNodeMetrics(ctx context.Context, now pcommo r.mb.RecordElasticsearchNodeThreadPoolTasksFinishedDataPoint(now, tpInfo.RejectedTasks, tpName, metadata.AttributeTaskStateRejected) } + for cbName, cbInfo := range info.CircuitBreakerInfo { + r.mb.RecordElasticsearchBreakerMemoryEstimatedDataPoint(now, cbInfo.EstimatedSizeInBytes, cbName) + r.mb.RecordElasticsearchBreakerMemoryLimitDataPoint(now, cbInfo.LimitSizeInBytes, cbName) + r.mb.RecordElasticsearchBreakerTrippedDataPoint(now, cbInfo.Tripped, cbName) + } + r.mb.RecordElasticsearchNodeDocumentsDataPoint(now, info.Indices.DocumentStats.ActiveCount, metadata.AttributeDocumentStateActive) r.mb.RecordElasticsearchNodeDocumentsDataPoint(now, info.Indices.DocumentStats.DeletedCount, metadata.AttributeDocumentStateDeleted) r.mb.RecordElasticsearchNodeOpenFilesDataPoint(now, info.ProcessStats.OpenFileDescriptorsCount) + r.mb.RecordElasticsearchNodeTranslogOperationsDataPoint(now, info.Indices.TranslogStats.Operations) + r.mb.RecordElasticsearchNodeTranslogSizeDataPoint(now, info.Indices.TranslogStats.SizeInBy) + r.mb.RecordElasticsearchNodeTranslogUncommittedSizeDataPoint(now, info.Indices.TranslogStats.UncommittedOperationsInBy) + + r.mb.RecordElasticsearchOsCPUUsageDataPoint(now, info.OS.CPU.Usage) + r.mb.RecordElasticsearchOsCPULoadAvg1mDataPoint(now, info.OS.CPU.LoadAvg.OneMinute) + r.mb.RecordElasticsearchOsCPULoadAvg5mDataPoint(now, info.OS.CPU.LoadAvg.FiveMinutes) + r.mb.RecordElasticsearchOsCPULoadAvg15mDataPoint(now, info.OS.CPU.LoadAvg.FifteenMinutes) + + r.mb.RecordElasticsearchOsMemoryDataPoint(now, info.OS.Memory.UsedInBy, metadata.AttributeMemoryStateUsed) + r.mb.RecordElasticsearchOsMemoryDataPoint(now, info.OS.Memory.FreeInBy, metadata.AttributeMemoryStateFree) + r.mb.RecordJvmClassesLoadedDataPoint(now, info.JVMInfo.ClassInfo.CurrentLoadedCount) r.mb.RecordJvmGcCollectionsCountDataPoint(now, info.JVMInfo.JVMGCInfo.Collectors.Young.CollectionCount, "young") diff --git a/receiver/elasticsearchreceiver/testdata/expected_metrics/clusterSkip.json b/receiver/elasticsearchreceiver/testdata/expected_metrics/clusterSkip.json index 08189f42ebaf..a66130ad2596 100644 --- a/receiver/elasticsearchreceiver/testdata/expected_metrics/clusterSkip.json +++ b/receiver/elasticsearchreceiver/testdata/expected_metrics/clusterSkip.json @@ -8,6 +8,271 @@ "version": "latest" }, "metrics": [ + { + "description": "Estimated memory used for the operation.", + "gauge": { + "dataPoints": [ + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "request" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "fielddata" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "in_flight_requests" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "model_inference" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "accounting" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "305152000", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "parent" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "name": "elasticsearch.breaker.memory.estimated", + "unit": "By" + }, + { + "description": "Memory limit for the circuit breaker.", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "322122547", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "request" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "214748364", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "fielddata" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "536870912", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "in_flight_requests" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "268435456", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "model_inference" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "536870912", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "accounting" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "510027366", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "parent" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ], + "isMonotonic": false + }, + "name": "elasticsearch.breaker.memory.limit", + "unit": "By" + }, + { + "description": "Total number of times the circuit breaker has been triggered and prevented an out of memory error.", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "request" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "fielddata" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "in_flight_requests" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "model_inference" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "accounting" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "parent" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ], + "isMonotonic": true + }, + "name": "elasticsearch.breaker.tripped", + "unit": "1" + }, { "description": "The number of evictions from the cache.", "name": "elasticsearch.node.cache.evictions", @@ -184,6 +449,36 @@ }, "unit": "By" }, + { + "description": "The total number of kilobytes read across all file stores for this node.", + "name": "elasticsearch.node.disk.io.read", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "1617780", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "By" + }, + { + "description": "The total number of kilobytes written across all file stores for this node.", + "name": "elasticsearch.node.disk.io.write", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "602016", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "By" + }, { "description": "The number of HTTP connections to the node.", "name": "elasticsearch.node.http.connections", @@ -537,6 +832,175 @@ }, "unit": "By" }, + { + "description": "Total data set size of all shards assigned to the node. This includes the size of shards not stored fully on the node, such as the cache for partially mounted indices.", + "name": "elasticsearch.node.shards.data_set.size", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "0", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "By" + }, + { + "description": "A prediction of how much larger the shard stores on this node will eventually grow due to ongoing peer recoveries, restoring snapshots, and similar activities. A value of -1 indicates that this is not available.", + "name": "elasticsearch.node.shards.reserved.size", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "0", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "By" + }, + { + "description": "Number of transaction log operations.", + "name": "elasticsearch.node.translog.operations", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "0", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ], + "isMonotonic": true + }, + "unit": "{operations}" + }, + { + "description": "Size of the transaction log.", + "name": "elasticsearch.node.translog.size", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "0", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "By" + }, + { + "description": "Size of uncommitted transaction log operations.", + "name": "elasticsearch.node.translog.uncommitted.size", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "0", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "By" + }, + { + "description": "Recent CPU usage for the whole system, or -1 if not supported.", + "name": "elasticsearch.os.cpu.usage", + "gauge": { + "dataPoints": [ + { + "asInt": "3", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "%" + }, + { + "description": "One-minute load average on the system (field is not present if one-minute load average is not available).", + "name": "elasticsearch.os.cpu.load_avg.1m", + "gauge": { + "dataPoints": [ + { + "asDouble": "0.0", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "1" + }, + { + "description": "Five-minute load average on the system (field is not present if five-minute load average is not available).", + "name": "elasticsearch.os.cpu.load_avg.5m", + "gauge": { + "dataPoints": [ + { + "asDouble": "0.02", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "1" + }, + { + "description": "Fifteen-minute load average on the system (field is not present if fifteen-minute load average is not available).", + "name": "elasticsearch.os.cpu.load_avg.15m", + "gauge": { + "dataPoints": [ + { + "asDouble": "0.02", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "1" + }, + { + "description": "Amount of physical memory.", + "name": "elasticsearch.os.memory", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "294109184", + "attributes": [ + { + "key": "state", + "value": { + "stringValue": "free" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "779632640", + "attributes": [ + { + "key": "state", + "value": { + "stringValue": "used" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ], + "isMonotonic": false + }, + "unit": "By" + }, { "description": "The number of tasks finished by the thread pool.", "name": "elasticsearch.node.thread_pool.tasks.finished", diff --git a/receiver/elasticsearchreceiver/testdata/expected_metrics/full.json b/receiver/elasticsearchreceiver/testdata/expected_metrics/full.json index 9babee269613..e11e274aef92 100644 --- a/receiver/elasticsearchreceiver/testdata/expected_metrics/full.json +++ b/receiver/elasticsearchreceiver/testdata/expected_metrics/full.json @@ -8,6 +8,271 @@ "version": "latest" }, "metrics": [ + { + "description": "Estimated memory used for the operation.", + "gauge": { + "dataPoints": [ + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "request" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "fielddata" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "in_flight_requests" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "model_inference" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "accounting" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "305152000", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "parent" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "name": "elasticsearch.breaker.memory.estimated", + "unit": "By" + }, + { + "description": "Memory limit for the circuit breaker.", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "322122547", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "request" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "214748364", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "fielddata" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "536870912", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "in_flight_requests" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "268435456", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "model_inference" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "536870912", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "accounting" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "510027366", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "parent" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ], + "isMonotonic": false + }, + "name": "elasticsearch.breaker.memory.limit", + "unit": "By" + }, + { + "description": "Total number of times the circuit breaker has been triggered and prevented an out of memory error.", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "request" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "fielddata" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "in_flight_requests" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "model_inference" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "accounting" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "0", + "attributes": [ + { + "key": "name", + "value": { + "stringValue": "parent" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ], + "isMonotonic": true + }, + "name": "elasticsearch.breaker.tripped", + "unit": "1" + }, { "description": "The number of evictions from the cache.", "name": "elasticsearch.node.cache.evictions", @@ -184,6 +449,36 @@ }, "unit": "By" }, + { + "description": "The total number of kilobytes read across all file stores for this node.", + "name": "elasticsearch.node.disk.io.read", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "1617780", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "By" + }, + { + "description": "The total number of kilobytes written across all file stores for this node.", + "name": "elasticsearch.node.disk.io.write", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "602016", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "By" + }, { "description": "The number of HTTP connections to the node.", "name": "elasticsearch.node.http.connections", @@ -537,6 +832,175 @@ }, "unit": "By" }, + { + "description": "Total data set size of all shards assigned to the node. This includes the size of shards not stored fully on the node, such as the cache for partially mounted indices.", + "name": "elasticsearch.node.shards.data_set.size", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "0", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "By" + }, + { + "description": "A prediction of how much larger the shard stores on this node will eventually grow due to ongoing peer recoveries, restoring snapshots, and similar activities. A value of -1 indicates that this is not available.", + "name": "elasticsearch.node.shards.reserved.size", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "0", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "By" + }, + { + "description": "Number of transaction log operations.", + "name": "elasticsearch.node.translog.operations", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "0", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ], + "isMonotonic": true + }, + "unit": "{operations}" + }, + { + "description": "Size of the transaction log.", + "name": "elasticsearch.node.translog.size", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "0", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "By" + }, + { + "description": "Size of uncommitted transaction log operations.", + "name": "elasticsearch.node.translog.uncommitted.size", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "0", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "By" + }, + { + "description": "Recent CPU usage for the whole system, or -1 if not supported.", + "name": "elasticsearch.os.cpu.usage", + "gauge": { + "dataPoints": [ + { + "asInt": "3", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "%" + }, + { + "description": "One-minute load average on the system (field is not present if one-minute load average is not available).", + "name": "elasticsearch.os.cpu.load_avg.1m", + "gauge": { + "dataPoints": [ + { + "asDouble": "0.0", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "1" + }, + { + "description": "Five-minute load average on the system (field is not present if five-minute load average is not available).", + "name": "elasticsearch.os.cpu.load_avg.5m", + "gauge": { + "dataPoints": [ + { + "asDouble": "0.02", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "1" + }, + { + "description": "Fifteen-minute load average on the system (field is not present if fifteen-minute load average is not available).", + "name": "elasticsearch.os.cpu.load_avg.15m", + "gauge": { + "dataPoints": [ + { + "asDouble": "0.02", + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ] + }, + "unit": "1" + }, + { + "description": "Amount of physical memory.", + "name": "elasticsearch.os.memory", + "sum": { + "aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE", + "dataPoints": [ + { + "asInt": "294109184", + "attributes": [ + { + "key": "state", + "value": { + "stringValue": "free" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + }, + { + "asInt": "779632640", + "attributes": [ + { + "key": "state", + "value": { + "stringValue": "used" + } + } + ], + "startTimeUnixNano": "1642218266053041000", + "timeUnixNano": "1642218266053039000" + } + ], + "isMonotonic": false + }, + "unit": "By" + }, { "description": "The number of tasks finished by the thread pool.", "name": "elasticsearch.node.thread_pool.tasks.finished", diff --git a/unreleased/add-more-elasticsearch-metrics.yaml b/unreleased/add-more-elasticsearch-metrics.yaml new file mode 100755 index 000000000000..13c920c96e53 --- /dev/null +++ b/unreleased/add-more-elasticsearch-metrics.yaml @@ -0,0 +1,17 @@ +# 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 metrics + +# One or more tracking issues related to the change +issues: [12176] + +# (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: | + Add additional metrics for circuit breakers, disk IO r/w, translog, and CPU load.