Metrics collection and alerting service
Dependencies:
- Go
1.23 - PostgreSQL
- Linux or macOS platform
To build a server, run in the terminal:
cd cmd/server && go run . # in the root directory of the projectTo startup the server, run in the terminal:
./cmd/server/server # in the root directory of the projectBuild and compilation flags (ldflags):
- buildVersion: any string (example,
-X 'main.buildVersion=v0.0.1') - buildDate:
$(date -u '+%Y/%m/%d %H:%M:%S')' - buildCommit:
$(git rev-parse --short HEAD || echo 'unknown')'
ADDRESS|-a– address and port to run server. Default:8080DATABASE_DSN|-d– DB connection addressLOG_LEVEL|-l– log level. DefaultinfoFILE_STORAGE_PATH|-f– file storage path. Default./temp.storage.dbRESTORE|-r– load data from storage. DefaulttrueSTORE_INTERVAL|-i– store interval in seconds (zero for sync). Default300
To build a agent, run in the terminal:
cd cmd/agent && go run . # in the root directory of the projectTo startup the agent, run in the terminal:
./cmd/server/agent # in the root directory of the projectBuild and compilation flags (-ldflags):
- buildVersion: any string (example,
-X 'main.buildVersion=v0.0.1') - buildDate:
$(date -u '+%Y/%m/%d %H:%M:%S')' - buildCommit:
$(git rev-parse --short HEAD || echo 'unknown')'
ADDRESS|-a– address and port to run agent. Defaultlocalhost:8080KEY|-k– encryption keyPOLL_INTERVAL|-p– frequency (seconds) of metric polling. Default2RATE_LIMIT|-l– number of simultaneous outgoing requests to the server. Default1REPORT_INTERVAL|-r– frequency (seconds) of sending values to the server. Default10
To be able to receive updates to autotests and other parts of the template, run the command:
git remote add -m main template https://github.com/Yandex-Practicum/go-musthave-metrics-tpl.gitTo update the autotest code, run the command:
git fetch template && git checkout template/main .githubThen add the received changes to your repository.
To successfully run autotests, name the branches iter<number>, where <number> is the sequence number of the increment. For example, in the branch named iter4, autotests will be launched for increments from the first to the fourth.
When you merge a branch with an increment into the main branch main, all autotests will be run.
Read more about local and automatic startup in README autotests.