Skip to content

Commit

Permalink
fix: Add metrics for old proxy forward (#6695)
Browse files Browse the repository at this point in the history
This change adds a new prometheus counter to all us to capture when we
automatically forward traffic from old /proxy paths to the /api/frontend
path.


![image](https://github.com/Unleash/unleash/assets/158948/639a4ade-4758-41e6-b87b-a497f00313fa)
  • Loading branch information
ivarconr authored Mar 26, 2024
1 parent 91b3336 commit d065905
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ export default class MetricsMonitor {
help: 'Number of times a feature toggle has been used',
labelNames: ['toggle', 'active', 'appName'],
});
const oldEmbeddedProxyForwardCounter = createCounter({
name: 'old_embedded_proxy_forward_total',
help: 'Number of times we forwarded old embedded proxy requests',
labelNames: ['path', 'method'],
});
const featureTogglesTotal = createGauge({
name: 'feature_toggles_total',
help: 'Number of feature toggles',
Expand Down Expand Up @@ -600,6 +605,11 @@ export default class MetricsMonitor {
}
});

// On purpose a hard-coded string. Will we removed when we are done migrating.
eventBus.on('OLD_EMBEDDED_PROXY_REQUEST', ({ path, method }) => {
oldEmbeddedProxyForwardCounter.labels({ path, method }).inc();
});

await this.configureDbMetrics(db, eventBus, schedulerService);

return Promise.resolve();
Expand Down

0 comments on commit d065905

Please sign in to comment.