9 Commits

Author SHA1 Message Date
naomi 936f588f7e release: v1.1.1
Node.js CI / Lint and Test (push) Successful in 31s
2025-10-07 17:45:02 -07:00
naomi 52190a5112 chore(tools): lint and build before publishing 2025-10-07 17:44:42 -07:00
naomi f0481af558 release: v1.1.0-hotfix
Node.js CI / Lint and Test (push) Successful in 31s
2025-10-07 16:41:10 -07:00
naomi 6f4f06d143 chore: remove sonar workflow
Node.js CI / Lint and Test (push) Successful in 28s
2025-10-07 16:11:56 -07:00
naomi c997e83aa5 release: v1.1.0
Code Analysis / SonarQube (push) Failing after 18s
Node.js CI / Lint and Test (push) Successful in 35s
2025-10-07 16:09:40 -07:00
naomi f2f5d9b1b4 feat: add method for sending metrics 2025-10-07 16:09:20 -07:00
naomi b65f3a4d6d chore: add sonar workflow
Node.js CI / Lint and Test (push) Successful in 45s
Code Analysis / SonarQube (push) Successful in 1m1s
2025-02-26 13:30:09 -08:00
naomi 4f7f2d87e5 release: v1.0.0
Node.js CI / Lint and Test (push) Successful in 29s
2025-02-10 20:58:34 -08:00
naomi 9d9fa40bcb feat: initial prototype (#1)
Node.js CI / Lint and Test (push) Has been cancelled
### Explanation

_No response_

### Issue

_No response_

### Attestations

- [x] I have read and agree to the [Code of Conduct](https://docs.nhcarrigan.com/community/coc/)
- [x] I have read and agree to the [Community Guidelines](https://docs.nhcarrigan.com/community/guide/).
- [x] My contribution complies with the [Contributor Covenant](https://docs.nhcarrigan.com/dev/covenant/).

### Dependencies

- [x] I have pinned the dependencies to a specific patch version.

### Style

- [x] I have run the linter and resolved any errors.
- [x] My pull request uses an appropriate title, matching the conventional commit standards.
- [x] My scope of feat/fix/chore/etc. correctly matches the nature of changes in my pull request.

### Tests

- [ ] My contribution adds new code, and I have added tests to cover it.
- [ ] My contribution modifies existing code, and I have updated the tests to reflect these changes.
- [ ] All new and existing tests pass locally with my changes.
- [ ] Code coverage remains at or above the configured threshold.

### Documentation

_No response_

### Versioning

Major - My pull request introduces a breaking change.

Reviewed-on: #1
Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com>
Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
2025-02-10 20:58:23 -08:00
2 changed files with 32 additions and 1 deletions
+2 -1
View File
@@ -1,10 +1,11 @@
{ {
"name": "@nhcarrigan/logger", "name": "@nhcarrigan/logger",
"version": "0.0.1", "version": "1.1.1",
"description": "Our custom logging package, which pipes logs to our alerts server.", "description": "Our custom logging package, which pipes logs to our alerts server.",
"type": "module", "type": "module",
"main": "prod/index.js", "main": "prod/index.js",
"scripts": { "scripts": {
"prepublish": "pnpm lint && pnpm build",
"lint": "eslint src --max-warnings 0", "lint": "eslint src --max-warnings 0",
"build": "rm -rf prod && tsc", "build": "rm -rf prod && tsc",
"test": "echo \"Error: no test specified\" && exit 0" "test": "echo \"Error: no test specified\" && exit 0"
+30
View File
@@ -71,4 +71,34 @@ export class Logger {
method: "POST", method: "POST",
}); });
} }
/**
* Sends a counter metric to the alerting service.
* The alerting service is configured to handle aggregation, so you can send
* summative counts or individual increments. (e.g. Send a count of all users, or send a count of 1 every time a user joins).
* @param name -- The name of the metric to track.
* @param value -- The value of the metric to insert.
* @param metadata -- Any metadata to attach to the metric.
*/
public async metric(
name: string,
value: number,
metadata: Record<string, string | number | boolean>,
): Promise<void> {
await fetch(`${this.url}/metric`, {
body: JSON.stringify({
application: this.application,
metadata: metadata,
name: name,
value: value,
}),
headers: {
// eslint-disable-next-line @typescript-eslint/naming-convention -- Standard header name.
"Authorization": this.token,
// eslint-disable-next-line @typescript-eslint/naming-convention -- Standard header name.
"Content-Type": "application/json",
},
method: "POST",
});
}
} }