Skip to content

Commit

Permalink
chore: add type to providers_upload_duration_seconds metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Sep 3, 2023
1 parent abc03dd commit ea07bd3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ providersImageCount.set(IMAGE_PROVIDERS.filter(p => providersMap[p].isConfigured
export const timeProvidersUpload = new client.Histogram({
name: 'providers_upload_duration_seconds',
help: "Duration in seconds of provider's upload requests.",
labelNames: ['name'],
labelNames: ['name', 'type'],
buckets: [0.5, 1, 2, 5, 10, 15]
});

Expand Down
4 changes: 2 additions & 2 deletions src/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ export default function uploadToProviders(providers: string[], params: any) {

return Promise.any(
configuredProviders.map(async name => {
const end = timeProvidersUpload.startTimer({ name });
const type = params instanceof Buffer ? 'image' : 'json';
const end = timeProvidersUpload.startTimer({ name, type });

try {
countOpenProvidersRequest.inc({ name });

const result = await providersMap[name].set(params);
const size = (params instanceof Buffer ? params : Buffer.from(JSON.stringify(params)))
.length;
const type = params instanceof Buffer ? 'image' : 'json';
providersUploadSize.inc({ name, type }, size);

return result;
Expand Down

0 comments on commit ea07bd3

Please sign in to comment.