mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 14:49:07 +00:00
refactor: Update logging in CheckHeartbeat.ts and Telemetry.ts
This commit is contained in:
parent
fe8aa54f1c
commit
adfb3e1db4
@ -17,7 +17,12 @@ RunCron(
|
||||
"IncomingRequestMonitor:CheckHeartbeat",
|
||||
{ schedule: EVERY_THIRTY_SECONDS, runOnStartup: false },
|
||||
async () => {
|
||||
logger.debug("Checking IncomingRequestMonitor:CheckHeartbeat");
|
||||
logger.debug(
|
||||
"Checking IncomingRequestMonitor:CheckHeartbeat at " +
|
||||
OneUptimeDate.getDateAsLocalFormattedString(
|
||||
OneUptimeDate.getCurrentDate(),
|
||||
),
|
||||
);
|
||||
|
||||
const newIncomingRequestMonitors: Array<Monitor> =
|
||||
await MonitorService.findBy({
|
||||
@ -87,6 +92,10 @@ RunCron(
|
||||
|
||||
for (const monitor of totalIncomingRequestMonitors) {
|
||||
try {
|
||||
logger.debug(
|
||||
`Processing incoming request monitor: ${monitor.id?.toString()}`,
|
||||
);
|
||||
|
||||
if (!monitor.monitorSteps) {
|
||||
logger.debug("Monitor has no steps. Skipping...");
|
||||
continue;
|
||||
@ -103,6 +112,10 @@ RunCron(
|
||||
},
|
||||
});
|
||||
|
||||
logger.debug(
|
||||
`Updated incoming request monitor heartbeat checked at: ${monitor.id?.toString()}`,
|
||||
);
|
||||
|
||||
const processRequest: boolean = shouldProcessRequest(monitor);
|
||||
|
||||
logger.debug(
|
||||
@ -123,7 +136,15 @@ RunCron(
|
||||
onlyCheckForIncomingRequestReceivedAt: true,
|
||||
};
|
||||
|
||||
logger.debug(
|
||||
`Processing incoming request monitor: ${monitor.id?.toString()}`,
|
||||
);
|
||||
|
||||
await MonitorResourceUtil.monitorResource(incomingRequest);
|
||||
|
||||
logger.debug(
|
||||
`Processed incoming request monitor: ${monitor.id?.toString()}`,
|
||||
);
|
||||
} catch (error) {
|
||||
logger.error(
|
||||
`Error while processing incoming request monitor: ${monitor.id?.toString()}`,
|
||||
|
@ -5,7 +5,6 @@ import {
|
||||
Histogram,
|
||||
MetricOptions,
|
||||
} from "@opentelemetry/api/build/src/metrics/Metric";
|
||||
import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentations-node";
|
||||
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
|
||||
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-proto";
|
||||
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
|
||||
@ -152,7 +151,11 @@ export default class Telemetry {
|
||||
const nodeSdkConfiguration: Partial<opentelemetry.NodeSDKConfiguration> =
|
||||
{
|
||||
idGenerator: new AWSXRayIdGenerator(),
|
||||
instrumentations: hasHeaders ? [getNodeAutoInstrumentations()] : [],
|
||||
instrumentations: hasHeaders
|
||||
? [
|
||||
// Add instrumentations here
|
||||
]
|
||||
: [],
|
||||
resource: this.getResource({
|
||||
serviceName: data.serviceName,
|
||||
}),
|
||||
|
@ -51,7 +51,6 @@
|
||||
"@nivo/line": "^0.87.0",
|
||||
"@opentelemetry/api": "^1.9.0",
|
||||
"@opentelemetry/api-logs": "^0.52.1",
|
||||
"@opentelemetry/auto-instrumentations-node": "^0.49.1",
|
||||
"@opentelemetry/context-zone": "^1.25.0",
|
||||
"@opentelemetry/exporter-logs-otlp-http": "^0.52.1",
|
||||
"@opentelemetry/exporter-metrics-otlp-proto": "^0.52.1",
|
||||
|
@ -57,7 +57,7 @@ const getMonitorFetchQuery: GetMonitorFetchQueryFunction = (
|
||||
};
|
||||
|
||||
router.get(
|
||||
"/monitor/pending-list/:probeId",
|
||||
"/monitor/pending-list/by-probe/:probeId",
|
||||
ClusterKeyAuthorization.isAuthorizedServiceMiddleware,
|
||||
async (
|
||||
req: ExpressRequest,
|
||||
@ -201,7 +201,7 @@ router.get(
|
||||
|
||||
// This API returns the count of the monitor waiting to be monitored.
|
||||
router.get(
|
||||
"/monitor/pending-count/:probeId",
|
||||
"/monitor/pending-count/by-probe/:probeId",
|
||||
ClusterKeyAuthorization.isAuthorizedServiceMiddleware,
|
||||
async (
|
||||
req: ExpressRequest,
|
||||
|
Loading…
Reference in New Issue
Block a user