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

Updates for metrics URL settign and checking #285

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
sonar-scanner.properties
.scannerwork/
artifacts
.idea
6 changes: 5 additions & 1 deletion deployment/remediations-consumer-clowdapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ objects:
- name: METRICS_PREFIX
value: remediations_cleaner_
- name: METRICS_PUSH_GATEWAY
value: http://${PROMETHEUS_PUSHGATEWAY}
value: ${METRICS_GW_SCHEME}${PROMETHEUS_PUSHGATEWAY}
- name: METRICS_PUSH_GATEWAY_ENABLED
value: ${METRICS_PUSH_GATEWAY_ENABLED}
resources:
Expand Down Expand Up @@ -146,6 +146,10 @@ parameters:
name: IMAGE_TAG
required: true
- name: PROMETHEUS_PUSHGATEWAY
- name: METRICS_GW_SCHEME
value: 'http://'
- name: PROMETHEUS_PUSHGATEWAY
value: 'localhost:9091'
- name: METRICS_PUSH_GATEWAY_ENABLED
value: 'true'
- description: Cpu limit of cleaner job
Expand Down
5 changes: 3 additions & 2 deletions src/cleaner/probes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ export async function pushMetrics () {
const asyncGateway = P.promisifyAll(gateway);

const jobName = `${config.namespace}|${os.hostname}`;
logger.info({jobName}, 'pushing metrics');

const resp = await asyncGateway.pushAsync({jobName});
if (resp.statusCode !== 200) {
throw new Error(`failed to push metrics ${resp.statusCode}`);
}
log.info('metrics sent');
} else {
log.info(`metrics not enabled(METRICS_PUSH_GATEWAY_ENABLED = ${config.metrics.pushGatewayEnabled})`);
}
}
1 change: 0 additions & 1 deletion src/cleaner/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ async function run () {
} finally {
try {
await probes.pushMetrics();
log.info('metrics sent');
} finally {
await stop();
}
Expand Down