{"id":19107370,"url":"https://github.com/smartcontractkit/wasp","last_synced_at":"2025-04-18T21:32:07.125Z","repository":{"id":152865773,"uuid":"624155497","full_name":"smartcontractkit/wasp","owner":"smartcontractkit","description":"Protocol-agnostic load testing library for Go","archived":false,"fork":false,"pushed_at":"2024-08-26T20:17:43.000Z","size":15910,"stargazers_count":23,"open_issues_count":1,"forks_count":3,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-08-26T23:25:53.462Z","etag":null,"topics":["grafana","load-testing","performance","testing"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smartcontractkit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-05T21:33:14.000Z","updated_at":"2024-08-26T20:17:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"21b71adf-39fe-43e5-bc19-bdcaa6c96e03","html_url":"https://github.com/smartcontractkit/wasp","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Fwasp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Fwasp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Fwasp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Fwasp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smartcontractkit","download_url":"https://codeload.github.com/smartcontractkit/wasp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223783173,"owners_count":17201915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grafana","load-testing","performance","testing"],"created_at":"2024-11-09T04:12:22.544Z","updated_at":"2024-11-09T04:12:23.241Z","avatar_url":"https://github.com/smartcontractkit.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg alt=\"wasp\" src=\"./docs/wasp-2.png\"\u003e \n\u003c/p\u003e\n\u003cdiv align=\"center\"\u003e\n\n![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/smartcontractkit/wasp)\n![GitHub](https://img.shields.io/github/license/smartcontractkit/wasp)\n[![Go Report Card](https://goreportcard.com/badge/github.com/smartcontractkit/wasp)](https://goreportcard.com/report/github.com/smartcontractkit/wasp)\n[![Go Tests](https://github.com/smartcontractkit/wasp/actions/workflows/test.yml/badge.svg)](https://github.com/smartcontractkit/wasp/actions/workflows/test.yml)\n[![Bench](https://github.com/smartcontractkit/wasp/actions/workflows/bench.yml/badge.svg?branch=master)](https://github.com/smartcontractkit/wasp/actions/workflows/bench.yml)\n\u003ca href='https://github.com/jpoles1/gopherbadger' target='_blank'\u003e![gopherbadger-tag-do-not-edit](https://img.shields.io/badge/Go%20Coverage-80%25-brightgreen.svg?longCache=true\u0026style=flat)\u003c/a\u003e\n\n*DISCLAIMER*: This repository is archived, there will be no new commits or support, all development is moved to https://github.com/smartcontractkit/chainlink-testing-framework\n\nScalable protocol-agnostic load testing library for `Go`\n\n\u003c/div\u003e\n\n## Goals\n- Easy to reuse any custom client `Go` code\n- Easy to grasp\n- Have a slim codebase (500-1k loc)\n- No test harness or CLI, easy to integrate and run with plain `go test`\n- Have a predictable performance footprint\n- Easy to create synthetic or user-based scenarios\n- Scalable in `k8s` without complicated configuration or vendored UI interfaces\n- Non-opinionated reporting, push any data to `Loki`\n\n## Setup\nWe are using `nix` for deps, see [installation](https://nixos.org/manual/nix/stable/installation/installation.html) guide\n```bash\nnix develop\n```\n\n\n## Run example tests with Grafana + Loki\n```bash\nmake start\n```\nInsert `GRAFANA_TOKEN` created in previous command\n```bash\nexport LOKI_TOKEN=\nexport LOKI_URL=http://localhost:3030/loki/api/v1/push\nexport GRAFANA_URL=http://localhost:3000\nexport GRAFANA_TOKEN=\nexport DATA_SOURCE_NAME=Loki\nexport DASHBOARD_FOLDER=LoadTests\nexport DASHBOARD_NAME=Wasp\n\nmake dashboard\n```\nRun some tests:\n```\nmake test_loki\n```\nOpen your [Grafana dashboard](http://localhost:3000/d/wasp/wasp-load-generator?orgId=1\u0026refresh=5s)\n\nIn case you deploy to your own Grafana check `DASHBOARD_FOLDER` and `DASHBOARD_NAME`, defaults are `LoadTests` dir and dashboard is called `Wasp`\n\nRemove environment:\n```bash\nmake stop\n```\n\n## Test Layout and examples\nCheck [examples](examples/README.md) to understand what is the easiest way to structure your tests, run them both locally and remotely, at scale, inside `k8s`\n\n## Run pyroscope test\n```\nmake pyro_start\nmake test_pyro_rps\nmake test_pyro_vu\nmake pyro_stop\n```\nOpen [pyroscope](http://localhost:4040/)\n\nYou can also use `trace.out` in the root folder with `Go` default tracing UI\n\n## How it works\n![img.png](docs/how-it-works.png)\n\nCheck this [doc](./HOW_IT_WORKS.md) for more examples and project overview\n\n## Loki debug\nYou can check all the messages the tool sends with env var `WASP_LOG_LEVEL=trace`\n\nIf Loki client fail to deliver a batch test will proceed, if you experience Loki issues, consider setting `Timeout` in `LokiConfig` or set `MaxErrors: 10` to return an error after N Loki errors\n\n`MaxErrors: -1` can be used to ignore all the errors\n\nDefault Promtail settings are:\n```\n\u0026LokiConfig{\n    TenantID:                os.Getenv(\"LOKI_TENANT_ID\"),\n    URL:                     os.Getenv(\"LOKI_URL\"),\n    Token:                   os.Getenv(\"LOKI_TOKEN\"),\n    BasicAuth:               os.Getenv(\"LOKI_BASIC_AUTH\"),\n    MaxErrors:               10,\n    BatchWait:               5 * time.Second,\n    BatchSize:               500 * 1024,\n    Timeout:                 20 * time.Second,\n    DropRateLimitedBatches:  false,\n    ExposePrometheusMetrics: false,\n    MaxStreams:              600,\n    MaxLineSize:             999999,\n    MaxLineSizeTruncate:     false,\n}\n```\nIf you see errors like\n```\nERR Malformed promtail log message, skipping Line=[\"level\",{},\"component\",\"client\",\"host\",\"...\",\"msg\",\"batch add err\",\"tenant\",\"\",\"error\",{}]\n```\nTry to increase `MaxStreams` even more or check your `Loki` configuration\n\n\n## WASP Dashboard\n\nBasic [dashboard](dashboard/dashboard.go):\n\n![dashboard_img](./docs/dashboard_basic.png)\n\n### Reusing Dashboard Components\n\nYou can integrate components from the WASP dashboard into your custom dashboards. \n\nExample:\n\n```\nimport (\n    waspdashboard \"github.com/smartcontractkit/wasp/dashboard\"\n)\n\nfunc BuildCustomLoadTestDashboard(dashboardName string) (dashboard.Builder, error) {\n    // Custom key,value used to query for panels\n    panelQuery := map[string]string{\n\t\t\"branch\": `=~\"${branch:pipe}\"`,\n\t\t\"commit\": `=~\"${commit:pipe}\"`,\n        \"network_type\": `=\"testnet\"`,\n\t}\n\n\treturn dashboard.New(\n\t\tdashboardName,\n        waspdashboard.WASPLoadStatsRow(\"Loki\", panelQuery),\n\t\twaspdashboard.WASPDebugDataRow(\"Loki\", panelQuery, true),\n        # other options\n    )\n}\n```\n\n## Annotate Dashboards and Monitor Alerts\n\nTo enable dashboard annotations and alert monitoring, utilize the `WithGrafana()` function in conjunction with `wasp.Profile`. This approach allows for the integration of dashboard annotations and the evaluation of dashboard alerts.\n\nExample:\n\n```\n_, err = wasp.NewProfile().\n    WithGrafana(grafanaOpts).\n    Add(wasp.NewGenerator(getLatestReportByTimestampCfg)).\n    Run(true)\nrequire.NoError(t, err)\n```\n\nWhere:\n\n```\ntype GrafanaOpts struct {\n\tGrafanaURL                   string        `toml:\"grafana_url\"`\n\tGrafanaToken                 string        `toml:\"grafana_token_secret\"`\n\tWaitBeforeAlertCheck         time.Duration `toml:\"grafana_wait_before_alert_check\"`                  // Cooldown period to wait before checking for alerts\n\tAnnotateDashboardUIDs        []string      `toml:\"grafana_annotate_dashboard_uids\"`                  // Grafana dashboardUIDs to annotate start and end of the run\n\tCheckDashboardAlertsAfterRun []string      `toml:\"grafana_check_alerts_after_run_on_dashboard_uids\"` // Grafana dashboardIds to check for alerts after run\n}\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartcontractkit%2Fwasp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartcontractkit%2Fwasp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartcontractkit%2Fwasp/lists"}