Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sshcheckreceiver] New receiver #14694

Merged
merged 1 commit into from
Jan 25, 2023
Merged

[sshcheckreceiver] New receiver #14694

merged 1 commit into from
Jan 25, 2023

Conversation

nslaughter
Copy link
Contributor

@nslaughter nslaughter commented Oct 3, 2022

Description:

This provides a remote check for the availability of SSH and SFTP servers. Observability for the status of SSH and SFTP servers is an important capability for practically all operators managing data for business customers.

Link to tracking Issue: Fixes #14312

Testing: (1) PR Includes over 90% coverage in the package with the scraper. (2) Also includes coverage ~75% in the internal/sshconfig package. (3) Built the PR branch and ran in Docker against lscr.io/linuxserver/openssh-server.

Documentation: The new receiver includes documentation in receiver/sshcheckreceiver/README.md and receiver/sshcheckreceiver/documentation.md.

The metric output looks like the following ...

Resource SchemaURL: 
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope otelcol/sshcheckreceiver latest
Metric #0
Descriptor:
     -> Name: sshcheck.duration
     -> Description: Measures the duration of SSH connection.
     -> Unit: ms
     -> DataType: Gauge
NumberDataPoints #0
Data point attributes:
     -> ssh.endpoint: Str(sshserver:2222)
StartTimestamp: 2022-10-19 04:14:59.070384439 +0000 UTC
Timestamp: 2022-10-19 04:15:09.09442365 +0000 UTC
Value: 59
Metric #1
Descriptor:
     -> Name: sshcheck.sftp_duration
     -> Description: Measures SFTP request duration.
     -> Unit: ms
     -> DataType: Gauge
NumberDataPoints #0
Data point attributes:
     -> ssh.endpoint: Str(sshserver:2222)
StartTimestamp: 2022-10-19 04:14:59.070384439 +0000 UTC
Timestamp: 2022-10-19 04:15:09.09442365 +0000 UTC
Value: 65
Metric #2
Descriptor:
     -> Name: sshcheck.sftp_status
     -> Description: 1 if the SFTP server replied to request, otherwise 0.
     -> Unit: 1
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
Data point attributes:
     -> ssh.endpoint: Str(sshserver:2222)
StartTimestamp: 2022-10-19 04:14:59.070384439 +0000 UTC
Timestamp: 2022-10-19 04:15:09.09442365 +0000 UTC
Value: 1
Metric #3
Descriptor:
     -> Name: sshcheck.status
     -> Description: 1 if the SSH client successfully connected, otherwise 0.
     -> Unit: 1
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
Data point attributes:
     -> ssh.endpoint: Str(sshserver:2222)
StartTimestamp: 2022-10-19 04:14:59.070384439 +0000 UTC
Timestamp: 2022-10-19 04:15:09.09442365 +0000 UTC
Value: 1

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 3, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: jamesmoessis / name: James Moessis (3f3d70c)
  • ✅ login: jpkrohling / name: Juraci Paixão Kröhling (596e1a8)
  • ✅ login: Yamakaky / name: Yamakaky (fc54ead)
  • ✅ login: frzifus / name: Ben B. (31ed02a)
  • ✅ login: linjunzhe / name: Junzhe Lin (b52c269)
  • ✅ login: dmitryax / name: Dmitrii Anoshin (a23743b)
  • ✅ login: BinaryFissionGames / name: Brandon Johnson (01ed0b6, fbd386f)
  • ✅ login: nslaughter / name: Nathan Slaughter (19d7a7e, 36e15ff)

