Skip to content

Commit

Permalink
[mdatagen] add unsupported_platforms support and enable several com…
Browse files Browse the repository at this point in the history
…ponents (#30640)

**Description:**
Add `supported_platforms` to enable components to describe which
platforms are supported, meanwhile this configuration can also be used
to generate the liftcycle test to skip windows when the component does
not support windows.

**Link to tracking Issue:** fix #30561

---------

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>
  • Loading branch information
fatsheep9146 and dmitryax authored Jan 20, 2024
1 parent 38c5be1 commit ff3023c
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions cmd/mdatagen/metadata-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ status:
codeowners:
active: [string]
emeritus: [string]
unsupported_platforms: [<linux|windows>]

# Optional: OTel Semantic Conventions version that will be associated with the scraped metrics.
# This attribute should be set for metrics compliant with OTel Semantic Conventions.
Expand Down
11 changes: 6 additions & 5 deletions cmd/mdatagen/statusdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ type Codeowners struct {
}

type Status struct {
Stability map[string][]string `mapstructure:"stability"`
Distributions []string `mapstructure:"distributions"`
Class string `mapstructure:"class"`
Warnings []string `mapstructure:"warnings"`
Codeowners *Codeowners `mapstructure:"codeowners"`
Stability map[string][]string `mapstructure:"stability"`
Distributions []string `mapstructure:"distributions"`
Class string `mapstructure:"class"`
Warnings []string `mapstructure:"warnings"`
Codeowners *Codeowners `mapstructure:"codeowners"`
UnsupportedPlatforms []string `mapstructure:"unsupported_platforms"`
}

func (s *Status) SortedDistributions() []string {
Expand Down
4 changes: 4 additions & 0 deletions cmd/mdatagen/templates/component_test.go.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// Code generated by mdatagen. DO NOT EDIT.

{{ if len .Status.UnsupportedPlatforms -}}
//go:build {{ range $i, $v := .Status.UnsupportedPlatforms }}{{ if $i }} && {{ end }}!{{ . }}{{ end }}
{{- end }}

package {{ .Package }}

import (
Expand Down
2 changes: 2 additions & 0 deletions receiver/podmanreceiver/generated_component_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions receiver/podmanreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ status:
distributions: [contrib, observiq, sumo]
codeowners:
active: [rogercoll]
unsupported_platforms: [windows]

tests:
config:
Expand Down
2 changes: 2 additions & 0 deletions receiver/sshcheckreceiver/generated_component_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions receiver/sshcheckreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ status:
distributions: [contrib, sumo]
codeowners:
active: [nslaughter, codeboten]
unsupported_platforms: [windows]

resource_attributes:
ssh.endpoint:
Expand Down

0 comments on commit ff3023c

Please sign in to comment.