Skip to content

Commit

Permalink
organize the change for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
metal-messiah committed Oct 7, 2024
1 parent 71b5279 commit 712b61f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/features/logging/aggregate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ export class Aggregate extends AggregateBase {

prepareHarvest (options = {}) {
if (this.blocked || !this.bufferedLogs.hasData) return
/** These attributes are evaluated and dropped at ingest processing time and do not get stored on NRDB */
const unbilledAttributes = {
'instrumentation.provider': 'browser',
'instrumentation.version': this.#agentRuntime.version,
'instrumentation.name': this.#agentRuntime.loaderType
}
/** see https://source.datanerd.us/agents/rum-specs/blob/main/browser/Log for logging spec */
const payload = {
qs: {
Expand All @@ -103,17 +109,15 @@ export class Aggregate extends AggregateBase {
common: {
/** Attributes in the `common` section are added to `all` logs generated in the payload */
attributes: {
'instrumentation.provider': 'browser',
'instrumentation.version': this.#agentRuntime.version,
'instrumentation.name': this.#agentRuntime.loaderType,
'entity.guid': this.#agentRuntime.appMetadata?.agents?.[0]?.entityGuid, // browser entity guid as provided from RUM response
session: this.#agentRuntime?.session?.state.value || '0', // The session ID that we generate and keep across page loads
hasReplay: this.#agentRuntime?.session?.state.sessionReplayMode === 1, // True if a session replay recording is running
hasTrace: this.#agentRuntime?.session?.state.sessionTraceMode === 1, // True if a session trace recording is running
ptid: this.#agentRuntime.ptid, // page trace id
appId: this.#agentInfo.applicationID, // Application ID from info object,
standalone: Boolean(this.#agentInfo.sa), // copy paste (true) vs APM (false)
agentVersion: this.#agentRuntime.version // browser agent version
agentVersion: this.#agentRuntime.version, // browser agent version,
...unbilledAttributes
}
},
/** logs section contains individual unique log entries */
Expand Down

0 comments on commit 712b61f

Please sign in to comment.