Skip to content

Commit

Permalink
Disallow class and stability for non-components packages
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu committed Oct 23, 2024
1 parent b30b542 commit b8decc2
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 81 deletions.
25 changes: 25 additions & 0 deletions .chloggen/rm-usage-of-stability-class.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: mdatagen

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Disallow class and stability for non-components packages

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

# (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]
12 changes: 11 additions & 1 deletion cmd/mdatagen/internal/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,20 @@ func (md *Metadata) validateStatus() error {
return nil
}

var errs error
if md.Status == nil {
return errors.New("missing status")
}

var errs error
if md.Status.NotComponent {
if md.Status.Class != "" {
errs = errors.Join(errs, errors.New("class should not be configured for non-components"))
}
if len(md.Status.Stability) != 0 {
errs = errors.Join(errs, errors.New("stability should not be configured for non-components"))
}
return errs
}
if err := md.Status.validateClass(); err != nil {
errs = errors.Join(errs, err)
}
Expand Down
17 changes: 0 additions & 17 deletions exporter/exporterhelper/generated_component_telemetry_test.go

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

3 changes: 0 additions & 3 deletions exporter/exporterhelper/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ type: exporterhelper
github_project: open-telemetry/opentelemetry-collector

status:
class: exporter
not_component: true
stability:
beta: [traces, metrics, logs]

telemetry:
metrics:
Expand Down
17 changes: 0 additions & 17 deletions processor/processorhelper/generated_component_telemetry_test.go

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

3 changes: 0 additions & 3 deletions processor/processorhelper/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
type: processorhelper

status:
class: processor
not_component: true
stability:
beta: [traces, metrics, logs]

telemetry:
metrics:
Expand Down
17 changes: 0 additions & 17 deletions receiver/receiverhelper/generated_component_telemetry_test.go

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

3 changes: 0 additions & 3 deletions receiver/receiverhelper/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ type: receiverhelper
github_project: open-telemetry/opentelemetry-collector

status:
class: receiver
not_component: true
stability:
beta: [traces, metrics, logs]

telemetry:
metrics:
Expand Down
17 changes: 0 additions & 17 deletions receiver/scraperhelper/generated_component_telemetry_test.go

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

3 changes: 0 additions & 3 deletions receiver/scraperhelper/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ type: scraperhelper
github_project: open-telemetry/opentelemetry-collector

status:
class: receiver
not_component: true
stability:
beta: [traces, metrics, logs]

telemetry:
metrics:
Expand Down

0 comments on commit b8decc2

Please sign in to comment.