Skip to content

Commit

Permalink
[service/telemetry] Deprecate telemetry.Settings in favor of telemetr…
Browse files Browse the repository at this point in the history
…y.CreateSettings
  • Loading branch information
mx-psi committed Jan 26, 2024
1 parent 9082cb1 commit 6005f4a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
25 changes: 25 additions & 0 deletions .chloggen/mx-psi_createsettings.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: service/telemetry

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Deprecate `telemetry.Settings` in favor of `telemetry.CreateSettings`

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

# (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]
2 changes: 1 addition & 1 deletion service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func New(ctx context.Context, set Settings, cfg Config) (*Service, error) {
collectorConf: set.CollectorConf,
}
var err error
srv.telemetry, err = telemetry.New(ctx, telemetry.Settings{ZapOptions: set.LoggingOptions}, cfg.Telemetry)
srv.telemetry, err = telemetry.New(ctx, telemetry.CreateSettings{ZapOptions: set.LoggingOptions}, cfg.Telemetry)
if err != nil {
return nil, fmt.Errorf("failed to get logger: %w", err)
}
Expand Down
8 changes: 6 additions & 2 deletions service/telemetry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ func (t *Telemetry) Shutdown(ctx context.Context) error {
}

// Settings holds configuration for building Telemetry.
type Settings struct {
// Deprecated [v0.94.0]: Use CreateSettings instead.
type Settings = CreateSettings

// CreateSettings holds configuration for building Telemetry.
type CreateSettings struct {
ZapOptions []zap.Option
}

// New creates a new Telemetry from Config.
func New(_ context.Context, set Settings, cfg Config) (*Telemetry, error) {
func New(_ context.Context, set CreateSettings, cfg Config) (*Telemetry, error) {
logger, err := newLogger(cfg.Logs, set.ZapOptions)
if err != nil {
return nil, err
Expand Down

0 comments on commit 6005f4a

Please sign in to comment.