Skip to content

Commit

Permalink
add feature flags on start (#314)
Browse files Browse the repository at this point in the history
* add feature flags on start

* revert sleep change

* document feature flags

* feature flag definitions

* Revert "document feature flags"

This reverts commit c975f5d.

* document feature flags

* document feature flags

* add reference to feature flags

* fix nits
  • Loading branch information
puckpuck committed Aug 18, 2022
1 parent 8fb48f3 commit eca1ae1
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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 several feature flags which can control failure conditions
in specific services. By default the flags are disabled. Using 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

0 comments on commit eca1ae1

Please sign in to comment.