Skip to content

Commit a8050f5

Browse files
committed
better licence
1 parent 27555eb commit a8050f5

File tree

3 files changed

+33
-26
lines changed

3 files changed

+33
-26
lines changed

packages/core/src/utils/spanUtils.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,7 @@ export function spanTimeInputToSeconds(input: SpanTimeInput | undefined): number
3737
}
3838

3939
if (Array.isArray(input)) {
40-
/**
41-
* Defines High-Resolution Time.
42-
*
43-
* The first number, HrTime[0], is UNIX Epoch time in seconds since 00:00:00 UTC on 1 January 1970.
44-
* The second number, HrTime[1], represents the partial second elapsed since Unix Epoch time represented by first number in nanoseconds.
45-
* For example, 2021-01-01T12:30:10.150Z in UNIX Epoch time in milliseconds is represented as 1609504210150.
46-
* The first number is calculated by converting and truncating the Epoch time in milliseconds to seconds:
47-
* HrTime[0] = Math.trunc(1609504210150 / 1000) = 1609504210.
48-
* The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:
49-
* HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.
50-
* This is represented in HrTime format as [1609504210, 150000000].
51-
*/
40+
// See {@link HrTime} for the array-based time format
5241
return input[0] + input[1] / 1e9;
5342
}
5443

packages/types/src/opentelemetry.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// This file contains vendored types from OpenTelemetry
18+
19+
/**
20+
* Defines High-Resolution Time.
21+
*
22+
* The first number, HrTime[0], is UNIX Epoch time in seconds since 00:00:00 UTC on 1 January 1970.
23+
* The second number, HrTime[1], represents the partial second elapsed since Unix Epoch time represented by first number in nanoseconds.
24+
* For example, 2021-01-01T12:30:10.150Z in UNIX Epoch time in milliseconds is represented as 1609504210150.
25+
* The first number is calculated by converting and truncating the Epoch time in milliseconds to seconds:
26+
* HrTime[0] = Math.trunc(1609504210150 / 1000) = 1609504210.
27+
* The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:
28+
* HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.
29+
* This is represented in HrTime format as [1609504210, 150000000].
30+
*/
31+
export type HrTime = [number, number];

packages/types/src/span.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { TraceContext } from './context';
22
import type { Instrumenter } from './instrumenter';
33
import type { Primitive } from './misc';
4+
import type { HrTime } from './opentelemetry';
45
import type { Transaction } from './transaction';
56

67
type SpanOriginType = 'manual' | 'auto';
@@ -24,20 +25,6 @@ export type SpanAttributeValue =
2425

2526
export type SpanAttributes = Record<string, SpanAttributeValue | undefined>;
2627

27-
/**
28-
* Defines High-Resolution Time.
29-
*
30-
* The first number, HrTime[0], is UNIX Epoch time in seconds since 00:00:00 UTC on 1 January 1970.
31-
* The second number, HrTime[1], represents the partial second elapsed since Unix Epoch time represented by first number in nanoseconds.
32-
* For example, 2021-01-01T12:30:10.150Z in UNIX Epoch time in milliseconds is represented as 1609504210150.
33-
* The first number is calculated by converting and truncating the Epoch time in milliseconds to seconds:
34-
* HrTime[0] = Math.trunc(1609504210150 / 1000) = 1609504210.
35-
* The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:
36-
* HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.
37-
* This is represented in HrTime format as [1609504210, 150000000].
38-
*/
39-
export type HrTime = [number, number];
40-
4128
/** This type is aligned with the OpenTelemetry TimeInput type. */
4229
export type SpanTimeInput = HrTime | number | Date;
4330

0 commit comments

Comments
 (0)