Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: @opentelemetry/metrics fails to run due to bad import #881

Merged
merged 2 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/opentelemetry-metrics/src/Meter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
import { LabelSet } from './LabelSet';
import { Batcher, UngroupedBatcher } from './export/Batcher';
import { PushController } from './export/Controller';
import { NoopExporter } from '../test/mocks/Exporter';
import { NoopExporter } from './export/NoopExporter';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is to use ConsoleMetricExporter as a default metric exporter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or InMemoryMetricExporter similar to InMemorySpanExporter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think no-op is better. We can create a more fancy version of no-op if a need arises later.


/**
* Meter is an implementation of the {@link Meter} interface.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2019, OpenTelemetry Authors
* Copyright 2020, OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,19 +14,16 @@
* limitations under the License.
*/

import { MetricExporter, MetricRecord } from '../../src/export/types';
import { MetricExporter, MetricRecord } from './types';
import { ExportResult } from '@opentelemetry/base';
import { EventEmitter } from 'events';

export class NoopExporter extends EventEmitter implements MetricExporter {
export class NoopExporter implements MetricExporter {
// By default does nothing
export(
metrics: MetricRecord[],
resultCallback: (result: ExportResult) => void
): void {
this.emit('export', metrics, resultCallback);
}
): void {}

shutdown(): void {
this.emit('shutdown');
}
// By default does nothing
shutdown(): void {}
}