cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

jobs: scheduled jobs Prometheus Metrics not being updated

Open pxlogan opened this issue 5 years ago • 5 comments

Describe the problem When monitoring backups using the prometheus values, the values are not being incremented correctly resulting in false reporting

Please describe the issue you observed, and any steps we can take to reproduce it:

To Reproduce

What did you do? Describe in your own words.

If possible, provide steps to reproduce the behavior:

  1. Set up CockroachDB cluster v 20.2.5
  2. Setup scheduled backups to run incrementals on the hour and full every 24 hours
  3. Check prometheus values in db console
  4. Example of output,

HELP schedules_BACKUP_succeeded Number of BACKUP jobs succeeded

TYPE schedules_BACKUP_succeeded counter

schedules_BACKUP_succeeded 0

HELP schedules_BACKUP_started Number of BACKUP jobs started

TYPE schedules_BACKUP_started counter

schedules_BACKUP_started 8

HELP schedules_BACKUP_failed Number of BACKUP jobs failed

TYPE schedules_BACKUP_failed counter

schedules_BACKUP_failed 0

Jobs dashboard in DB Console shows all backups completed successfully.

Expected behavior I would expect succeeded and failed to add up to number of started backups.

Additional data / screenshots Output from prometheus metrics

  • HELP schedules_BACKUP_succeeded Number of BACKUP jobs succeeded
  • TYPE schedules_BACKUP_succeeded counter schedules_BACKUP_succeeded 0
  • HELP schedules_BACKUP_started Number of BACKUP jobs started
  • TYPE schedules_BACKUP_started counter schedules_BACKUP_started 8
  • HELP schedules_BACKUP_failed Number of BACKUP jobs failed
  • TYPE schedules_BACKUP_failed counter schedules_BACKUP_failed 0

If applicable, add screenshots to help explain your problem.

Environment:

  • CockroachDB version 20.2.5

Additional context What was the impact?

Add any other context about the problem here.

gz#7934

Epic CRDB-8816

pxlogan avatar Mar 30 '21 11:03 pxlogan

Seeing this as well with v21.1.3 and particularly also with backup schedule related counters.

EDIT: running daily FULL schedule.

erkki avatar Jul 01 '21 10:07 erkki

Thanks the mention. Were you aggregating the counters from across all of the nodes? The command you ran (without the credentials) would be helpful, along with confirmation that you're seeing BACKUP jobs in the jobs table (you can view in the DB Console jobs page or run SHOW JOBS from SQL)

mwang1026 avatar Jul 01 '21 14:07 mwang1026

We're monitoring daily backups (with a daily backup schedule) in K8S/prometheus/alertmanager with (sum by(namespace) (increase(schedules_BACKUP_succeeded{namespace="xxx"}[2d]))) < 1.

For some days the counter just does not increment.

More-so, in a cluster of 5 CRDB servers, only 3 return a value at all for the schedules_BACKUP_succeeded variable in /_status/vars.

We have verified that our prometheus can successfully scrape all the cluster members and that schedules_BACKUP_succeeded is missing on some nodes.

We only started the scheduled backup job on this cluster a few days ago, so maybe schedules_BACKUP_succeeded only gets populated after a backup has been scheduled on a specific node?

Still does not explain the lack of increment.

show jobs output seems to be garbaged collected quite quickly for us, is there a good way to check longer term history, including which node ended up running the job, and correlate to (lack of) counter increment?

show jobs shows the last succeeded backup correctly.

erkki avatar Jul 01 '21 16:07 erkki

so maybe schedules_BACKUP_succeeded only gets populated after a backup has been scheduled on a specific node?

that's correct

Still does not explain the lack of increment.

agreed. we'll take a peek.

show jobs output seems to be garbaged collected quite quickly for us, is there a good way to check longer term history, including which node ended up running the job, and correlate to (lack of) counter increment?

you can update the jobs.retention_time cluster setting to a higher number in the meantime while you're trying to triage the issue

mwang1026 avatar Jul 01 '21 16:07 mwang1026

Also observing this, I shared a some details a few months back on crdb community Slack https://cockroachdb.slack.com/archives/CP4D9LD5F/p1614335613081200?thread_ts=1614165706.061300&cid=CP4D9LD5F

nick-jones avatar Jul 04 '21 14:07 nick-jones