Skip to content

Commit 41cf216

Browse files
Fix linter issues:
- Fix import orders - Rename stutter structs Signed-off-by: Patryk Matyjasek <[email protected]>
1 parent 22bcedc commit 41cf216

12 files changed

+25
-24
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- Remove `tracetranslator.TagHTTPStatusCode`, use `conventions.AttributeHTTPStatusCode` (#3111)
1111
- Remove OpenCensus status constants and transformation (#3110)
1212
- Remove `tracetranslator.AttributeArrayToSlice`, not used in core or contrib (#3109)
13-
- Introduce `ServiceSettings` and `ApplicationSettings` instead of `Parameters` (#3163)
13+
- Introduce `SvcSettings` and `AppSettings` instead of `Parameters` (#3163)
1414

1515
## v0.26.0 Beta
1616

cmd/otelcol/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ func main() {
4141
Factories: factories,
4242
}
4343

44-
if err := run(service.ApplicationSettings{CommonSettings: commonSettings}); err != nil {
44+
if err := run(service.AppSettings{CommonSettings: commonSettings}); err != nil {
4545
log.Fatal(err)
4646
}
4747
}
4848

49-
func runInteractive(settings service.ApplicationSettings) error {
49+
func runInteractive(settings service.AppSettings) error {
5050
app, err := service.New(settings)
5151
if err != nil {
5252
return fmt.Errorf("failed to construct the application: %w", err)

cmd/otelcol/main_others.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ package main
1818

1919
import "go.opentelemetry.io/collector/service"
2020

21-
func run(settings service.ApplicationSettings) error {
21+
func run(settings service.AppSettings) error {
2222
return runInteractive(settings)
2323
}

cmd/otelcol/main_windows.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"go.opentelemetry.io/collector/service"
2626
)
2727

28-
func run(set service.ApplicationSettings) error {
28+
func run(set service.AppSettings) error {
2929
if useInteractiveMode, err := checkUseInteractiveMode(); err != nil {
3030
return err
3131
} else if useInteractiveMode {
@@ -51,7 +51,7 @@ func checkUseInteractiveMode() (bool, error) {
5151
}
5252
}
5353

54-
func runService(set service.ApplicationSettings) error {
54+
func runService(set service.AppSettings) error {
5555
// do not need to supply service name when startup is invoked through Service Control Manager directly
5656
if err := svc.Run("", service.NewWindowsService(set)); err != nil {
5757
return fmt.Errorf("failed to start service %w", err)

component/component.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ type Component interface {
6161
Shutdown(ctx context.Context) error
6262
}
6363

64-
// ComponentSettings is passed to ReceiverFactory.Create* functions.
65-
type ComponentSettings struct {
64+
// Settings is passed to ReceiverFactory.Create* functions.
65+
type Settings struct {
6666
// Logger that the factory can use during creation and can pass to the created
6767
// component to be used later as well.
6868
Logger *zap.Logger

service/application.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ type Application struct {
8080
}
8181

8282
// New creates and returns a new instance of Application.
83-
func New(set ApplicationSettings) (*Application, error) {
83+
func New(set AppSettings) (*Application, error) {
8484
if err := configcheck.ValidateConfigFromFactories(set.CommonSettings.Factories); err != nil {
8585
return nil, err
8686
}
@@ -229,7 +229,7 @@ func (app *Application) setupConfigurationComponents(ctx context.Context) error
229229
Factories: app.factories,
230230
}
231231

232-
service, err := newService(&ServiceSettings{
232+
service, err := newService(&SvcSettings{
233233
CommonSettings: commonSettings,
234234
Config: cfg,
235235
Logger: app.logger,

service/application_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func TestApplication_Start(t *testing.T) {
5656
Factories: factories,
5757
}
5858

59-
app, err := New(ApplicationSettings{CommonSettings: commonSettings, LoggingOptions: []zap.Option{zap.Hooks(hook)}})
59+
app, err := New(AppSettings{CommonSettings: commonSettings, LoggingOptions: []zap.Option{zap.Hooks(hook)}})
6060
require.NoError(t, err)
6161
assert.Equal(t, app.rootCmd, app.Command())
6262

@@ -129,7 +129,7 @@ func TestApplication_ReportError(t *testing.T) {
129129
Factories: factories,
130130
}
131131

132-
app, err := New(ApplicationSettings{CommonSettings: commonSettings})
132+
app, err := New(AppSettings{CommonSettings: commonSettings})
133133
require.NoError(t, err)
134134

135135
app.rootCmd.SetArgs([]string{"--config=testdata/otelcol-config-minimal.yaml"})
@@ -157,7 +157,7 @@ func TestApplication_StartAsGoRoutine(t *testing.T) {
157157
Factories: factories,
158158
}
159159

160-
params := ApplicationSettings{
160+
params := AppSettings{
161161
CommonSettings: commonSettings,
162162
ParserProvider: new(minimalParserLoader),
163163
}

service/application_windows.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ import (
2727
)
2828

2929
type WindowsService struct {
30-
settings ApplicationSettings
30+
settings AppSettings
3131
app *Application
3232
}
3333

34-
func NewWindowsService(set ApplicationSettings) *WindowsService {
34+
func NewWindowsService(set AppSettings) *WindowsService {
3535
return &WindowsService{settings: set}
3636
}
3737

@@ -120,7 +120,7 @@ func openEventLog(serviceName string) (*eventlog.Log, error) {
120120
return elog, nil
121121
}
122122

123-
func newWithEventViewerLoggingHook(set ApplicationSettings, elog *eventlog.Log) (*Application, error) {
123+
func newWithEventViewerLoggingHook(set AppSettings, elog *eventlog.Log) (*Application, error) {
124124
set.LoggingOptions = append(
125125
set.LoggingOptions,
126126
zap.Hooks(func(entry zapcore.Entry) error {

service/service.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type service struct {
4040
builtExtensions builder.Extensions
4141
}
4242

43-
func newService(set *ServiceSettings) (*service, error) {
43+
func newService(set *SvcSettings) (*service, error) {
4444
srv := &service{
4545
factories: set.CommonSettings.Factories,
4646
buildInfo: set.CommonSettings.BuildInfo,

service/service_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func createExampleService(t *testing.T) *service {
108108
Factories: factories,
109109
}
110110

111-
srv, err := newService(&ServiceSettings{
111+
srv, err := newService(&SvcSettings{
112112
CommonSettings: commonSettings,
113113
Logger: zap.NewNop(),
114114
Config: cfg,

service/settings.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
package service
1616

1717
import (
18+
"go.uber.org/zap"
19+
1820
"go.opentelemetry.io/collector/component"
1921
"go.opentelemetry.io/collector/config"
2022
"go.opentelemetry.io/collector/service/parserprovider"
21-
"go.uber.org/zap"
2223
)
2324

2425
// CommonSettings holds common settings for Service and Application
@@ -30,8 +31,8 @@ type CommonSettings struct {
3031
BuildInfo component.BuildInfo
3132
}
3233

33-
// ServiceSettings holds configuration for building a new service.
34-
type ServiceSettings struct {
34+
// SvcSettings holds configuration for building a new service.
35+
type SvcSettings struct {
3536
// CommonSettings contains Factories and BuildInfo
3637
CommonSettings CommonSettings
3738

@@ -45,8 +46,8 @@ type ServiceSettings struct {
4546
AsyncErrorChannel chan error
4647
}
4748

48-
// ApplicationSettings holds configuration for creating a new Application.
49-
type ApplicationSettings struct {
49+
// AppSettings holds configuration for creating a new Application.
50+
type AppSettings struct {
5051
// CommonSettings contains Factories and BuildInfo
5152
CommonSettings CommonSettings
5253

testbed/testbed/otelcol_runner.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func (ipp *InProcessCollector) Start(args StartParams) error {
9191
},
9292
Factories: ipp.factories,
9393
}
94-
settings := service.ApplicationSettings{
94+
settings := service.AppSettings{
9595
CommonSettings: commonSettings,
9696
ParserProvider: parserprovider.NewInMemory(strings.NewReader(ipp.configStr)),
9797
}

0 commit comments

Comments
 (0)