Skip to content

Commit

Permalink
fix(services): fix runtime exporter metrics data caching issue (#1663)
Browse files Browse the repository at this point in the history
* Fix metrics data caching issue

* chore
  • Loading branch information
HUAHUAI23 committed Nov 9, 2023
1 parent dfcdb9f commit 9e8ee08
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions build/charts/laf-server/templates/rumtime-exporter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ spec:
- interval: 60s
path: "/runtime/metrics/{{ .Values.default_region.runtime_exporter_secret}}"
scrapeTimeout: 10s
honorLabels: true
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
Expand Down
3 changes: 3 additions & 0 deletions services/runtime-exporter/src/handler/get-runtime-metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ const getRuntimeMetrics: RequestHandler = async (req, res) => {
return res.status(403).send('forbidden')
}

// Clear the metrics data generated by the last request
register.clear()

const runtimeMetrics =
await ClusterService.getRuntimePodMetricsForAllNamespaces()

Expand Down

0 comments on commit 9e8ee08

Please sign in to comment.