Compare commits
No commits in common. "50459bcb643ca64299a42cdb86f281af1af791a0" and "703549703be502598d058c1c35683bb9820bcb3b" have entirely different histories.
50459bcb64
...
703549703b
@ -1,20 +1,23 @@
|
|||||||
version: "3.4"
|
version: "3.4"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
monitoring:
|
queues:
|
||||||
image: mathwave/sprint-repo:monitoring
|
image: mathwave/sprint-repo:monitoring
|
||||||
networks:
|
networks:
|
||||||
- clickhouse
|
- monitoring
|
||||||
environment:
|
environment:
|
||||||
CLICKHOUSE_PASSWORD: $CLICKHOUSE_PASSWORD_PROD
|
MONGO_HOST: "mongo.sprinthub.ru"
|
||||||
|
MONGO_PASSWORD: $MONGO_PASSWORD_PROD
|
||||||
deploy:
|
deploy:
|
||||||
mode: replicated
|
mode: replicated
|
||||||
restart_policy:
|
restart_policy:
|
||||||
condition: any
|
condition: any
|
||||||
|
placement:
|
||||||
|
constraints: [node.labels.stage == production]
|
||||||
update_config:
|
update_config:
|
||||||
parallelism: 1
|
parallelism: 1
|
||||||
order: start-first
|
order: start-first
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
clickhouse:
|
queues:
|
||||||
external: true
|
external: true
|
@ -1,43 +0,0 @@
|
|||||||
name: Deploy Prod
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- prod
|
|
||||||
types: [closed]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build
|
|
||||||
runs-on: [dev]
|
|
||||||
steps:
|
|
||||||
- name: login
|
|
||||||
run: docker login -u mathwave -p ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
||||||
- name: checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: prod
|
|
||||||
- name: build
|
|
||||||
run: docker build -t mathwave/sprint-repo:monitoring .
|
|
||||||
push:
|
|
||||||
name: Push
|
|
||||||
runs-on: [dev]
|
|
||||||
needs: build
|
|
||||||
steps:
|
|
||||||
- name: push
|
|
||||||
run: docker push mathwave/sprint-repo:monitoring
|
|
||||||
deploy-prod:
|
|
||||||
name: Deploy prod
|
|
||||||
runs-on: [prod]
|
|
||||||
needs: push
|
|
||||||
steps:
|
|
||||||
- name: login
|
|
||||||
run: docker login -u mathwave -p ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
||||||
- name: checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: prod
|
|
||||||
- name: deploy
|
|
||||||
env:
|
|
||||||
CLICKHOUSE_PASSWORD_PROD: ${{ secrets.CLICKHOUSE_PASSWORD_PROD }}
|
|
||||||
run: docker stack deploy --with-registry-auth -c ./.deploy/deploy-prod.yaml infra
|
|
@ -57,16 +57,15 @@ func Migrate() error {
|
|||||||
context.TODO(),
|
context.TODO(),
|
||||||
`CREATE TABLE IF NOT EXISTS endpoints (
|
`CREATE TABLE IF NOT EXISTS endpoints (
|
||||||
timestamp DateTime,
|
timestamp DateTime,
|
||||||
service LowCardinality(String),
|
service_name LowCardinality(String),
|
||||||
environment LowCardinality(String),
|
|
||||||
endpoint LowCardinality(String),
|
endpoint LowCardinality(String),
|
||||||
status_code UInt16,
|
status_code UInt16,
|
||||||
response_time_ms UInt32,
|
response_time_ms UInt32,
|
||||||
method LowCardinality(String)
|
request_method LowCardinality(String)
|
||||||
)
|
)
|
||||||
ENGINE = MergeTree
|
ENGINE = MergeTree
|
||||||
PARTITION BY toYYYYMM(timestamp)
|
PARTITION BY toYYYYMM(timestamp)
|
||||||
ORDER BY (service, environment, endpoint, request_method, timestamp);`,
|
ORDER BY (service_name, endpoint, request_method, timestamp);`,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@ -77,15 +76,14 @@ func Migrate() error {
|
|||||||
context.TODO(),
|
context.TODO(),
|
||||||
`CREATE TABLE IF NOT EXISTS tasks (
|
`CREATE TABLE IF NOT EXISTS tasks (
|
||||||
timestamp DateTime,
|
timestamp DateTime,
|
||||||
service LowCardinality(String),
|
service_name LowCardinality(String),
|
||||||
environment LowCardinality(String),
|
queue_name LowCardinality(String),
|
||||||
queue LowCardinality(String),
|
|
||||||
success Bool,
|
success Bool,
|
||||||
execution_time_ms UInt32
|
execution_time_ms UInt32
|
||||||
)
|
)
|
||||||
ENGINE = MergeTree
|
ENGINE = MergeTree
|
||||||
PARTITION BY toYYYYMM(timestamp)
|
PARTITION BY toYYYYMM(timestamp)
|
||||||
ORDER BY (service, environment, queue, timestamp);`,
|
ORDER BY (service_name, queue_name, timestamp);`,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
@ -11,7 +11,6 @@ import (
|
|||||||
type EndpointMetric struct {
|
type EndpointMetric struct {
|
||||||
Timestamp time.Time `json:"timestamp"`
|
Timestamp time.Time `json:"timestamp"`
|
||||||
Service string `json:"service"`
|
Service string `json:"service"`
|
||||||
Environment string `json:"environment"`
|
|
||||||
Endpoint string `json:"endpoint"`
|
Endpoint string `json:"endpoint"`
|
||||||
StatusCode int `json:"status_code"`
|
StatusCode int `json:"status_code"`
|
||||||
ResponseTime int `json:"response_time"`
|
ResponseTime int `json:"response_time"`
|
||||||
@ -27,7 +26,6 @@ func AddEndpointMetric(metric EndpointMetric) error {
|
|||||||
err = batch.Append(
|
err = batch.Append(
|
||||||
metric.Timestamp,
|
metric.Timestamp,
|
||||||
metric.Service,
|
metric.Service,
|
||||||
metric.Environment,
|
|
||||||
metric.Endpoint,
|
metric.Endpoint,
|
||||||
metric.StatusCode,
|
metric.StatusCode,
|
||||||
metric.ResponseTime,
|
metric.ResponseTime,
|
||||||
|
@ -8,7 +8,6 @@ import (
|
|||||||
type TaskMetric struct {
|
type TaskMetric struct {
|
||||||
Timestamp time.Time `json:"timestamp"`
|
Timestamp time.Time `json:"timestamp"`
|
||||||
Service string `json:"service"`
|
Service string `json:"service"`
|
||||||
Environment string `json:"environment"`
|
|
||||||
Queue string `json:"queue"`
|
Queue string `json:"queue"`
|
||||||
Success bool `json:"success"`
|
Success bool `json:"success"`
|
||||||
ExecutionTimeMs int `json:"execution_time_ms"`
|
ExecutionTimeMs int `json:"execution_time_ms"`
|
||||||
@ -23,7 +22,6 @@ func AddTaskMetric(metric TaskMetric) error {
|
|||||||
err = batch.Append(
|
err = batch.Append(
|
||||||
metric.Timestamp,
|
metric.Timestamp,
|
||||||
metric.Service,
|
metric.Service,
|
||||||
metric.Environment,
|
|
||||||
metric.Queue,
|
metric.Queue,
|
||||||
metric.Success,
|
metric.Success,
|
||||||
metric.ExecutionTimeMs,
|
metric.ExecutionTimeMs,
|
||||||
|
Loading…
Reference in New Issue
Block a user