Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Otel demo #25

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Otel demo #25

wants to merge 7 commits into from

Conversation

MSpryszynski
Copy link
Collaborator

Added metrics and logs support for OpenTelemetry and created monitoring local setup

handler.js Outdated
@@ -34,17 +41,19 @@ async function handleJob(taskId, rcl, message) {
let connector = new RemoteJobConnector(rcl, wfId);

// time interval (ms) at which to probe and log metrics
const probeInterval = process.env.HF_VAR_PROBE_INTERVAL || 2000;
const probeInterval = process.env.HF_VAR_PROBE_INTERVAL || 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is 1ms! Is this necessary? It might have negative impact on performance.

handler.js Outdated
// periodically log process IO
logProcIO = function (pid) {
try {
let ioInfo = procfs.processIo(pid);
ioInfo.pid = pid;
ioInfo.name = jm["name"];
if (process.env.HF_VAR_ENABLE_TRACING === "1") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If (otelLogger) { ... } should be sufficient. That way we avoid too many places where env is tested. The same occurs in other places where otelLogger is used.

handler.js Outdated
const tracer = process.env.HF_VAR_ENABLE_TRACING === "1" ? require("./tracing.js")("hyperflow-job-executor"): undefined;
const { spawn } = require('child_process');
const tracer = process.env.HF_VAR_ENABLE_TRACING === "1" ? require("./tracing.js")("hyperflow-job-executor") : undefined;
const otelLogger = process.env.HF_VAR_ENABLE_TRACING === "1" ? require("./logs.js")("hyperflow-job-executor") : undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here test a different env, e.g. "HF_VAR_ENABLE_OTEL". TRACING should be enabled separately because it requires proper context propagation.

handler.js Outdated
@@ -140,6 +176,29 @@ async function handleJob(taskId, rcl, message) {
// elapsed: 6650000, // ms since the start of the process
// timestamp: 864000000 // ms since epoch
// }
if (process.env.HF_VAR_ENABLE_TRACING === "1") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here (for sending metrics) let's use another guard, e.g. "If (otelEnabled)". Evaluate it at the beginning using the HF_VAR_ENABLE_OTEL env. (That way we evaluate all envs only at the beginning)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants