Development

Tamland is built in Python.

Setup development environment

This project uses mise (formerly known as rtx) to manage tool dependencies for development.

Install mise through below command or read about other methods of installation.

Tool dependencies and their versions are managed through .tool-versions.

curl https://mise.jdx.dev/install.sh | sh

Setup the local development environment and prepare all tool and python dependencies:

make prepare

Refer to GitLab’s developer setup guide at for more information.

Python dependencies

Python dependencies are managed through poetry, which can be installed through pip. This happens automatically with make prepare.

Testing

Tamland includes pytest unit and integration tests, which can be run with make test.

To run all tests, lints, etc. run make test-all.

Forecasting during development

Experimenting locally provides us with a shorter feedback loop to test new features and ideas. There are a few steps to be done to set up your development environment to do that.

First, copy the sample environment variable file:

cp .env.example .env

Update the environment variables accordingly:

  1. PROMETHEUS_USERNAME
  2. PROMETHEUS_PASSWORD
  3. PROMETHEUS_QUERY_URL
  4. PROMETHEUS_HEADER_PROVIDER
  5. ALL_PROXY

Most likely, only username and password need to be tweaked while the other values will be kept with the default value.

Evaluate the .env file in your shell:

source .env

Set up the ssh tunnel through the bastion host:

make ssh-tunnel

scripts/ssh-tunnel.sh
Connected! Press Enter to disconnect.

The username defaults to your system user, optionally set a specific username like below:

USER=tamland-ssh-user make ssh-tunnel

The connection with the Mimir backend can be tested using a script:

scripts/mimir-status.sh

{"status":"success","data":{"yaml": "global:\n  external_labels:\n    source: mimir"}}

Now everything should be ready to run a forecast:

bin/shell forecast . --manifest=manifest.json --pattern=ai-gateway.gcp_quota_limit_vertex_ai

Starting forecast for 1 components:
patroni-embedding.pg_table_bloat
2024-07-23 11:38:15,985   Starting forecast for patroni-embedding.pg_table_bloat
2024-07-23 11:38:15,987   Refreshing prometheus headers from: scripts/prometheus-header-provider.sh
2024-07-23 11:39:24,666   Saving forecast for patroni-embedding.pg_table_bloat to /forecasts/components/patroni-embedding/pg_table_bloat/20240723-093815-4973bf36-48d7-11ef-8c08-0ae32442bf55