-
Notifications
You must be signed in to change notification settings - Fork 1k
PoC: widen 'Attributes' to support the extended AnyValue #6579
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
base: main
Are you sure you want to change the base?
Changes from 5 commits
0b70688
d438f46
2b2f308
5469036
74282bd
2ca3075
31b15cd
29b0978
6303b2c
34f8ee8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| /** | ||
| * AnyValue can be: | ||
| * - a string, number, boolean value | ||
| * - a byte array (Uint8Array) | ||
| * - array of any value | ||
| * - map from string to any value | ||
| * - empty value | ||
| * | ||
| * https://opentelemetry.io/docs/specs/otel/common/#anyvalue | ||
| * | ||
| * @since 1.3.0 | ||
| */ | ||
| export type AnyValue = | ||
| | string | ||
| | number | ||
| | boolean | ||
| | Uint8Array | ||
| | Array<AnyValue> | ||
| | AnyValueMap | ||
| | null | ||
| | undefined; | ||
|
|
||
| interface AnyValueMap { | ||
| [attributeKey: string]: AnyValue; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,12 +3,12 @@ | |
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import type { Attributes } from '../common/Attributes'; | ||
| import type { | ||
| BatchObservableCallback, | ||
| Counter, | ||
| Gauge, | ||
| Histogram, | ||
| MetricAttributes, | ||
| MetricOptions, | ||
| Observable, | ||
| ObservableCounter, | ||
|
|
@@ -44,7 +44,7 @@ export interface Meter { | |
| * @param name the name of the metric. | ||
| * @param [options] the metric options. | ||
| */ | ||
| createGauge<AttributesTypes extends MetricAttributes = MetricAttributes>( | ||
| createGauge<AttributesTypes extends Attributes = Attributes>( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q: What is the |
||
| name: string, | ||
| options?: MetricOptions | ||
| ): Gauge<AttributesTypes>; | ||
|
|
@@ -54,7 +54,7 @@ export interface Meter { | |
| * @param name the name of the metric. | ||
| * @param [options] the metric options. | ||
| */ | ||
| createHistogram<AttributesTypes extends MetricAttributes = MetricAttributes>( | ||
| createHistogram<AttributesTypes extends Attributes = Attributes>( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a lot of s/{Metric,Span}Attributes/Attributes/ changes in the PR that could be done in a separate PR to make it smaller. I may end up separating them to help reviews. |
||
| name: string, | ||
| options?: MetricOptions | ||
| ): Histogram<AttributesTypes>; | ||
|
|
@@ -66,7 +66,7 @@ export interface Meter { | |
| * @param name the name of the metric. | ||
| * @param [options] the metric options. | ||
| */ | ||
| createCounter<AttributesTypes extends MetricAttributes = MetricAttributes>( | ||
| createCounter<AttributesTypes extends Attributes = Attributes>( | ||
| name: string, | ||
| options?: MetricOptions | ||
| ): Counter<AttributesTypes>; | ||
|
|
@@ -89,7 +89,7 @@ export interface Meter { | |
| * @param [options] the metric options. | ||
| */ | ||
| createUpDownCounter< | ||
| AttributesTypes extends MetricAttributes = MetricAttributes, | ||
| AttributesTypes extends Attributes = Attributes, | ||
| >( | ||
| name: string, | ||
| options?: MetricOptions | ||
|
|
@@ -104,7 +104,7 @@ export interface Meter { | |
| * @param [options] the metric options. | ||
| */ | ||
| createObservableGauge< | ||
| AttributesTypes extends MetricAttributes = MetricAttributes, | ||
| AttributesTypes extends Attributes = Attributes, | ||
| >( | ||
| name: string, | ||
| options?: MetricOptions | ||
|
|
@@ -119,7 +119,7 @@ export interface Meter { | |
| * @param [options] the metric options. | ||
| */ | ||
| createObservableCounter< | ||
| AttributesTypes extends MetricAttributes = MetricAttributes, | ||
| AttributesTypes extends Attributes = Attributes, | ||
| >( | ||
| name: string, | ||
| options?: MetricOptions | ||
|
|
@@ -134,7 +134,7 @@ export interface Meter { | |
| * @param [options] the metric options. | ||
| */ | ||
| createObservableUpDownCounter< | ||
| AttributesTypes extends MetricAttributes = MetricAttributes, | ||
| AttributesTypes extends Attributes = Attributes, | ||
| >( | ||
| name: string, | ||
| options?: MetricOptions | ||
|
|
@@ -155,7 +155,7 @@ export interface Meter { | |
| * @param observables the observables associated with this batch observable callback | ||
| */ | ||
| addBatchObservableCallback< | ||
| AttributesTypes extends MetricAttributes = MetricAttributes, | ||
| AttributesTypes extends Attributes = Attributes, | ||
| >( | ||
| callback: BatchObservableCallback<AttributesTypes>, | ||
| observables: Observable<AttributesTypes>[] | ||
|
|
@@ -171,7 +171,7 @@ export interface Meter { | |
| * @param observables the observables associated with this batch observable callback | ||
| */ | ||
| removeBatchObservableCallback< | ||
| AttributesTypes extends MetricAttributes = MetricAttributes, | ||
| AttributesTypes extends Attributes = Attributes, | ||
| >( | ||
| callback: BatchObservableCallback<AttributesTypes>, | ||
| observables: Observable<AttributesTypes>[] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This belongs in a separate PR, if at all. I did this as I was working through the full API to grok usage of Attributes/AnyValue.