Skip to content

Commit

Permalink
TEST: add trace
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael O'Brien committed Jul 10, 2024
1 parent 9d54249 commit 4bd7ecd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ export class CustomMetrics {
let dimensions = this.makeDimensionString(dim)
let old = await this.getMetric(owner, namespace, metricName, dimensions, options.log)
metric = this.upgradeMetric(old)
await this.putMetric(metric, options)
}
return metric
}
Expand Down
3 changes: 3 additions & 0 deletions test/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ test('Upgrade Spans', async () => {
expect(metric.spans[1].points.length).toBe(12)
expect(metric.spans[2].points.length).toBe(1)
expect(metric.spans[3].points.length).toBe(0)
dump(metric)

// Test upgrade
metrics = new CustomMetrics({client, table, log: true, spans: MoreSpans})
Expand All @@ -52,6 +53,7 @@ test('Upgrade Spans', async () => {
// Test downgrade
metrics = new CustomMetrics({client, table, log: true, spans: LessSpans})
metric = await metrics.emit('test/upgrade', 'UpMetric', 7, [], {upgrade: true})
dump(metric)
expect(metric).toBeDefined()
expect(metric.spans.length).toBe(2)
expect(metric.spans[0].points.length).toBe(1)
Expand All @@ -64,5 +66,6 @@ test('Upgrade Spans', async () => {
// Test already upgraded
metrics = new CustomMetrics({client, table, log: true, spans: LessSpans})
metric = await metrics.emit('test/upgrade', 'UpMetric', 7, [], {upgrade: true})
dump(metric)
expect(metric).toBeDefined()
})

0 comments on commit 4bd7ecd

Please sign in to comment.