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

Added selector in k8sattributesprocessor #1

Merged
merged 5 commits into from
Jul 3, 2023

Conversation

hdkshingala
Copy link

No description provided.

@hdkshingala hdkshingala merged commit cae8793 into fluxninja-v0.79.0 Jul 3, 2023
82 checks passed
hdkshingala added a commit that referenced this pull request Jul 4, 2023
* Added selector in k8sattributesprocessor

* Format changes

* Fixed tests

* [chore] Fix spark integration test by pinning version (open-telemetry#23675)

Fixes open-telemetry#23670

The test appears to have begun failing when the
[`latest`](https://hub.docker.com/layers/apache/spark/latest/images/sha256-a1dd2487a97fb5e35c5a5b409e830b501a92919029c62f9a559b13c4f5c50f63?context=explore)
tag of for the image was updated. This PR just pins the version.

* Version change and skip flaky tests
@hdkshingala hdkshingala deleted the infra-meter-filter branch July 4, 2023 06:45
jmichalak-fluxninja pushed a commit that referenced this pull request Aug 9, 2023
* Added selector in k8sattributesprocessor

* Format changes

* Fixed tests

* [chore] Fix spark integration test by pinning version (open-telemetry#23675)

Fixes open-telemetry#23670

The test appears to have begun failing when the
[`latest`](https://hub.docker.com/layers/apache/spark/latest/images/sha256-a1dd2487a97fb5e35c5a5b409e830b501a92919029c62f9a559b13c4f5c50f63?context=explore)
tag of for the image was updated. This PR just pins the version.

* Version change and skip flaky tests
kwapik pushed a commit that referenced this pull request Oct 12, 2023
…emetry#24676)

**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:** open-telemetry#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
```
kwapik pushed a commit that referenced this pull request Oct 12, 2023
)

**Description:** 

Adding command line argument `--status-code` to `telemetrygen traces`,
which accepts `(Unset,Error,Ok)` (case sensitive) or the enum equivalent
of `(0,1,2)`.

Running 

```shell
telemetrygen traces --otlp-insecure --traces 1 --status-code 1
```

against a minimal local collector yields

```txt
2023-07-29T21:27:57.862+0100	info	ResourceSpans #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.4.0
Resource attributes:
     -> service.name: Str(telemetrygen)
ScopeSpans #0
ScopeSpans SchemaURL:
InstrumentationScope telemetrygen
Span #0
    Trace ID       : f6dc4be32c78b9999c69d504a79e68c1
    Parent ID      : 4e2cd6e0e90cf2ea
    ID             : 20835413e32d26a5
    Name           : okey-dokey
    Kind           : Server
    Start time     : 2023-07-29 20:27:57.861602 +0000 UTC
    End time       : 2023-07-29 20:27:57.861726 +0000 UTC
    Status code    : Error
    Status message :
Attributes:
     -> net.peer.ip: Str(1.2.3.4)
     -> peer.service: Str(telemetrygen-client)
Span #1
    Trace ID       : f6dc4be32c78b9999c69d504a79e68c1
    Parent ID      :
    ID             : 4e2cd6e0e90cf2ea
    Name           : lets-go
    Kind           : Client
    Start time     : 2023-07-29 20:27:57.861584 +0000 UTC
    End time       : 2023-07-29 20:27:57.861726 +0000 UTC
    Status code    : Error
    Status message :
Attributes:
     -> net.peer.ip: Str(1.2.3.4)
     -> peer.service: Str(telemetrygen-server)
```

and similarly (the string version)

```shell
telemetrygen traces --otlp-insecure --traces 1 --status-code '"Ok"'
```

produces 

```txt
Resource SchemaURL: https://opentelemetry.io/schemas/1.4.0
Resource attributes:
     -> service.name: Str(telemetrygen)
ScopeSpans #0
ScopeSpans SchemaURL:
InstrumentationScope telemetrygen
Span #0
    Trace ID       : dfd830da170acfe567b12f87685d7917
    Parent ID      : 8e15b390dc6a1ccc
    ID             : 165c300130532072
    Name           : okey-dokey
    Kind           : Server
    Start time     : 2023-07-29 20:29:16.026965 +0000 UTC
    End time       : 2023-07-29 20:29:16.027089 +0000 UTC
    Status code    : Ok
    Status message :
Attributes:
     -> net.peer.ip: Str(1.2.3.4)
     -> peer.service: Str(telemetrygen-client)
Span #1
    Trace ID       : dfd830da170acfe567b12f87685d7917
    Parent ID      :
    ID             : 8e15b390dc6a1ccc
    Name           : lets-go
    Kind           : Client
    Start time     : 2023-07-29 20:29:16.026956 +0000 UTC
    End time       : 2023-07-29 20:29:16.027089 +0000 UTC
    Status code    : Ok
    Status message :
Attributes:
     -> net.peer.ip: Str(1.2.3.4)
     -> peer.service: Str(telemetrygen-server)
```

The default is `Unset` which is the current behaviour.

**Link to tracking Issue:**

24286

**Testing:**

Added unit tests which covers both valid and invalid inputs.

**Documentation:**

Command line arguments are self documenting via the usage info in the
flag.

Co-authored-by: Pablo Baeyens <[email protected]>
kwapik pushed a commit that referenced this pull request Oct 12, 2023
* Added selector in k8sattributesprocessor

* Format changes

* Fixed tests

* [chore] Fix spark integration test by pinning version (open-telemetry#23675)

Fixes open-telemetry#23670

The test appears to have begun failing when the
[`latest`](https://hub.docker.com/layers/apache/spark/latest/images/sha256-a1dd2487a97fb5e35c5a5b409e830b501a92919029c62f9a559b13c4f5c50f63?context=explore)
tag of for the image was updated. This PR just pins the version.

* Version change and skip flaky tests
hdkshingala added a commit that referenced this pull request Nov 8, 2023
* Added selector in k8sattributesprocessor

* Format changes

* Fixed tests

* [chore] Fix spark integration test by pinning version (open-telemetry#23675)

Fixes open-telemetry#23670

The test appears to have begun failing when the
[`latest`](https://hub.docker.com/layers/apache/spark/latest/images/sha256-a1dd2487a97fb5e35c5a5b409e830b501a92919029c62f9a559b13c4f5c50f63?context=explore)
tag of for the image was updated. This PR just pins the version.

* Version change and skip flaky tests
hdkshingala pushed a commit that referenced this pull request Nov 30, 2023
open-telemetry#29116)

**Description:** 

As originally proposed in open-telemetry#26991 before I got distracted

Exposes the duration of generated spans as a command line parameter. It
uses a `DurationVar` flag so units can be easily provided and are
automatically applied.

Example usage:

```bash
telemetrygen traces --traces 100 --otlp-insecure --span-duration 10ns # nanoseconds
telemetrygen traces --traces 100 --otlp-insecure --span-duration 10us # microseconds
telemetrygen traces --traces 100 --otlp-insecure --span-duration 10ms # milliseconds
telemetrygen traces --traces 100 --otlp-insecure --span-duration 10s # seconds
```

**Testing:** 

Ran without the argument provided `telemetrygen traces --traces 1
--otlp-insecure` and seen spans publishing with the default value.

Ran again with the argument provided: `telemetrygen traces --traces 1
--otlp-insecure --span-duration 1s`

And observed the expected output:

```
Resource SchemaURL: https://opentelemetry.io/schemas/1.4.0
Resource attributes:
     -> service.name: Str(telemetrygen)
ScopeSpans #0
ScopeSpans SchemaURL: 
InstrumentationScope telemetrygen 
Span #0
    Trace ID       : 8b441587ffa5820688b87a6b511d634c
    Parent ID      : 39faad428638791b
    ID             : 88f0886894bd4ee2
    Name           : okey-dokey
    Kind           : Server
    Start time     : 2023-11-12 02:05:07.97443 +0000 UTC
    End time       : 2023-11-12 02:05:08.97443 +0000 UTC
    Status code    : Unset
    Status message : 
Attributes:
     -> net.peer.ip: Str(1.2.3.4)
     -> peer.service: Str(telemetrygen-client)
Span #1
    Trace ID       : 8b441587ffa5820688b87a6b511d634c
    Parent ID      : 
    ID             : 39faad428638791b
    Name           : lets-go
    Kind           : Client
    Start time     : 2023-11-12 02:05:07.97443 +0000 UTC
    End time       : 2023-11-12 02:05:08.97443 +0000 UTC
    Status code    : Unset
    Status message : 
Attributes:
     -> net.peer.ip: Str(1.2.3.4)
     -> peer.service: Str(telemetrygen-server)
	{"kind": "exporter", "data_type": "traces", "name": "debug"}
```

**Documentation:** No documentation added.

---------

Co-authored-by: Pablo Baeyens <[email protected]>
hdkshingala added a commit that referenced this pull request Nov 30, 2023
* Added selector in k8sattributesprocessor

* Format changes

* Fixed tests

* [chore] Fix spark integration test by pinning version (open-telemetry#23675)

Fixes open-telemetry#23670

The test appears to have begun failing when the
[`latest`](https://hub.docker.com/layers/apache/spark/latest/images/sha256-a1dd2487a97fb5e35c5a5b409e830b501a92919029c62f9a559b13c4f5c50f63?context=explore)
tag of for the image was updated. This PR just pins the version.

* Version change and skip flaky tests
hdkshingala added a commit that referenced this pull request Jan 1, 2024
* Added selector in k8sattributesprocessor

* Format changes

* Fixed tests

* [chore] Fix spark integration test by pinning version (open-telemetry#23675)

Fixes open-telemetry#23670

The test appears to have begun failing when the
[`latest`](https://hub.docker.com/layers/apache/spark/latest/images/sha256-a1dd2487a97fb5e35c5a5b409e830b501a92919029c62f9a559b13c4f5c50f63?context=explore)
tag of for the image was updated. This PR just pins the version.

* Version change and skip flaky tests
hdkshingala added a commit that referenced this pull request Feb 5, 2024
* Added selector in k8sattributesprocessor

* Format changes

* Fixed tests

* [chore] Fix spark integration test by pinning version (open-telemetry#23675)

Fixes open-telemetry#23670

The test appears to have begun failing when the
[`latest`](https://hub.docker.com/layers/apache/spark/latest/images/sha256-a1dd2487a97fb5e35c5a5b409e830b501a92919029c62f9a559b13c4f5c50f63?context=explore)
tag of for the image was updated. This PR just pins the version.

* Version change and skip flaky tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants