-
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.
[#242] Fix Histogram gRPC Data convert No Data
- Loading branch information
Showing
11 changed files
with
197 additions
and
133 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* Pinpoint Node.js Agent | ||
* Copyright 2020-present NAVER Corp. | ||
* Apache License v2.0 | ||
*/ | ||
|
||
'use strict' | ||
|
||
const SimpleCache = require('../utils/simple-cache') | ||
const ActiveTraceHistogram = require('./active-trace-histogram') | ||
const HistogramSchema = require('./histogram-schema') | ||
|
||
// DefaultActiveTraceRepository.java | ||
class ActiveRequestRepository { | ||
constructor() { | ||
this.activeTraceCache = new SimpleCache() | ||
} | ||
|
||
register(localTraceRoot) { | ||
const id = localTraceRoot.getTransactionId() | ||
if (typeof id !== 'string' || id.length < 1) { | ||
return | ||
} | ||
|
||
this.activeTraceCache.put(id, localTraceRoot) | ||
} | ||
|
||
remove(localTraceRoot) { | ||
const id = localTraceRoot.getTransactionId() | ||
this.activeTraceCache.delete(id) | ||
} | ||
|
||
getCurrentActiveTraceHistogram() { | ||
const currentTime = Date.now() | ||
return this.getActiveTraceHistogram(currentTime) | ||
} | ||
|
||
getActiveTraceHistogram(currentTime) { | ||
const histogram = new ActiveTraceHistogram(HistogramSchema.NORMAL_SCHEMA) | ||
this.activeTraceCache.getAll().forEach((traceRoot) => { | ||
const elapsedTime = currentTime - traceRoot.getTraceStartTime() | ||
histogram.increase(elapsedTime) | ||
}) | ||
return histogram | ||
} | ||
} | ||
|
||
module.exports = new ActiveRequestRepository() |
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 was deleted.
Oops, something went wrong.
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.