google / slo-generator

SLO Generator computes SLIs, SLOs, Error Budgets and Burn Rates from supported backends, then exports an SLO report to supported targets.
Apache License 2.0
483 stars 77 forks source link

💡 [REQUEST] - Document how to use Visual Studio Code launch configurations for debugging #306

Open lvaylet opened 1 year ago

lvaylet commented 1 year ago

Summary

Running and debugging the SLO Generator from Visual Studio Code can be confusing due to the fact that slo-generator is defined as a console script entrypoint in setup.cfg:

[options.entry_points]
console_scripts =
    slo-generator = slo_generator.cli:main

Document how to run/debug a simple slo-generator compute ... command, for example in CONTRIBUTING.md.

Basic Example

This sample launch.json can be used to run/debug a simple slo-generator compute ... call:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "SLO Generator",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/venv/bin/slo-generator",
            "args": [
                "compute",
                "--slo-config",
                "samples/cloud_monitoring/slo_gae_app_availability.yaml",
                "--config",
                "samples/config.yaml"
            ],
            "envFile": "${workspaceFolder}/.env",
            "console": "integratedTerminal",
            "justMyCode": true
        }
    ]
}

Especially note the values of program (retrieved from which slo-generator after the package is installed in editable mode), args and envFile.

Screenshots

![DESCRIPTION](LINK.png)

Drawbacks

None identified.

Unresolved questions

No response

Code of Conduct

lvaylet commented 4 months ago

Update: type is now debugpy, as python will be deprecated soon according to Visual Studio Code itself.