Skip to content

Commit 66a91eb

Browse files
committed
Add SM when new log is added to events
1 parent ffab851 commit 66a91eb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/features/logging/aggregate/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import { SESSION_EVENT_TYPES, SESSION_EVENTS } from '../../../common/session/con
1515
import { ABORT_REASONS } from '../../session_replay/constants'
1616
import { canEnableSessionTracking } from '../../utils/feature-gates'
1717

18+
const LOGGING_EVENT = 'Logging/Event/'
19+
1820
export class Aggregate extends AggregateBase {
1921
static featureName = FEATURE_NAME
2022
constructor (agentRef) {
@@ -73,7 +75,7 @@ export class Aggregate extends AggregateBase {
7375
if (typeof level === 'string') level = level.toUpperCase()
7476
if (!isValidLogLevel(level)) return warn(30, level)
7577
if (modeForThisLog < (LOGGING_MODE[level] || Infinity)) {
76-
this.reportSupportabilityMetric('Logging/Event/Dropped/Sampling')
78+
this.reportSupportabilityMetric(LOGGING_EVENT + 'Dropped/Sampling')
7779
return
7880
}
7981

@@ -90,7 +92,7 @@ export class Aggregate extends AggregateBase {
9092
}
9193
} catch (err) {
9294
warn(16, message)
93-
this.reportSupportabilityMetric('Logging/Event/Dropped/Casting')
95+
this.reportSupportabilityMetric(LOGGING_EVENT + 'Dropped/Casting')
9496
return
9597
}
9698
if (typeof message !== 'string' || !message) return warn(32)
@@ -102,7 +104,7 @@ export class Aggregate extends AggregateBase {
102104
level
103105
)
104106

105-
this.events.add(log, targetEntityGuid)
107+
if (this.events.add(log, targetEntityGuid)) this.reportSupportabilityMetric(LOGGING_EVENT + (autoCaptured ? 'Auto' : 'API') + '/Added')
106108
}
107109

108110
serializer (eventBuffer, targetEntityGuid) {

0 commit comments

Comments
 (0)