efc0de230a
* fix: stabilize history timestamps and telemetry docs * fix: preserve numeric epoch cursors in history SQLite queries Normalize mixed ISO and unixepoch time values for incremental resume and scoped dedup so legacy numeric rows are not dropped by julianday filters. Co-authored-by: Cursor <cursoragent@cursor.com> * Bump version to v1.1.2 * fix: aggregate incremental start timestamps in SQLite Use MAX on the normalized time expression with GROUP BY so incremental resume loaders stay O(groups) instead of materializing every history row. Co-authored-by: Cursor <cursoragent@cursor.com> * test: parametrize duplicated incremental-start cases in TestIncrementalStart Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
1.3 KiB
1.3 KiB
Telemetry
::: mt5cli.telemetry
Enabling OpenTelemetry metrics
Install the optional exporter dependencies with:
uv add 'mt5cli[otel]'
Then enable the default OTLP HTTP pipeline:
from mt5cli.telemetry import enable_otel_metrics
enable_otel_metrics(service_name="mt5cli")
When readers=None, enable_otel_metrics() builds a
PeriodicExportingMetricReader backed by the OTLP HTTP exporter and reads the
endpoint from OTEL_EXPORTER_OTLP_ENDPOINT.
If your application already owns an OpenTelemetry Meter, wire mt5cli into it
directly with configure_metrics(meter).
Emitted metric names
enable_otel_metrics() / configure_metrics() register these instruments:
mt5_history_update_duration_secondsmt5_history_update_rows_totalmt5_history_update_failures_totalmt5_snapshot_update_duration_secondsmt5_snapshot_update_failures_totalmt5_account_balancemt5_account_equitymt5_account_marginmt5_account_margin_freemt5_account_margin_levelmt5_position_profitmt5_position_volumemt5_terminal_connectedmt5_terminal_trade_allowedmt5_terminal_trade_expertmt5_last_successful_update_timestamp
The history metrics use a dataset attribute. Account and position gauges add
labels such as login, server, and symbol where applicable.