Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2

### :house: Internal

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

## 0.203.0

### :boom: Breaking Changes
Expand Down
18 changes: 8 additions & 10 deletions experimental/packages/sdk-logs/src/LogRecordImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

import { AttributeValue, diag } from '@opentelemetry/api';
import type * as logsAPI from '@opentelemetry/api-logs';
import * as api from '@opentelemetry/api';
import {
Expand All @@ -26,7 +25,6 @@ import type { Resource } from '@opentelemetry/resources';

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

export class LogRecordImpl implements ReadableLogRecord {
Expand All @@ -38,7 +36,7 @@ export class LogRecordImpl implements ReadableLogRecord {
readonly attributes: logsAPI.LogAttributes = {};
private _severityText?: string;
private _severityNumber?: logsAPI.SeverityNumber;
private _body?: LogBody;
private _body?: logsAPI.LogBody;
private _eventName?: string;
private totalAttributesCount: number = 0;

Expand All @@ -65,13 +63,13 @@ export class LogRecordImpl implements ReadableLogRecord {
return this._severityNumber;
}

set body(body: LogBody | undefined) {
set body(body: logsAPI.LogBody | undefined) {
if (this._isLogRecordReadonly()) {
return;
}
this._body = body;
}
get body(): LogBody | undefined {
get body(): logsAPI.LogBody | undefined {
return this._body;
}

Expand Down Expand Up @@ -125,7 +123,7 @@ export class LogRecordImpl implements ReadableLogRecord {
this.setAttributes(attributes);
}

public setAttribute(key: string, value?: AnyValue) {
public setAttribute(key: string, value?: logsAPI.AnyValue) {
if (this._isLogRecordReadonly()) {
return this;
}
Expand Down Expand Up @@ -167,14 +165,14 @@ export class LogRecordImpl implements ReadableLogRecord {
return this;
}

public setAttributes(attributes: LogAttributes) {
public setAttributes(attributes: logsAPI.LogAttributes) {
for (const [k, v] of Object.entries(attributes)) {
this.setAttribute(k, v);
}
return this;
}

public setBody(body: LogBody) {
public setBody(body: logsAPI.LogBody) {
this.body = body;
return this;
}
Expand Down Expand Up @@ -203,7 +201,7 @@ export class LogRecordImpl implements ReadableLogRecord {
this._isReadonly = true;
}

private _truncateToSize(value: AttributeValue): AttributeValue {
private _truncateToSize(value: api.AttributeValue): api.AttributeValue {
const limit = this._logRecordLimits.attributeValueLengthLimit;
// Check limit
if (limit <= 0) {
Expand Down Expand Up @@ -237,7 +235,7 @@ export class LogRecordImpl implements ReadableLogRecord {

private _isLogRecordReadonly(): boolean {
if (this._isReadonly) {
diag.warn('Can not execute the operation on emitted log record');
api.diag.warn('Can not execute the operation on emitted log record');
}
return this._isReadonly;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
* limitations under the License.
*/

import { ExportResult, getNumberFromEnv } from '@opentelemetry/core';
import { diag } from '@opentelemetry/api';
import {
ExportResult,
ExportResultCode,
getNumberFromEnv,
globalErrorHandler,
unrefTimer,
BindOnceFuture,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
* limitations under the License.
*/

import { ExportResult, hrTimeToMicroseconds } from '@opentelemetry/core';
import { ExportResultCode } from '@opentelemetry/core';
import {
ExportResultCode,
ExportResult,
hrTimeToMicroseconds,
} from '@opentelemetry/core';

import type { ReadableLogRecord } from './ReadableLogRecord';
import type { LogRecordExporter } from './LogRecordExporter';
Expand Down