Skip to content

Commit 994c60c

Browse files
committed
feat: add traces to sync streams
Signed-off-by: Simon Schrottner <[email protected]>
1 parent 7566f51 commit 994c60c

File tree

12 files changed

+709
-1288
lines changed

12 files changed

+709
-1288
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ docker-build: # default to flagd
3232
docker-push: # default to flagd
3333
make docker-push-flagd
3434
docker-build-flagd:
35-
docker buildx build --build-arg=VERSION="$$(git describe --tags --abbrev=0)" --build-arg=COMMIT="$$(git rev-parse --short HEAD)" --build-arg DATE="$$(date +%FT%TZ)" --platform="linux/arm64" -t ${IMG} -f flagd/build.Dockerfile .
35+
docker buildx build --build-arg=VERSION="$$(git describe --tags --abbrev=0)" --build-arg=COMMIT="$$(git rev-parse --short HEAD)" --build-arg DATE="$$(date +%FT%TZ)" --platform="linux/amd64" -t ${IMG} -f flagd/build.Dockerfile .
3636
docker-push-flagd:
3737
docker buildx build --push --build-arg=VERSION="$$(git describe --tags --abbrev=0)" --build-arg=COMMIT="$$(git rev-parse --short HEAD)" --build-arg DATE="$$(date +%FT%TZ)" --platform="linux/ppc64le,linux/s390x,linux/amd64,linux/arm64" -t ${IMG} -f flagd/build.Dockerfile .
3838
build: workspace-init # default to flagd
@@ -108,11 +108,11 @@ run-flagd-proxy-zd-test:
108108
# - .markdownlint.yaml contains the rules for markdownfiles
109109
MDL_DOCKER_VERSION := next
110110
ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
111-
MDL_CMD := docker run -v $(ROOT_DIR):/workdir --rm
111+
MDL_CMD := docker run -v $(ROOT_DIR):/workdir --rm
112112

113113
.PHONY: markdownlint markdownlint-fix
114114
markdownlint:
115-
$(MDL_CMD) davidanson/markdownlint-cli2-rules:$(MDL_DOCKER_VERSION) "**/*.md"
115+
$(MDL_CMD) davidanson/markdownlint-cli2-rules:$(MDL_DOCKER_VERSION) "**/*.md"
116116

117117
markdownlint-fix:
118118
$(MDL_CMD) --entrypoint="markdownlint-cli2-fix" davidanson/markdownlint-cli2-rules:$(MDL_DOCKER_VERSION) "**/*.md"

core/go.sum

Lines changed: 4 additions & 74 deletions
Large diffs are not rendered by default.

