Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add feature flags on start #314

Merged
merged 12 commits into from
Aug 18, 2022
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,5 @@ 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))
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 11 additions & 0 deletions docs/feature_flags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Feature Flags

This demo comes with 2 feature flags which control failure conditions in the
Product Catalog and Shipping services. By default the flags are disabled. Using
puckpuck marked this conversation as resolved.
Show resolved Hide resolved
the Feature Flags UI <http://localhost:8081> 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 |
Original file line number Diff line number Diff line change
Expand Up @@ -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
end
puckpuck marked this conversation as resolved.
Show resolved Hide resolved