Skip to content

Commit

Permalink
fixup! feat(instrumentation): added synchronous gauge to SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
clintonb committed Mar 23, 2024
1 parent 475ba67 commit 6131e5e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/sdk-metrics/src/Instruments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
ValueType,
UpDownCounter,
Counter,
Gauge,
Histogram,
Observable,
ObservableCallback,
Expand All @@ -37,6 +36,7 @@ import {
AsyncWritableMetricStorage,
WritableMetricStorage,
} from './state/WritableMetricStorage';
import { Gauge } from './types';

export class SyncInstrument {
constructor(
Expand Down
11 changes: 11 additions & 0 deletions packages/sdk-metrics/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Context, MetricAttributes } from '@opentelemetry/api';

export type CommonReaderOptions = {
timeoutMillis?: number;
Expand All @@ -23,3 +24,13 @@ export type CollectionOptions = CommonReaderOptions;
export type ShutdownOptions = CommonReaderOptions;

export type ForceFlushOptions = CommonReaderOptions;

// NOTE: This is here because of the strange dependency on api?
export interface Gauge<
AttributesTypes extends MetricAttributes = MetricAttributes,
> {
/**
* Records a measurement. Value of the measurement must not be negative.
*/
record(value: number, attributes?: AttributesTypes, context?: Context): void;
}

0 comments on commit 6131e5e

Please sign in to comment.