@nslaughter nslaughter changed the title Sshcheckreceiver [sshcheckreceiver] New receiver Oct 4, 2022
@nslaughter nslaughter marked this pull request as ready for review October 4, 2022 15:46
@nslaughter nslaughter requested a review from a team as a code owner October 4, 2022 15:46
@jpkrohling jpkrohling requested review from codeboten and removed request for jpkrohling October 4, 2022 16:44
.github/CODEOWNERS Outdated Show resolved Hide resolved
.github/CODEOWNERS Outdated Show resolved Hide resolved
receiver/sshcheckreceiver/README.md Outdated Show resolved Hide resolved
receiver/sshcheckreceiver/doc.go Outdated Show resolved Hide resolved
receiver/sshcheckreceiver/config.go Outdated Show resolved Hide resolved
receiver/sshcheckreceiver/scraper.go Show resolved Hide resolved
receiver/sshcheckreceiver/config.go Outdated Show resolved Hide resolved
receiver/sshcheckreceiver/factory.go Outdated Show resolved Hide resolved
receiver/sshcheckreceiver/factory_windows.go Outdated Show resolved Hide resolved
@github-actions github-actions bot added the cmd/configschema configschema command label Nov 13, 2022
@nslaughter
Copy link
Contributor Author

I'm seeing a Windows build failure on this PR in apparently unrelated code. See https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/3462915743/jobs/5782436074.

Advice on how I should address?

@codeboten
Copy link
Contributor

I'm seeing a Windows build failure on this PR in apparently unrelated code. See https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/3462915743/jobs/5782436074.

Advice on how I should address?

Possibly a flaky test. If you address the lint failures, it will trigger the build again and we should be able to see if the windows issue persist:

 Error: factory.go:43:28: SA1019: config.Receiver is deprecated: [v0.64.0] use component.ReceiverConfig. (staticcheck)
