GoogleCloudPlatform / cloud-ops-sandbox

Cloud Operations Sandbox is an open source collection of tools that helps practitioners to learn O11y and R9y practices from Google and apply them using Cloud Operations suite of tools.
Apache License 2.0
406 stars 148 forks source link

Develop SRE recipe that introduce general delay for home page rendering in Online Boutique #1009

Open minherz opened 1 year ago

minherz commented 1 year ago

Implement an SRE recipe that will replace recipe 0 and will introduce latency in displaying the Online Boutique's home page by injecting code in one of the other services that support source code refresh at runtime (e.g. Javascript or Python*).

-- * cpython does not support this feature without the use of additional modules (e.g. watchdog). Another way to do it is to convert one or more of the Online Boutique services to run on pypy.

minherz commented 1 year ago

Downgrading the issue priority to reflect the decrease in the maintenance capacity of the project.

lvaylet commented 1 year ago

Hi @minherz, I understand this issue and #1010 are the main reasons why SRE Recipes were temporarily disabled in 0.9.

Instead of injecting code into the current running version of the Online Boutique provisioned by Kustomize, would it make more sense to open PRs on the Online Boutique so faults can be injected by modifying the value of an environment variable, like in 0.8? For example, we could request an update to recommendation_server.py, from:

max_responses = 5

to:

max_responses = int(os.environ.get("MAX_RESPONSES", 5))

This is compliant with the twelve-factor app good practices and does not introduce any breaking change, so I do not see why the Online Boutique maintainers would decline the PR.

That could work for other recipes as well.

WDYT?

minherz commented 1 year ago

We would like to avoid introducing unrelated code changes to other projects. One of the primary goals to remove the code of the demo application from COS was to reduce chorn maintenance of artifacts that aren't related to COS. Adding code that is used solely in COS to the demo projects will (re)introduce these maintenance tasks that we want to avoid. The new recipe engine in COS should provide flexibility to recipe developers to demonstrate targeting scenarios without maintaining a specialized branch or code in the demo apps that are used with COS. Regarding the particular proposal, it seems unrelated to the scenario that is described in this issue. However, if the demo app allows to simulate a desired behavior by misconfiguration, it can be used as an alternative to the suggested approach.