mirror of
https://github.com/zadam/trilium.git
synced 2025-10-21 07:38:53 +02:00
fix(metrics): don't assign a timestamp to Prometheus metrics, let the scraper assign the timestamp to the time series
This commit is contained in:
parent
fc98240614
commit
c0dfee8439
@ -43,7 +43,6 @@ interface MetricsData {
|
|||||||
*/
|
*/
|
||||||
function formatPrometheusMetrics(data: MetricsData): string {
|
function formatPrometheusMetrics(data: MetricsData): string {
|
||||||
const lines: string[] = [];
|
const lines: string[] = [];
|
||||||
const timestamp = Math.floor(new Date(data.timestamp).getTime() / 1000);
|
|
||||||
|
|
||||||
// Helper function to add a metric
|
// Helper function to add a metric
|
||||||
const addMetric = (name: string, value: number | null, help: string, type: string = 'gauge', labels: Record<string, string> = {}) => {
|
const addMetric = (name: string, value: number | null, help: string, type: string = 'gauge', labels: Record<string, string> = {}) => {
|
||||||
@ -56,7 +55,7 @@ function formatPrometheusMetrics(data: MetricsData): string {
|
|||||||
? `{${Object.entries(labels).map(([k, v]) => `${k}="${v}"`).join(',')}}`
|
? `{${Object.entries(labels).map(([k, v]) => `${k}="${v}"`).join(',')}}`
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
lines.push(`${name}${labelStr} ${value} ${timestamp}`);
|
lines.push(`${name}${labelStr} ${value}`);
|
||||||
lines.push('');
|
lines.push('');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user