core/pkg/evaluator/json.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ import (
1919
"github.com/open-feature/flagd/core/pkg/sync"
2020
"github.com/xeipuuv/gojsonschema"
2121
"go.opentelemetry.io/otel"
22-
"go.opentelemetry.io/otel/attribute"
23-
"go.opentelemetry.io/otel/codes"
2422
"go.opentelemetry.io/otel/trace"
2523
"go.uber.org/zap"
2624
"golang.org/x/exp/maps"
@@ -100,19 +98,10 @@ func (je *JSON) GetState() (string, error) {
10098
}
10199

102100
func (je *JSON) SetState(payload sync.DataSync) (map[string]interface{}, bool, error) {
103-
_, span := je.jsonEvalTracer.Start(
104-
context.Background(),
105-
"flagSync",
106-
trace.WithAttributes(attribute.String("feature_flag.source", payload.Source)),
107-
trace.WithAttributes(attribute.String("feature_flag.sync_type", payload.Type.String())))
108-
defer span.End()
109-
110101
var definition Definition
111102

112103
err := configToFlagDefinition(je.Logger, payload.FlagData, &definition)
113104
if err != nil {
114-
span.SetStatus(codes.Error, "flagSync error")
115-
span.RecordError(err)
116105
return nil, false, err
117106
}
118107

@@ -133,9 +122,6 @@ func (je *JSON) SetState(payload sync.DataSync) (map[string]interface{}, bool, e
133122
return nil, false, fmt.Errorf("unsupported sync type: %d", payload.Type)
134123
}
135124

136-
// Number of events correlates to the number of flags changed through this sync, record it
137-
span.SetAttributes(attribute.Int("feature_flag.change_count", len(events)))
138-
139125
return events, reSync, nil
140126
}
141127

flagd-proxy/go.sum

Lines changed: 2 additions & 65 deletions
Large diffs are not rendered by default.

flagd/go.mod

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,18 @@ require (
1111
connectrpc.com/connect v1.18.1
1212
github.com/dimiro1/banner v1.1.0
1313
github.com/gorilla/mux v1.8.1
14+
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
1415
github.com/mattn/go-colorable v0.1.14
15-
github.com/open-feature/flagd/core v0.11.2
16+
github.com/open-feature/flagd/core v0.11.3
1617
github.com/prometheus/client_golang v1.21.1
1718
github.com/rs/cors v1.11.1
1819
github.com/rs/xid v1.6.0
1920
github.com/spf13/cobra v1.9.1
2021
github.com/spf13/pflag v1.0.6
2122
github.com/spf13/viper v1.19.0
2223
github.com/stretchr/testify v1.10.0
24+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0
25+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0
2326
go.opentelemetry.io/otel v1.35.0
2427
go.opentelemetry.io/otel/sdk v1.35.0
2528
go.opentelemetry.io/otel/sdk/metric v1.35.0
@@ -39,7 +42,7 @@ require (
3942
cloud.google.com/go/compute/metadata v0.6.0 // indirect
4043
cloud.google.com/go/iam v1.1.13 // indirect
4144
cloud.google.com/go/storage v1.43.0 // indirect
42-
connectrpc.com/otelconnect v0.7.1 // indirect
45+
connectrpc.com/otelconnect v0.7.2 // indirect
4346
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0 // indirect
4447
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect
4548
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
@@ -97,7 +100,7 @@ require (
97100
github.com/google/wire v0.6.0 // indirect
98101
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
99102
github.com/googleapis/gax-go/v2 v2.13.0 // indirect
100-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 // indirect
103+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1 // indirect
101104
github.com/hashicorp/hcl v1.0.0 // indirect
102105
github.com/imdario/mergo v0.3.16 // indirect
103106
github.com/inconshreveable/mousetrap v1.1.0 // indirect
@@ -114,7 +117,7 @@ require (
114117
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
115118
github.com/modern-go/reflect2 v1.0.2 // indirect
116119
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
117-
github.com/open-feature/flagd-schemas v0.2.9-0.20250127221449-bb763438abc5 // indirect
120+
github.com/open-feature/flagd-schemas v0.2.9-0.20250319190911-9b0ee43ecc47 // indirect
118121
github.com/open-feature/open-feature-operator/apis v0.2.44 // indirect
119122
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
120123
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
@@ -139,20 +142,18 @@ require (
139142
github.com/zeebo/xxh3 v1.0.2 // indirect
140143
go.opencensus.io v0.24.0 // indirect
141144
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
142-
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect
143-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
144-
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0 // indirect
145-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 // indirect
146-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 // indirect
147-
go.opentelemetry.io/otel/exporters/prometheus v0.56.0 // indirect
145+
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.35.0 // indirect
146+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 // indirect
147+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 // indirect
148+
go.opentelemetry.io/otel/exporters/prometheus v0.57.0 // indirect
148149
go.opentelemetry.io/otel/metric v1.35.0 // indirect
149150
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
150151
go.uber.org/multierr v1.11.0 // indirect
151152
gocloud.dev v0.40.0 // indirect
152153
golang.org/x/crypto v0.33.0 // indirect
153154
golang.org/x/exp v0.0.0-20250210185358-939b2ce775ac // indirect
154155
golang.org/x/mod v0.23.0 // indirect
155-
golang.org/x/oauth2 v0.25.0 // indirect
156+
golang.org/x/oauth2 v0.26.0 // indirect
156157
golang.org/x/sys v0.30.0 // indirect
157158
golang.org/x/term v0.29.0 // indirect
158159
golang.org/x/text v0.22.0 // indirect
@@ -161,7 +162,7 @@ require (
161162
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
162163
google.golang.org/api v0.191.0 // indirect
163164
google.golang.org/genproto v0.0.0-20240812133136-8ffd90a71988 // indirect
164-
google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f // indirect
165+
google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a // indirect
165166
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect
166167
gopkg.in/inf.v0 v0.9.1 // indirect
167168
gopkg.in/ini.v1 v1.67.0 // indirect

0 commit comments

Comments
 (0)