Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into confighttp-omitempty
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-bradley committed Feb 26, 2025
2 parents 7f66209 + 216046a commit 96903c4
Show file tree
Hide file tree
Showing 102 changed files with 1,415 additions and 594 deletions.
25 changes: 25 additions & 0 deletions .chloggen/add-confmap-to-mdatagen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# 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. otlpreceiver)
component: mdatagen

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add `converter` and `provider` module classes

# One or more tracking issues or pull requests related to the change
issues: [12467]

# (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:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
25 changes: 25 additions & 0 deletions .chloggen/configauth-omitempty.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# 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. otlpreceiver)
component: configauth

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add the `omitempty` mapstructure tag to struct fields

# One or more tracking issues or pull requests related to the change
issues: [12191]

# (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: This results in unset fields not being rendered when marshaling.

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
25 changes: 25 additions & 0 deletions .chloggen/finishsize.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

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

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Deprecate `min_size_items` and `max_size_items` in favor of `min_size` and `max_size`.

# One or more tracking issues or pull requests related to the change
issues: [12486]

# (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:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
25 changes: 25 additions & 0 deletions .chloggen/finishsize_breaking.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

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

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Update MergeSplit function signature to use the new SizeConfig

# One or more tracking issues or pull requests related to the change
issues: [12486]

# (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:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
25 changes: 25 additions & 0 deletions .chloggen/finishsize_deprecation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

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

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Deprecate MinSizeConfig and MaxSizeItems.

# One or more tracking issues or pull requests related to the change
issues: [12486]

# (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:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
25 changes: 25 additions & 0 deletions .chloggen/jackgopack4-add-converters-component-command.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# 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. otlpreceiver)
component: otelcol

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Converters are now available in the `components` command.

# One or more tracking issues or pull requests related to the change
issues: [11900, 12385]

# (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:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user, api]
25 changes: 25 additions & 0 deletions .chloggen/mx-psi_extensionauth.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

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

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: extension/auth, extension/auth/authtest

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Deprecate extension/auth and the related test module in favor of extension/extensionauth

# One or more tracking issues or pull requests related to the change
issues: [12478]

# (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:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
25 changes: 25 additions & 0 deletions .chloggen/pprofile-sample-link-index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# 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. otlpreceiver)
component: pprofile

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add LinkIndex attribute to the generated Sample type

# One or more tracking issues or pull requests related to the change
issues: [12485]

# (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:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
1 change: 0 additions & 1 deletion .github/workflows/contrib-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
- internal
- pkg
- cmd-0
- cmd-1
- other
steps:
- name: Checkout Repo
Expand Down
4 changes: 2 additions & 2 deletions cmd/builder/internal/builder/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ var replaceModules = []string{
"/exporter/otlpexporter",
"/exporter/otlphttpexporter",
"/extension",
"/extension/auth",
"/extension/auth/authtest",
"/extension/extensionauth",
"/extension/extensionauth/extensionauthtest",
"/extension/extensioncapabilities",
"/extension/extensiontest",
"/extension/zpagesextension",
Expand Down
7 changes: 6 additions & 1 deletion cmd/builder/internal/builder/templates/main.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ func main() {
{{- range .ConfmapProviders}}
{{.Name}}.NewFactory().Create(confmap.ProviderSettings{}).Scheme(): "{{.GoMod}}",
{{- end}}
},
}, ConverterModules: []string{
{{- range .ConfmapConverters}}
"{{.GoMod}}",
{{- end}}
},

}