func createDefaultConfig() config.Receiver {
                           ^
Error: factory.go:46:51: SA1019: config.NewComponentID is deprecated: [v0.64.0] use component.NewID. (staticcheck)
			ReceiverSettings:   config.NewReceiverSettings(config.NewComponentID(typeStr)),
			                                               ^
Error: factory.go:56:96: SA1019: config.Receiver is deprecated: [v0.64.0] use component.ReceiverConfig. (staticcheck)
func createMetricsReceiver(ctx context.Context, params component.ReceiverCreateSettings, rConf config.Receiver, consumer consumer.Metrics) (component.MetricsReceiver, error) {
                                                                                               ^
Error: config_test.go:30:12: SA1019: configtest.CheckConfigStruct is deprecated: [v0.64.0] use componenttest.CheckConfigStruct. (staticcheck)
	if err := configtest.CheckConfigStruct(&Config{}); err != nil {
	          ^
Error: factory_test.go:52:21: SA1019: config.Receiver is deprecated: [v0.64.0] use component.ReceiverConfig. (staticcheck)
				var expectedCfg config.Receiver = &Config{
				                ^
Error: factory_test.go:54:54: SA1019: config.NewComponentID is deprecated: [v0.64.0] use component.NewID. (staticcheck)
						ReceiverSettings:   config.NewReceiverSettings(config.NewComponentID(typeStr)),
						                                               ^
Error: internal/configssh/configssh_test.go:32:10: SA1019: config.ComponentID is deprecated: [v0.64.0] use component.ID. (staticcheck)
	ext map[config.ComponentID]component.Extension
	        ^
Error: internal/configssh/configssh_test.go:37:12: SA1019: config.ComponentID is deprecated: [v0.64.0] use component.ID. (staticcheck)
		ext: map[config.ComponentID]component.Extension{
		         ^
Error: internal/configssh/configssh_test.go:38:4: SA1019: config.NewComponentID is deprecated: [v0.64.0] use component.NewID. (staticcheck)
			config.NewComponentID("testauth"): &configauth.MockClientAuthenticator{},
			^
Error: internal/configssh/configssh_test.go:140:12: SA1019: config.ComponentID is deprecated: [v0.64.0] use component.ID. (staticcheck)
		ext: map[config.ComponentID]component.Extension{
		         ^

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2022

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Dec 4, 2022
@runforesight
Copy link

runforesight bot commented Dec 4, 2022

Foresight Summary

    
Major Impacts

build-and-test duration(40 minutes 27 seconds) has decreased 11 minutes 41 seconds compared to main branch avg(52 minutes 8 seconds).
View More Details

✅  tracegen workflow has finished in 1 minute 18 seconds (1 minute 8 seconds less than main branch avg.) and finished at 25th Jan, 2023.


Job Failed Steps Tests
build-dev -     🔗  N/A See Details
publish-latest -     🔗  N/A See Details
publish-stable -     🔗  N/A See Details

✅  telemetrygen workflow has finished in 1 minute 23 seconds (1 minute 2 seconds less than main branch avg.) and finished at 25th Jan, 2023.


Job Failed Steps Tests
build-dev -     🔗  N/A See Details
publish-stable -     🔗  N/A See Details
publish-latest -     🔗  N/A See Details

✅  changelog workflow has finished in 1 minute 26 seconds (38 seconds less than main branch avg.) and finished at 25th Jan, 2023.


Job Failed Steps Tests
changelog -     🔗  N/A See Details

✅  check-links workflow has finished in 1 minute 39 seconds and finished at 25th Jan, 2023.


Job Failed Steps Tests
changed files -     🔗  N/A See Details
check-links -     🔗  N/A See Details

✅  prometheus-compliance-tests workflow has finished in 3 minutes 38 seconds (3 minutes 57 seconds less than main branch avg.) and finished at 25th Jan, 2023.


Job Failed Steps Tests
prometheus-compliance-tests -     🔗  ✅ 21  ❌ 0  ⏭ 0    🔗 See Details

✅  build-and-test workflow has finished in 40 minutes 27 seconds (11 minutes 41 seconds less than main branch avg.) and finished at 25th Jan, 2023.


Job Failed Steps Tests
unittest-matrix (1.18, internal) -     🔗  ✅ 561  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.19, extension) -     🔗  ✅ 528  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.19, internal) -     🔗  ✅ 561  ❌ 0  ⏭ 0    🔗 See Details
correctness-metrics -     🔗  ✅ 2  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.18, processor) -     🔗  ✅ 1471  ❌ 0  ⏭ 0    🔗 See Details
correctness-traces -     🔗  ✅ 17  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.18, extension) -     🔗  ✅ 528  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.19, processor) -     🔗  ✅ 1471  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.19, receiver-0) -     🔗  ✅ 2567  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.18, receiver-0) -     🔗  ✅ 2567  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.18, exporter) -     🔗  ✅ 2435  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.19, exporter) -     🔗  ✅ 2435  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.18, other) -     🔗  ✅ 4631  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.19, other) -     🔗  ✅ 4631  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.19, receiver-1) -     🔗  ✅ 1944  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.18, receiver-1) -     🔗  ✅ 1944  ❌ 0  ⏭ 0    🔗 See Details
integration-tests -     🔗  ✅ 55  ❌ 0  ⏭ 0    🔗 See Details
setup-environment -     🔗  N/A See Details
check-collector-module-version -     🔗  N/A See Details
lint-matrix (receiver-0) -     🔗  N/A See Details
lint-matrix (receiver-1) -     🔗  N/A See Details
lint-matrix (processor) -     🔗  N/A See Details
lint-matrix (exporter) -     🔗  N/A See Details
lint-matrix (extension) -     🔗  N/A See Details
lint-matrix (internal) -     🔗  N/A See Details
lint-matrix (other) -     🔗  N/A See Details
check-codeowners -     🔗  N/A See Details
build-examples -     🔗  N/A See Details
checks -     🔗  N/A See Details
lint -     🔗  N/A See Details
unittest (1.19) -     🔗  N/A See Details
unittest (1.18) -     🔗  N/A See Details
cross-compile (darwin, amd64) -     🔗  N/A See Details
cross-compile (darwin, arm64) -     🔗  N/A See Details
cross-compile (linux, 386) -     🔗  N/A See Details
cross-compile (linux, amd64) -     🔗  N/A See Details
cross-compile (linux, arm) -     🔗  N/A See Details
cross-compile (linux, arm64) -     🔗  N/A See Details
cross-compile (linux, ppc64le) -     🔗  N/A See Details
cross-compile (windows, 386) -     🔗  N/A See Details
cross-compile (windows, amd64) -     🔗  N/A See Details
build-package (deb) -     🔗  N/A See Details
build-package (rpm) -     🔗  N/A See Details
windows-msi -     🔗  N/A See Details
publish-check -     🔗  N/A See Details
publish-stable -     🔗  N/A See Details
publish-dev -     🔗  N/A See Details

