diff --git a/cmd/otelcontribcol/go.mod b/cmd/otelcontribcol/go.mod index c79f821fde51..2b5b23f84d45 100644 --- a/cmd/otelcontribcol/go.mod +++ b/cmd/otelcontribcol/go.mod @@ -460,6 +460,7 @@ require ( github.com/influxdata/influxdb-observability/otel2influx v0.5.8 // indirect github.com/influxdata/line-protocol/v2 v2.2.1 // indirect github.com/ionos-cloud/sdk-go/v6 v6.1.9 // indirect + github.com/ishleenk17/opentelemetry-collector-contrib/processor/elasticprocessor v0.0.0-20240205053831-6d9a005cfe4b // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgconn v1.14.0 // indirect github.com/jackc/pgio v1.0.0 // indirect diff --git a/cmd/otelcontribcol/go.sum b/cmd/otelcontribcol/go.sum index 3bf0ad9105ef..57eaa83147cb 100644 --- a/cmd/otelcontribcol/go.sum +++ b/cmd/otelcontribcol/go.sum @@ -975,6 +975,10 @@ github.com/influxdata/line-protocol/v2 v2.2.1 h1:EAPkqJ9Km4uAxtMRgUubJyqAr6zgWM0 github.com/influxdata/line-protocol/v2 v2.2.1/go.mod h1:DmB3Cnh+3oxmG6LOBIxce4oaL4CPj3OmMPgvauXh+tM= github.com/ionos-cloud/sdk-go/v6 v6.1.9 h1:Iq3VIXzeEbc8EbButuACgfLMiY5TPVWUPNrF+Vsddo4= github.com/ionos-cloud/sdk-go/v6 v6.1.9/go.mod h1:EzEgRIDxBELvfoa/uBN0kOQaqovLjUWEB7iW4/Q+t4k= +github.com/ishleenk17/opentelemetry-collector-contrib/processor/elasticprocessor v0.0.0-20240203071249-1d18877c8eeb h1:De6AZyMQNMH+TKs4TCIt2d8Gl1EG0JxZ6ryTr26J7pg= +github.com/ishleenk17/opentelemetry-collector-contrib/processor/elasticprocessor v0.0.0-20240203071249-1d18877c8eeb/go.mod h1:EDhNj/4y/IGUH0EHt0zG9rNF/AyTxuTD3EgnEvc5l7k= +github.com/ishleenk17/opentelemetry-collector-contrib/processor/elasticprocessor v0.0.0-20240205053831-6d9a005cfe4b h1:iPnsUzbDkRGM+YW5WynoYrXSl6aeoy34DajfMI8O0ns= +github.com/ishleenk17/opentelemetry-collector-contrib/processor/elasticprocessor v0.0.0-20240205053831-6d9a005cfe4b/go.mod h1:EDhNj/4y/IGUH0EHt0zG9rNF/AyTxuTD3EgnEvc5l7k= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= diff --git a/processor/elasticprocessor/internal/hostmetrics/hostmetrics.go b/processor/elasticprocessor/internal/hostmetrics/hostmetrics.go index 7bf616502464..4666d9f51c71 100644 --- a/processor/elasticprocessor/internal/hostmetrics/hostmetrics.go +++ b/processor/elasticprocessor/internal/hostmetrics/hostmetrics.go @@ -15,7 +15,7 @@ var scraperToElasticDataset = map[string]string{ "memory": "system.memory", "network": "system.network", "paging": "system.memory", - "processes": "system.process", + "processes": "system.process.summary", "process": "system.process", } diff --git a/processor/elasticprocessor/internal/hostmetrics/process.go b/processor/elasticprocessor/internal/hostmetrics/process.go index 3484b0882e7a..47b9a5f80936 100644 --- a/processor/elasticprocessor/internal/hostmetrics/process.go +++ b/processor/elasticprocessor/internal/hostmetrics/process.go @@ -7,7 +7,7 @@ import ( func addProcessMetrics(metrics pmetric.MetricSlice, dataset string) error { var timestamp pcommon.Timestamp - var threads, memUsage, memVirtual int64 + var threads, memUsage, memVirtual, fdOpen int64 var memUtil float64 for i := 0; i < metrics.Len(); i++ { @@ -28,6 +28,10 @@ func addProcessMetrics(metrics pmetric.MetricSlice, dataset string) error { dp := metric.Sum().DataPoints().At(0) timestamp = dp.Timestamp() memVirtual = dp.IntValue() + } else if metric.Name() == "process.open_file_descriptors" { + dp := metric.Sum().DataPoints().At(0) + timestamp = dp.Timestamp() + fdOpen = dp.IntValue() } } @@ -58,6 +62,12 @@ func addProcessMetrics(metrics pmetric.MetricSlice, dataset string) error { timestamp: timestamp, intValue: &memVirtual, }, + metric{ + dataType: Sum, + name: "system.process.fd.open", + timestamp: timestamp, + intValue: &fdOpen, + }, ) return nil