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

feat(metrics) Limit Cardinality of CSV metrics #1099

Conversation

awgreene
Copy link
Member

@awgreene awgreene commented Oct 30, 2019

This commit introduces a change that limits the number of metrics that
an OLM cluster reports at any given time for a CSV.

The first metric introduced is called csv_succeeded, which tracks CSVs that
have reached the succeeded phase. The following information is
provided about the CSV via labels: name, version. The value of this
metric will always be 0 or 1.

The second metric introduced is called csv_abnormal, which is reported
whenever the CSV is updated and has not reached the succeeded phase. The
following information is provided about the CSV via labels: name,
version, phase, reason. Whenever a CSV is updated, the existing
timeseries is deleted and replaced by an updated version.

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /docs
  • Commit messages sensible and descriptive

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 30, 2019
@awgreene awgreene force-pushed the limit-cardinality-on-csv-metrics branch from fba91bb to f8c01b9 Compare October 30, 2019 17:09
@awgreene
Copy link
Member Author

awgreene commented Oct 30, 2019

Example Cases:

When a CSV is updated but not in the succeeded phase

# HELP csv_abnormal Successful CSV Install
# TYPE csv_abnormal gauge
csv_abnormal{name="etcd-operator.v1.0.0",phase="Failed",reason="UnsupportedOperatorGroup",version="1.0.0"} 1.0
...
...
...
# HELP csv_succeeded Successful CSV Install
# TYPE csv_succeeded gauge
csv_succeeded{name="packageserver",version="1.0.0"} 1.0
csv_succeeded{name="etcd-operator.v1.0.0",version="1.0.0"} 0.0

Note: When a CSV is updated, the old metric is deleted.

When a CSV reaches the succeeded phase

# HELP csv_succeeded Successful CSV Install
# TYPE csv_succeeded gauge
csv_succeeded{name="packageserver",version="1.0.0"} 1.0
csv_succeeded{name="etcd-operator.v1.0.0",version="1.0.0"} 1.0

Note: Notice that the csv_abnormal timeseries was removed

@awgreene
Copy link
Member Author

@ecordell it should be noted that this data will get messy if multiple instances of the same operator are installed.

@awgreene awgreene force-pushed the limit-cardinality-on-csv-metrics branch 6 times, most recently from 37278d8 to c2adb1c Compare October 30, 2019 18:44
@awgreene
Copy link
Member Author

/test e2e-gcp-upgrade

@awgreene awgreene force-pushed the limit-cardinality-on-csv-metrics branch from c2adb1c to 571ec70 Compare October 30, 2019 19:27
@awgreene awgreene changed the title WIP: feat(metrics) Limit Cardinality of CSV metrics feat(metrics) Limit Cardinality of CSV metrics Oct 30, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 30, 2019
pkg/metrics/metrics.go Outdated Show resolved Hide resolved
@awgreene awgreene force-pushed the limit-cardinality-on-csv-metrics branch from 571ec70 to 288425b Compare October 31, 2019 02:09
@awgreene
Copy link
Member Author

/retest

Copy link
Member

@ecordell ecordell left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 31, 2019
@ecordell
Copy link
Member

/hold

while I spin up a cluster to look at this :)

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 31, 2019
@awgreene
Copy link
Member Author

/hold

while I spin up a cluster to look at this :)

Sure - let me know if you find anything interesting!

@ecordell
Copy link
Member

Checking CSV succeeded:
blue is packageserver, which is always good
green is etcd-operator - I killed its deployment to watch it go unhealthy

Screen Shot 2019-10-31 at 8 58 56 AM

This is csv_abnormal - I just see it for installready, when olm detected the deployment was deleted and reconciles from the CSV.
Screen Shot 2019-10-31 at 8 59 16 AM

This looks good, but I did expect to see more values for "abnormal". I think what's happening is that we're deleting the abnormal states from prometheus before prometheus can scrape them.

Knowing when to delete them is tricky, since the scrape time is configurable. I think it's 20s by default. We may need to do something where we keep the "old" timeseries around for a while before deleting them.

@awgreene awgreene force-pushed the limit-cardinality-on-csv-metrics branch from 288425b to 2a93602 Compare October 31, 2019 14:54
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 31, 2019
This commit introduces a change that limits the number of metrics that
an OLM cluster reports at any given time for a CSV.

The first metric introduced is called csv_up, which tracks CSVs that
have reached the succeeded phase. The following information is
provided about the CSV via labels: namespace, name, version. The value
of this metric will always be 0 or 1.

The second metric introduced is called csv_abnormal, which is reported
whenever the CSV is updated and has not reached the succeeded phase. The
following information is provided about the CSV via labels: namespace,
name, version, phase, reason. Whenever a CSV is updated, the existing
timeseries is deleted and replaced by an updated version.
@awgreene awgreene force-pushed the limit-cardinality-on-csv-metrics branch from 2a93602 to 5884308 Compare October 31, 2019 15:23
@kevinrizza
Copy link
Member

Checking CSV succeeded:
blue is packageserver, which is always good
green is etcd-operator - I killed its deployment to watch it go unhealthy

This is csv_abnormal - I just see it for installready, when olm detected the deployment was deleted and reconciles from the CSV.

This looks good, but I did expect to see more values for "abnormal". I think what's happening is that we're deleting the abnormal states from prometheus before prometheus can scrape them.

Knowing when to delete them is tricky, since the scrape time is configurable. I think it's 20s by default. We may need to do something where we keep the "old" timeseries around for a while before deleting them.

@ecordell Maybe this is a silly question, but what value do we get from seeing every step here rather than just seeing "it's in a good state" or "it's not in a good state" ? Is there some unique knowledge we would gain from seeing all of those steps? I was thinking that we care more about "what step are we stuck in" in the same way that I can learn that by kubectl getting the CSV

My concern is that being aware of the state of these things and deleting them later seems like it adds a medium amount of complexity to managing the metric endpoint's state for the value that it adds.

@ecordell
Copy link
Member

That's a good point, and I do think it would be reasonable to merge this as-is and accept that not all states will necessarily get picked up by prometheus.

It would be nice to see the full lifecycle of operators reported if possible though. Perhaps we do that as a follow up.

@ecordell
Copy link
Member

/lgtm
/hold cancel

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Oct 31, 2019
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: awgreene, ecordell

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ecordell
Copy link
Member

/retest

2 similar comments
@awgreene
Copy link
Member Author

/retest

@awgreene
Copy link
Member Author

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants