Skip to content

Commit 8743ed2

Browse files
committed
fix
1 parent 629b8c6 commit 8743ed2

File tree

2 files changed

+9
-27
lines changed

2 files changed

+9
-27
lines changed

components/common-go/experiments/configcat.go

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ package experiments
66

77
import (
88
"context"
9-
"fmt"
109

1110
configcat "github.com/configcat/go-sdk/v7"
12-
"github.com/gitpod-io/gitpod/common-go/log"
1311
"github.com/sirupsen/logrus"
1412
)
1513

@@ -33,28 +31,20 @@ type configCatClient struct {
3331
client *configcat.Client
3432
}
3533

36-
func (c *configCatClient) GetBoolValue(ctx context.Context, experimentName string, defaultValue bool, attributes Attributes) bool {
37-
value := c.client.GetBoolValue(experimentName, defaultValue, attributesToUser(attributes))
38-
log.AddFields(ctx, logField(experimentName, value))
39-
return value
34+
func (c *configCatClient) GetBoolValue(_ context.Context, experimentName string, defaultValue bool, attributes Attributes) bool {
35+
return c.client.GetBoolValue(experimentName, defaultValue, attributesToUser(attributes))
4036
}
4137

42-
func (c *configCatClient) GetIntValue(ctx context.Context, experimentName string, defaultValue int, attributes Attributes) int {
43-
value := c.client.GetIntValue(experimentName, defaultValue, attributesToUser(attributes))
44-
log.AddFields(ctx, logField(experimentName, value))
45-
return value
38+
func (c *configCatClient) GetIntValue(_ context.Context, experimentName string, defaultValue int, attributes Attributes) int {
39+
return c.client.GetIntValue(experimentName, defaultValue, attributesToUser(attributes))
4640
}
4741

48-
func (c *configCatClient) GetFloatValue(ctx context.Context, experimentName string, defaultValue float64, attributes Attributes) float64 {
49-
value := c.client.GetFloatValue(experimentName, defaultValue, attributesToUser(attributes))
50-
log.AddFields(ctx, logField(experimentName, value))
51-
return value
42+
func (c *configCatClient) GetFloatValue(_ context.Context, experimentName string, defaultValue float64, attributes Attributes) float64 {
43+
return c.client.GetFloatValue(experimentName, defaultValue, attributesToUser(attributes))
5244
}
5345

54-
func (c *configCatClient) GetStringValue(ctx context.Context, experimentName string, defaultValue string, attributes Attributes) string {
55-
value := c.client.GetStringValue(experimentName, defaultValue, attributesToUser(attributes))
56-
log.AddFields(ctx, logField(experimentName, value))
57-
return value
46+
func (c *configCatClient) GetStringValue(_ context.Context, experimentName string, defaultValue string, attributes Attributes) string {
47+
return c.client.GetStringValue(experimentName, defaultValue, attributesToUser(attributes))
5848
}
5949

6050
func attributesToUser(attributes Attributes) *configcat.UserData {
@@ -95,9 +85,3 @@ type configCatLogger struct {
9585
func (l *configCatLogger) GetLevel() configcat.LogLevel {
9686
return configcat.LogLevelError
9787
}
98-
99-
func logField(experimentName, value interface{}) logrus.Fields {
100-
return logrus.Fields{
101-
fmt.Sprintf("experiments.%s", experimentName): value,
102-
}
103-
}

components/common-go/experiments/flags.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
package experiments
66

7-
import (
8-
"context"
9-
)
7+
import "context"
108

119
const (
1210
PersonalAccessTokensEnabledFlag = "personalAccessTokensEnabled"

0 commit comments

Comments
 (0)