✅  load-tests workflow has finished in 8 minutes 34 seconds (5 minutes 40 seconds less than main branch avg.) and finished at 25th Jan, 2023.


Job Failed Steps Tests
loadtest (TestIdleMode) -     🔗  ✅ 1  ❌ 0  ⏭ 0    🔗 See Details
loadtest (TestTraceAttributesProcessor) -     🔗  ✅ 3  ❌ 0  ⏭ 0    🔗 See Details
loadtest (TestMetric10kDPS|TestMetricsFromFile) -     🔗  ✅ 6  ❌ 0  ⏭ 0    🔗 See Details
loadtest (TestMetricResourceProcessor|TestTrace10kSPS) -     🔗  ✅ 12  ❌ 0  ⏭ 0    🔗 See Details
loadtest (TestTraceNoBackend10kSPS|TestTrace1kSPSWithAttrs) -     🔗  ✅ 8  ❌ 0  ⏭ 0    🔗 See Details
loadtest (TestTraceBallast1kSPSWithAttrs|TestTraceBallast1kSPSAddAttrs) -     🔗  ✅ 10  ❌ 0  ⏭ 0    🔗 See Details
loadtest (TestBallastMemory|TestLog10kDPS) -     🔗  ✅ 19  ❌ 0  ⏭ 0    🔗 See Details
setup-environment -     🔗  N/A See Details

✅  build-and-test-windows workflow has finished in 42 minutes 56 seconds and finished at 25th Jan, 2023.


Job Failed Steps Tests
windows-unittest-matrix (internal) -     🔗  ✅ 525  ❌ 0  ⏭ 0    🔗 See Details
windows-unittest-matrix (processor) -     🔗  ✅ 1471  ❌ 0  ⏭ 0    🔗 See Details
windows-unittest-matrix (extension) -     🔗  ✅ 515  ❌ 0  ⏭ 0    🔗 See Details
windows-unittest-matrix (receiver-0) -     🔗  ✅ 2560  ❌ 0  ⏭ 0    🔗 See Details
windows-unittest-matrix (receiver-1) -     🔗  ✅ 1881  ❌ 0  ⏭ 0    🔗 See Details
windows-unittest-matrix (exporter) -     🔗  ✅ 2399  ❌ 0  ⏭ 0    🔗 See Details
windows-unittest-matrix (other) -     🔗  ✅ 4467  ❌ 0  ⏭ 0    🔗 See Details
windows-unittest -     🔗  N/A See Details

🔎 See details on Foresight

*You can configure Foresight comments in your organization settings page.

@nslaughter
Copy link
Contributor Author

I don't see a connection between the integration test failures and this PR. Maybe kicking off the actions again will work it out.

@djaglowski
Copy link
Member

I've restarted the tests.

The failure appears to be #17070, which I will take a look at soon.

@djaglowski
Copy link
Member

There appears to be a unit test failure related to this component: https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/3759785467/jobs/6389764835#step:8:4084

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs another rebase, please take a look at @djaglowski's comment

@nslaughter
Copy link
Contributor Author

Needs another rebase, please take a look at @djaglowski's comment

Thank you. It's done.

@nslaughter
Copy link
Contributor Author

Do I need to resolve conflicts with main that come up until this can be merged? @codeboten

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nslaughter yeah sorry I didn't get a chance to merge this before the last release. Please update the PR and ping me, will merge this today

@codeboten codeboten merged commit 297a8c1 into open-telemetry:main Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New component: SSH Receiver
6 participants