Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(metrics): don't assign a timestamp to Prometheus metrics, let the scraper assign the timestamp to the time series
perf3ctc0dfee843915
diff --git a/apps/server/src/etapi/metrics.ts b/apps/server/src/etapi/metrics.tsindex 972a6e4e7a..d460266472 100644--- a/apps/server/src/etapi/metrics.ts+++ b/apps/server/src/etapi/metrics.ts@@ -43,7 +43,6 @@ interface MetricsData {*/function formatPrometheusMetrics(data: MetricsData): string {const lines: string[] = [];- const timestamp = Math.floor(new Date(data.timestamp).getTime() / 1000);// Helper function to add a metricconst 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(',')}}`: '';- lines.push(`${name}${labelStr} ${value} ${timestamp}`);+ lines.push(`${name}${labelStr} ${value}`);lines.push('');};