Merged in feature/prometheus (pull request #52)
API instrumentation - metrics and logging * api instrumentation prometheus metrics and logging for all routes * Merge branch 'main' of bitbucket.org:aarete/query-orchestration into feature/prometheus * add log_level and sync the config initialize * docs * cleanup * add to compose:up:test * docs for prometheus testing * custom metrics * cleanup * merge main * add tests * cleanup docs * cleanup * lint * fix unit tests (attempt) * fix tests * resolvesetlogger * expose 8080 * compose changes * bugfixesformichael * don't build _test * merge in main * job_sync_runner
This commit is contained in:
@@ -1,11 +1,18 @@
|
||||
# compose.local.yaml
|
||||
---
|
||||
services:
|
||||
doc_init_runner:
|
||||
image: queryorchestration:latest
|
||||
command: ["./docInitRunner"]
|
||||
depends_on:
|
||||
- db
|
||||
- localstack
|
||||
localstack:
|
||||
condition: service_healthy
|
||||
db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "8081:8080"
|
||||
expose:
|
||||
- 8080
|
||||
environment:
|
||||
LOG_LEVEL: DEBUG
|
||||
QUEUE_URL: ${DOCUMENT_INIT_URL}
|
||||
@@ -48,12 +55,19 @@ services:
|
||||
AWS_S3_USE_PATH_STYLE: true
|
||||
networks:
|
||||
- server-network
|
||||
|
||||
doc_clean_runner:
|
||||
image: queryorchestration:latest
|
||||
command: ["./docCleanRunner"]
|
||||
depends_on:
|
||||
- db
|
||||
- localstack
|
||||
localstack:
|
||||
condition: service_healthy
|
||||
db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "8082:8080"
|
||||
expose:
|
||||
- 8080
|
||||
environment:
|
||||
LOG_LEVEL: DEBUG
|
||||
QUEUE_URL: ${DOCUMENT_CLEAN_URL}
|
||||
@@ -72,12 +86,19 @@ services:
|
||||
AWS_S3_USE_PATH_STYLE: true
|
||||
networks:
|
||||
- server-network
|
||||
|
||||
doc_text_runner:
|
||||
image: queryorchestration:latest
|
||||
command: ["./docTextRunner"]
|
||||
depends_on:
|
||||
- db
|
||||
- localstack
|
||||
localstack:
|
||||
condition: service_healthy
|
||||
db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "8083:8080"
|
||||
expose:
|
||||
- 8080
|
||||
environment:
|
||||
LOG_LEVEL: DEBUG
|
||||
QUEUE_URL: ${DOCUMENT_TEXT_URL}
|
||||
@@ -96,12 +117,19 @@ services:
|
||||
AWS_S3_USE_PATH_STYLE: true
|
||||
networks:
|
||||
- server-network
|
||||
|
||||
query_sync_runner:
|
||||
image: queryorchestration:latest
|
||||
command: ["./querySyncRunner"]
|
||||
depends_on:
|
||||
- db
|
||||
- localstack
|
||||
localstack:
|
||||
condition: service_healthy
|
||||
db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "8084:8080"
|
||||
expose:
|
||||
- 8080
|
||||
environment:
|
||||
LOG_LEVEL: DEBUG
|
||||
QUEUE_URL: ${QUERY_SYNC_URL}
|
||||
@@ -120,12 +148,19 @@ services:
|
||||
AWS_S3_USE_PATH_STYLE: true
|
||||
networks:
|
||||
- server-network
|
||||
|
||||
query_runner:
|
||||
image: queryorchestration:latest
|
||||
command: ["./queryRunner"]
|
||||
depends_on:
|
||||
- db
|
||||
- localstack
|
||||
localstack:
|
||||
condition: service_healthy
|
||||
db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "8085:8080"
|
||||
expose:
|
||||
- 8080
|
||||
environment:
|
||||
LOG_LEVEL: DEBUG
|
||||
QUEUE_URL: ${QUERY_URL}
|
||||
@@ -144,38 +179,17 @@ services:
|
||||
AWS_S3_USE_PATH_STYLE: true
|
||||
networks:
|
||||
- server-network
|
||||
job_sync_runner:
|
||||
image: queryorchestration:latest
|
||||
command: ["./jobSyncRunner"]
|
||||
depends_on:
|
||||
- db
|
||||
- localstack
|
||||
environment:
|
||||
LOG_LEVEL: DEBUG
|
||||
QUEUE_URL: ${JOB_SYNC_URL}
|
||||
DOCUMENT_SYNC_URL: ${DOCUMENT_SYNC_URL}
|
||||
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
|
||||
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
|
||||
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN}
|
||||
AWS_REGION: ${AWS_REGION}
|
||||
DB_USER: ${DB_USER}
|
||||
DB_PASS: ${DB_PASS}
|
||||
DB_HOST: db
|
||||
DB_PORT: 5432
|
||||
DB_NAME: ${DB_NAME}
|
||||
DB_NOSSL: ${DB_NOSSL}
|
||||
AWS_ENDPOINT_URL: "http://localstack:4566"
|
||||
AWS_S3_USE_PATH_STYLE: true
|
||||
networks:
|
||||
- server-network
|
||||
|
||||
query_service:
|
||||
image: queryorchestration:latest
|
||||
command: ["./queryService"]
|
||||
depends_on:
|
||||
- db
|
||||
- localstack
|
||||
localstack:
|
||||
condition: service_healthy
|
||||
db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- 8080:8080
|
||||
- "8086:8080"
|
||||
expose:
|
||||
- 8080
|
||||
environment:
|
||||
@@ -195,6 +209,47 @@ services:
|
||||
AWS_S3_USE_PATH_STYLE: true
|
||||
networks:
|
||||
- server-network
|
||||
|
||||
job_sync_runner:
|
||||
image: queryorchestration:latest
|
||||
command: ["./jobSyncRunner"]
|
||||
depends_on:
|
||||
localstack:
|
||||
condition: service_healthy
|
||||
db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "8087:8080"
|
||||
expose:
|
||||
- 8080
|
||||
environment:
|
||||
LOG_LEVEL: DEBUG
|
||||
QUEUE_URL: ${JOB_SYNC_URL}
|
||||
DOCUMENT_SYNC_URL: ${DOCUMENT_SYNC_URL}
|
||||
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
|
||||
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
|
||||
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN}
|
||||
AWS_REGION: ${AWS_REGION}
|
||||
DB_USER: ${DB_USER}
|
||||
DB_PASS: ${DB_PASS}
|
||||
DB_HOST: db
|
||||
DB_PORT: 5432
|
||||
DB_NAME: ${DB_NAME}
|
||||
DB_NOSSL: ${DB_NOSSL}
|
||||
AWS_ENDPOINT_URL: "http://localstack:4566"
|
||||
AWS_S3_USE_PATH_STYLE: true
|
||||
networks:
|
||||
- server-network
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus:latest
|
||||
ports:
|
||||
- "9091:9090"
|
||||
volumes:
|
||||
- ./prometheus.allmetrics.yaml:/etc/prometheus/prometheus.yml
|
||||
networks:
|
||||
- server-network
|
||||
|
||||
db:
|
||||
image: postgres:17.2-alpine3.21
|
||||
ports:
|
||||
@@ -214,6 +269,7 @@ services:
|
||||
retries: 5
|
||||
networks:
|
||||
- server-network
|
||||
|
||||
localstack:
|
||||
image: localstack/localstack:4.1.0
|
||||
ports:
|
||||
@@ -230,13 +286,14 @@ services:
|
||||
EAGER_SERVICE_LOADING: "1"
|
||||
expose:
|
||||
- 4566
|
||||
# healthcheck:
|
||||
# test: ["CMD-SHELL", "pg_isready -U ${DB_USER}"]
|
||||
# interval: 10s
|
||||
# timeout: 5s
|
||||
# retries: 5
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:4566/_localstack/health"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
networks:
|
||||
- server-network
|
||||
|
||||
volumes:
|
||||
db-data:
|
||||
networks:
|
||||
|
||||
@@ -19,7 +19,20 @@ services:
|
||||
retries: 5
|
||||
networks:
|
||||
- test-server-network
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus:latest
|
||||
ports:
|
||||
- "9090:9090"
|
||||
volumes:
|
||||
- ./prometheus.localservice.yaml:/etc/prometheus/prometheus.yml
|
||||
networks:
|
||||
- test-server-network
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
volumes:
|
||||
test-db-data:
|
||||
|
||||
networks:
|
||||
test-server-network:
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# prometheus.yml
|
||||
---
|
||||
global:
|
||||
scrape_interval: 10s
|
||||
|
||||
scrape_configs:
|
||||
- job_name: 'doc_init_runner'
|
||||
static_configs:
|
||||
- targets:
|
||||
- 'doc_init_runner:8080'
|
||||
metrics_path: '/metrics'
|
||||
|
||||
- job_name: 'doc_clean_runner'
|
||||
static_configs:
|
||||
- targets:
|
||||
- 'doc_clean_runner:8080'
|
||||
metrics_path: '/metrics'
|
||||
|
||||
- job_name: 'doc_text_runner'
|
||||
static_configs:
|
||||
- targets:
|
||||
- 'doc_text_runner:8080'
|
||||
metrics_path: '/metrics'
|
||||
|
||||
- job_name: 'query_sync_runner'
|
||||
static_configs:
|
||||
- targets:
|
||||
- 'query_sync_runner:8080'
|
||||
metrics_path: '/metrics'
|
||||
|
||||
- job_name: 'query_runner'
|
||||
static_configs:
|
||||
- targets:
|
||||
- 'query_runner:8080'
|
||||
metrics_path: '/metrics'
|
||||
|
||||
- job_name: 'query_service'
|
||||
static_configs:
|
||||
- targets:
|
||||
- 'query_service:8080'
|
||||
metrics_path: '/metrics'
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
global:
|
||||
scrape_interval: 10s
|
||||
|
||||
scrape_configs:
|
||||
- job_name: 'api'
|
||||
static_configs:
|
||||
- targets:
|
||||
- 'host.docker.internal:8080'
|
||||
metrics_path: '/metrics'
|
||||
@@ -0,0 +1,25 @@
|
||||
# Deployments
|
||||
|
||||
## Note about host service testing
|
||||
If you want the docker prometheus in this stack to pull from your
|
||||
locally running service on localhost:8080 then edit the
|
||||
`compose.local.yaml` and change the reference from
|
||||
`./prometheus.allmetrics.yaml:/etc/prometheus/prometheus.yml`
|
||||
to `./prometheus.localservice.yaml:/etc/prometheus/prometheus.yml`
|
||||
|
||||
|
||||
## Local
|
||||
When running `task compose:up:local` prometheus will be available on
|
||||
http://localhost:9090
|
||||
|
||||
When running `task compose:up` prometheus will be available on
|
||||
http://localhost:9091
|
||||
|
||||
To see which target services are being scraped by prometheus you can go to
|
||||
http:// localhost: [port] /targets
|
||||
|
||||
|
||||
### Local with service on host
|
||||
If you need to run a service directly on the host for debugging then use
|
||||
`task compose:up:test` and then run the service like
|
||||
`DB_PORT=5430 go run ./cmd/queryService`
|
||||
Reference in New Issue
Block a user