vaticle / typedb

TypeDB: the polymorphic database powered by types
https://typedb.com
Mozilla Public License 2.0
3.72k stars 337 forks source link

Metrics and diagnostics service #6989

Closed dmitrii-ubskii closed 3 months ago

dmitrii-ubskii commented 4 months ago

Usage and product changes

We introduce a metrics and diagnostics service. The web endpoint is bound at port 4104 by default and exposes metrics formatted for prometheus (http://localhost:4104/metrics?format=prometheus) or as JSON (http://localhost:4104/metrics?format=JSON).

Example metrics:

# TypeDB version: TypeDB Core 2.26.6
# Time zone: Europe/London
# Java version: Azul Systems, Inc. 11.0.15
# Platform: Mac OS X aarch64 13.6.3

# TYPE typedb_attempted_requests_total counter
typedb_attempted_requests_total{kind="CONNECTION_OPEN"} 625
typedb_attempted_requests_total{kind="SERVERS_ALL"} 625
typedb_attempted_requests_total{kind="USER_MANAGEMENT"} 0
typedb_attempted_requests_total{kind="USER"} 0
typedb_attempted_requests_total{kind="DATABASE_MANAGEMENT"} 2606
typedb_attempted_requests_total{kind="DATABASE"} 252
typedb_attempted_requests_total{kind="SESSION"} 1207
typedb_attempted_requests_total{kind="TRANSACTION"} 2835

# TYPE typedb_successful_requests_total counter
typedb_successful_requests_total{kind="CONNECTION_OPEN"} 625
typedb_successful_requests_total{kind="SERVERS_ALL"} 625
typedb_successful_requests_total{kind="USER_MANAGEMENT"} 0
typedb_successful_requests_total{kind="USER"} 0
typedb_successful_requests_total{kind="DATABASE_MANAGEMENT"} 2606
typedb_successful_requests_total{kind="DATABASE"} 252
typedb_successful_requests_total{kind="SESSION"} 1207
typedb_successful_requests_total{kind="TRANSACTION"} 2755

# TYPE typedb_current_count gauge
typedb_current_count{kind="DATABASES"} 2
typedb_current_count{kind="SESSIONS"} 1
typedb_current_count{kind="TRANSACTIONS"} 1
typedb_current_count{kind="USERS"} 0

# TYPE typedb_error_total counter
typedb_error_total{code="TXN23"} 2
typedb_error_total{code="QRY22"} 4
typedb_error_total{code="TXN19"} 2
typedb_error_total{code="THR10"} 19

We also extract the metrics reporter into a separate module within the diagnostics package and redirect it to the dedicated diagnostics service.

vaticle-bot commented 4 months ago

PR Review Checklist

Do not edit the content of this comment. The PR reviewer should simply update this comment by ticking each review item below, as they get completed.


Trivial Change

Code

Architecture