Skip to content

Commit

Permalink
CLEAN
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael O'Brien committed Sep 5, 2023
1 parent 556c5e0 commit 2e520ed
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 54 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

CustomMetrics is a NodeJS library to emit and query custom metrics for AWS apps.

>CustomMetrics is under active development and is not (yet) ready for production use. This README documentation is incomplete. All feedback is welcome.
## Background

AWS CloudWatch offers metrics to monitor specific aspects of your apps that are not covered by the default AWS infrastructure metrics.
Expand Down
18 changes: 4 additions & 14 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,25 +419,12 @@ export class CustomMetrics {
(buffer.count && elt.count >= buffer.count) ||
this.timestamp >= elt.timestamp
) {
/* KEEP
this.log.trace(
`Emit buffered metric ${namespace}/${metricName} = ${point.sum}, sum ${elt.sum} count ${
elt.count
} remaining ${elt.timestamp - this.timestamp}`
) */
point.timestamp = elt.timestamp
await this.emitDimensionedMetric(namespace, metricName, point, dimensions, options)
}
elt.count += point.count
elt.sum += point.sum

/* KEEP
this.log.trace(
`Buffer metric ${namespace}/${metricName} = sum ${elt.sum} count ${elt.count}, remaining ${
elt.timestamp - this.timestamp
}`, {buffers: this.buffers}
) */

CustomMetrics.saveInstance({key}, this)
return {
spans: [{points: [{count: elt.count, sum: elt.sum}]}],
Expand Down Expand Up @@ -1102,9 +1089,9 @@ export class CustomMetrics {
}

/*
UNDOCUMENTED DEPRECATED
Allocate a CustomMetrics instance from the cache
*/
//REMOVE
static allocInstance(tags: object, options: MetricOptions = {}) {
let key = JSON.stringify(tags)
let metrics = Instances[key]
Expand All @@ -1114,6 +1101,7 @@ export class CustomMetrics {
return metrics
}

//REMOVE
static freeInstance(tags: object) {
let key = JSON.stringify(tags)
delete Instances[key]
Expand All @@ -1123,6 +1111,7 @@ export class CustomMetrics {
delete Instances[key]
}

//REMOVE
static getInstance(tags: object) {
let key = JSON.stringify(tags)
return Instances[key]
Expand All @@ -1133,6 +1122,7 @@ export class CustomMetrics {
Instances[key] = metrics
}

//REMOVE
static getCache() {
return Instances
}
Expand Down
38 changes: 0 additions & 38 deletions test/cache.ts

This file was deleted.

0 comments on commit 2e520ed

Please sign in to comment.