Skip to content

Commit 48538b4

Browse files
chore(sdk-logs): refactored imports (#5801)
1 parent 8de8873 commit 48538b4

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

experimental/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2
1616

1717
### :house: Internal
1818

19+
* chore(sdk-logs): refactored imports [#5801](https://github.com/open-telemetry/opentelemetry-js/pull/5801) @svetlanabrennan
20+
1921
## 0.203.0
2022

2123
### :boom: Breaking Changes

experimental/packages/sdk-logs/src/LogRecordImpl.ts

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

17-
import { AttributeValue, diag } from '@opentelemetry/api';
1817
import type * as logsAPI from '@opentelemetry/api-logs';
1918
import * as api from '@opentelemetry/api';
2019
import {
@@ -26,7 +25,6 @@ import type { Resource } from '@opentelemetry/resources';
2625

2726
import type { ReadableLogRecord } from './export/ReadableLogRecord';
2827
import type { LogRecordLimits } from './types';
29-
import { AnyValue, LogAttributes, LogBody } from '@opentelemetry/api-logs';
3028
import { LoggerProviderSharedState } from './internal/LoggerProviderSharedState';
3129

3230
export class LogRecordImpl implements ReadableLogRecord {
@@ -38,7 +36,7 @@ export class LogRecordImpl implements ReadableLogRecord {
3836
readonly attributes: logsAPI.LogAttributes = {};
3937
private _severityText?: string;
4038
private _severityNumber?: logsAPI.SeverityNumber;
41-
private _body?: LogBody;
39+
private _body?: logsAPI.LogBody;
4240
private _eventName?: string;
4341
private totalAttributesCount: number = 0;
4442

@@ -65,13 +63,13 @@ export class LogRecordImpl implements ReadableLogRecord {
6563
return this._severityNumber;
6664
}
6765

68-
set body(body: LogBody | undefined) {
66+
set body(body: logsAPI.LogBody | undefined) {
6967
if (this._isLogRecordReadonly()) {
7068
return;
7169
}
7270
this._body = body;
7371
}
74-
get body(): LogBody | undefined {
72+
get body(): logsAPI.LogBody | undefined {
7573
return this._body;
7674
}
7775

@@ -125,7 +123,7 @@ export class LogRecordImpl implements ReadableLogRecord {
125123
this.setAttributes(attributes);
126124
}
127125

128-
public setAttribute(key: string, value?: AnyValue) {
126+
public setAttribute(key: string, value?: logsAPI.AnyValue) {
129127
if (this._isLogRecordReadonly()) {
130128
return this;
131129
}
@@ -167,14 +165,14 @@ export class LogRecordImpl implements ReadableLogRecord {
167165
return this;
168166
}
169167

170-
public setAttributes(attributes: LogAttributes) {
168+
public setAttributes(attributes: logsAPI.LogAttributes) {
171169
for (const [k, v] of Object.entries(attributes)) {
172170
this.setAttribute(k, v);
173171
}
174172
return this;
175173
}
176174

177-
public setBody(body: LogBody) {
175+
public setBody(body: logsAPI.LogBody) {
178176
this.body = body;
179177
return this;
180178
}
@@ -203,7 +201,7 @@ export class LogRecordImpl implements ReadableLogRecord {
203201
this._isReadonly = true;
204202
}
205203

206-
private _truncateToSize(value: AttributeValue): AttributeValue {
204+
private _truncateToSize(value: api.AttributeValue): api.AttributeValue {
207205
const limit = this._logRecordLimits.attributeValueLengthLimit;
208206
// Check limit
209207
if (limit <= 0) {
@@ -237,7 +235,7 @@ export class LogRecordImpl implements ReadableLogRecord {
237235

238236
private _isLogRecordReadonly(): boolean {
239237
if (this._isReadonly) {
240-
diag.warn('Can not execute the operation on emitted log record');
238+
api.diag.warn('Can not execute the operation on emitted log record');
241239
}
242240
return this._isReadonly;
243241
}

experimental/packages/sdk-logs/src/export/BatchLogRecordProcessorBase.ts

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

17-
import { ExportResult, getNumberFromEnv } from '@opentelemetry/core';
1817
import { diag } from '@opentelemetry/api';
1918
import {
19+
ExportResult,
2020
ExportResultCode,
21+
getNumberFromEnv,
2122
globalErrorHandler,
2223
unrefTimer,
2324
BindOnceFuture,

experimental/packages/sdk-logs/src/export/ConsoleLogRecordExporter.ts

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

17-
import { ExportResult, hrTimeToMicroseconds } from '@opentelemetry/core';
18-
import { ExportResultCode } from '@opentelemetry/core';
17+
import {
18+
ExportResultCode,
19+
ExportResult,
20+
hrTimeToMicroseconds,
21+
} from '@opentelemetry/core';
1922

2023
import type { ReadableLogRecord } from './ReadableLogRecord';
2124
import type { LogRecordExporter } from './LogRecordExporter';

0 commit comments

Comments
 (0)