if err := run(set); err != nil {
Expand Down
10 changes: 9 additions & 1 deletion cmd/mdatagen/internal/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"path/filepath"
"regexp"
"runtime/debug"
"slices"
"strings"
"text/template"

Expand All @@ -26,6 +27,13 @@ const (
statusEnd = "<!-- end autogenerated section -->"
)

var nonComponents = []string{
"cmd",
"converter",
"pkg",
"provider",
}

func getVersion() (string, error) {
// the second returned value is a boolean, which is true if the binaries are built with module support.
info, ok := debug.ReadBuildInfo()
Expand Down Expand Up @@ -78,7 +86,7 @@ func run(ymlPath string) error {
codeDir := filepath.Join(ymlDir, "internal", md.GeneratedPackageName)
toGenerate := map[string]string{}
if md.Status != nil {
if md.Status.Class != "cmd" && md.Status.Class != "pkg" {
if !slices.Contains(nonComponents, md.Status.Class) {
toGenerate[filepath.Join(tmplDir, "status.go.tmpl")] = filepath.Join(codeDir, "generated_status.go")
if err = generateFile(filepath.Join(tmplDir, "component_test.go.tmpl"),
filepath.Join(ymlDir, "generated_component_test.go"), md, packageName); err != nil {
Expand Down
26 changes: 26 additions & 0 deletions cmd/mdatagen/internal/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,32 @@ Some info about a component
componentClass: "extension",
distros: []string{"contrib"},
},
{
name: "readme with status for converter",
markdown: `# Some component
<!-- status autogenerated section -->
<!-- end autogenerated section -->
Some info about a component
`,
outputFile: "readme_with_status_converter.md",
componentClass: "converter",
distros: []string{"contrib"},
},
{
name: "readme with status for provider",
markdown: `# Some component
<!-- status autogenerated section -->
<!-- end autogenerated section -->
Some info about a component
`,
outputFile: "readme_with_status_provider.md",
componentClass: "provider",
distros: []string{"contrib"},
},
{
name: "readme with status with codeowners and seeking new",
markdown: `# Some component
Expand Down
67 changes: 42 additions & 25 deletions cmd/mdatagen/internal/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package internal // import "go.opentelemetry.io/collector/cmd/mdatagen/internal"
import (
"errors"
"fmt"
"slices"
"sort"

"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -48,6 +49,45 @@ type Status struct {
UnsupportedPlatforms []string `mapstructure:"unsupported_platforms"`
}

var validClasses = []string{
"cmd",
"connector",
"converter",
"exporter",
"extension",
"pkg",
"processor",
"provider",
"receiver",
"scraper",
}

var validStabilityKeys = []string{
"converter",
"extension",
"logs",
"logs_to_traces",
"logs_to_metrics",
"logs_to_logs",
"logs_to_profiles",
"metrics",
"metrics_to_traces",
"metrics_to_metrics",
"metrics_to_logs",
"metrics_to_profiles",
"profiles",
"profiles_to_profiles",
"profiles_to_traces",
"profiles_to_metrics",
"profiles_to_logs",
"provider",
"traces_to_traces",
"traces_to_metrics",
"traces_to_logs",
"traces_to_profiles",
"traces",
}

func (s *Status) SortedDistributions() []string {
sorted := s.Distributions
sort.Slice(sorted, func(i, j int) bool {
Expand Down Expand Up @@ -87,10 +127,7 @@ func (s *Status) validateClass() error {
if s.Class == "" {
return errors.New("missing class")
}
if s.Class != "receiver" && s.Class != "processor" &&
s.Class != "exporter" && s.Class != "connector" &&
s.Class != "extension" && s.Class != "scraper" &&
s.Class != "cmd" && s.Class != "pkg" {
if !slices.Contains(validClasses, s.Class) {
return fmt.Errorf("invalid class: %v", s.Class)
}
return nil
Expand All @@ -108,27 +145,7 @@ func (ms StabilityMap) Validate() error {
errs = errors.Join(errs, fmt.Errorf("missing component for stability: %v", stability))
}
for _, c := range cmps {
if c != "metrics" &&
c != "traces" &&
c != "logs" &&
c != "profiles" &&
c != "traces_to_traces" &&
c != "traces_to_metrics" &&
c != "traces_to_logs" &&
c != "traces_to_profiles" &&
c != "metrics_to_traces" &&
c != "metrics_to_metrics" &&
c != "metrics_to_logs" &&
c != "metrics_to_profiles" &&
c != "logs_to_traces" &&
c != "logs_to_metrics" &&
c != "logs_to_logs" &&
c != "logs_to_profiles" &&
c != "profiles_to_profiles" &&
c != "profiles_to_traces" &&
c != "profiles_to_metrics" &&
c != "profiles_to_logs" &&
c != "extension" {
if !slices.Contains(validStabilityKeys, c) {
errs = errors.Join(errs, fmt.Errorf("invalid component: %v", c))
}
}
Expand Down
Loading

0 comments on commit 96903c4

Please sign in to comment.