Skip to content

Commit 0b37427

Browse files
authored
ref(core): Update log types to explicitly reference otel (#15704)
In #15530 I added types for the log envelope and log item. This PR comes and explicitly references that these added types were otel logs. For more details, see the logs spec in develop: getsentry/sentry-docs#12920. Note I used `Otel` everywhere here, but I'm also fine with switching to `OpenTelemetry`.
1 parent 9da8e7f commit 0b37427

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

packages/core/src/types-hoist/envelope.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { LegacyCSPReport } from './csp';
55
import type { DsnComponents } from './dsn';
66
import type { Event } from './event';
77
import type { FeedbackEvent, UserFeedback } from './feedback';
8-
import type { Log } from './log';
8+
import type { SerializedOtelLog } from './log';
99
import type { Profile, ProfileChunk } from './profiling';
1010
import type { ReplayEvent, ReplayRecordingData } from './replay';
1111
import type { SdkInfo } from './sdkinfo';
@@ -87,7 +87,7 @@ type CheckInItemHeaders = { type: 'check_in' };
8787
type ProfileItemHeaders = { type: 'profile' };
8888
type ProfileChunkItemHeaders = { type: 'profile_chunk' };
8989
type SpanItemHeaders = { type: 'span' };
90-
type LogItemHeaders = { type: 'otel_log' };
90+
type OtelLogItemHeaders = { type: 'otel_log' };
9191
type RawSecurityHeaders = { type: 'raw_security'; sentry_release?: string; sentry_environment?: string };
9292

9393
export type EventItem = BaseEnvelopeItem<EventItemHeaders, Event>;
@@ -104,7 +104,7 @@ export type FeedbackItem = BaseEnvelopeItem<FeedbackItemHeaders, FeedbackEvent>;
104104
export type ProfileItem = BaseEnvelopeItem<ProfileItemHeaders, Profile>;
105105
export type ProfileChunkItem = BaseEnvelopeItem<ProfileChunkItemHeaders, ProfileChunk>;
106106
export type SpanItem = BaseEnvelopeItem<SpanItemHeaders, Partial<SpanJSON>>;
107-
export type LogItem = BaseEnvelopeItem<LogItemHeaders, Log>;
107+
export type OtelLogItem = BaseEnvelopeItem<OtelLogItemHeaders, SerializedOtelLog>;
108108
export type RawSecurityItem = BaseEnvelopeItem<RawSecurityHeaders, LegacyCSPReport>;
109109

110110
export type EventEnvelopeHeaders = { event_id: string; sent_at: string; trace?: Partial<DynamicSamplingContext> };
@@ -113,7 +113,7 @@ type CheckInEnvelopeHeaders = { trace?: DynamicSamplingContext };
113113
type ClientReportEnvelopeHeaders = BaseEnvelopeHeaders;
114114
type ReplayEnvelopeHeaders = BaseEnvelopeHeaders;
115115
type SpanEnvelopeHeaders = BaseEnvelopeHeaders & { trace?: DynamicSamplingContext };
116-
type LogEnvelopeHeaders = BaseEnvelopeHeaders & { trace?: DynamicSamplingContext };
116+
type OtelLogEnvelopeHeaders = BaseEnvelopeHeaders & { trace?: DynamicSamplingContext };
117117

118118
export type EventEnvelope = BaseEnvelope<
119119
EventEnvelopeHeaders,
@@ -126,7 +126,7 @@ export type CheckInEnvelope = BaseEnvelope<CheckInEnvelopeHeaders, CheckInItem>;
126126
export type SpanEnvelope = BaseEnvelope<SpanEnvelopeHeaders, SpanItem>;
127127
export type ProfileChunkEnvelope = BaseEnvelope<BaseEnvelopeHeaders, ProfileChunkItem>;
128128
export type RawSecurityEnvelope = BaseEnvelope<BaseEnvelopeHeaders, RawSecurityItem>;
129-
export type LogEnvelope = BaseEnvelope<LogEnvelopeHeaders, LogItem>;
129+
export type OtelLogEnvelope = BaseEnvelope<OtelLogEnvelopeHeaders, OtelLogItem>;
130130

131131
export type Envelope =
132132
| EventEnvelope
@@ -137,6 +137,6 @@ export type Envelope =
137137
| CheckInEnvelope
138138
| SpanEnvelope
139139
| RawSecurityEnvelope
140-
| LogEnvelope;
140+
| OtelLogEnvelope;
141141

142142
export type EnvelopeItem = Envelope[1][number];

packages/core/src/types-hoist/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export type {
110110
TraceFlag,
111111
} from './span';
112112
export type { SpanStatus } from './spanStatus';
113-
export type { Log, LogAttribute, LogSeverityLevel, LogAttributeValueType } from './log';
113+
export type { SerializedOtelLog, LogAttribute, LogSeverityLevel, LogAttributeValueType } from './log';
114114
export type { TimedEvent } from './timedEvent';
115115
export type { StackFrame } from './stackframe';
116116
export type { Stacktrace, StackParser, StackLineParser, StackLineParserFn } from './stacktrace';

packages/core/src/types-hoist/log.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ export type LogAttributeValueType =
55
stringValue: string;
66
}
77
| {
8-
intValue: number;
8+
// integers must be represented as a string
9+
// because JSON cannot differentiate between integers and floats
10+
intValue: string;
911
}
1012
| {
1113
boolValue: boolean;
@@ -19,7 +21,7 @@ export type LogAttribute = {
1921
value: LogAttributeValueType;
2022
};
2123

22-
export interface Log {
24+
export interface SerializedOtelLog {
2325
/**
2426
* The severity level of the log.
2527
*

0 commit comments

Comments
 (0)