Skip to content

Commit 16f79e0

Browse files
committed
More specific api type names (open-telemetry#1874)
1 parent 1203c11 commit 16f79e0

File tree

15 files changed

+813
-1255
lines changed

15 files changed

+813
-1255
lines changed

api/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ async function doSomething() {
133133
} catch (err) {
134134
span.setStatus({
135135
// use an appropriate status code here
136-
code: api.StatusCode.ERROR,
136+
code: api.SpanStatusCode.ERROR,
137137
message: err.message,
138138
});
139139
span.end();

api/packages/opentelemetry-api/package-lock.json

Lines changed: 468 additions & 765 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/packages/opentelemetry-context-base/package-lock.json

Lines changed: 304 additions & 449 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/src/baggage/Baggage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { EntryValue } from './EntryValue';
17+
import { BaggageEntryValue } from './EntryValue';
1818

1919
/**
2020
* Baggage represents collection of entries. Each key of
@@ -25,5 +25,5 @@ import { EntryValue } from './EntryValue';
2525
* dimension to the metric or additional contest properties to logs and traces.
2626
*/
2727
export interface Baggage {
28-
[entryKey: string]: EntryValue;
28+
[entryKey: string]: BaggageEntryValue;
2929
}

api/src/baggage/EntryValue.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
export interface EntryValue {
17-
/** `String` value of the `EntryValue`. */
16+
export interface BaggageEntryValue {
17+
/** `String` value of the `BaggageEntryValue`. */
1818
value: string;
1919
/**
2020
* ttl is an integer that represents number of hops an entry can
2121
* propagate.
2222
*/
23-
ttl?: EntryTtl;
23+
ttl?: BaggageEntryTtl;
2424
}
2525

2626
/**
27-
* EntryTtl is an integer that represents number of hops an entry can propagate.
27+
* BaggageEntryTtl is an integer that represents number of hops an entry can propagate.
2828
*
2929
* For now, ONLY special values (0 and -1) are supported.
3030
*/
31-
export enum EntryTtl {
31+
export enum BaggageEntryTtl {
3232
/**
3333
* NO_PROPAGATION is considered to have local context and is used within the
3434
* process it created.

api/src/trace/Event.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Attributes } from './attributes';
17+
import { SpanAttributes } from './attributes';
1818

1919
/** A text annotation with a set of attributes. */
2020
export interface Event {
2121
/** The name of the event. */
2222
name: string;
2323
/** The attributes of the event. */
24-
attributes?: Attributes;
24+
attributes?: SpanAttributes;
2525
}

api/src/trace/NoopSpan.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
import { Exception } from '../common/Exception';
1818
import { TimeInput } from '../common/Time';
19-
import { Attributes } from './attributes';
19+
import { SpanAttributes } from './attributes';
2020
import { Span } from './span';
2121
import { SpanContext } from './span_context';
22-
import { Status } from './status';
22+
import { SpanStatus } from './status';
2323
import { INVALID_SPAN_CONTEXT } from './spancontext-utils';
2424

2525
/**
@@ -43,17 +43,17 @@ export class NoopSpan implements Span {
4343
}
4444

4545
// By default does nothing
46-
setAttributes(_attributes: Attributes): this {
46+
setAttributes(_attributes: SpanAttributes): this {
4747
return this;
4848
}
4949

5050
// By default does nothing
51-
addEvent(_name: string, _attributes?: Attributes): this {
51+
addEvent(_name: string, _attributes?: SpanAttributes): this {
5252
return this;
5353
}
5454

5555
// By default does nothing
56-
setStatus(_status: Status): this {
56+
setStatus(_status: SpanStatus): this {
5757
return this;
5858
}
5959

api/src/trace/Sampler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import { Context } from '@opentelemetry/context-base';
18-
import { Attributes } from './attributes';
18+
import { SpanAttributes } from './attributes';
1919
import { Link } from './link';
2020
import { SamplingResult } from './SamplingResult';
2121
import { SpanKind } from './span_kind';
@@ -35,7 +35,7 @@ export interface Sampler {
3535
* span to be created starts a new trace.
3636
* @param spanName of the span to be created.
3737
* @param spanKind of the span to be created.
38-
* @param attributes Initial set of Attributes for the Span being constructed.
38+
* @param attributes Initial set of SpanAttributes for the Span being constructed.
3939
* @param links Collection of links that will be associated with the Span to
4040
* be created. Typically useful for batch operations.
4141
* @returns a {@link SamplingResult}.
@@ -45,7 +45,7 @@ export interface Sampler {
4545
traceId: string,
4646
spanName: string,
4747
spanKind: SpanKind,
48-
attributes: Attributes,
48+
attributes: SpanAttributes,
4949
links: Link[]
5050
): SamplingResult;
5151

api/src/trace/SamplingResult.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Attributes } from './attributes';
17+
import { SpanAttributes } from './attributes';
1818

1919
/**
2020
* A sampling decision that determines how a {@link Span} will be recorded
@@ -52,5 +52,5 @@ export interface SamplingResult {
5252
* Caller may call {@link Sampler}.shouldSample any number of times and
5353
* can safely cache the returned value.
5454
*/
55-
attributes?: Readonly<Attributes>;
55+
attributes?: Readonly<SpanAttributes>;
5656
}

api/src/trace/SpanOptions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import { TimeInput } from '../common/Time';
18-
import { Attributes } from './attributes';
18+
import { SpanAttributes } from './attributes';
1919
import { Link } from './link';
2020
import { SpanKind } from './span_kind';
2121

@@ -30,7 +30,7 @@ export interface SpanOptions {
3030
kind?: SpanKind;
3131

3232
/** A span's attributes */
33-
attributes?: Attributes;
33+
attributes?: SpanAttributes;
3434

3535
/** {@link Link}s span to other spans */
3636
links?: Link[];

0 commit comments

Comments
 (0)