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

[processor/resourcedetection] Add host.mac to system detector #29588

Merged
merged 3 commits into from
Dec 7, 2023

Conversation

mx-psi
Copy link
Member

@mx-psi mx-psi commented Nov 30, 2023

Description:

Adds support for host.mac detection to the system detector on the resource detection processor.

This convention is defined in the specification on the host document.

Link to tracking Issue: Fixes #29587 and therefore fixes #22045

Testing:

Unit tests; manually Tested on my laptop with the following configuration:

receivers:
  hostmetrics:
    collection_interval: 10s
    scrapers:
      load:

processors:
  resourcedetection:
    detectors: ["system"]
    system:
      resource_attributes:
        host.mac:
          enabled: true

exporters:
  debug:
    verbosity: detailed

service:
  pipelines:
    metrics:
      receivers: [hostmetrics]
      processors: [resourcedetection]
      exporters: [debug]

@mx-psi
Copy link
Member Author

mx-psi commented Nov 30, 2023

Very similar to #24450 cc @ChrsMark @frzifus @dmitryax @atoulme in case you want to review as well

@mx-psi mx-psi marked this pull request as ready for review November 30, 2023 17:30
@mx-psi mx-psi requested a review from a team as a code owner November 30, 2023 17:30
Copy link
Member

@crobert-1 crobert-1 left a comment

Choose a reason for hiding this comment

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

Just some wording nits and a style question.

// toIEEERA converts a MAC address to IEEE RA format.
// Per the spec: "MAC Addresses MUST be represented in IEEE RA hexadecimal form: as hyphen-separated
// octets in uppercase hexadecimal form from most to least significant."
// Golang returns MAC addresses as colon-separated octets in lowercase hexadecimal form from most
Copy link
Member

Choose a reason for hiding this comment

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

Just as a future reference for myself or others, I was wondering where this was documented/guaranteed, and found it in the implementation of String(). 👍

Co-authored-by: Curtis Robert <crobert@splunk.com>
Copy link
Member

@songy23 songy23 left a comment

Choose a reason for hiding this comment

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

LGTM

@mx-psi mx-psi merged commit cdfaa45 into open-telemetry:main Dec 7, 2023
83 checks passed
@github-actions github-actions bot added this to the next release milestone Dec 7, 2023
jayasai470 pushed a commit to jayasai470/opentelemetry-collector-contrib that referenced this pull request Dec 8, 2023
…elemetry#29588)

**Description:**

Adds support for `host.mac` detection to the `system` detector on the
resource detection processor.

This convention is defined in the specification [on the host
document](https://github.com/open-telemetry/semantic-conventions/blob/v1.23.1/docs/resource/host.md).

**Link to tracking Issue:** Fixes open-telemetry#29587 and therefore fixes open-telemetry#22045

**Testing:** 

Unit tests; manually Tested on my laptop with the following
configuration:

```
receivers:
  hostmetrics:
    collection_interval: 10s
    scrapers:
      load:

processors:
  resourcedetection:
    detectors: ["system"]
    system:
      resource_attributes:
        host.mac:
          enabled: true

exporters:
  debug:
    verbosity: detailed

service:
  pipelines:
    metrics:
      receivers: [hostmetrics]
      processors: [resourcedetection]
      exporters: [debug]
```

---------

Co-authored-by: Curtis Robert <crobert@splunk.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants