-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
631 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* Pinpoint Node.js Agent | ||
* Copyright 2020-present NAVER Corp. | ||
* Apache License v2.0 | ||
*/ | ||
|
||
'use strict' | ||
|
||
const SpanEventBuilder = require('./span-event-builder') | ||
const SpanEventRecorder = require('./span-event-recorder2') | ||
|
||
/** | ||
* DefaultCallStack.java in Java agent | ||
*/ | ||
class CallStack { | ||
constructor() { | ||
this.stack = [] | ||
this.sequence = 0 | ||
this.depth = 0 | ||
} | ||
|
||
makeSpanEventRecorder(stackId) { | ||
const recorder = new SpanEventRecorder(SpanEventBuilder.make(stackId)) | ||
this.push(recorder.getSpanEventBuilder()) | ||
return recorder | ||
} | ||
|
||
push(spanEventBuilder) { | ||
if (spanEventBuilder.needsSequence()) { | ||
spanEventBuilder.setSequence(this.sequence++) | ||
} | ||
|
||
if (spanEventBuilder.needsDepth()) { | ||
spanEventBuilder.setDepth(this.stack.length + 1) | ||
} | ||
|
||
this.stack.push(spanEventBuilder) | ||
} | ||
|
||
// pop in java agent | ||
pop() { | ||
if (this.stack.length < 1) { | ||
return SpanEventBuilder.nullObject() | ||
} | ||
return this.stack.pop() | ||
} | ||
} | ||
|
||
module.exports = CallStack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.