From 094b8782b39dbb7ef95b24016fa5f244763c0e62 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Tue, 7 Jul 2020 16:53:06 -0700 Subject: [PATCH] Remove vmmetrics receiver, 1y later after the hack was added (#1282) Signed-off-by: Bogdan Drutu --- receiver/README.md | 1 - receiver/vmmetricsreceiver/README.md | 16 -- receiver/vmmetricsreceiver/config.go | 30 --- receiver/vmmetricsreceiver/config_test.go | 57 ----- receiver/vmmetricsreceiver/doc.go | 17 -- .../vmmetricsreceiver/example_config.yaml | 13 - receiver/vmmetricsreceiver/factory.go | 90 ------- receiver/vmmetricsreceiver/factory_test.go | 57 ----- .../vmmetricsreceiver/metrics_receiver.go | 59 ----- .../vmmetricsreceiver/testdata/config.yaml | 20 -- .../vmmetricsreceiver/vm_metrics_collector.go | 240 ------------------ .../vmmetricsreceiver/vm_metrics_constants.go | 104 -------- service/defaultcomponents/defaults.go | 2 - service/defaultcomponents/defaults_test.go | 2 - 14 files changed, 708 deletions(-) delete mode 100644 receiver/vmmetricsreceiver/README.md delete mode 100644 receiver/vmmetricsreceiver/config.go delete mode 100644 receiver/vmmetricsreceiver/config_test.go delete mode 100644 receiver/vmmetricsreceiver/doc.go delete mode 100644 receiver/vmmetricsreceiver/example_config.yaml delete mode 100644 receiver/vmmetricsreceiver/factory.go delete mode 100644 receiver/vmmetricsreceiver/factory_test.go delete mode 100644 receiver/vmmetricsreceiver/metrics_receiver.go delete mode 100644 receiver/vmmetricsreceiver/testdata/config.yaml delete mode 100644 receiver/vmmetricsreceiver/vm_metrics_collector.go delete mode 100644 receiver/vmmetricsreceiver/vm_metrics_constants.go diff --git a/receiver/README.md b/receiver/README.md index bcde91d7c96..3eeb6050904 100644 --- a/receiver/README.md +++ b/receiver/README.md @@ -17,7 +17,6 @@ Supported metric receivers (sorted alphabetically): - [OpenCensus Receiver](opencensusreceiver/README.md) - [OpenTelemetry Receiver](otlpreceiver/README.md) - [Prometheus Receiver](prometheusreceiver/README.md) -- [VM Metrics Receiver](vmmetricsreceiver/README.md) The [contributors repository](https://github.com/open-telemetry/opentelemetry-collector-contrib) has more receivers that can be added to custom builds of the collector. diff --git a/receiver/vmmetricsreceiver/README.md b/receiver/vmmetricsreceiver/README.md deleted file mode 100644 index 1a6200b062b..00000000000 --- a/receiver/vmmetricsreceiver/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# VM Metrics Receiver - -Collects metrics from the host operating system. This is applicable when the -OpenTelemetry Collector is running as an agent. - -```yaml -receivers: - vmmetrics: - scrape_interval: 10s - metric_prefix: "testmetric" - mount_point: "/proc" - #process_mount_point: "/data/proc" # Only using when running as an agent / daemonset -``` - -The full list of settings exposed for this receiver are documented [here](./config.go) -with detailed sample configurations [here](./testdata/config.yaml). diff --git a/receiver/vmmetricsreceiver/config.go b/receiver/vmmetricsreceiver/config.go deleted file mode 100644 index 53f45beb312..00000000000 --- a/receiver/vmmetricsreceiver/config.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package vmmetricsreceiver - -import ( - "time" - - "go.opentelemetry.io/collector/config/configmodels" -) - -// Config defines configuration for VMMetrics receiver. -type Config struct { - configmodels.ReceiverSettings `mapstructure:",squash"` - ScrapeInterval time.Duration `mapstructure:"scrape_interval"` - MountPoint string `mapstructure:"mount_point"` - ProcessMountPoint string `mapstructure:"process_mount_point"` - MetricPrefix string `mapstructure:"metric_prefix"` -} diff --git a/receiver/vmmetricsreceiver/config_test.go b/receiver/vmmetricsreceiver/config_test.go deleted file mode 100644 index e2c14b02e38..00000000000 --- a/receiver/vmmetricsreceiver/config_test.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package vmmetricsreceiver - -import ( - "path" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/collector/config" - "go.opentelemetry.io/collector/config/configmodels" -) - -func TestLoadConfig(t *testing.T) { - factories, err := config.ExampleComponents() - assert.NoError(t, err) - - factory := &Factory{} - factories.Receivers[typeStr] = factory - cfg, err := config.LoadConfigFile(t, path.Join(".", "testdata", "config.yaml"), factories) - - require.NoError(t, err) - require.NotNil(t, cfg) - - assert.Equal(t, len(cfg.Receivers), 2) - - r0 := cfg.Receivers["vmmetrics"] - assert.Equal(t, r0, factory.CreateDefaultConfig()) - - r1 := cfg.Receivers["vmmetrics/customname"].(*Config) - assert.Equal(t, r1, - &Config{ - ReceiverSettings: configmodels.ReceiverSettings{ - TypeVal: typeStr, - NameVal: "vmmetrics/customname", - }, - ScrapeInterval: 5 * time.Second, - MetricPrefix: "testmetric", - MountPoint: "/mountpoint", - ProcessMountPoint: "/proc", - }) -} diff --git a/receiver/vmmetricsreceiver/doc.go b/receiver/vmmetricsreceiver/doc.go deleted file mode 100644 index a6fea610ce4..00000000000 --- a/receiver/vmmetricsreceiver/doc.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package vmmetricsreceiver has the logic for scraping VM metrics -// and then passing them onto a metric consumer instance. -package vmmetricsreceiver diff --git a/receiver/vmmetricsreceiver/example_config.yaml b/receiver/vmmetricsreceiver/example_config.yaml deleted file mode 100644 index 70a813d7753..00000000000 --- a/receiver/vmmetricsreceiver/example_config.yaml +++ /dev/null @@ -1,13 +0,0 @@ -receivers: - vmmetrics: - scrape_interval: 10 - mount_point: "/proc" - # process_mount_point: "/data/proc" # Should only be used for Daemon Set within a container. - -zpages: - port: 55679 - -exporters: - prometheus: - namespace: "vmmetrics_test" - address: "0.0.0.0:8888" diff --git a/receiver/vmmetricsreceiver/factory.go b/receiver/vmmetricsreceiver/factory.go deleted file mode 100644 index e71ac180549..00000000000 --- a/receiver/vmmetricsreceiver/factory.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package vmmetricsreceiver - -import ( - "context" - "errors" - "runtime" - - "go.uber.org/zap" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/config/configerror" - "go.opentelemetry.io/collector/config/configmodels" - "go.opentelemetry.io/collector/consumer" -) - -// This file implements Factory for VMMetrics receiver. - -const ( - // The value of "type" key in configuration. - typeStr = "vmmetrics" -) - -// Factory is the Factory for receiver. -type Factory struct { -} - -// Type gets the type of the Receiver config created by this Factory. -func (f *Factory) Type() configmodels.Type { - return typeStr -} - -// CustomUnmarshaler returns custom unmarshaler for this config. -func (f *Factory) CustomUnmarshaler() component.CustomUnmarshaler { - return nil -} - -// CreateDefaultConfig creates the default configuration for receiver. -func (f *Factory) CreateDefaultConfig() configmodels.Receiver { - return &Config{ - ReceiverSettings: configmodels.ReceiverSettings{ - TypeVal: typeStr, - NameVal: typeStr, - }, - } -} - -// CreateTraceReceiver creates a trace receiver based on provided config. -func (f *Factory) CreateTraceReceiver( - ctx context.Context, - logger *zap.Logger, - cfg configmodels.Receiver, - nextConsumer consumer.TraceConsumerOld, -) (component.TraceReceiver, error) { - // VMMetrics does not support traces - return nil, configerror.ErrDataTypeIsNotSupported -} - -// CreateMetricsReceiver creates a metrics receiver based on provided config. -func (f *Factory) CreateMetricsReceiver(ctx context.Context, logger *zap.Logger, cfg configmodels.Receiver, nextConsumer consumer.MetricsConsumerOld) (component.MetricsReceiver, error) { - - if runtime.GOOS != "linux" { - // TODO: add support for other platforms. - return nil, errors.New("vmmetrics receiver is only supported on linux") - } - rCfg := cfg.(*Config) - - vmc, err := NewVMMetricsCollector(rCfg.ScrapeInterval, rCfg.MountPoint, rCfg.ProcessMountPoint, rCfg.MetricPrefix, nextConsumer) - if err != nil { - return nil, err - } - - vmr := &Receiver{ - vmc: vmc, - } - return vmr, nil -} diff --git a/receiver/vmmetricsreceiver/factory_test.go b/receiver/vmmetricsreceiver/factory_test.go deleted file mode 100644 index 7583d164ba0..00000000000 --- a/receiver/vmmetricsreceiver/factory_test.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package vmmetricsreceiver - -import ( - "context" - "runtime" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" - - "go.opentelemetry.io/collector/config/configcheck" - "go.opentelemetry.io/collector/config/configerror" -) - -func TestCreateDefaultConfig(t *testing.T) { - factory := &Factory{} - cfg := factory.CreateDefaultConfig() - assert.NotNil(t, cfg, "failed to create default config") - assert.NoError(t, configcheck.ValidateConfig(cfg)) -} - -func TestCreateReceiver(t *testing.T) { - factory := &Factory{} - cfg := factory.CreateDefaultConfig() - - tReceiver, err := factory.CreateTraceReceiver(context.Background(), zap.NewNop(), cfg, nil) - - assert.Equal(t, err, configerror.ErrDataTypeIsNotSupported) - assert.Nil(t, tReceiver) - - mReceiver, err := factory.CreateMetricsReceiver(context.Background(), zap.NewNop(), cfg, nil) - - // Currently vmmetrics receiver is only supported on linux. - if runtime.GOOS != "linux" { - require.Nil(t, tReceiver) - require.NotNil(t, err) - return - } - - assert.NoError(t, err) - assert.NotNil(t, mReceiver) -} diff --git a/receiver/vmmetricsreceiver/metrics_receiver.go b/receiver/vmmetricsreceiver/metrics_receiver.go deleted file mode 100644 index b21b4ae30f0..00000000000 --- a/receiver/vmmetricsreceiver/metrics_receiver.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package vmmetricsreceiver - -import ( - "context" - "sync" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/component/componenterror" -) - -// Receiver is the type used to handle metrics from VM metrics. -type Receiver struct { - mu sync.Mutex - - vmc *VMMetricsCollector - - stopOnce sync.Once - startOnce sync.Once -} - -// Start scrapes VM metrics based on the OS platform. -func (vmr *Receiver) Start(ctx context.Context, host component.Host) error { - vmr.mu.Lock() - defer vmr.mu.Unlock() - - var err = componenterror.ErrAlreadyStarted - vmr.startOnce.Do(func() { - vmr.vmc.StartCollection() - err = nil - }) - return err -} - -// Shutdown stops and cancels the underlying VM metrics scrapers. -func (vmr *Receiver) Shutdown(context.Context) error { - vmr.mu.Lock() - defer vmr.mu.Unlock() - - var err = componenterror.ErrAlreadyStopped - vmr.stopOnce.Do(func() { - vmr.vmc.StopCollection() - err = nil - }) - return err -} diff --git a/receiver/vmmetricsreceiver/testdata/config.yaml b/receiver/vmmetricsreceiver/testdata/config.yaml deleted file mode 100644 index 85f46fd3782..00000000000 --- a/receiver/vmmetricsreceiver/testdata/config.yaml +++ /dev/null @@ -1,20 +0,0 @@ -receivers: - vmmetrics: - vmmetrics/customname: - scrape_interval: 5s - mount_point: /mountpoint - process_mount_point: /proc - metric_prefix: testmetric - -processors: - exampleprocessor: - -exporters: - exampleexporter: - -service: - pipelines: - traces: - receivers: [vmmetrics] - processors: [exampleprocessor] - exporters: [exampleexporter] diff --git a/receiver/vmmetricsreceiver/vm_metrics_collector.go b/receiver/vmmetricsreceiver/vm_metrics_collector.go deleted file mode 100644 index 0f641ba613c..00000000000 --- a/receiver/vmmetricsreceiver/vm_metrics_collector.go +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package vmmetricsreceiver - -import ( - "context" - "fmt" - "os" - "runtime" - "sync" - "time" - - "contrib.go.opencensus.io/resource/auto" - metricspb "github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1" - resourcepb "github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1" - "github.com/prometheus/procfs" - "go.opencensus.io/trace" - - "go.opentelemetry.io/collector/component/componenterror" - "go.opentelemetry.io/collector/consumer" - "go.opentelemetry.io/collector/consumer/consumerdata" - "go.opentelemetry.io/collector/internal" -) - -// VMMetricsCollector is a struct that collects and reports VM and process metrics (cpu, mem, etc). -type VMMetricsCollector struct { - consumer consumer.MetricsConsumerOld - - startTime time.Time - - fs procfs.FS - processFs procfs.FS - pid int - - scrapeInterval time.Duration - metricPrefix string - done chan struct{} -} - -const ( - defaultMountPoint = procfs.DefaultMountPoint // "/proc" - defaultScrapeInterval = 10 * time.Second -) - -var rsc *resourcepb.Resource -var resourceDetectionSync sync.Once - -// NewVMMetricsCollector creates a new set of VM and Process Metrics (mem, cpu). -func NewVMMetricsCollector(si time.Duration, mountPoint, processMountPoint, prefix string, consumer consumer.MetricsConsumerOld) (*VMMetricsCollector, error) { - if mountPoint == "" { - mountPoint = defaultMountPoint - } - if processMountPoint == "" { - processMountPoint = defaultMountPoint - } - if si <= 0 { - si = defaultScrapeInterval - } - fs, err := procfs.NewFS(mountPoint) - if err != nil { - return nil, fmt.Errorf("failed to create new VMMetricsCollector: %s", err) - } - processFs, err := procfs.NewFS(processMountPoint) - if err != nil { - return nil, fmt.Errorf("failed to create new VMMetricsCollector: %s", err) - } - vmc := &VMMetricsCollector{ - consumer: consumer, - startTime: time.Now(), - fs: fs, - processFs: processFs, - pid: os.Getpid(), - scrapeInterval: si, - metricPrefix: prefix, - done: make(chan struct{}), - } - - return vmc, nil -} - -func detectResource() { - resourceDetectionSync.Do(func() { - res, err := auto.Detect(context.Background()) - if err != nil { - panic(fmt.Sprintf("Resource detection failed, err:%v", err)) - } - if res != nil { - rsc = &resourcepb.Resource{ - Type: res.Type, - Labels: make(map[string]string, len(res.Labels)), - } - for k, v := range res.Labels { - rsc.Labels[k] = v - } - } - }) -} - -// StartCollection starts a ticker'd goroutine that will scrape and export vm metrics periodically. -func (vmc *VMMetricsCollector) StartCollection() { - detectResource() - - go func() { - ticker := time.NewTicker(vmc.scrapeInterval) - for { - select { - case <-ticker.C: - vmc.scrapeAndExport() - - case <-vmc.done: - return - } - } - }() -} - -// StopCollection stops the collection of metric information -func (vmc *VMMetricsCollector) StopCollection() { - close(vmc.done) -} - -func (vmc *VMMetricsCollector) scrapeAndExport() { - ctx, span := trace.StartSpan(context.Background(), "VMMetricsCollector.scrapeAndExport") - defer span.End() - - metrics := make([]*metricspb.Metric, 0, len(vmMetricDescriptors)) - var errs []error - - ms := &runtime.MemStats{} - runtime.ReadMemStats(ms) - metrics = append( - metrics, - &metricspb.Metric{ - MetricDescriptor: metricAllocMem, - Resource: rsc, - Timeseries: []*metricspb.TimeSeries{vmc.getInt64TimeSeries(ms.Alloc)}, - }, - &metricspb.Metric{ - MetricDescriptor: metricTotalAllocMem, - Resource: rsc, - Timeseries: []*metricspb.TimeSeries{vmc.getInt64TimeSeries(ms.TotalAlloc)}, - }, - &metricspb.Metric{ - MetricDescriptor: metricSysMem, - Resource: rsc, - Timeseries: []*metricspb.TimeSeries{vmc.getInt64TimeSeries(ms.Sys)}, - }, - ) - - if proc, err := vmc.processFs.Proc(vmc.pid); err == nil { - if procStat, errStat := proc.Stat(); errStat == nil { - metrics = append( - metrics, - &metricspb.Metric{ - MetricDescriptor: metricProcessCPUSeconds, - Resource: rsc, - Timeseries: []*metricspb.TimeSeries{vmc.getDoubleTimeSeries(procStat.CPUTime(), nil)}, - }, - ) - } else { - errs = append(errs, errStat) - } - } else { - errs = append(errs, err) - } - - if stat, err := vmc.fs.Stat(); err == nil { - cpuStat := stat.CPUTotal - metrics = append( - metrics, - &metricspb.Metric{ - MetricDescriptor: metricProcessesRunning, - Resource: rsc, - Timeseries: []*metricspb.TimeSeries{vmc.getInt64TimeSeries(stat.ProcessesRunning)}, - }, - &metricspb.Metric{ - MetricDescriptor: metricProcessesBlocked, - Resource: rsc, - Timeseries: []*metricspb.TimeSeries{vmc.getInt64TimeSeries(stat.ProcessesBlocked)}, - }, - &metricspb.Metric{ - MetricDescriptor: metricProcessesCreated, - Resource: rsc, - Timeseries: []*metricspb.TimeSeries{vmc.getInt64TimeSeries(stat.ProcessCreated)}, - }, - &metricspb.Metric{ - MetricDescriptor: metricCPUSeconds, - Resource: rsc, - Timeseries: []*metricspb.TimeSeries{ - vmc.getDoubleTimeSeries(cpuStat.User, labelValueCPUUser), - vmc.getDoubleTimeSeries(cpuStat.System, labelValueCPUSystem), - vmc.getDoubleTimeSeries(cpuStat.Idle, labelValueCPUIdle), - vmc.getDoubleTimeSeries(cpuStat.Nice, labelValueCPUNice), - vmc.getDoubleTimeSeries(cpuStat.Iowait, labelValueCPUIOWait), - }, - }, - ) - } else { - errs = append(errs, err) - } - - if len(errs) > 0 { - span.SetStatus(trace.Status{Code: trace.StatusCodeDataLoss, Message: fmt.Sprintf("Error(s) when scraping VM metrics: %v", componenterror.CombineErrors(errs))}) - } - - if len(metrics) > 0 { - vmc.consumer.ConsumeMetricsData(ctx, consumerdata.MetricsData{Metrics: metrics}) - } -} - -func (vmc *VMMetricsCollector) getInt64TimeSeries(val uint64) *metricspb.TimeSeries { - return &metricspb.TimeSeries{ - StartTimestamp: internal.TimeToTimestamp(vmc.startTime), - Points: []*metricspb.Point{{Timestamp: internal.TimeToTimestamp(time.Now()), Value: &metricspb.Point_Int64Value{Int64Value: int64(val)}}}, - } -} - -func (vmc *VMMetricsCollector) getDoubleTimeSeries(val float64, labelVal *metricspb.LabelValue) *metricspb.TimeSeries { - var labelVals []*metricspb.LabelValue - if labelVal != nil { - labelVals = append(labelVals, labelVal) - } - return &metricspb.TimeSeries{ - StartTimestamp: internal.TimeToTimestamp(vmc.startTime), - LabelValues: labelVals, - Points: []*metricspb.Point{{Timestamp: internal.TimeToTimestamp(time.Now()), Value: &metricspb.Point_DoubleValue{DoubleValue: val}}}, - } -} diff --git a/receiver/vmmetricsreceiver/vm_metrics_constants.go b/receiver/vmmetricsreceiver/vm_metrics_constants.go deleted file mode 100644 index c4dc0161a00..00000000000 --- a/receiver/vmmetricsreceiver/vm_metrics_constants.go +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package vmmetricsreceiver - -import ( - metricspb "github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1" -) - -// VM and process metric constants. - -var metricAllocMem = &metricspb.MetricDescriptor{ - Name: "process/memory_alloc", - Description: "Number of bytes currently allocated in use", - Unit: "By", - Type: metricspb.MetricDescriptor_GAUGE_INT64, - LabelKeys: nil, -} - -var metricTotalAllocMem = &metricspb.MetricDescriptor{ - Name: "process/total_memory_alloc", - Description: "Number of allocations in total", - Unit: "By", - Type: metricspb.MetricDescriptor_GAUGE_INT64, - LabelKeys: nil, -} - -var metricSysMem = &metricspb.MetricDescriptor{ - Name: "process/sys_memory_alloc", - Description: "Number of bytes given to the process to use in total", - Unit: "By", - Type: metricspb.MetricDescriptor_GAUGE_INT64, - LabelKeys: nil, -} - -var metricProcessCPUSeconds = &metricspb.MetricDescriptor{ - Name: "process/cpu_seconds", - Description: "CPU seconds for this process", - Unit: "s", - Type: metricspb.MetricDescriptor_CUMULATIVE_DOUBLE, - LabelKeys: nil, -} - -var metricCPUSeconds = &metricspb.MetricDescriptor{ - Name: "system/cpu_seconds", - Description: "Total kernel/system CPU seconds broken down by different states", - Unit: "s", - Type: metricspb.MetricDescriptor_CUMULATIVE_DOUBLE, - LabelKeys: []*metricspb.LabelKey{{Key: "state", Description: "State of CPU time, e.g user/system/idle"}}, -} - -var metricProcessesCreated = &metricspb.MetricDescriptor{ - Name: "system/processes/created", - Description: "Total number of times a process was created", - Unit: "1", - Type: metricspb.MetricDescriptor_CUMULATIVE_INT64, - LabelKeys: nil, -} - -var metricProcessesRunning = &metricspb.MetricDescriptor{ - Name: "system/processes/running", - Description: "Total number of running processes", - Unit: "1", - Type: metricspb.MetricDescriptor_GAUGE_INT64, - LabelKeys: nil, -} - -var metricProcessesBlocked = &metricspb.MetricDescriptor{ - Name: "system/processes/blocked", - Description: "Total number of blocked processes", - Unit: "1", - Type: metricspb.MetricDescriptor_GAUGE_INT64, - LabelKeys: nil, -} - -var ( - labelValueCPUUser = &metricspb.LabelValue{Value: "user", HasValue: true} - labelValueCPUSystem = &metricspb.LabelValue{Value: "system", HasValue: true} - labelValueCPUIdle = &metricspb.LabelValue{Value: "idle", HasValue: true} - labelValueCPUNice = &metricspb.LabelValue{Value: "nice", HasValue: true} - labelValueCPUIOWait = &metricspb.LabelValue{Value: "iowait", HasValue: true} -) - -var vmMetricDescriptors = []*metricspb.MetricDescriptor{ - metricAllocMem, - metricTotalAllocMem, - metricSysMem, - metricProcessCPUSeconds, - metricCPUSeconds, - metricProcessesCreated, - metricProcessesRunning, - metricProcessesBlocked, -} diff --git a/service/defaultcomponents/defaults.go b/service/defaultcomponents/defaults.go index d0a9ed0c9b0..16fef55d991 100644 --- a/service/defaultcomponents/defaults.go +++ b/service/defaultcomponents/defaults.go @@ -43,7 +43,6 @@ import ( "go.opentelemetry.io/collector/receiver/opencensusreceiver" "go.opentelemetry.io/collector/receiver/otlpreceiver" "go.opentelemetry.io/collector/receiver/prometheusreceiver" - "go.opentelemetry.io/collector/receiver/vmmetricsreceiver" "go.opentelemetry.io/collector/receiver/zipkinreceiver" ) @@ -70,7 +69,6 @@ func Components() ( &prometheusreceiver.Factory{}, &opencensusreceiver.Factory{}, &otlpreceiver.Factory{}, - &vmmetricsreceiver.Factory{}, hostmetricsreceiver.NewFactory(), ) if err != nil { diff --git a/service/defaultcomponents/defaults_test.go b/service/defaultcomponents/defaults_test.go index 38bfc5929c0..ff9ffbd87b6 100644 --- a/service/defaultcomponents/defaults_test.go +++ b/service/defaultcomponents/defaults_test.go @@ -47,7 +47,6 @@ import ( "go.opentelemetry.io/collector/receiver/opencensusreceiver" "go.opentelemetry.io/collector/receiver/otlpreceiver" "go.opentelemetry.io/collector/receiver/prometheusreceiver" - "go.opentelemetry.io/collector/receiver/vmmetricsreceiver" "go.opentelemetry.io/collector/receiver/zipkinreceiver" ) @@ -63,7 +62,6 @@ func TestDefaultComponents(t *testing.T) { "prometheus": &prometheusreceiver.Factory{}, "opencensus": &opencensusreceiver.Factory{}, "otlp": &otlpreceiver.Factory{}, - "vmmetrics": &vmmetricsreceiver.Factory{}, "hostmetrics": hostmetricsreceiver.NewFactory(), } expectedProcessors := map[configmodels.Type]component.ProcessorFactoryBase{