@@ -63,13 +63,11 @@ import { parseSampleRate } from './utils/parseSampleRate';
6363import { prepareEvent } from './utils/prepareEvent' ;
6464import { showSpanDropWarning , spanToTraceContext } from './utils/spanUtils' ;
6565import { convertSpanJsonToTransactionEvent , convertTransactionEventToSpanJson } from './utils/transactionEvent' ;
66- import type { Log , SerializedOtelLog } from './types-hoist/log' ;
67- import { SEVERITY_TEXT_TO_SEVERITY_NUMBER , createOtelLogEnvelope , logAttributeToSerializedLogAttribute } from './log' ;
66+ import type { SerializedOtelLog } from './types-hoist/log' ;
6867import { _getSpanForScope } from './utils/spanOnScope' ;
6968
7069const ALREADY_SEEN_ERROR = "Not capturing exception because it's already been captured." ;
7170const MISSING_RELEASE_FOR_SESSION_ERROR = 'Discarded session because of missing or non-string release' ;
72- const MAX_LOG_BUFFER_SIZE = 100 ;
7371
7472/**
7573 * Base implementation for all JavaScript SDK clients.
@@ -125,8 +123,6 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
125123 // eslint-disable-next-line @typescript-eslint/ban-types
126124 private _hooks : Record < string , Function [ ] > ;
127125
128- private _logsBuffer : Array < SerializedOtelLog > ;
129-
130126 /**
131127 * Initializes this client instance.
132128 *
@@ -139,7 +135,6 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
139135 this . _outcomes = { } ;
140136 this . _hooks = { } ;
141137 this . _eventProcessors = [ ] ;
142- this . _logsBuffer = [ ] ;
143138
144139 if ( options . dsn ) {
145140 this . _dsn = makeDsn ( options . dsn ) ;
@@ -267,58 +262,6 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
267262 */
268263 public captureCheckIn ?( checkIn : CheckIn , monitorConfig ?: MonitorConfig , scope ?: Scope ) : string ;
269264
270- /**
271- * Captures a log event and sends it to Sentry.
272- *
273- * @param log The log event to capture.
274- *
275- * @experimental This method will experience breaking changes. This is not yet part of
276- * the stable Sentry SDK API and can be changed or removed without warning.
277- */
278- public captureLog ( { level, message, attributes, severityNumber } : Log , currentScope = getCurrentScope ( ) ) : void {
279- const { _experiments, release, environment } = this . getOptions ( ) ;
280- if ( ! _experiments ?. enableLogs ) {
281- DEBUG_BUILD && logger . warn ( 'logging option not enabled, log will not be captured.' ) ;
282- return ;
283- }
284-
285- const [ , traceContext ] = _getTraceInfoFromScope ( this , currentScope ) ;
286-
287- const logAttributes = {
288- ...attributes ,
289- } ;
290-
291- if ( release ) {
292- logAttributes . release = release ;
293- }
294-
295- if ( environment ) {
296- logAttributes . environment = environment ;
297- }
298-
299- const span = _getSpanForScope ( currentScope ) ;
300- if ( span ) {
301- // Add the parent span ID to the log attributes for trace context
302- logAttributes [ 'sentry.trace.parent_span_id' ] = span . spanContext ( ) . spanId ;
303- }
304-
305- const serializedLog : SerializedOtelLog = {
306- severityText : level ,
307- body : {
308- stringValue : message ,
309- } ,
310- attributes : Object . entries ( logAttributes ) . map ( ( [ key , value ] ) => logAttributeToSerializedLogAttribute ( key , value ) ) ,
311- timeUnixNano : `${ new Date ( ) . getTime ( ) . toString ( ) } 000000` ,
312- traceId : traceContext ?. trace_id ,
313- severityNumber : severityNumber ?? SEVERITY_TEXT_TO_SEVERITY_NUMBER [ level ] ,
314- } ;
315-
316- this . _logsBuffer . push ( serializedLog ) ;
317- if ( this . _logsBuffer . length > MAX_LOG_BUFFER_SIZE ) {
318- this . _flushLogsBuffer ( ) ;
319- }
320- }
321-
322265 /**
323266 * Get the current Dsn.
324267 */
@@ -358,7 +301,6 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
358301 * still events in the queue when the timeout is reached.
359302 */
360303 public flush ( timeout ?: number ) : PromiseLike < boolean > {
361- this . _flushLogsBuffer ( ) ;
362304 const transport = this . _transport ;
363305 if ( transport ) {
364306 this . emit ( 'flush' ) ;
@@ -1200,21 +1142,6 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
12001142 this . sendEnvelope ( envelope ) ;
12011143 }
12021144
1203- /**
1204- * Flushes the logs buffer to Sentry.
1205- */
1206- protected _flushLogsBuffer ( ) : void {
1207- if ( this . _logsBuffer . length === 0 ) {
1208- return ;
1209- }
1210-
1211- const envelope = createOtelLogEnvelope ( this . _logsBuffer , this . _options . _metadata , this . _options . tunnel , this . _dsn ) ;
1212- this . _logsBuffer = [ ] ;
1213- // sendEnvelope should not throw
1214- // eslint-disable-next-line @typescript-eslint/no-floating-promises
1215- this . sendEnvelope ( envelope ) ;
1216- }
1217-
12181145 /**
12191146 * Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.
12201147 */
0 commit comments