-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: calculate the size of the bucket (#13)
* feat: calculate the size of the bucket * chore: upgrade deps * chore: prepare v0.0.4
- Loading branch information
1 parent
9035a63
commit 5c0c466
Showing
5 changed files
with
904 additions
and
795 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "s3-prometheus-exporter", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "S3 data exporter for prometheus", | ||
"author": "Tchoupinax <[email protected]> (https://corentinfiloche.xyz)", | ||
"license": "MIT", | ||
|
@@ -21,25 +21,25 @@ | |
"watch": "nodemon --exec vite-node --options.deps.inline=\"@aws-sdk\" src/index.ts" | ||
}, | ||
"dependencies": { | ||
"@aws-sdk/client-s3": "3.456.0", | ||
"@aws-sdk/client-s3": "3.478.0", | ||
"config": "3.3.9", | ||
"express": "4.18.2", | ||
"fastify": "4.24.3", | ||
"fastify": "4.25.2", | ||
"moment": "2.29.4", | ||
"pino": "8.16.2", | ||
"pino-pretty": "10.2.3", | ||
"pino": "8.17.1", | ||
"pino-pretty": "10.3.0", | ||
"pretty-bytes": "6.1.1", | ||
"prom-client": "15.0.0", | ||
"vite-node": "0.34.6", | ||
"vitest": "0.34.6" | ||
"prom-client": "15.1.0", | ||
"vite-node": "1.1.0", | ||
"vitest": "1.1.0" | ||
}, | ||
"devDependencies": { | ||
"@types/config": "3.3.3", | ||
"@types/express": "4.17.21", | ||
"@types/node": "20.10.0", | ||
"@types/node": "20.10.5", | ||
"esbuild-plugin-tsc": "0.4.0", | ||
"eslint-config-tchoupinax": "1.0.3", | ||
"nodemon": "3.0.1", | ||
"nodemon": "3.0.2", | ||
"typescript": "5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { _Object } from "@aws-sdk/client-s3"; | ||
import { Gauge, Registry } from "prom-client"; | ||
|
||
import { Metric } from "../metric"; | ||
|
||
export default class extends Metric { | ||
constructor () { | ||
super("bucket_size", "global"); | ||
} | ||
|
||
declarePrometheusMesure (register: Registry): Gauge<any> { | ||
return new Gauge({ | ||
name: this.name(), | ||
help: "Size of the bucket (in Bytes)", | ||
labelNames: ["name"], | ||
registers: [register], | ||
}); | ||
} | ||
|
||
process (files: _Object[]): number { | ||
return files.reduce((acc: number, cur: _Object) => { | ||
return cur.Size! + acc; | ||
}, 0); | ||
} | ||
} |
Oops, something went wrong.