forked from pinpoint-apm/pinpoint-node-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pinpoint-apm#226] Implemetations TraceRoot
* URL have to create baseURL that To parse the URL into its parts * TraceContext no needs Singleton. It is only a member variable of the agent singleton * Fix a test failure * Fix github actions
- Loading branch information
Showing
31 changed files
with
1,085 additions
and
427 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* Pinpoint Node.js Agent | ||
* Copyright 2020-present NAVER Corp. | ||
* Apache License v2.0 | ||
*/ | ||
|
||
'use strict' | ||
|
||
const TraceRootBuilder = require("./trace-root-builder") | ||
const TraceIdBuilder = require("./trace/trace-id-builder") | ||
|
||
class RemoteTraceRoot { | ||
constructor(traceId, traceRoot) { | ||
this.traceId = traceId | ||
this.traceRoot = traceRoot | ||
} | ||
|
||
getTraceStartTime() { | ||
return this.traceRoot.getTraceStartTime() | ||
} | ||
} | ||
|
||
class RemoteTraceRootBuilder { | ||
constructor(agentInfo) { | ||
this.agentInfo = agentInfo | ||
} | ||
|
||
setTraceId(traceId) { | ||
this.traceId = traceId | ||
return this | ||
} | ||
|
||
build(transactionId) { | ||
if (this.traceId) { | ||
return new RemoteTraceRoot(this.traceId, new TraceRootBuilder(this.agentInfo.agentId).build(transactionId)) | ||
} | ||
|
||
const traceId = new TraceIdBuilder(this.agentInfo, transactionId).build() | ||
return new RemoteTraceRoot(traceId, new TraceRootBuilder(this.agentInfo.agentId).build(transactionId)) | ||
} | ||
} | ||
|
||
module.exports = RemoteTraceRootBuilder |
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,26 @@ | ||
/** | ||
* Pinpoint Node.js Agent | ||
* Copyright 2020-present NAVER Corp. | ||
* Apache License v2.0 | ||
*/ | ||
|
||
'use strict' | ||
|
||
class Span { | ||
constructor(traceRoot) { | ||
this.traceRoot = traceRoot | ||
this.startTime = traceRoot.getTraceStartTime() | ||
} | ||
} | ||
|
||
class SpanBuilder { | ||
constructor(traceRoot) { | ||
this.traceRoot = traceRoot | ||
} | ||
|
||
build() { | ||
return new Span(this.traceRoot) | ||
} | ||
} | ||
|
||
module.exports = SpanBuilder |
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,25 @@ | ||
/** | ||
* Pinpoint Node.js Agent | ||
* Copyright 2020-present NAVER Corp. | ||
* Apache License v2.0 | ||
*/ | ||
|
||
'use strict' | ||
class SpanChunk { | ||
constructor(traceRoot, spanEventList) { | ||
this.traceRoot = traceRoot | ||
this.spanEventList = spanEventList | ||
} | ||
} | ||
|
||
class SpanChunkBuilder { | ||
constructor(traceRoot) { | ||
this.traceRoot = traceRoot | ||
} | ||
|
||
build(spanEventList) { | ||
return new SpanChunk(this.traceRoot, spanEventList) | ||
} | ||
} | ||
|
||
module.exports = SpanChunkBuilder |
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,32 @@ | ||
/** | ||
* Pinpoint Node.js Agent | ||
* Copyright 2020-present NAVER Corp. | ||
* Apache License v2.0 | ||
*/ | ||
|
||
'use strict' | ||
|
||
class Trace { | ||
constructor(span, repository, spanRecorder, spanEventRecorder) { | ||
this.span = span | ||
this.repository = repository | ||
this.spanRecorder = spanRecorder | ||
this.spanEventRecorder = spanEventRecorder | ||
} | ||
|
||
} | ||
|
||
class TraceBuilder { | ||
constructor(span, repository, spanRecorder, spanEventRecorder) { | ||
this.span = span | ||
this.repository = repository | ||
this.spanRecorder = spanRecorder | ||
this.spanEventRecorder = spanEventRecorder | ||
} | ||
|
||
build() { | ||
return new Trace(this.span, this.repository, this.spanRecorder, this.spanEventRecorder) | ||
} | ||
} | ||
|
||
module.exports = TraceBuilder |
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,31 @@ | ||
/** | ||
* Pinpoint Node.js Agent | ||
* Copyright 2020-present NAVER Corp. | ||
* Apache License v2.0 | ||
*/ | ||
|
||
'use strict' | ||
|
||
class TraceRoot { | ||
constructor(agentId, traceStartTime, transactionId) { | ||
this.agentId = agentId | ||
this.traceStartTime = traceStartTime | ||
this.transactionId = transactionId | ||
} | ||
|
||
getTraceStartTime() { | ||
return this.traceStartTime | ||
} | ||
} | ||
|
||
class TraceRootBuilder { | ||
constructor(agentId) { | ||
this.agentId = agentId | ||
} | ||
|
||
build(transactionId) { | ||
return new TraceRoot(this.agentId, Date.now(), transactionId) | ||
} | ||
} | ||
|
||
module.exports = TraceRootBuilder |
Oops, something went wrong.