Skip to content

Commit

Permalink
Move code in service to follow a consistent structure (open-telemetry…
Browse files Browse the repository at this point in the history
…#2673)

Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu authored Mar 11, 2021
1 parent 7724634 commit 2688af9
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ const (
Closed
)

// GetStateChannel returns state channel of the application.
func (app *Application) GetStateChannel() chan State {
return app.stateChannel
}

// Application represents a collector application
type Application struct {
info component.ApplicationStartInfo
Expand All @@ -91,11 +86,6 @@ type Application struct {
asyncErrorChannel chan error
}

// Command returns Application's root command.
func (app *Application) Command() *cobra.Command {
return app.rootCmd
}

// Parameters holds configuration for creating a new Application.
type Parameters struct {
// Factories component factories.
Expand Down Expand Up @@ -190,11 +180,14 @@ func New(params Parameters) (*Application, error) {
return app, nil
}

// ReportFatalError is used to report to the host that the receiver encountered
// a fatal error (i.e.: an error that the instance can't recover from) after
// its start function has already returned.
func (app *Application) ReportFatalError(err error) {
app.asyncErrorChannel <- err
// GetStateChannel returns state channel of the application.
func (app *Application) GetStateChannel() chan State {
return app.stateChannel
}

// Command returns Application's root command.
func (app *Application) Command() *cobra.Command {
return app.rootCmd
}

// GetLogger returns logger used by the Application.
Expand All @@ -203,6 +196,13 @@ func (app *Application) GetLogger() *zap.Logger {
return app.logger
}

// ReportFatalError is used to report to the host that the receiver encountered
// a fatal error (i.e.: an error that the instance can't recover from) after
// its start function has already returned.
func (app *Application) ReportFatalError(err error) {
app.asyncErrorChannel <- err
}

func (app *Application) GetFactory(kind component.Kind, componentType configmodels.Type) component.Factory {
switch kind {
case component.KindReceiver:
Expand Down

0 comments on commit 2688af9

Please sign in to comment.