Metrics: Difference between revisions

From Svacer Wiki
(add setup part and prometheus config example)
(add grafana dashboard)
 
(One intermediate revision by one other user not shown)
Line 6: Line 6:
После этого метрики будут доступны по URL вашего сервера на '''/api/metrics'''
После этого метрики будут доступны по URL вашего сервера на '''/api/metrics'''
  <pre>http://localhost:8080/api/metrics</pre>
  <pre>http://localhost:8080/api/metrics</pre>
=== Добавление в Prometheus ===
Для сбора метрик Прометеусом добавьте в его конфиг-файл '''/etc/prometheus/prometheus.yml''' подобную запись, поменяв название, хост и порт на те что у вас
- job_name: svacer-metrics-example
  metrics_path: /api/metrics
  static_configs:
    - targets: ['svacer.ispras.ru:8080']


=== Список метрик ===
=== Список метрик ===
{| class="wikitable"
{| class="wikitable"
|+
|+
Line 22: Line 13:
!Описание
!Описание
|-
|-
|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
|}
|}
=== Добавление в Prometheus ===
Для сбора метрик Прометеусом добавьте в его конфиг-файл '''/etc/prometheus/prometheus.yml''' подобную запись, поменяв название, хост и порт на те что у вас
- job_name: svacer-metrics-example
  metrics_path: /api/metrics
  static_configs:
    - targets: ['svacer.ispras.ru:8080']
=== Grafana dashboard ===
Для визуализации метрик в [https://grafana.com Grafana] импортируете dashboard из файла [[Media:Grafana-dashboard-svacer.json|grafana-dashboard-svacer.json]]. В диалоге импорта выберите собирающий метрики Prometheus в качестве data source.

Latest revision as of 14:20, 27 September 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

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

Название Описание
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

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

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

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

Grafana dashboard

Для визуализации метрик в Grafana импортируете dashboard из файла grafana-dashboard-svacer.json. В диалоге импорта выберите собирающий метрики Prometheus в качестве data source.