Skip to content
This repository was archived by the owner on Nov 2, 2023. It is now read-only.

Commit 3854529

Browse files
author
Julio Guerra
committed
config: change the use_signal_backend config logic to disable_signal_backend
1 parent b99af5c commit 3854529

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

internal/agent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ func (a *AgentType) Serve() error {
343343

344344
token := a.config.BackendHTTPAPIToken()
345345
appName := a.config.AppName()
346-
appLoginRes, err := appLogin(a.ctx, a.logger, a.client, token, appName, a.appInfo, a.config.UseSignalBackend())
346+
appLoginRes, err := appLogin(a.ctx, a.logger, a.client, token, appName, a.appInfo, a.config.DisableSignalBackend())
347347
if err != nil {
348348
if xerrors.Is(err, context.Canceled) {
349349
a.logger.Debug(err)

internal/backend/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func (c *Client) Health() HealthStatus {
115115
return health
116116
}
117117

118-
func (c *Client) AppLogin(req *api.AppLoginRequest, token string, appName string, useSignalBackend bool) (*api.AppLoginResponse, error) {
118+
func (c *Client) AppLogin(req *api.AppLoginRequest, token string, appName string, disableSignalBackend bool) (*api.AppLoginResponse, error) {
119119
httpReq, err := c.newRequest(&config.BackendHTTPAPIEndpoint.AppLogin)
120120
if err != nil {
121121
return nil, err
@@ -136,7 +136,7 @@ func (c *Client) AppLogin(req *api.AppLoginRequest, token string, appName string
136136

137137
c.session = res.SessionId
138138

139-
if useSignalBackend || res.Features.UseSignals {
139+
if !disableSignalBackend && res.Features.UseSignals {
140140
c.signalClient = client.NewClient(c.client, c.session)
141141

142142
// If the default signal URL is not healthy, fallback to the general

internal/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (e LoginError) Unwrap() error {
5353

5454
// Login to the backend. When the API request fails, retry for ever and after
5555
// sleeping some time.
56-
func appLogin(ctx context.Context, logger *plog.Logger, client *backend.Client, token string, appName string, appInfo *app.Info, useSignalBackend bool) (*api.AppLoginResponse, error) {
56+
func appLogin(ctx context.Context, logger *plog.Logger, client *backend.Client, token string, appName string, appInfo *app.Info, disableSignalBackend bool) (*api.AppLoginResponse, error) {
5757
_, bundleSignature, err := appInfo.Dependencies()
5858
if err != nil {
5959
logger.Error(withNotificationError{sqerrors.Wrap(err, "could not retrieve the program dependencies")})
@@ -83,7 +83,7 @@ func appLogin(ctx context.Context, logger *plog.Logger, client *backend.Client,
8383
case <-ctx.Done():
8484
return nil, ctx.Err()
8585
default:
86-
appLoginRes, err = client.AppLogin(&appLoginReq, token, appName, useSignalBackend)
86+
appLoginRes, err = client.AppLogin(&appLoginReq, token, appName, disableSignalBackend)
8787
if err == nil && appLoginRes.Status {
8888
return appLoginRes, nil
8989
}

internal/config/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ const (
222222
configKeyRules = `rules`
223223
configKeySDKMetricsPeriod = `sdk_metrics_period`
224224
configKeyMaxMetricsStoreLength = `max_metrics_store_length`
225-
configKeyUseSignalBackend = `use_signal_backend`
225+
configKeyDisableSignalBackend = `disable_signal_backend`
226226
configKeyStripSensitiveKeyRegexp = `strip_sensitive_key_regexp`
227227
configKeyStripSensitiveValueRegexp = `strip_sensitive_value_regexp`
228228
)
@@ -271,7 +271,7 @@ func New(logger *plog.Logger) (*Config, error) {
271271
{key: configKeyRules, defaultValue: "", hidden: true},
272272
{key: configKeySDKMetricsPeriod, defaultValue: configDefaultSDKMetricsPeriod, hidden: true},
273273
{key: configKeyMaxMetricsStoreLength, defaultValue: configDefaultMaxMetricsStoreLength, hidden: true},
274-
{key: configKeyUseSignalBackend, defaultValue: "", hidden: true},
274+
{key: configKeyDisableSignalBackend, defaultValue: "", hidden: true},
275275
{key: configKeyStripSensitiveKeyRegexp, defaultValue: configDefaultStripSensitiveKeyRegexp},
276276
{key: configKeyStripSensitiveValueRegexp, defaultValue: configDefaultStripSensitiveValueRegexp},
277277
}
@@ -413,8 +413,8 @@ func (c *Config) MaxMetricsStoreLength() uint {
413413
// UseSignalBackend returns true to force the agent to use the signal backend
414414
// no matter the feature flag. When false, the app-login feature flag tells
415415
// whether or not to use the signal backend.
416-
func (c *Config) UseSignalBackend() bool {
417-
strip := sanitizeString(c.GetString(configKeyUseSignalBackend))
416+
func (c *Config) DisableSignalBackend() bool {
417+
strip := sanitizeString(c.GetString(configKeyDisableSignalBackend))
418418
return strip != ""
419419
}
420420

0 commit comments

Comments
 (0)