diff --git a/CHANGELOG.md b/CHANGELOG.md index bbf73ae8dd..04a67b58d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,6 +75,8 @@ significant modifications will be credited to OpenTelemetry Authors. ([#245](https://github.com/open-telemetry/opentelemetry-demo/pull/245)) * Added Frontend Instrumentation ([#293](https://github.com/open-telemetry/opentelemetry-demo/pull/293)) +* Add Feature Flags definitions +([#314](https://github.com/open-telemetry/opentelemetry-demo/pull/314)) * Enable Locust loadgen environment variable config options ([#316](https://github.com/open-telemetry/opentelemetry-demo/pull/316)) * Simplified and cleaned up ProductCatalogService diff --git a/README.md b/README.md index 80b058bb28..2581227e9d 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ This repo is a work in progress. If you'd like to help, check out our ## Documentation - [Demo Screenshots](./docs/demo_screenshots.md) +- [Feature Flags](./docs/feature_flags.md) - [Manual Span Attributes](./docs/manual_span_attributes.md) - [Metric Feature Coverage by Service](./docs/metric_service_features.md) - [Requirements](./docs/requirements/README.md) diff --git a/docs/feature_flags.md b/docs/feature_flags.md new file mode 100644 index 0000000000..9254c02b68 --- /dev/null +++ b/docs/feature_flags.md @@ -0,0 +1,11 @@ +# Feature Flags + +This demo comes with several feature flags which can control failure conditions +in specific services. By default the flags are disabled. Using the Feature Flags +UI you will be able to control the status of these +feature flags. + +| Feature Flag | Service(s) | Description | +|-------------------------|-----------------|---------------------------------------------------------------------------| +| `productCatalogFailure` | Product Catalog | Generate an error for `GetProduct` requests with product id: `OLJCESPC7Z` | +| `shippingFailure` | Shipping | Induce very long latency when shipping outside of USA | diff --git a/src/featureflagservice/priv/repo/migrations/20220524172636_create_featureflags.exs b/src/featureflagservice/priv/repo/migrations/20220524172636_create_featureflags.exs index 4d1f61ebad..61dee0c5ed 100644 --- a/src/featureflagservice/priv/repo/migrations/20220524172636_create_featureflags.exs +++ b/src/featureflagservice/priv/repo/migrations/20220524172636_create_featureflags.exs @@ -11,5 +11,24 @@ defmodule Featureflagservice.Repo.Migrations.CreateFeatureflags do end create unique_index(:featureflags, [:name]) + + execute(&execute_up/0, &execute_down/0) + end + + defp execute_up do + repo().insert(%Featureflagservice.FeatureFlags.FeatureFlag{ + name: "productCatalogFailure", + description: "Fail product catalog service on a specific product", + enabled: false}) + + repo().insert(%Featureflagservice.FeatureFlags.FeatureFlag{ + name: "shippingFailure", + description: "Fail shipping service when shipping a product to a non-USA address", + enabled: false}) + end + + defp execute_down do + repo().delete(%Featureflagservice.FeatureFlags.FeatureFlag{name: "productCatalogFailure"}) + repo().delete(%Featureflagservice.FeatureFlags.FeatureFlag{name: "shippingFailure"}) end end