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

[mdatagen] add unsupported_platforms support and enable several components #30640

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}
fatsheep9146 marked this conversation as resolved.
Show resolved Hide resolved
//go:build !({{range $i, $v := .Status.UnsupportedPlatforms}}{{if $i}} || {{end}}{{.}}{{end}})
fatsheep9146 marked this conversation as resolved.
Show resolved Hide resolved
{{- end }}

package {{ .Package }}

import (
Expand Down
2 changes: 2 additions & 0 deletions cmd/opampsupervisor/supervisor/supervisor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package supervisor

import (
"bytes"
"os"
"sync/atomic"
"testing"
Expand Down Expand Up @@ -52,6 +53,7 @@ func Test_composeEffectiveConfig(t *testing.T) {

expectedConfig, err := os.ReadFile("../testdata/collector/effective_config.yaml")
require.NoError(t, err)
expectedConfig = bytes.ReplaceAll(expectedConfig, []byte("\r\n"), []byte("\n"))
Copy link
Contributor

Choose a reason for hiding this comment

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

can this change be made in a separate PR? it seems unrelated to the change here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#30690 is created @codeboten


require.True(t, configChanged)
require.Equal(t, string(expectedConfig), s.effectiveConfig.Load().(string))
Expand Down
1 change: 1 addition & 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
1 change: 1 addition & 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
Loading