mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-13 04:45:19 +00:00
rename some prom metrics and cleanup unused
This commit is contained in:
parent
fab2fea562
commit
8531b14a82
2 changed files with 6 additions and 22 deletions
|
|
@ -5,13 +5,11 @@ export class PromClient {
|
||||||
private registry: Registry;
|
private registry: Registry;
|
||||||
private app: express.Application;
|
private app: express.Application;
|
||||||
public activeRepoIndexingJobs: Gauge<string>;
|
public activeRepoIndexingJobs: Gauge<string>;
|
||||||
public repoIndexingDuration: Histogram<string>;
|
public repoIndexingReattemptsTotal: Counter<string>;
|
||||||
public repoIndexingErrorTotal: Counter<string>;
|
|
||||||
public repoIndexingFailTotal: Counter<string>;
|
public repoIndexingFailTotal: Counter<string>;
|
||||||
public repoIndexingSuccessTotal: Counter<string>;
|
public repoIndexingSuccessTotal: Counter<string>;
|
||||||
|
|
||||||
public activeRepoGarbageCollectionJobs: Gauge<string>;
|
public activeRepoGarbageCollectionJobs: Gauge<string>;
|
||||||
public repoGarbageCollectionDuration: Histogram<string>;
|
|
||||||
public repoGarbageCollectionErrorTotal: Counter<string>;
|
public repoGarbageCollectionErrorTotal: Counter<string>;
|
||||||
public repoGarbageCollectionFailTotal: Counter<string>;
|
public repoGarbageCollectionFailTotal: Counter<string>;
|
||||||
public repoGarbageCollectionSuccessTotal: Counter<string>;
|
public repoGarbageCollectionSuccessTotal: Counter<string>;
|
||||||
|
|
@ -28,19 +26,12 @@ export class PromClient {
|
||||||
});
|
});
|
||||||
this.registry.registerMetric(this.activeRepoIndexingJobs);
|
this.registry.registerMetric(this.activeRepoIndexingJobs);
|
||||||
|
|
||||||
this.repoIndexingDuration = new Histogram({
|
this.repoIndexingReattemptsTotal = new Counter({
|
||||||
name: 'repo_indexing_duration',
|
name: 'repo_indexing_reattempts',
|
||||||
help: 'The duration of repo indexing jobs',
|
help: 'The number of repo indexing reattempts',
|
||||||
labelNames: ['repo'],
|
labelNames: ['repo'],
|
||||||
});
|
});
|
||||||
this.registry.registerMetric(this.repoIndexingDuration);
|
this.registry.registerMetric(this.repoIndexingReattemptsTotal);
|
||||||
|
|
||||||
this.repoIndexingErrorTotal = new Counter({
|
|
||||||
name: 'repo_indexing_errors',
|
|
||||||
help: 'The number of repo indexing errors',
|
|
||||||
labelNames: ['repo'],
|
|
||||||
});
|
|
||||||
this.registry.registerMetric(this.repoIndexingErrorTotal);
|
|
||||||
|
|
||||||
this.repoIndexingFailTotal = new Counter({
|
this.repoIndexingFailTotal = new Counter({
|
||||||
name: 'repo_indexing_fails',
|
name: 'repo_indexing_fails',
|
||||||
|
|
@ -63,13 +54,6 @@ export class PromClient {
|
||||||
});
|
});
|
||||||
this.registry.registerMetric(this.activeRepoGarbageCollectionJobs);
|
this.registry.registerMetric(this.activeRepoGarbageCollectionJobs);
|
||||||
|
|
||||||
this.repoGarbageCollectionDuration = new Histogram({
|
|
||||||
name: 'repo_garbage_collection_duration',
|
|
||||||
help: 'The duration of repo garbage collection jobs',
|
|
||||||
labelNames: ['repo'],
|
|
||||||
});
|
|
||||||
this.registry.registerMetric(this.repoGarbageCollectionDuration);
|
|
||||||
|
|
||||||
this.repoGarbageCollectionErrorTotal = new Counter({
|
this.repoGarbageCollectionErrorTotal = new Counter({
|
||||||
name: 'repo_garbage_collection_errors',
|
name: 'repo_garbage_collection_errors',
|
||||||
help: 'The number of repo garbage collection errors',
|
help: 'The number of repo garbage collection errors',
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,7 @@ export class RepoManager implements IRepoManager {
|
||||||
break;
|
break;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
attempts++;
|
attempts++;
|
||||||
this.promClient.repoIndexingErrorTotal.inc();
|
this.promClient.repoIndexingReattemptsTotal.inc();
|
||||||
if (attempts === maxAttempts) {
|
if (attempts === maxAttempts) {
|
||||||
this.logger.error(`Failed to sync repository ${repo.id} after ${maxAttempts} attempts. Error: ${error}`);
|
this.logger.error(`Failed to sync repository ${repo.id} after ${maxAttempts} attempts. Error: ${error}`);
|
||||||
throw error;
|
throw error;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue