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

[DRAFT] [DO NOT MERGE] Entities support prototype #35538

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dmitryax
Copy link
Member

@dmitryax dmitryax commented Oct 2, 2024

Built on top of tigrannajaryan#1 with updated proto definition allowing one resource to have several entities.

Changes:

  • Most of the changes are files generated by the updated mdatagen tool in [DRAFT] [DO NOT MERGE] Entities support prototype opentelemetry-collector#11282. The affected components supporting entity references are host receiver and resource detection processor. Only their metadata.yaml was updated, with no manual changes to the code. The entity references are added in the generated code.
  • k8scluster receiver was updated to deal with pdata entities instead of the experimental log-based entities package, but it still produces logs.

TODO:

  • Update host metrics receiver and k8scluster receiver to produce entities instead of logs.

Result

Using the following collector configuration

receivers:
  hostmetrics:
    collection_interval: 10s
    scrapers:
      cpu:
exporters:
  debug:
    verbosity: detailed
processors:
  resourcedetection:
    detectors:
      - system
    system:
      resource_attributes:
        host.id:
          enabled: true
        os.description:
          enabled: true
        host.arch:
          enabled: true
        host.ip:
          enabled: true
        host.mac:
          enabled: true
        host.cpu.vendor.id:
          enabled: true
        host.cpu.family:
          enabled: true
        host.cpu.model.id:
          enabled: true
        host.cpu.model.name:
          enabled: true
        host.cpu.stepping:
          enabled: true
        host.cpu.cache.l2.size:
          enabled: true
service:
  pipelines:
    metrics:
      receivers:
        - hostmetrics
      processors:
        - resourcedetection
      exporters:
        - debug

The output of the debug processor now includes the entity references that are added by the resource detection processor (note that all optional resource attributes had to be enabled in the collector configuration):

2024-10-02T22:39:05.392-0700	info	MetricsExporter	{"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 40}
2024-10-02T22:39:05.397-0700	info	ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
Resource attributes:
     -> host.name: Str(L0DW3V3F09)
     -> os.type: Str(darwin)
     -> host.id: Str(2EBC3D9B-BE17-542F-A036-79911CE23546)
     -> host.arch: Str(arm64)
     -> host.ip: Slice(["fe80::bcd0:74ff:fe68:60c1","fe80::b0:2b6d:f5df:f14d","2601:646:8300:4190::759","10.0.0.243","2601:646:8300:4190:104f:9fa2:4200:5eeb","2601:646:8300:4190:8da7:5aaf:2870:1a63","fe80::b40b:24ff:fefa:9e06","fe80::b40b:24ff:fefa:9e06","fe80::f01b:5675:d928:dc64","fe80::8635:9275:ab7a:d1fc","fe80::d241:fd05:a2b:b2b0","fe80::ce81:b1c:bd2c:69e","fe80::e6aa:1f5d:6347:2421","fe80::c44a:6ada:683:740e","fe80::de58:23c2:280f:9f23","fe80::2dd5:ef28:90f2:e9aa"])
     -> host.mac: Slice(["22-91-2B-27-19-37","22-91-2B-27-19-38","22-91-2B-27-19-39","22-91-2B-27-19-17","22-91-2B-27-19-18","22-91-2B-27-19-19","36-04-2B-F6-B4-80","36-04-2B-F6-B4-84","36-04-2B-F6-B4-88","36-04-2B-F6-B4-80","BE-D0-74-68-60-C1","BC-D0-74-68-60-C1","B6-0B-24-FA-9E-06","B6-0B-24-FA-9E-06","","","","","","","","",""])
     -> os.description: Str(macOS 14.6.1 (23G93) (Darwin L0DW3V3F09 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 arm64))
     -> host.cpu.vendor.id: Str()
     -> host.cpu.family: Str(0)
     -> host.cpu.model.id: Str(0)
     -> host.cpu.model.name: Str(Apple M1 Max)
     -> host.cpu.stepping: Str(0)
     -> host.cpu.cache.l2.size: Int(0)
Entities:
Entity Ref #0
     -> Entity Type: host
     -> SchemaURL:
     -> Identifying Attributes: host.id
     -> Descriptive Attributes: host.name, os.type, host.arch, host.ip, host.mac, host.cpu.vendor.id, host.cpu.family, host.cpu.model.id, host.cpu.model.name, host.cpu.stepping, host.cpu.cache.l2.size

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.

2 participants