Skip to content

Commit

Permalink
feat(orchestrator): move pushgateway url to env var (#1756)
Browse files Browse the repository at this point in the history
* feat(orchestrator): move pushgateway url to env var

* add words

* eslint
  • Loading branch information
pepoviola authored Apr 1, 2024
1 parent 8b134ea commit b9750f8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ variables:
# Improve gitlab cache performance
CACHE_COMPRESSION_LEVEL: "fastest"
FF_USE_FASTZIP: "true"
PUSHGATEWAY_URL: "http://zombienet-prometheus-pushgateway.managed-monitoring:9091/metrics/job/zombie-metrics"

cache:
- key:
Expand Down
17 changes: 9 additions & 8 deletions javascript/packages/orchestrator/src/orchestrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,11 @@ export async function start(
const spawnElapsedSecs = Math.round((spawnEnd - spawnStart) / 1000);
debug(`\t 🕰 [Spawn] elapsed time: ${spawnElapsedSecs} secs`);

if (options?.inCI && process.env["CI_JOB_NAME"]) {
if (
options?.inCI &&
process.env["PUSHGATEWAY_URL"] &&
process.env["CI_JOB_NAME"]
) {
const jobId = process.env["CI_JOB_ID"];
const jobName = process.env["CI_JOB_NAME"];
const projectName = process.env["CI_PROJECT_NAME"] || "";
Expand All @@ -552,13 +556,10 @@ export async function start(
const metricString = `${metricName}{job_id="${jobId}", job_name="${jobName}", project_name="${projectName}"} ${spawnElapsedSecs}`;
const body = [help, type, metricString, "\n"].join("\n");
debug!(`Sending metric with content:\n ${body}`);
await fetch(
"http://zombienet-prometheus-pushgateway.managed-monitoring:9091/metrics/job/zombie-metrics",
{
method: "POST",
body,
},
);
await fetch(process.env["PUSHGATEWAY_URL"], {
method: "POST",
body,
});
}

// clean cache before dump the info.
Expand Down
2 changes: 2 additions & 0 deletions javascript/words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ prevotes
procps
propery
protobuf
PUSHGATEWAY
pushgateway
rawdata
rawmetric
readgzipped
Expand Down

0 comments on commit b9750f8

Please sign in to comment.