Metrics: Difference between revisions

From Svacer Wiki
(add setup part and prometheus config example)
(add 'svacer_' prefix)
Line 22: Line 22:
!Описание
!Описание
|-
|-
|import_results_since_start
|svacer_active_imports
|The total number of imported results since last server start
|Number of active imports of svace/sarif results
|-
|-
|import_snapshots_since_start
|svacer_active_snapshot_exports
|The total number of imported snapshots since last server start
|Number of active snapshot exports
|-
|-
|review_changes_since_start
|svacer_active_snapshot_imports
|The total number of review modifications since start
|Number of active snapshot imports
|-
|-
|comment_changes_since_start
|svacer_comment_changes_since_start
|The total number of comment additions/deletions/modifications since start
|The total number of comment additions/deletions/modifications since start
|-
|-
|wsocket_sessions_counter
|svacer_import_results_since_start
|The total number of active web socket connections
|The total number of imported results since last server start
|-
|svacer_import_snapshots_since_start
|The total number of imported snapshots since last server start
|-
|-
|rest_import_svace_dirs
|svacer_rest_import_svace_dirs
|The total number of import svace dir requests via REST endpoint
|The total number of import svace dir requests via REST endpoint
|-
|-
|rest_import_svace_dirs_success
|svacer_rest_import_svace_dirs_failed
|The total number of success import svace dir requests via REST endpoint
|-
|rest_import_svace_dirs_failed
|The total number of failed import svace dir requests via REST endpoint
|The total number of failed import svace dir requests via REST endpoint
|-
|-
|active_imports
|svacer_rest_import_svace_dirs_success
|Number of active imports of svace/sarif results
|The total number of success import svace dir requests via REST endpoint
|-
|-
|active_snapshot_imports
|svacer_review_changes_since_start
|Number of active snapshot imports
|The total number of review modifications since start
|-
|-
|active_snapshot_exports
|svacer_wsocket_sessions_counter
|Number of active snapshot exports
|The total number of active web socket connections
|}
|}

Revision as of 12:17, 4 July 2024

Включение метрик

Для включения метрик запустите сервер Svacer с переменной окружения SVACER_TRACE_OPTIONS=prom_metrics_on

SVACER_TRACE_OPTIONS=prom_metrics_on svacer-server run

После этого метрики будут доступны по URL вашего сервера на /api/metrics

http://localhost:8080/api/metrics

Добавление в Prometheus

Для сбора метрик Прометеусом добавьте в его конфиг-файл /etc/prometheus/prometheus.yml подобную запись, поменяв название, хост и порт на те что у вас

- job_name: svacer-metrics-example
  metrics_path: /api/metrics
  static_configs:
    - targets: ['svacer.ispras.ru:8080']

Список метрик

Название Описание
svacer_active_imports Number of active imports of svace/sarif results
svacer_active_snapshot_exports Number of active snapshot exports
svacer_active_snapshot_imports Number of active snapshot imports
svacer_comment_changes_since_start The total number of comment additions/deletions/modifications since start
svacer_import_results_since_start The total number of imported results since last server start
svacer_import_snapshots_since_start The total number of imported snapshots since last server start
svacer_rest_import_svace_dirs The total number of import svace dir requests via REST endpoint
svacer_rest_import_svace_dirs_failed The total number of failed import svace dir requests via REST endpoint
svacer_rest_import_svace_dirs_success The total number of success import svace dir requests via REST endpoint
svacer_review_changes_since_start The total number of review modifications since start
svacer_wsocket_sessions_counter The total number of active web socket connections