diff --git a/.chloggen/ciscoosreceiver-initial-skeleton.yaml b/.chloggen/ciscoosreceiver-initial-skeleton.yaml new file mode 100644 index 0000000000000..7aa769408f690 --- /dev/null +++ b/.chloggen/ciscoosreceiver-initial-skeleton.yaml @@ -0,0 +1,19 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: new_component + +# The name of the component (path or short name is acceptable) +component: receiver/ciscoosreceiver + +# A brief description of the change +note: "Add initial skeleton of Cisco OS receiver (README, config, factory, metadata) with In Development stability." + +# Mandatory: tracking issues (use PR number if no issue exists) +issues: [42647] + +# Optional: additional lines shown under the main note +subtext: | + This PR adds structure only (no scraping implementation yet). + Scrapers and SSH-based collection logic (BGP, Environment, Facts, Interfaces, Optics) will be added in follow-up PRs. + +# Change logs where this entry should appear +change_logs: [user] diff --git a/.codecov.yml b/.codecov.yml index fa8888369745e..84a4c0a32fa60 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -608,6 +608,10 @@ component_management: name: receiver_chrony paths: - receiver/chronyreceiver/** + - component_id: receiver_ciscoos + name: receiver_ciscoos + paths: + - receiver/ciscoosreceiver/** - component_id: receiver_cloudflare name: receiver_cloudflare paths: diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b16220fc42d91..0aebe770cf56b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -230,6 +230,7 @@ receiver/azureblobreceiver/ @open-telemetry receiver/azureeventhubreceiver/ @open-telemetry/collector-contrib-approvers @atoulme @cparkins @dyl10s receiver/azuremonitorreceiver/ @open-telemetry/collector-contrib-approvers @nslaughter @celian-garcia @ishleenk17 receiver/chronyreceiver/ @open-telemetry/collector-contrib-approvers @MovieStoreGuy @jamesmoessis +receiver/ciscoosreceiver/ @open-telemetry/collector-contrib-approvers @dmitryax receiver/cloudflarereceiver/ @open-telemetry/collector-contrib-approvers @dehaansa receiver/cloudfoundryreceiver/ @open-telemetry/collector-contrib-approvers @crobert-1 receiver/collectdreceiver/ @open-telemetry/collector-contrib-approvers @atoulme diff --git a/.github/ISSUE_TEMPLATE/beta_stability.yaml b/.github/ISSUE_TEMPLATE/beta_stability.yaml index 638b5b254d342..9f43c8cc2b07a 100644 --- a/.github/ISSUE_TEMPLATE/beta_stability.yaml +++ b/.github/ISSUE_TEMPLATE/beta_stability.yaml @@ -233,6 +233,7 @@ body: - receiver/bigip - receiver/carbon - receiver/chrony + - receiver/ciscoos - receiver/cloudflare - receiver/cloudfoundry - receiver/collectd diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 423cc67a3b89d..8a349d3f6cf00 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -236,6 +236,7 @@ body: - receiver/bigip - receiver/carbon - receiver/chrony + - receiver/ciscoos - receiver/cloudflare - receiver/cloudfoundry - receiver/collectd diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index 187931da368eb..b992dfa8afc65 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -230,6 +230,7 @@ body: - receiver/bigip - receiver/carbon - receiver/chrony + - receiver/ciscoos - receiver/cloudflare - receiver/cloudfoundry - receiver/collectd diff --git a/.github/ISSUE_TEMPLATE/other.yaml b/.github/ISSUE_TEMPLATE/other.yaml index 41928bc05db7d..f01155a1b0a2f 100644 --- a/.github/ISSUE_TEMPLATE/other.yaml +++ b/.github/ISSUE_TEMPLATE/other.yaml @@ -230,6 +230,7 @@ body: - receiver/bigip - receiver/carbon - receiver/chrony + - receiver/ciscoos - receiver/cloudflare - receiver/cloudfoundry - receiver/collectd diff --git a/.github/ISSUE_TEMPLATE/unmaintained.yaml b/.github/ISSUE_TEMPLATE/unmaintained.yaml index 9ebc4b3fb2808..5cd27fae8d447 100644 --- a/.github/ISSUE_TEMPLATE/unmaintained.yaml +++ b/.github/ISSUE_TEMPLATE/unmaintained.yaml @@ -235,6 +235,7 @@ body: - receiver/bigip - receiver/carbon - receiver/chrony + - receiver/ciscoos - receiver/cloudflare - receiver/cloudfoundry - receiver/collectd diff --git a/.github/component_labels.txt b/.github/component_labels.txt index 99140642ea9e5..18645c7ff8fa5 100644 --- a/.github/component_labels.txt +++ b/.github/component_labels.txt @@ -211,6 +211,7 @@ receiver/azureblobreceiver receiver/azureblob receiver/azureeventhubreceiver receiver/azureeventhub receiver/azuremonitorreceiver receiver/azuremonitor receiver/chronyreceiver receiver/chrony +receiver/ciscoosreceiver receiver/ciscoos receiver/cloudflarereceiver receiver/cloudflare receiver/cloudfoundryreceiver receiver/cloudfoundry receiver/collectdreceiver receiver/collectd diff --git a/cmd/otelcontribcol/builder-config.yaml b/cmd/otelcontribcol/builder-config.yaml index 1e6953d99846e..266a0b726f76d 100644 --- a/cmd/otelcontribcol/builder-config.yaml +++ b/cmd/otelcontribcol/builder-config.yaml @@ -162,6 +162,7 @@ receivers: - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/bigipreceiver v0.136.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver v0.136.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/chronyreceiver v0.136.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/ciscoosreceiver v0.136.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudflarereceiver v0.136.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudfoundryreceiver v0.136.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/collectdreceiver v0.136.0 diff --git a/internal/tidylist/tidylist.txt b/internal/tidylist/tidylist.txt index 1c93c524d57f9..4a1a610ac1bea 100644 --- a/internal/tidylist/tidylist.txt +++ b/internal/tidylist/tidylist.txt @@ -240,6 +240,7 @@ receiver/azureeventhubreceiver receiver/azuremonitorreceiver receiver/bigipreceiver receiver/chronyreceiver +receiver/ciscoosreceiver receiver/cloudflarereceiver receiver/cloudfoundryreceiver receiver/collectdreceiver diff --git a/receiver/ciscoosreceiver/Makefile b/receiver/ciscoosreceiver/Makefile new file mode 100644 index 0000000000000..ded7a36092dc3 --- /dev/null +++ b/receiver/ciscoosreceiver/Makefile @@ -0,0 +1 @@ +include ../../Makefile.Common diff --git a/receiver/ciscoosreceiver/README.md b/receiver/ciscoosreceiver/README.md new file mode 100644 index 0000000000000..b6bd445826abc --- /dev/null +++ b/receiver/ciscoosreceiver/README.md @@ -0,0 +1,89 @@ +# Cisco OS Receiver + + +| Status | | +| ------------- |-----------| +| Stability | [development]: metrics | +| Distributions | [] | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Fciscoos%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Fciscoos) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Fciscoos%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Fciscoos) | +| Code coverage | [![codecov](https://codecov.io/github/open-telemetry/opentelemetry-collector-contrib/graph/main/badge.svg?component=receiver_ciscoosreceiver)](https://app.codecov.io/gh/open-telemetry/opentelemetry-collector-contrib/tree/main/?components%5B0%5D=receiver_ciscoosreceiver&displayType=list) | +| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@dmitryax](https://www.github.com/dmitryax) | + +[development]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#development + + +The Cisco OS Receiver is a modular receiver that collects metrics from Cisco network devices via SSH connections. It supports multiple scrapers for comprehensive network monitoring and provides native OpenTelemetry OTLP metrics generation. + +## Configuration + +The following settings are available: + +| Setting | Type | Required | Description | +|---------|------|----------|-------------| +| `devices` | []DeviceConfig | Yes | List of Cisco devices to monitor | +| `collection_interval` | duration | No | How often to collect metrics (default: 60s) | +| `timeout` | duration | No | SSH connection and command timeout (default: 30s) | +| `scrapers` | map | Yes | Scrapers to enable | + +### Device Configuration + +| Setting | Type | Required | Description | +|---------|------|----------|-------------| +| `host` | string | Yes | Device address in `host:port` format | +| `username` | string | Yes | SSH username for authentication | +| `password` | string | No* | Password for authentication | +| `key_file` | string | No* | Path to SSH private key file | + +*Either `password` or `key_file` is required, but not both. + +### Scrapers Configuration + +The scrapers are configured as groups. + +| Setting | Type | Description | +|---------|------|-------------| +| `bgp` | map | BGP session metrics configuration | +| `environment` | map | Temperature and power metrics configuration | +| `facts` | map | System information metrics configuration | +| `interfaces` | map | Interface status and statistics configuration | +| `optics` | map | Optical transceiver metrics configuration | + +Each scraper can be enabled by simply including it in the configuration, or disabled by omitting it. Future versions may support scraper-specific configuration options within each group. + +## Scrapers + +The receiver supports the following scrapers: + +- **BGP**: Collects BGP session information and statistics +- **Environment**: Collects temperature and power consumption metrics +- **Facts**: Collects system information (OS version, memory, CPU utilization) +- **Interfaces**: Collects interface statistics (bytes, packets, errors) +- **Optics**: Collects optical signal strength information + +## Example Configuration + +```yaml +receivers: + ciscoosreceiver: + collection_interval: 60s + timeout: 30s + devices: + - host: "cisco-device:22" + username: "admin" + password: "password" + scrapers: + bgp: + environment: + facts: + interfaces: + optics: + +exporters: + debug: + +service: + pipelines: + metrics: + receivers: [ciscoosreceiver] + exporters: [debug] +``` \ No newline at end of file diff --git a/receiver/ciscoosreceiver/config.go b/receiver/ciscoosreceiver/config.go new file mode 100644 index 0000000000000..1712ca8535a87 --- /dev/null +++ b/receiver/ciscoosreceiver/config.go @@ -0,0 +1,76 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package ciscoosreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/ciscoosreceiver" + +import ( + "errors" + + "go.opentelemetry.io/collector/scraper/scraperhelper" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/ciscoosreceiver/internal/metadata" +) + +// Config represents the receiver configuration +type Config struct { + scraperhelper.ControllerConfig `mapstructure:",squash"` + metadata.MetricsBuilderConfig `mapstructure:",squash"` + + Devices []DeviceConfig `mapstructure:"devices"` + Scrapers ScrapersConfig `mapstructure:"scrapers"` +} + +// DeviceConfig represents configuration for a single Cisco device +type DeviceConfig struct { + Host string `mapstructure:"host"` + KeyFile string `mapstructure:"key_file"` + Username string `mapstructure:"username"` + Password string `mapstructure:"password"` +} + +// ScrapersConfig represents which scrapers are enabled +type ScrapersConfig struct { + BGP bool `mapstructure:"bgp"` + Environment bool `mapstructure:"environment"` + Facts bool `mapstructure:"facts"` + Interfaces bool `mapstructure:"interfaces"` + Optics bool `mapstructure:"optics"` +} + +// Validate checks if the receiver configuration is valid +func (cfg *Config) Validate() error { + if len(cfg.Devices) == 0 { + return errors.New("at least one device must be configured") + } + + for _, device := range cfg.Devices { + if device.Host == "" { + return errors.New("device host cannot be empty") + } + + // Authentication validation logic: + // 1. If using key file: username + key_file (password optional) + // 2. If not using key file: username + password required + if device.KeyFile != "" { + // Key file authentication: requires username + if device.Username == "" { + return errors.New("device username cannot be empty") + } + } else { + // Password authentication: requires both username and password + if device.Username == "" { + return errors.New("device username cannot be empty") + } + if device.Password == "" { + return errors.New("device password cannot be empty") + } + } + } + + // Check if at least one scraper is enabled + if !cfg.Scrapers.BGP && !cfg.Scrapers.Environment && !cfg.Scrapers.Facts && !cfg.Scrapers.Interfaces && !cfg.Scrapers.Optics { + return errors.New("at least one scraper must be enabled") + } + + return nil +} diff --git a/receiver/ciscoosreceiver/config_test.go b/receiver/ciscoosreceiver/config_test.go new file mode 100644 index 0000000000000..339f6af1fd120 --- /dev/null +++ b/receiver/ciscoosreceiver/config_test.go @@ -0,0 +1,148 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package ciscoosreceiver + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/scraper/scraperhelper" +) + +func TestConfigValidate(t *testing.T) { + tests := []struct { + name string + config *Config + expectedErr string + }{ + { + name: "valid config with password auth", + config: &Config{ + ControllerConfig: scraperhelper.ControllerConfig{ + Timeout: 30 * time.Second, + CollectionInterval: 60 * time.Second, + }, + Devices: []DeviceConfig{ + {Host: "localhost:22", Username: "admin", Password: "password"}, + }, + Scrapers: ScrapersConfig{ + BGP: true, + }, + }, + expectedErr: "", + }, + { + name: "valid config with key file auth", + config: &Config{ + ControllerConfig: scraperhelper.ControllerConfig{ + Timeout: 30 * time.Second, + CollectionInterval: 60 * time.Second, + }, + Devices: []DeviceConfig{ + {Host: "localhost:22", Username: "admin", KeyFile: "/path/to/key"}, + }, + Scrapers: ScrapersConfig{ + Facts: true, + }, + }, + expectedErr: "", + }, + { + name: "no devices", + config: &Config{ + ControllerConfig: scraperhelper.ControllerConfig{ + Timeout: 30 * time.Second, + CollectionInterval: 60 * time.Second, + }, + Devices: []DeviceConfig{}, + Scrapers: ScrapersConfig{ + BGP: true, + }, + }, + expectedErr: "at least one device must be configured", + }, + { + name: "empty host", + config: &Config{ + ControllerConfig: scraperhelper.ControllerConfig{ + Timeout: 30 * time.Second, + CollectionInterval: 60 * time.Second, + }, + Devices: []DeviceConfig{ + {Host: "", Username: "admin", Password: "password"}, + }, + Scrapers: ScrapersConfig{ + BGP: true, + }, + }, + expectedErr: "device host cannot be empty", + }, + { + name: "missing username for password auth", + config: &Config{ + ControllerConfig: scraperhelper.ControllerConfig{ + Timeout: 30 * time.Second, + CollectionInterval: 60 * time.Second, + }, + Devices: []DeviceConfig{ + {Host: "localhost:22", Username: "", Password: "password"}, + }, + Scrapers: ScrapersConfig{ + BGP: true, + }, + }, + expectedErr: "device username cannot be empty", + }, + { + name: "missing password for password auth", + config: &Config{ + ControllerConfig: scraperhelper.ControllerConfig{ + Timeout: 30 * time.Second, + CollectionInterval: 60 * time.Second, + }, + Devices: []DeviceConfig{ + {Host: "localhost:22", Username: "admin", Password: ""}, + }, + Scrapers: ScrapersConfig{ + BGP: true, + }, + }, + expectedErr: "device password cannot be empty", + }, + { + name: "no scrapers enabled", + config: &Config{ + ControllerConfig: scraperhelper.ControllerConfig{ + Timeout: 30 * time.Second, + CollectionInterval: 60 * time.Second, + }, + Devices: []DeviceConfig{ + {Host: "localhost:22", Username: "admin", Password: "password"}, + }, + Scrapers: ScrapersConfig{ + BGP: false, + Environment: false, + Facts: false, + Interfaces: false, + Optics: false, + }, + }, + expectedErr: "at least one scraper must be enabled", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.config.Validate() + if tt.expectedErr == "" { + require.NoError(t, err) + } else { + require.Error(t, err) + assert.Contains(t, err.Error(), tt.expectedErr) + } + }) + } +} diff --git a/receiver/ciscoosreceiver/doc.go b/receiver/ciscoosreceiver/doc.go new file mode 100644 index 0000000000000..460d588acabcb --- /dev/null +++ b/receiver/ciscoosreceiver/doc.go @@ -0,0 +1,7 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +//go:generate mdatagen metadata.yaml + +// Package ciscoosreceiver provides a receiver for collecting metrics from Cisco network devices via SSH. +package ciscoosreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/ciscoosreceiver" diff --git a/receiver/ciscoosreceiver/documentation.md b/receiver/ciscoosreceiver/documentation.md new file mode 100644 index 0000000000000..c6d568f1377c2 --- /dev/null +++ b/receiver/ciscoosreceiver/documentation.md @@ -0,0 +1,27 @@ +[comment]: <> (Code generated by mdatagen. DO NOT EDIT.) + +# ciscoosreceiver + +## Default Metrics + +The following metrics are emitted by default. Each of them can be disabled by applying the following configuration: + +```yaml +metrics: + : + enabled: false +``` + +### cisco.device.connected + +Device connectivity status (1=connected, 0=disconnected) + +| Unit | Metric Type | Value Type | +| ---- | ----------- | ---------- | +| 1 | Gauge | Int | + +#### Attributes + +| Name | Description | Values | Optional | +| ---- | ----------- | ------ | -------- | +| host | The Cisco device hostname or IP address | Any Str | false | diff --git a/receiver/ciscoosreceiver/factory.go b/receiver/ciscoosreceiver/factory.go new file mode 100644 index 0000000000000..4d5ebd0ead0aa --- /dev/null +++ b/receiver/ciscoosreceiver/factory.go @@ -0,0 +1,78 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package ciscoosreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/ciscoosreceiver" + +import ( + "context" + "time" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/receiver" + "go.opentelemetry.io/collector/scraper/scraperhelper" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/ciscoosreceiver/internal/metadata" +) + +const ( + defaultCollectionInterval = 60 * time.Second + defaultTimeout = 10 * time.Second +) + +// NewFactory creates a factory for Cisco OS receiver. +func NewFactory() receiver.Factory { + return receiver.NewFactory( + metadata.Type, + createDefaultConfig, + receiver.WithMetrics(createMetricsReceiver, metadata.MetricsStability), + ) +} + +func createDefaultConfig() component.Config { + cfg := scraperhelper.NewDefaultControllerConfig() + cfg.CollectionInterval = defaultCollectionInterval + cfg.Timeout = defaultTimeout + + return &Config{ + ControllerConfig: cfg, + MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(), + Devices: []DeviceConfig{}, + Scrapers: ScrapersConfig{ + BGP: true, + Environment: true, + Facts: true, + Interfaces: true, + Optics: true, + }, + } +} + +func createMetricsReceiver( + _ context.Context, + set receiver.Settings, + cfg component.Config, + consumer consumer.Metrics, +) (receiver.Metrics, error) { + conf := cfg.(*Config) + + // TODO: Replace with actual scraper implementation in second PR + // For skeleton, we'll return a placeholder + _ = conf + _ = set + _ = consumer + return &nopMetricsReceiver{}, nil +} + +// nopMetricsReceiver is a minimal receiver to satisfy component lifecycle tests. +type nopMetricsReceiver struct{} + +func (r *nopMetricsReceiver) Start(_ context.Context, _ component.Host) error { + _ = r + return nil +} + +func (r *nopMetricsReceiver) Shutdown(_ context.Context) error { + _ = r + return nil +} diff --git a/receiver/ciscoosreceiver/factory_test.go b/receiver/ciscoosreceiver/factory_test.go new file mode 100644 index 0000000000000..aa356266c9702 --- /dev/null +++ b/receiver/ciscoosreceiver/factory_test.go @@ -0,0 +1,65 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package ciscoosreceiver + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/receiver/receivertest" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/ciscoosreceiver/internal/metadata" +) + +func TestNewFactory(t *testing.T) { + factory := NewFactory() + require.NotNil(t, factory) + assert.Equal(t, "ciscoosreceiver", factory.Type().String()) +} + +func TestCreateDefaultConfig(t *testing.T) { + factory := NewFactory() + cfg := factory.CreateDefaultConfig() + require.NotNil(t, cfg) + + config, ok := cfg.(*Config) + require.True(t, ok) + assert.Equal(t, 60*time.Second, config.CollectionInterval) + assert.Equal(t, 10*time.Second, config.Timeout) + assert.Empty(t, config.Devices) + assert.True(t, config.Scrapers.BGP) + assert.True(t, config.Scrapers.Environment) + assert.True(t, config.Scrapers.Facts) + assert.True(t, config.Scrapers.Interfaces) + assert.True(t, config.Scrapers.Optics) +} + +func TestCreateMetricsReceiver(t *testing.T) { + factory := NewFactory() + cfg := factory.CreateDefaultConfig() + + // Add a device to make config valid + config := cfg.(*Config) + config.Devices = []DeviceConfig{ + {Host: "localhost:22", Username: "admin", Password: "password"}, + } + + set := receivertest.NewNopSettings(metadata.Type) + consumer := consumertest.NewNop() + + // For skeleton, we expect a no-op receiver and no error + receiver, err := factory.CreateMetrics(t.Context(), set, cfg, consumer) + assert.NotNil(t, receiver) + assert.NoError(t, err) +} + +func TestFactoryCanBeUsed(t *testing.T) { + factory := NewFactory() + err := componenttest.CheckConfigStruct(factory.CreateDefaultConfig()) + require.NoError(t, err) +} diff --git a/receiver/ciscoosreceiver/generated_component_test.go b/receiver/ciscoosreceiver/generated_component_test.go new file mode 100644 index 0000000000000..ae3fc11a057de --- /dev/null +++ b/receiver/ciscoosreceiver/generated_component_test.go @@ -0,0 +1,87 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package ciscoosreceiver + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/confmap/confmaptest" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/receiver" + "go.opentelemetry.io/collector/receiver/receivertest" +) + +var typ = component.MustNewType("ciscoosreceiver") + +func TestComponentFactoryType(t *testing.T) { + require.Equal(t, typ, NewFactory().Type()) +} + +func TestComponentConfigStruct(t *testing.T) { + require.NoError(t, componenttest.CheckConfigStruct(NewFactory().CreateDefaultConfig())) +} + +func TestComponentLifecycle(t *testing.T) { + factory := NewFactory() + + tests := []struct { + createFn func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error) + name string + }{ + + { + name: "metrics", + createFn: func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error) { + return factory.CreateMetrics(ctx, set, cfg, consumertest.NewNop()) + }, + }, + } + + cm, err := confmaptest.LoadConf("metadata.yaml") + require.NoError(t, err) + cfg := factory.CreateDefaultConfig() + sub, err := cm.Sub("tests::config") + require.NoError(t, err) + require.NoError(t, sub.Unmarshal(&cfg)) + + for _, tt := range tests { + t.Run(tt.name+"-shutdown", func(t *testing.T) { + c, err := tt.createFn(context.Background(), receivertest.NewNopSettings(typ), cfg) + require.NoError(t, err) + err = c.Shutdown(context.Background()) + require.NoError(t, err) + }) + t.Run(tt.name+"-lifecycle", func(t *testing.T) { + firstRcvr, err := tt.createFn(context.Background(), receivertest.NewNopSettings(typ), cfg) + require.NoError(t, err) + host := newMdatagenNopHost() + require.NoError(t, err) + require.NoError(t, firstRcvr.Start(context.Background(), host)) + require.NoError(t, firstRcvr.Shutdown(context.Background())) + secondRcvr, err := tt.createFn(context.Background(), receivertest.NewNopSettings(typ), cfg) + require.NoError(t, err) + require.NoError(t, secondRcvr.Start(context.Background(), host)) + require.NoError(t, secondRcvr.Shutdown(context.Background())) + }) + } +} + +var _ component.Host = (*mdatagenNopHost)(nil) + +type mdatagenNopHost struct{} + +func newMdatagenNopHost() component.Host { + return &mdatagenNopHost{} +} + +func (mnh *mdatagenNopHost) GetExtensions() map[component.ID]component.Component { + return nil +} + +func (mnh *mdatagenNopHost) GetFactory(_ component.Kind, _ component.Type) component.Factory { + return nil +} diff --git a/receiver/ciscoosreceiver/generated_package_test.go b/receiver/ciscoosreceiver/generated_package_test.go new file mode 100644 index 0000000000000..c586931e49563 --- /dev/null +++ b/receiver/ciscoosreceiver/generated_package_test.go @@ -0,0 +1,13 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package ciscoosreceiver + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/receiver/ciscoosreceiver/go.mod b/receiver/ciscoosreceiver/go.mod new file mode 100644 index 0000000000000..dbc299d176723 --- /dev/null +++ b/receiver/ciscoosreceiver/go.mod @@ -0,0 +1,65 @@ +module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/ciscoosreceiver + +go 1.24.0 + +require ( + github.com/google/go-cmp v0.7.0 + github.com/stretchr/testify v1.11.1 + go.opentelemetry.io/collector/component v1.42.1-0.20250925151503-069408608b28 + go.opentelemetry.io/collector/component/componenttest v0.136.1-0.20250925151503-069408608b28 + go.opentelemetry.io/collector/confmap v1.42.1-0.20250925151503-069408608b28 + go.opentelemetry.io/collector/consumer v1.42.1-0.20250925151503-069408608b28 + go.opentelemetry.io/collector/consumer/consumertest v0.136.1-0.20250925151503-069408608b28 + go.opentelemetry.io/collector/receiver v1.42.1-0.20250925151503-069408608b28 + go.opentelemetry.io/collector/receiver/receivertest v0.136.1-0.20250925151503-069408608b28 + go.opentelemetry.io/collector/scraper/scraperhelper v0.136.1-0.20250925151503-069408608b28 + go.uber.org/goleak v1.3.0 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-logr/logr v1.4.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-viper/mapstructure/v2 v2.4.0 // indirect + github.com/gobwas/glob v0.2.3 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/hashicorp/go-version v1.7.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/knadh/koanf/maps v0.1.2 // indirect + github.com/knadh/koanf/providers/confmap v1.0.0 // indirect + github.com/knadh/koanf/v2 v2.3.0 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect + go.opentelemetry.io/collector/consumer/consumererror v0.136.1-0.20250925151503-069408608b28 // indirect + go.opentelemetry.io/collector/consumer/xconsumer v0.136.1-0.20250925151503-069408608b28 // indirect + go.opentelemetry.io/collector/featuregate v1.42.1-0.20250925151503-069408608b28 // indirect + go.opentelemetry.io/collector/internal/telemetry v0.136.1-0.20250925151503-069408608b28 // indirect + go.opentelemetry.io/collector/pdata v1.42.1-0.20250925151503-069408608b28 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.136.1-0.20250925151503-069408608b28 // indirect + go.opentelemetry.io/collector/pipeline v1.42.1-0.20250925151503-069408608b28 // indirect + go.opentelemetry.io/collector/receiver/receiverhelper v0.136.1-0.20250925151503-069408608b28 // indirect + go.opentelemetry.io/collector/receiver/xreceiver v0.136.1-0.20250925151503-069408608b28 // indirect + go.opentelemetry.io/collector/scraper v0.136.1-0.20250925151503-069408608b28 // indirect + go.opentelemetry.io/contrib/bridges/otelzap v0.13.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/log v0.14.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.27.0 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect + golang.org/x/net v0.41.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/text v0.26.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7 // indirect + google.golang.org/grpc v1.75.1 // indirect + google.golang.org/protobuf v1.36.9 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/receiver/ciscoosreceiver/go.sum b/receiver/ciscoosreceiver/go.sum new file mode 100644 index 0000000000000..7974a4f04e401 --- /dev/null +++ b/receiver/ciscoosreceiver/go.sum @@ -0,0 +1,171 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= +github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= +github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/knadh/koanf/maps v0.1.2 h1:RBfmAW5CnZT+PJ1CVc1QSJKf4Xu9kxfQgYVQSu8hpbo= +github.com/knadh/koanf/maps v0.1.2/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI= +github.com/knadh/koanf/providers/confmap v1.0.0 h1:mHKLJTE7iXEys6deO5p6olAiZdG5zwp8Aebir+/EaRE= +github.com/knadh/koanf/providers/confmap v1.0.0/go.mod h1:txHYHiI2hAtF0/0sCmcuol4IDcuQbKTybiB1nOcUo1A= +github.com/knadh/koanf/v2 v2.3.0 h1:Qg076dDRFHvqnKG97ZEsi9TAg2/nFTa9hCdcSa1lvlM= +github.com/knadh/koanf/v2 v2.3.0/go.mod h1:gRb40VRAbd4iJMYYD5IxZ6hfuopFcXBpc9bbQpZwo28= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/collector/component v1.42.1-0.20250925151503-069408608b28 h1:3pTSwA8fcn01tuS1/CUqOxCPbQqpUiVbAAWVmUMr9OQ= +go.opentelemetry.io/collector/component v1.42.1-0.20250925151503-069408608b28/go.mod h1:MK8AOgsH13rQFYgruF1uqLmpgwoymYhBYZDzAqmSnwY= +go.opentelemetry.io/collector/component/componenttest v0.136.1-0.20250925151503-069408608b28 h1:g97PbHQ8knLdk1RbA30H6mII9cSe4Y9LSFx2KMqV+ww= +go.opentelemetry.io/collector/component/componenttest v0.136.1-0.20250925151503-069408608b28/go.mod h1:vCV42h1wuT2JCpRZEXsXZH5UwRrOJNH6p4upNP/BY1Y= +go.opentelemetry.io/collector/confmap v1.42.1-0.20250925151503-069408608b28 h1:oiS3KOjZTwtugUpdE0PpcC46zVYkKF3RT/hlHto5jMU= +go.opentelemetry.io/collector/confmap v1.42.1-0.20250925151503-069408608b28/go.mod h1:KW/l4uXBGnl5OM8WYi3gTg6PeG+y24nlIMS71KwWQjk= +go.opentelemetry.io/collector/consumer v1.42.1-0.20250925151503-069408608b28 h1:PPj+hF0Pnh6mwEkqTrAcAyY8oQW6KE7llmkF9JR2+24= +go.opentelemetry.io/collector/consumer v1.42.1-0.20250925151503-069408608b28/go.mod h1:jKcMYx9LXWMK4dupP2NhiAuHK063JiVMlyAC+ZMqlD0= +go.opentelemetry.io/collector/consumer/consumererror v0.136.1-0.20250925151503-069408608b28 h1:uzlSieuViJMsu/COOQET2inOZ0jxdd/nhC1aC0FeQoo= +go.opentelemetry.io/collector/consumer/consumererror v0.136.1-0.20250925151503-069408608b28/go.mod h1:DIivxQ3sy3mDZLaEcXdwZvEFLILpcyHxRiqEaPkHRFU= +go.opentelemetry.io/collector/consumer/consumertest v0.136.1-0.20250925151503-069408608b28 h1:jwtGvkqVyYohwabjv/RnRVkJRDS9gsLhSH2gYfE1wA0= +go.opentelemetry.io/collector/consumer/consumertest v0.136.1-0.20250925151503-069408608b28/go.mod h1:gTdRvUiJSmzmWp2Ndlh0N0yQ3hPnmTYul2DWuy31/D0= +go.opentelemetry.io/collector/consumer/xconsumer v0.136.1-0.20250925151503-069408608b28 h1:oSsW9KQUKHg1jraUmerf0cGeFKK4ilVNfplYiDlz0G4= +go.opentelemetry.io/collector/consumer/xconsumer v0.136.1-0.20250925151503-069408608b28/go.mod h1:sXw0lOF6D1iKhLy2xorJ8D3PysDXT0egmHJZu8TY0lE= +go.opentelemetry.io/collector/featuregate v1.42.1-0.20250925151503-069408608b28 h1:1UZY4/wGe9+B3qNG0QQ/EMkeKPejiwj+qvyK8ibwNtQ= +go.opentelemetry.io/collector/featuregate v1.42.1-0.20250925151503-069408608b28/go.mod h1:d0tiRzVYrytB6LkcYgz2ESFTv7OktRPQe0QEQcPt1L4= +go.opentelemetry.io/collector/internal/telemetry v0.136.1-0.20250925151503-069408608b28 h1:d1PZYb5PSbxKPVzq+zDIUDJDG0bXpy6co8oOWzMmo3U= +go.opentelemetry.io/collector/internal/telemetry v0.136.1-0.20250925151503-069408608b28/go.mod h1:FA4bv1roHY+FMnLho+bGqPllQa5HPF9or6NHJydYwI0= +go.opentelemetry.io/collector/pdata v1.42.1-0.20250925151503-069408608b28 h1:wtu8n5v9tYN8MXUUPjse7Zzn7+0HAHLcXHDWU3qqRWg= +go.opentelemetry.io/collector/pdata v1.42.1-0.20250925151503-069408608b28/go.mod h1:nnOmgf+RI/D5xYWgFPZ5nKuhf2E0Qy9Nx/mxoTvIq3k= +go.opentelemetry.io/collector/pdata/pprofile v0.136.1-0.20250925151503-069408608b28 h1:5ZqkczNm79ztJflJO+8oQND6CIR4QOYYST9VT5lrh74= +go.opentelemetry.io/collector/pdata/pprofile v0.136.1-0.20250925151503-069408608b28/go.mod h1:vAvrFj+xpwlSH85QFYGKYQ4xc0Lym5pWNRh1hMUH3TY= +go.opentelemetry.io/collector/pdata/testdata v0.136.0 h1:amivoDBK7ALqhwwCkSOYqfT95t1+o/TS6MHycseNs80= +go.opentelemetry.io/collector/pdata/testdata v0.136.0/go.mod h1:KlNRkMO7MZdbGjNJGFS0+yc2gpuraJg6F6gkuqaqA8Y= +go.opentelemetry.io/collector/pipeline v1.42.1-0.20250925151503-069408608b28 h1:eR+f4nbWM9xs4KSfAvhYdOdmTsQV3IYlEr5irDfivok= +go.opentelemetry.io/collector/pipeline v1.42.1-0.20250925151503-069408608b28/go.mod h1:xUrAqiebzYbrgxyoXSkk6/Y3oi5Sy3im2iCA51LwUAI= +go.opentelemetry.io/collector/receiver v1.42.1-0.20250925151503-069408608b28 h1:FZuLhtqGhGiqXBGBdKdlInBIlV3zEhHYDjEtM+EPweo= +go.opentelemetry.io/collector/receiver v1.42.1-0.20250925151503-069408608b28/go.mod h1:krKh5feVi2XyczfFZ76k0D6G7gHovA4IebCENOdIMkE= +go.opentelemetry.io/collector/receiver/receiverhelper v0.136.1-0.20250925151503-069408608b28 h1:KeK4C+iDb7hhW6mGYru3K8rxrg5EYTJBs8Hes8NUSbY= +go.opentelemetry.io/collector/receiver/receiverhelper v0.136.1-0.20250925151503-069408608b28/go.mod h1:yrlnI/6UsfD8ts8nZKkTOpF6qBaISmFNGNvVmh0ytX0= +go.opentelemetry.io/collector/receiver/receivertest v0.136.1-0.20250925151503-069408608b28 h1:QhSR8efGdeiNUsDjVLj4wBdMdZx3bmQx2dVQNWXPkFE= +go.opentelemetry.io/collector/receiver/receivertest v0.136.1-0.20250925151503-069408608b28/go.mod h1:FINUAigNZLhl85kvGJyjbNW2BDH2Bws6Ra4xaP1TEZg= +go.opentelemetry.io/collector/receiver/xreceiver v0.136.1-0.20250925151503-069408608b28 h1:l9a6vNQ0SSZwDcwPIuigV6VJpQ2NkUNu8Ss3q5JvSG8= +go.opentelemetry.io/collector/receiver/xreceiver v0.136.1-0.20250925151503-069408608b28/go.mod h1:v+qfBnubaHJLlQC6uxKX/HQnHBOfcNNfss9iUd2MzCU= +go.opentelemetry.io/collector/scraper v0.136.1-0.20250925151503-069408608b28 h1:iP4quZiEKO61s5Gc8eANMiCphjtFDC1FVwZmSUDl+gM= +go.opentelemetry.io/collector/scraper v0.136.1-0.20250925151503-069408608b28/go.mod h1:+e8umf+zZIXUBTSVHG3SlqAJJF2kq83bEHbQ+q8SZp8= +go.opentelemetry.io/collector/scraper/scraperhelper v0.136.1-0.20250925151503-069408608b28 h1:nugU9DPpDPEnCcYm5gSvx99zTqbuwFpcf85tV3muu1s= +go.opentelemetry.io/collector/scraper/scraperhelper v0.136.1-0.20250925151503-069408608b28/go.mod h1:xtztIrDHdzWL3l9anZGQolT9IHKexmQwlqTiINGb3hQ= +go.opentelemetry.io/contrib/bridges/otelzap v0.13.0 h1:aBKdhLVieqvwWe9A79UHI/0vgp2t/s2euY8X59pGRlw= +go.opentelemetry.io/contrib/bridges/otelzap v0.13.0/go.mod h1:SYqtxLQE7iINgh6WFuVi2AI70148B8EI35DSk0Wr8m4= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/log v0.14.0 h1:2rzJ+pOAZ8qmZ3DDHg73NEKzSZkhkGIua9gXtxNGgrM= +go.opentelemetry.io/otel/log v0.14.0/go.mod h1:5jRG92fEAgx0SU/vFPxmJvhIuDU9E1SUnEQrMlJpOno= +go.opentelemetry.io/otel/log/logtest v0.14.0 h1:BGTqNeluJDK2uIHAY8lRqxjVAYfqgcaTbVk1n3MWe5A= +go.opentelemetry.io/otel/log/logtest v0.14.0/go.mod h1:IuguGt8XVP4XA4d2oEEDMVDBBCesMg8/tSGWDjuKfoA= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= +go.opentelemetry.io/proto/slim/otlp v1.8.0 h1:afcLwp2XOeCbGrjufT1qWyruFt+6C9g5SOuymrSPUXQ= +go.opentelemetry.io/proto/slim/otlp v1.8.0/go.mod h1:Yaa5fjYm1SMCq0hG0x/87wV1MP9H5xDuG/1+AhvBcsI= +go.opentelemetry.io/proto/slim/otlp/collector/profiles/v1development v0.1.0 h1:Uc+elixz922LHx5colXGi1ORbsW8DTIGM+gg+D9V7HE= +go.opentelemetry.io/proto/slim/otlp/collector/profiles/v1development v0.1.0/go.mod h1:VyU6dTWBWv6h9w/+DYgSZAPMabWbPTFTuxp25sM8+s0= +go.opentelemetry.io/proto/slim/otlp/profiles/v1development v0.1.0 h1:i8YpvWGm/Uq1koL//bnbJ/26eV3OrKWm09+rDYo7keU= +go.opentelemetry.io/proto/slim/otlp/profiles/v1development v0.1.0/go.mod h1:pQ70xHY/ZVxNUBPn+qUWPl8nwai87eWdqL3M37lNi9A= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= +golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= +golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= +gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7 h1:pFyd6EwwL2TqFf8emdthzeX+gZE1ElRq3iM8pui4KBY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= +google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI= +google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ= +google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= +google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/receiver/ciscoosreceiver/internal/metadata/generated_config.go b/receiver/ciscoosreceiver/internal/metadata/generated_config.go new file mode 100644 index 0000000000000..1ee85633311c5 --- /dev/null +++ b/receiver/ciscoosreceiver/internal/metadata/generated_config.go @@ -0,0 +1,11 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package metadata + +// MetricsBuilderConfig is a configuration for ciscoosreceiver metrics builder. +type MetricsBuilderConfig struct { +} + +func DefaultMetricsBuilderConfig() MetricsBuilderConfig { + return MetricsBuilderConfig{} +} diff --git a/receiver/ciscoosreceiver/internal/metadata/generated_config_test.go b/receiver/ciscoosreceiver/internal/metadata/generated_config_test.go new file mode 100644 index 0000000000000..4490281d558d7 --- /dev/null +++ b/receiver/ciscoosreceiver/internal/metadata/generated_config_test.go @@ -0,0 +1,43 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package metadata + +import ( + "path/filepath" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/collector/confmap" + "go.opentelemetry.io/collector/confmap/confmaptest" +) + +func TestMetricsBuilderConfig(t *testing.T) { + tests := []struct { + name string + want MetricsBuilderConfig + }{ + { + name: "default", + want: DefaultMetricsBuilderConfig(), + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + cfg := loadMetricsBuilderConfig(t, tt.name) + diff := cmp.Diff(tt.want, cfg) + require.Emptyf(t, diff, "Config mismatch (-expected +actual):\n%s", diff) + }) + } +} + +func loadMetricsBuilderConfig(t *testing.T, name string) MetricsBuilderConfig { + cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config.yaml")) + require.NoError(t, err) + sub, err := cm.Sub(name) + require.NoError(t, err) + cfg := DefaultMetricsBuilderConfig() + require.NoError(t, sub.Unmarshal(&cfg, confmap.WithIgnoreUnused())) + return cfg +} diff --git a/receiver/ciscoosreceiver/internal/metadata/generated_status.go b/receiver/ciscoosreceiver/internal/metadata/generated_status.go new file mode 100644 index 0000000000000..b276ae223a35a --- /dev/null +++ b/receiver/ciscoosreceiver/internal/metadata/generated_status.go @@ -0,0 +1,16 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package metadata + +import ( + "go.opentelemetry.io/collector/component" +) + +var ( + Type = component.MustNewType("ciscoosreceiver") + ScopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/ciscoosreceiver" +) + +const ( + MetricsStability = component.StabilityLevelDevelopment +) diff --git a/receiver/ciscoosreceiver/internal/metadata/testdata/config.yaml b/receiver/ciscoosreceiver/internal/metadata/testdata/config.yaml new file mode 100644 index 0000000000000..6e04b174e6d66 --- /dev/null +++ b/receiver/ciscoosreceiver/internal/metadata/testdata/config.yaml @@ -0,0 +1,9 @@ +default: +all_set: + metrics: + cisco.device.connected: + enabled: true +none_set: + metrics: + cisco.device.connected: + enabled: false diff --git a/receiver/ciscoosreceiver/metadata.yaml b/receiver/ciscoosreceiver/metadata.yaml new file mode 100644 index 0000000000000..093358b0c98d0 --- /dev/null +++ b/receiver/ciscoosreceiver/metadata.yaml @@ -0,0 +1,26 @@ +type: ciscoosreceiver + +status: + class: receiver + stability: + development: [metrics] + distributions: [] + codeowners: + active: [dmitryax] + +resource_attributes: + +tests: + config: + collection_interval: 60s + timeout: 30s + scrapers: + bgp: true + environment: true + facts: true + interfaces: true + optics: true + devices: + - host: "localhost:2222" + username: "admin" + password: "admin" diff --git a/versions.yaml b/versions.yaml index f9c1c09d0f61a..d431998a00f89 100644 --- a/versions.yaml +++ b/versions.yaml @@ -226,6 +226,7 @@ module-sets: - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/bigipreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/chronyreceiver + - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/ciscoosreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudflarereceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudfoundryreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/collectdreceiver