Skip to main content
Version: v4

Legacy Prometheus endpoint

Before v4, SuiviBourse stored its data in Prometheus. To keep pre-v4 deployments working, the app still exposes a Prometheus /metrics endpoint in parallel with the InfluxDB writer.

It is enabled by default and reflects only the current snapshot of each share — there is no historical data or backfill on this endpoint (that lives in InfluxDB).

Configuration

VariableDefaultDescription
SB_PROMETHEUS_ENABLEDtrueExpose the /metrics endpoint
SB_METRICS_PORT8081TCP port for the endpoint

To disable it entirely:

SB_PROMETHEUS_ENABLED=false

Exposed gauges

All gauges are prefixed with sb_ and carry the labels share_name and share_symbol.

MetricDescription
sb_share_priceCurrent market price
sb_purchased_quantityQuantity purchased
sb_purchased_priceWeighted average cost price
sb_purchased_feeTotal fees
sb_owned_quantityCurrently owned quantity
sb_received_dividendTotal dividends received
sb_dividend_yieldDividend yield (percentage)
sb_pe_ratioPrice-to-Earnings ratio
sb_market_capMarket capitalization
sb_volumeTrading volume
sb_share_infoAlways 1; carries extra labels share_currency, share_exchange, quote_type

Scraping with Prometheus

Add a static scrape config pointing at the app:

/etc/prometheus/prometheus.yaml
scrape_configs:
- job_name: 'suivi-bourse'
scrape_interval: '120s'
static_configs:
- targets: ['localhost:8081']

Exporting to other databases

Because the endpoint speaks the Prometheus/OpenMetrics format, you can use Telegraf to forward it to other systems (ElasticSearch, InfluxDB v1/v2, MongoDB, …):

# Read metrics from the SuiviBourse app
[[inputs.prometheus]]
## URLs to scrape metrics from
urls = ["http://localhost:8081/metrics"]

## Metric version 1 or 2
metric_version = 1

## Optional tag added to every scraped metric
url_tag = "suivi-bourse"
tip

For historical data and long-term storage, prefer the native InfluxDB 3 integration — the Prometheus endpoint only carries the latest snapshot.