opentelemetry-demo icon indicating copy to clipboard operation
opentelemetry-demo copied to clipboard

[frontend] Slowloading of images

Open klucsik opened this issue 10 months ago • 5 comments

Changes

Add FeatureFlag Provider to client side. Add http fault filter to envoy Add slowloading featureflag, and modify the Product card element to disable caching and add the envoy http-fault header Example of a slowly loaded image trace: image

Merge Requirements

For new features contributions please make sure you have completed the following essential items:

  • [x] CHANGELOG.md updated to document new feature additions
  • [ ] Appropriate documentation updates in the docs
  • [ ] Appropriate Helm chart updates in the helm-charts

Maintainers will not merge until the above have been completed. If you're unsure which docs need to be changed ping the @open-telemetry/demo-approvers.

klucsik avatar Apr 10 '24 08:04 klucsik

When trying to build and run this I'm getting the following error:

flagd                    | 2024-04-10T12:45:39.071Z	error	evaluator/fractional.go:30	parse fractional evaluation data: bucketing value not supplied and no targetingKey in context
flagd                    | github.com/open-feature/flagd/core/pkg/evaluator.(*Fractional).Evaluate
flagd                    | 	/src/core/pkg/evaluator/fractional.go:30
flagd                    | github.com/diegoholiveira/jsonlogic/v3.operation
flagd                    | 	/go/pkg/mod/github.com/diegoholiveira/jsonlogic/[email protected]/operation.go:15
flagd                    | github.com/diegoholiveira/jsonlogic/v3.apply
flagd                    | 	/go/pkg/mod/github.com/diegoholiveira/jsonlogic/[email protected]/jsonlogic.go:493
flagd                    | github.com/diegoholiveira/jsonlogic/v3.ApplyInterface
flagd                    | 	/go/pkg/mod/github.com/diegoholiveira/jsonlogic/[email protected]/jsonlogic.go:587
flagd                    | github.com/diegoholiveira/jsonlogic/v3.Apply
flagd                    | 	/go/pkg/mod/github.com/diegoholiveira/jsonlogic/[email protected]/jsonlogic.go:522
flagd                    | github.com/open-feature/flagd/core/pkg/evaluator.(*JSON).evaluateVariant
flagd                    | 	/src/core/pkg/evaluator/json.go:339
flagd                    | github.com/open-feature/flagd/core/pkg/evaluator.resolve[...]
flagd                    | 	/src/core/pkg/evaluator/json.go:276
flagd                    | github.com/open-feature/flagd/core/pkg/evaluator.(*JSON).ResolveAllValues
flagd                    | 	/src/core/pkg/evaluator/json.go:159
flagd                    | github.com/open-feature/flagd/core/pkg/service/flag-evaluation.(*FlagEvaluationService).ResolveAll
flagd                    | 	/src/core/pkg/service/flag-evaluation/flag_evaluator_v2.go:65
flagd                    | connectrpc.com/connect.NewUnaryHandler[...].func1
flagd                    | 	/go/pkg/mod/connectrpc.com/[email protected]/handler.go:52
flagd                    | connectrpc.com/connect.NewUnaryHandler[...].func2
flagd                    | 	/go/pkg/mod/connectrpc.com/[email protected]/handler.go:84
flagd                    | connectrpc.com/connect.(*Handler).ServeHTTP
flagd                    | 	/go/pkg/mod/connectrpc.com/[email protected]/handler.go:265
flagd                    | buf.build/gen/go/open-feature/flagd/connectrpc/go/flagd/evaluation/v1/evaluationv1connect.NewServiceHandler.func1
flagd                    | 	/go/pkg/mod/buf.build/gen/go/open-feature/flagd/connectrpc/[email protected]/flagd/evaluation/v1/evaluationv1connect/evaluation.connect.go:245
flagd                    | net/http.HandlerFunc.ServeHTTP
flagd                    | 	/usr/local/go/src/net/http/server.go:2166
flagd                    | github.com/open-feature/flagd/core/pkg/service/flag-evaluation.bufSwitchHandler.ServeHTTP
flagd                    | 	/src/core/pkg/service/flag-evaluation/connect_service.go:51
flagd                    | github.com/open-feature/flagd/core/pkg/service/flag-evaluation.(*ConnectService).setupServer.(*ConnectService).AddMiddleware.Middleware.Handler.func1.1
flagd                    | 	/src/core/pkg/service/middleware/metrics/http_metrics.go:105
flagd                    | github.com/open-feature/flagd/core/pkg/service/middleware/metrics.Middleware.Measure
flagd                    | 	/src/core/pkg/service/middleware/metrics/http_metrics.go:90
flagd                    | github.com/open-feature/flagd/core/pkg/service/flag-evaluation.(*ConnectService).setupServer.(*ConnectService).AddMiddleware.Middleware.Handler.func1
flagd                    | 	/src/core/pkg/service/middleware/metrics/http_metrics.go:104
flagd                    | net/http.HandlerFunc.ServeHTTP
flagd                    | 	/usr/local/go/src/net/http/server.go:2166
flagd                    | github.com/open-feature/flagd/core/pkg/service/flag-evaluation.(*ConnectService).setupServer.(*ConnectService).AddMiddleware.Middleware.Handler.(*Cors).Handler.func2
flagd                    | 	/go/pkg/mod/github.com/rs/[email protected]/cors.go:281
flagd                    | net/http.HandlerFunc.ServeHTTP
flagd                    | 	/usr/local/go/src/net/http/server.go:2166
flagd                    | golang.org/x/net/http2/h2c.h2cHandler.ServeHTTP
flagd                    | 	/go/pkg/mod/golang.org/x/[email protected]/http2/h2c/h2c.go:125
flagd                    | net/http.serverHandler.ServeHTTP
flagd                    | 	/usr/local/go/src/net/http/server.go:3137
flagd                    | net/http.(*conn).serve
flagd                    | 	/usr/local/go/src/net/http/server.go:2039

Hmmm, only fractional is the adServiceFailure. the session span attribute is missing. I don't think I1m touching those requests in my PR, I'll dig around if I can reproduce the issue. EDIT: I see the issue too, digging further

klucsik avatar Apr 10 '24 13:04 klucsik

The session var should be setted here: https://github.com/open-telemetry/opentelemetry-demo/blob/6f89f569cbab3e0c2127794e1c2b9b95ce140864/src/adservice/src/main/java/oteldemo/AdService.java#L216 This is very far away from my changes, testing main now

klucsik avatar Apr 10 '24 13:04 klucsik

main works fine, but my PR somehow introduces these errors, I`ll investigate more

klucsik avatar Apr 10 '24 13:04 klucsik

These changes are working as expected, I find no problem in services behavior. But these error messages are emitted every time the react client makes a request against flagd. My suspect would be the interaction between https://github.com/open-feature/js-sdk and flagd.

klucsik avatar Apr 16 '24 07:04 klucsik

The problem will be around this caching: https://github.com/open-feature/js-sdk-contrib/tree/main/libs/providers/flagd-web#caching The provider requesting all featureflags, and does not provide any context, and flagd throws errors on this

klucsik avatar Apr 16 '24 09:04 klucsik

at provider side, this https://github.com/open-feature/flagd/pull/1295 solves the issue, we had in logs. And as I see, this fix is out in the wild now: https://github.com/open-feature/flagd/releases/tag/core%2Fv0.9.1 and this PR bump flagd version to 0.10.1, so we are not bloked

klucsik avatar May 02 '24 14:05 klucsik

This PR was marked stale due to lack of activity. It will be closed in 7 days.

github-actions[bot] avatar May 10 '24 03:05 github-actions[bot]