Skip to content

Commit

Permalink
Merge branch 'more-db-semantic-conventions' of github.com:naseemkulla…
Browse files Browse the repository at this point in the history
…h/opentelemetry-js into more-db-semantic-conventions
  • Loading branch information
Naseem committed Jul 8, 2020
2 parents 86ead4e + 2d66658 commit ab5ac2b
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions packages/opentelemetry-metrics/src/Meter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { BatchObserverMetric } from './BatchObserverMetric';
import { BaseBoundInstrument } from './BoundInstrument';
import { UpDownCounterMetric } from './UpDownCounterMetric';
import { CounterMetric } from './CounterMetric';
import { MetricRecord } from './export/types';
import { ValueRecorderMetric } from './ValueRecorderMetric';
import { Metric } from './Metric';
import { ValueObserverMetric } from './ValueObserverMetric';
Expand Down Expand Up @@ -231,20 +230,14 @@ export class Meter implements api.Meter {
* each aggregator belonging to the metrics that were created with this
* meter instance.
*/
collect(): Promise<unknown> {
return new Promise((resolve, reject) => {
const metrics: Promise<MetricRecord[]>[] = [];
Array.from(this._metrics.values()).forEach(metric => {
metrics.push(metric.getMetricRecord());
async collect(): Promise<void> {
const metrics = Array.from(this._metrics.values()).map(metric => {
return metric.getMetricRecord();
});
await Promise.all(metrics).then(records => {
records.forEach(metrics => {
metrics.forEach(metric => this._batcher.process(metric));
});
Promise.all(metrics)
.then(records => {
records.forEach(metrics => {
metrics.forEach(metric => this._batcher.process(metric));
});
resolve();
})
.catch(reject);
});
}

Expand Down

0 comments on commit ab5ac2b

Please sign in to comment.