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

Prom client in mock prom metrics #3613

Merged
merged 5 commits into from
May 15, 2024
Merged

Conversation

busma13
Copy link
Contributor

@busma13 busma13 commented May 14, 2024

This PR makes the following changes:

  • add teraslice_ prefix to promMetrics.init() for master so all metric names match what was in teraslice-exporter package.
  • update mockPrommetrics to use prom-client. This allows collect() functions to be used in TestContext.

@busma13 busma13 force-pushed the prom-client-in-mock-prom-metrics branch from 11af198 to 29c9d02 Compare May 14, 2024 20:26
@busma13 busma13 force-pushed the prom-client-in-mock-prom-metrics branch from 29c9d02 to 41f80f1 Compare May 14, 2024 20:32
@@ -1113,9 +1113,7 @@ export class ExecutionController {
* @link https://terascope.github.io/teraslice/docs/development/k8s#prometheus-metrics-api
*/
async setupPromMetrics() {
this.logger.info(`adding ${this.context.assignment} prom metrics...`);
Copy link
Member

Choose a reason for hiding this comment

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

You don't need to add it back right now but I think logging, at the info level, that prom metrics are enabled (once at "init" or "setup") makes sense.

Generally speaking a log for every optional feature that is "enabled" is useful, if it occurs ONCE per 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.

I must have deleted that accidentally. I'll add it back in.

@@ -150,7 +150,8 @@ export class ClusterMaster {
tf_prom_metrics_enabled: terafoundation.prom_metrics_enabled,
tf_prom_metrics_port: terafoundation.prom_metrics_port,
logger: this.logger,
assignment: 'cluster_master'
assignment: 'master',
prefix: 'teraslice_'
Copy link
Member

Choose a reason for hiding this comment

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

These are the "API" changes that are relevant to document in the CHANGELOG.

@godber godber merged commit d79ff05 into master May 15, 2024
40 checks passed
@godber godber deleted the prom-client-in-mock-prom-metrics branch May 15, 2024 18:19
godber pushed a commit that referenced this pull request May 17, 2024
This PR fixes a bug introduced in #3613, where the worker's
`slicesProcessed` promMetric `collect()` function would throw an error
when metrics were scraped, causing the pod to crash.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants