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

[receiver/sshcheck] Unused resource attribute definition in metadata.yaml #24441

Closed
dmitryax opened this issue Jul 24, 2023 · 5 comments
Closed
Labels
bug Something isn't working help wanted Extra attention is needed receiver/sshcheck

Comments

@dmitryax
Copy link
Member

dmitryax commented Jul 24, 2023

metadata.yaml defines ssh.endpoint resource attribute, but it's not applied to the emitted metrics

@dmitryax dmitryax added bug Something isn't working receiver/sshcheck help wanted Extra attention is needed labels Jul 24, 2023
@github-actions
Copy link
Contributor

Pinging code owners for receiver/sshcheck: @nslaughter @codeboten. See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@DewaldDeJager
Copy link
Contributor

@dmitryax I'm keen to take on this issue. I just want to clarify: Do we want to remove the ssh.endpoint resource attribute from the metadata.yml definition or change the receiver to start applying it?

@dmitryax
Copy link
Member Author

This is up to the code owners. I think this should be set, not removed

DewaldDeJager added a commit to DewaldDeJager/opentelemetry-collector-contrib that referenced this issue Jul 30, 2023
DewaldDeJager added a commit to DewaldDeJager/opentelemetry-collector-contrib that referenced this issue Jul 30, 2023
dmitryax pushed a commit that referenced this issue Aug 1, 2023
**Description:** The metadata.yml for the SSH check receiver currently
documents a resource attribute containing the SSH endpoint but this is
not emitted. This PR updates the receiver to include this resource
attribute.

**Link to tracking Issue:** #24441 

**Testing:**

Example collector config:
```yaml
receivers:
  sshcheck:
    endpoint: 13.245.150.131:22
    username: ec2-user
    key_file: /Users/dewald.dejager/.ssh/sandbox.pem
    collection_interval: 15s
    known_hosts: /Users/dewald.dejager/.ssh/known_hosts
    ignore_host_key: false
    resource_attributes:
      "ssh.endpoint":
        enabled: true

exporters:
  logging:
    verbosity: detailed
  prometheus:
    endpoint: 0.0.0.0:8081
    resource_to_telemetry_conversion:
      enabled: true

service:
  pipelines:
    metrics:
      receivers: [sshcheck]
      exporters: [logging, prometheus]
```

The log output looks like this:
```
2023-07-30T16:52:38.724+0200    info    MetricsExporter {"kind": "exporter", "data_type": "metrics", "name": "logging", "resource metrics": 1, "metrics": 2, "data points": 2}
2023-07-30T16:52:38.724+0200    info    ResourceMetrics #0
Resource SchemaURL: 
Resource attributes:
     -> ssh.endpoint: Str(13.245.150.131:22)
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope otelcol/sshcheckreceiver 0.82.0-dev
Metric #0
Descriptor:
     -> Name: sshcheck.duration
     -> Description: Measures the duration of SSH connection.
     -> Unit: ms
     -> DataType: Gauge
NumberDataPoints #0
StartTimestamp: 2023-07-30 14:52:22.381672 +0000 UTC
Timestamp: 2023-07-30 14:52:38.404003 +0000 UTC
Value: 319
Metric #1
Descriptor:
     -> Name: sshcheck.status
     -> Description: 1 if the SSH client successfully connected, otherwise 0.
     -> Unit: 1
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
StartTimestamp: 2023-07-30 14:52:22.381672 +0000 UTC
Timestamp: 2023-07-30 14:52:38.404003 +0000 UTC
Value: 1
```

And the Prometheus metrics look like this:
```
# HELP sshcheck_duration Measures the duration of SSH connection.
# TYPE sshcheck_duration gauge
sshcheck_duration{ssh_endpoint="13.245.150.131:22"} 311
# HELP sshcheck_status 1 if the SSH client successfully connected, otherwise 0.
# TYPE sshcheck_status gauge
sshcheck_status{ssh_endpoint="13.245.150.131:22"} 1
```
@dmitryax
Copy link
Member Author

dmitryax commented Aug 6, 2023

Fixed by #24676

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed receiver/sshcheck
Projects
None yet
Development

No branches or pull requests

2 participants