Skip to content

Commit

Permalink
fix: don't filter empty instrumentation library metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
seemk committed Mar 4, 2022
1 parent a5c3ad3 commit a6b1bea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,11 @@ export class PeriodicExportingMetricReader extends MetricReader {
private async _runOnce(): Promise<void> {
const metrics = await this.collect({});

return new Promise((resolve, reject) => {
if (metrics === undefined) {
resolve();
return;
}
if (metrics === undefined) {
return;
}

return new Promise((resolve, reject) => {
this._exporter.export(metrics, result => {
if (result.code !== ExportResultCode.SUCCESS) {
reject(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class MetricCollector implements MetricProducer {
async collect(): Promise<ResourceMetrics> {
const collectionTime = hrTime();
const instrumentationLibraryMetrics = (await Promise.all(this._sharedState.meters
.map(meter => meter.collect(this, collectionTime)))).filter(({ metrics }) => metrics.length > 0);
.map(meter => meter.collect(this, collectionTime))));

return {
resource: this._sharedState.resource,
Expand Down

0 comments on commit a6b1bea

Please sign in to comment.