diff --git a/CHANGELOG.md b/CHANGELOG.md index 50ee5fa56993..0c007ab3d750 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -186,6 +186,7 @@ - `filelogreceiver`: Fix issue where files were deduplicated unnecessarily (#24235) - `processor/tailsamplingprocessor`: Fix data race when accessing spans during policies evaluation (#24283) - `zipkintranslator`: Stop dropping error tags from Zipkin spans. The old code removes all errors from those spans, rendering them useless if an actual error happened. In addition, no longer delete error tags if they contain useful information. (#16530) +- `sshcheckreceiver`: Add the SSH endpoint as a resource attribute (#24441) ## v0.81.0 diff --git a/receiver/sshcheckreceiver/scraper.go b/receiver/sshcheckreceiver/scraper.go index 25131dc367ad..bfc95407c944 100644 --- a/receiver/sshcheckreceiver/scraper.go +++ b/receiver/sshcheckreceiver/scraper.go @@ -24,6 +24,7 @@ type sshcheckScraper struct { *configssh.Client *Config settings component.TelemetrySettings + rb *metadata.ResourceBuilder mb *metadata.MetricsBuilder } @@ -124,13 +125,15 @@ func (s *sshcheckScraper) scrape(ctx context.Context) (_ pmetric.Metrics, err er } } - return s.mb.Emit(), nil + s.rb.SetSSHEndpoint(s.Config.SSHClientSettings.Endpoint) + return s.mb.Emit(metadata.WithResource(s.rb.Emit())), nil } func newScraper(conf *Config, settings receiver.CreateSettings) *sshcheckScraper { return &sshcheckScraper{ Config: conf, settings: settings.TelemetrySettings, + rb: metadata.NewResourceBuilder(conf.MetricsBuilderConfig.ResourceAttributes), mb: metadata.NewMetricsBuilder(conf.MetricsBuilderConfig, settings), } } diff --git a/receiver/sshcheckreceiver/testdata/config.yaml b/receiver/sshcheckreceiver/testdata/config.yaml index 3100b4563618..1e461e15f323 100644 --- a/receiver/sshcheckreceiver/testdata/config.yaml +++ b/receiver/sshcheckreceiver/testdata/config.yaml @@ -3,7 +3,7 @@ receivers: endpoint: notdefault:1313 username: notdefault_password password: notdefault_password - keyfile: notdefault/path/keyfile + key_file: notdefault/path/keyfile collection_interval: 13m known_hosts: path/to/collector_known_hosts ignore_host_key: false