Skip to content

Commit b8927eb

Browse files
authored
feat: 默认开启 metrics 采集 (#82)
* feat: 默认开启 metrics 采集 * fix: 启用 metric 后只能起 1 个工作进程 * feat: 升级 bk-plugin-framework 版本 * fix: 添加 prometheus_multiproc_dir 参数
1 parent 2e1e804 commit b8927eb

3 files changed

Lines changed: 88 additions & 43 deletions

File tree

Lines changed: 84 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,86 @@
1-
spec_version: 2
1+
specVersion: 3
22
modules:
3-
default:
3+
- name: default
4+
isDefault: true
45
language: python
5-
is_default: true
6-
processes:
7-
web:
8-
command: gunicorn bk_plugin_runtime.wsgi --timeout 120 -k gthread --threads 16 -w 8 --max-requests=1000
9-
schedule:
10-
command: celery worker -A blueapps.core.celery -P threads -n schedule_worker@%h -c 500 -Q plugin_schedule,plugin_callback,schedule_delete -l INFO
11-
beat:
12-
command: celery beat -A blueapps.core.celery -l INFO
13-
env_variables:
14-
- key: PIP_VERSION
15-
value: 21.0
16-
description: pip version control
17-
- key: BK_APIGW_MANAGER_URL_TMPL
18-
value: {{cookiecutter.apigw_manager_url_tmpl}}
19-
description: pip version control
20-
- key: BK_APIGW_MANAGER_MAINTAINERS
21-
value: {{cookiecutter.init_apigw_maintainer}}
22-
description: plugin apigw managers
23-
- key: BK_INIT_SUPERUSER
24-
value: {{cookiecutter.init_admin}}
25-
description: plugin admin panel init superuser
26-
- key: BK_SOPS_APP_CODE
27-
value: bksops
28-
description: bk-sops app code
29-
- key: DJANGO_SETTINGS_MODULE
30-
value: bk_plugin_runtime.settings
31-
description: django settings module path
32-
- key: BK_APP_CONFIG_PATH
33-
value: bk_plugin_runtime.config
34-
description: blueapps config path
35-
- key: BK_APIGW_CORS_ALLOW_ORIGINS
36-
value: {{cookiecutter.apigw_cors_allow_origins}}
37-
description: apigw cors strategie allow origins
38-
- key: BK_APIGW_CORS_ALLOW_METHODS
39-
value: {{cookiecutter.apigw_cors_allow_methods}}
40-
description: apigw cors strategie allow methods
41-
- key: BK_APIGW_CORS_ALLOW_HEADERS
42-
value: {{cookiecutter.apigw_cors_allow_headers}}
43-
description: apigw cors strategie allow headers
6+
spec:
7+
processes:
8+
- name: web
9+
procCommand: gunicorn bk_plugin_runtime.wsgi --timeout 120 -k gthread --threads 16 -w 8 --max-requests=1000 --env prometheus_multiproc_dir=/tmp/
10+
services:
11+
- name: web
12+
exposedType:
13+
name: bk/http
14+
targetPort: 5000
15+
port: 80
16+
- name: metrics
17+
targetPort: 5001
18+
port: 5001
19+
- name: schedule
20+
procCommand: celery worker -A blueapps.core.celery -P threads -n schedule_worker@%h -c 500 -Q plugin_schedule,plugin_callback,schedule_delete -l INFO
21+
services:
22+
- name: metrics
23+
targetPort: 5001
24+
port: 5001
25+
- name: beat
26+
procCommand: celery beat -A blueapps.core.celery -l INFO
27+
services:
28+
- name: metrics
29+
targetPort: 5001
30+
port: 5001
31+
- name: c-monitor
32+
procCommand: celery-prometheus-exporter --broker amqp://$RABBITMQ_USER:$RABBITMQ_PASSWORD@$RABBITMQ_HOST:$RABBITMQ_PORT/$RABBITMQ_VHOST --addr 0.0.0.0:5001 --queue-list plugin_schedule plugin_callback schedule_delete
33+
services:
34+
- name: metrics
35+
targetPort: 5001
36+
port: 5001
37+
configuration:
38+
env:
39+
- name: PIP_VERSION
40+
value: 21.2.2
41+
description: pip version control
42+
- name: BK_APIGW_MANAGER_URL_TMPL
43+
value: {{cookiecutter.apigw_manager_url_tmpl}}
44+
description: pip version control
45+
- name: BK_APIGW_MANAGER_MAINTAINERS
46+
value: {{cookiecutter.init_apigw_maintainer}}
47+
description: plugin apigw managers
48+
- name: BK_INIT_SUPERUSER
49+
value: {{cookiecutter.init_admin}}
50+
description: plugin admin panel init superuser
51+
- name: BK_SOPS_APP_CODE
52+
value: bksops
53+
description: bk-sops app code
54+
- name: DJANGO_SETTINGS_MODULE
55+
value: bk_plugin_runtime.settings
56+
description: django settings module path
57+
- name: BK_APP_CONFIG_PATH
58+
value: bk_plugin_runtime.config
59+
description: blueapps config path
60+
- name: BK_APIGW_CORS_ALLOW_ORIGINS
61+
value: {{cookiecutter.apigw_cors_allow_origins}}
62+
description: apigw cors strategie allow origins
63+
- name: BK_APIGW_CORS_ALLOW_METHODS
64+
value: {{cookiecutter.apigw_cors_allow_methods}}
65+
description: apigw cors strategie allow methods
66+
- name: BK_APIGW_CORS_ALLOW_HEADERS
67+
value: {{cookiecutter.apigw_cors_allow_headers}}
68+
description: apigw cors strategie allow headers
69+
- name: ENABLE_METRICS
70+
value: 1
71+
description: enable metrics
72+
observability:
73+
monitoring:
74+
metrics:
75+
- process: web
76+
serviceName: metrics
77+
path: /metrics/
78+
- process: c-monitor
79+
serviceName: metrics
80+
path: /metrics/
81+
- process: beat
82+
serviceName: metrics
83+
path: /metrics/
84+
- process: schedule
85+
serviceName: metrics
86+
path: /metrics/
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# base
22
# DO NOT DELETE ANY PACKAGE IN base SECTION !!!
3-
bk-plugin-framework==2.2.3
3+
bk-plugin-framework==2.2.8
4+
# opentelemetry
5+
celery-prometheus-exporter==1.7.0
46
# add your custom requirements below this line
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python-3.6.12
1+
python-3.10.5

0 commit comments

Comments
 (0)