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

[cmd/mdatagen] Add parent field to metadata.yaml file for subcomponents #23636

Merged
merged 9 commits into from
Jun 26, 2023
20 changes: 20 additions & 0 deletions .chloggen/add-parent-field-metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use this changelog template to create an entry for release notes.
# If your change doesn't affect end users, such as a test fix or a tooling change,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: mdatagen

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Adds a parent field to metadata.yaml for subcomponents.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [23636]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
2 changes: 2 additions & 0 deletions cmd/mdatagen/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ func (attr *attribute) Unmarshal(parser *confmap.Conf) error {
type metadata struct {
// Type of the component.
Type string `mapstructure:"type"`
// Type of the parent component (applicable to subcomponents).
Parent string `mapstructure:"parent"`
// Status information for the component.
Status *Status `mapstructure:"status"`
// SemConvVersion is a version number of OpenTelemetry semantic conventions applied to the scraped metrics.
Expand Down
8 changes: 8 additions & 0 deletions cmd/mdatagen/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ func Test_loadMetadata(t *testing.T) {
ScopeName: "otelcol",
},
},
{
name: "testdata/parent.yaml",
want: metadata{
Type: "subcomponent",
Parent: "parentComponent",
ScopeName: "otelcol",
},
},
{
name: "testdata/unknown_metric_attribute.yaml",
want: metadata{},
Expand Down
3 changes: 3 additions & 0 deletions cmd/mdatagen/metadata-schema.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Required: The type of the component - Usually the name. The type and class combined uniquely identify the component (eg. receiver/otlp) or subcomponent (eg. receiver/hostmetricsreceiver/cpu)
type:

# Required for subcomponents: The type of the parent component.
parent: string

# Required for components (Optional for subcomponents): A high-level view of the development status and use of this component
status:
# Required: The class of the component (For example receiver)
Expand Down
5 changes: 5 additions & 0 deletions cmd/mdatagen/templates/documentation.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@

# {{ .Type }}

{{- if .Parent }}

**Parent Component:** {{ .Parent }}
{{- end }}

## Default Metrics

The following metrics are emitted by default. Each of them can be disabled by applying the following configuration:
Expand Down
3 changes: 3 additions & 0 deletions cmd/mdatagen/testdata/parent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type: subcomponent

parent: parentComponent
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: resourcedetectionprocessor/ec2

parent: resourcedetection

resource_attributes:
host.name:
description: The hostname
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: resourcedetectionprocessor/ecs

parent: resourcedetection

resource_attributes:
cloud.provider:
description: The cloud.provider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: resourcedetectionprocessor/eks

parent: resourcedetection

resource_attributes:
cloud.provider:
description: The cloud.provider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: resourcedetectionprocessor/elastic_beanstalk

parent: resourcedetection

resource_attributes:
cloud.provider:
description: The cloud.provider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: resourcedetectionprocessor/lambda

parent: resourcedetection

resource_attributes:
cloud.provider:
description: The cloud.provider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: resourcedetectionprocessor/aks

parent: resourcedetection

resource_attributes:
cloud.provider:
description: The cloud.provider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: resourcedetectionprocessor/azure

parent: resourcedetection

resource_attributes:
cloud.provider:
description: The cloud.provider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: resourcedetectionprocessor/consul

parent: resourcedetection

resource_attributes:
cloud.provider:
description: The cloud.provider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: resourcedetectionprocessor/docker

parent: resourcedetection

resource_attributes:
host.name:
description: The host.name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: resourcedetectionprocessor/gcp

parent: resourcedetection

resource_attributes:
host.name:
description: The host.name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: resourcedetectionprocessor/heroku

parent: resourcedetection

resource_attributes:
cloud.provider:
description: The cloud.provider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: resourcedetectionprocessor/openshift

parent: resourcedetection

resource_attributes:
cloud.provider:
description: The cloud.provider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: resourcedetectionprocessor/system

parent: resourcedetection

resource_attributes:
host.name:
description: The host.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# hostmetricsreceiver/cpu

**Parent Component:** hostmetrics

## Default Metrics

The following metrics are emitted by default. Each of them can be disabled by applying the following configuration:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: hostmetricsreceiver/cpu

parent: hostmetrics

sem_conv_version: 1.9.0

attributes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# hostmetricsreceiver/disk

**Parent Component:** hostmetrics

## Default Metrics

The following metrics are emitted by default. Each of them can be disabled by applying the following configuration:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: hostmetricsreceiver/disk

parent: hostmetrics

sem_conv_version: 1.9.0

attributes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# hostmetricsreceiver/filesystem

**Parent Component:** hostmetrics

## Default Metrics

The following metrics are emitted by default. Each of them can be disabled by applying the following configuration:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: hostmetricsreceiver/filesystem

parent: hostmetrics

sem_conv_version: 1.9.0

attributes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# hostmetricsreceiver/load

**Parent Component:** hostmetrics

## Default Metrics

The following metrics are emitted by default. Each of them can be disabled by applying the following configuration:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: hostmetricsreceiver/load

parent: hostmetrics

sem_conv_version: 1.9.0

metrics:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# hostmetricsreceiver/memory

**Parent Component:** hostmetrics

## Default Metrics

The following metrics are emitted by default. Each of them can be disabled by applying the following configuration:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: hostmetricsreceiver/memory

parent: hostmetrics

sem_conv_version: 1.9.0

attributes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# hostmetricsreceiver/network

**Parent Component:** hostmetrics

## Default Metrics

The following metrics are emitted by default. Each of them can be disabled by applying the following configuration:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: hostmetricsreceiver/network

parent: hostmetrics

sem_conv_version: 1.9.0

attributes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# hostmetricsreceiver/paging

**Parent Component:** hostmetrics

## Default Metrics

The following metrics are emitted by default. Each of them can be disabled by applying the following configuration:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: hostmetricsreceiver/paging

parent: hostmetrics

sem_conv_version: 1.9.0

attributes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# hostmetricsreceiver/processes

**Parent Component:** hostmetrics

## Default Metrics

The following metrics are emitted by default. Each of them can be disabled by applying the following configuration:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: hostmetricsreceiver/processes

parent: hostmetrics

sem_conv_version: 1.9.0

attributes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# hostmetricsreceiver/process

**Parent Component:** hostmetrics

## Default Metrics

The following metrics are emitted by default. Each of them can be disabled by applying the following configuration:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: hostmetricsreceiver/process

parent: hostmetrics

sem_conv_version: 1.9.0

resource_attributes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# k8s/deployment

**Parent Component:** k8s_cluster

## Default Metrics

The following metrics are emitted by default. Each of them can be disabled by applying the following configuration:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: k8s/deployment

parent: k8s_cluster

sem_conv_version: 1.18.0

resource_attributes:
Expand Down
2 changes: 2 additions & 0 deletions receiver/k8sclusterreceiver/internal/hpa/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# k8s/hpa

**Parent Component:** k8s_cluster

## Default Metrics

The following metrics are emitted by default. Each of them can be disabled by applying the following configuration:
Expand Down
2 changes: 2 additions & 0 deletions receiver/k8sclusterreceiver/internal/hpa/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: k8s/hpa

parent: k8s_cluster

sem_conv_version: 1.9.0

resource_attributes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# k8s/namespace

**Parent Component:** k8s_cluster

## Default Metrics

The following metrics are emitted by default. Each of them can be disabled by applying the following configuration:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: k8s/namespace

parent: k8s_cluster

sem_conv_version: 1.18.0

resource_attributes:
Expand Down
2 changes: 2 additions & 0 deletions receiver/k8sclusterreceiver/internal/node/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# k8s/node

**Parent Component:** k8s_cluster

## Default Metrics

The following metrics are emitted by default. Each of them can be disabled by applying the following configuration:
Expand Down
2 changes: 2 additions & 0 deletions receiver/k8sclusterreceiver/internal/node/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: k8s/node

parent: k8s_cluster

sem_conv_version: 1.18.0

resource_attributes:
Expand Down
Loading