Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Add a generic labeled gauge for K8s plugin resources #137

Merged
merged 27 commits into from
Jun 24, 2020

Conversation

wild-endeavor
Copy link
Contributor

@wild-endeavor wild-endeavor commented May 27, 2020

TL;DR

Adds a generic labeled gauge for K8s plugin resources

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

  • We are adding a generic utility to emit gauge metrics in the plugin_manager using the labeled gauges now found in flytestdlib.
  • Henceforth, a goroutine will be spun up that will create a ResourceLevelMonitor for each type that a plugin registers.
  • Changing the existing gauge collecting utilty for FlyteWorkflow CRD objects to use the same labeled gauge.
  • We may wish to combine these in the future but as their aggregations are different, we are keeping them separate for now.

Tracking Issue

flyteorg/flyte#311

Follow-up issue

NA

Copy link
Contributor

@EngHabu EngHabu left a comment

Choose a reason for hiding this comment

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

Awesome!

cmd/controller/cmd/root.go Outdated Show resolved Hide resolved
pkg/controller/nodes/task/k8s/plugin_collector.go Outdated Show resolved Hide resolved
pkg/controller/nodes/task/k8s/plugin_collector.go Outdated Show resolved Hide resolved
pkg/controller/nodes/task/k8s/plugin_manager.go Outdated Show resolved Hide resolved
EngHabu
EngHabu previously approved these changes May 28, 2020
Yee Hing Tong added 2 commits May 28, 2020 17:18
@wild-endeavor wild-endeavor changed the title [wip] Add a generic labeled gauge for K8s plugin resources Add a generic labeled gauge for K8s plugin resources May 29, 2020
@codecov-commenter
Copy link

codecov-commenter commented Jun 1, 2020

Codecov Report

Merging #137 into master will increase coverage by 0.31%.
The diff coverage is 79.80%.

Scope promutils.Scope

// Meta timer - this times each collection cycle to measure how long it takes to collect the levels GaugeVec below
CollectorTimer *labeled.StopWatch
Copy link
Contributor

Choose a reason for hiding this comment

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

is this a prometheus collector?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

stopwatches are defined in flytestdlib, but they're basically Summary objects https://github.com/lyft/flytestdlib/blob/c963e9ff8fc9bb46f169c43b923af07d6c5bf71e/promutils/scope.go#L72

}

func (r *ResourceLevelMonitor) RunCollector(ctx context.Context) {
ticker := time.NewTicker(resourceLevelMonitorCycleDuration)
Copy link
Contributor

Choose a reason for hiding this comment

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

defer ticker.Stop()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you mean inside the goroutine right? If I add it here, the ticker will just stop and it'll never run.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added it inside.

kumare3
kumare3 previously approved these changes Jun 23, 2020
Copy link
Contributor

@kumare3 kumare3 left a comment

Choose a reason for hiding this comment

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

LGTM

@wild-endeavor wild-endeavor merged commit cdd6fa2 into master Jun 24, 2020
kumare3 pushed a commit to nuclyde-io/flytepropeller that referenced this pull request Feb 4, 2021
eapolinario pushed a commit to eapolinario/flytepropeller that referenced this pull request Aug 9, 2023
# TL;DR
Adds a generic labeled gauge for K8s plugin resources

## Type
 - [ ] Bug Fix
 - [x] Feature
 - [ ] Plugin

## Are all requirements met?

 - [x] Code completed
 - [x] Smoke tested
 - [x] Unit tests added
 - [x] Code documentation added
 - [x] Any pending items have an associated Issue

## Complete description
* We are adding a generic utility to emit gauge metrics in the `plugin_manager` using the labeled gauges now found in flytestdlib.
* Henceforth, a goroutine will be spun up that will create a `ResourceLevelMonitor` for each type that a plugin registers.
* Changing the existing gauge collecting utilty for FlyteWorkflow CRD objects to use the same labeled gauge.
* We may wish to combine these in the future but as their aggregations are different, we are keeping them separate for now.

## Tracking Issue
flyteorg/flyte#311

## Follow-up issue
NA
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants