Skip to content

Commit

Permalink
Deprecate unnecessary type StatusFunc (#9146)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu authored Dec 19, 2023
1 parent 58744cd commit e0e6a26
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
20 changes: 20 additions & 0 deletions .chloggen/depstatusfunc.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.

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

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

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

# 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]
4 changes: 2 additions & 2 deletions component/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ func NewFatalErrorEvent(err error) *StatusEvent {
return ev
}

// StatusFunc is the expected type of ReportComponentStatus for component.TelemetrySettings
type StatusFunc func(*StatusEvent) error
// Deprecated: [v0.92.0] use directly func(*StatusEvent) error.
type StatusFunc = func(*StatusEvent) error

// AggregateStatus will derive a status for the given input using the following rules in order:
// 1. If all instances have the same status, there is nothing to aggregate, return it.
Expand Down
2 changes: 1 addition & 1 deletion component/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ type TelemetrySettings struct {
// - Calling this method before component startup
//
// If the API is being used properly, these errors are safe to ignore.
ReportComponentStatus StatusFunc
ReportComponentStatus func(*StatusEvent) error
}
2 changes: 1 addition & 1 deletion service/internal/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (r *Reporter) componentFSM(id *component.InstanceID) *fsm {
func NewComponentStatusFunc(
id *component.InstanceID,
srvStatus ServiceStatusFunc,
) component.StatusFunc {
) func(*component.StatusEvent) error {
return func(ev *component.StatusEvent) error {
return srvStatus(id, ev)
}
Expand Down

0 comments on commit e0e6a26

Please sign in to comment.