forked from OneUptime/oneuptime
-
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.
refactor: Add support for monitoring trace counts
- Loading branch information
Showing
22 changed files
with
953 additions
and
9,674 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
31 changes: 31 additions & 0 deletions
31
Common/Server/Utils/Monitor/Criteria/TraceMonitorCriteria.ts
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 @@ | ||
import TraceMonitorResponse from "../../../../Types/Monitor/TraceMonitor/TraceMonitorResponse"; | ||
import DataToProcess from "../DataToProcess"; | ||
import CompareCriteria from "./CompareCriteria"; | ||
import { CheckOn, CriteriaFilter } from "Common/Types/Monitor/CriteriaFilter"; | ||
|
||
export default class TraceMonitorCriteria { | ||
public static async isMonitorInstanceCriteriaFilterMet(input: { | ||
dataToProcess: DataToProcess; | ||
criteriaFilter: CriteriaFilter; | ||
}): Promise<string | null> { | ||
// Server Monitoring Checks | ||
|
||
let threshold: number | string | undefined | null = | ||
input.criteriaFilter.value; | ||
|
||
if (input.criteriaFilter.checkOn === CheckOn.SpanCount) { | ||
threshold = CompareCriteria.convertToNumber(threshold); | ||
|
||
const currentSpanCount: number = | ||
(input.dataToProcess as TraceMonitorResponse).spanCount || 0; | ||
|
||
return CompareCriteria.compareCriteriaNumbers({ | ||
value: currentSpanCount, | ||
threshold: threshold as number, | ||
criteriaFilter: input.criteriaFilter, | ||
}); | ||
} | ||
|
||
return null; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import { JSONObject } from "../../JSON"; | ||
import Log from "../../../Models/AnalyticsModels/Log"; | ||
import Query from "../../BaseDatabase/Query"; | ||
import ObjectID from "../../ObjectID"; | ||
|
||
export default interface LogMonitorResponse { | ||
logCount: number; | ||
logQuery: JSONObject; | ||
logQuery: Query<Log>; | ||
monitorId: ObjectID; | ||
} |
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
Oops, something went wrong.