0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-22 08:40:03 +01:00
posthog/plugin-server/tests/helpers/metrics.ts
Xavier Vello 25cb653c1b
feat(ingestion): run all analytic events through populateTeamDataStep (#14341)
* team-manager: expire negative lookups after 5 minutes, improve docs
* populateTeamDataStep: don't drop token, keep team_id from capture if present, report results
* ingestEvent: run all analytic events through runLightweightCaptureEndpointEventPipeline
* continue accepting events with no token but a team_id
2023-02-22 14:24:05 +01:00

16 lines
421 B
TypeScript

import { register } from 'prom-client'
export function resetMetrics() {
register.resetMetrics()
}
export async function getMetricValues(metricName: string): Promise<any> {
const metrics = await register.getMetricsAsJSON()
for (const metric of metrics) {
if (metric.name === metricName) {
return (metric as any).values
}
}
throw Error(`Metric not found: ${metricName}`)
}