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

Add external ports to job automatically when promMetrics are enabled #3643

Merged
merged 4 commits into from
Jul 1, 2024

Conversation

busma13
Copy link
Contributor

@busma13 busma13 commented Jun 6, 2024

This PR makees the following changes:

  • Creates an addExternalPortsToJobSpec() function that will add the external_ports field to a job if promMetrics are enabled and configure it to use the correct port.
  • Adds a call to addExternalPortsToJobSpec() with the submit() and update() function within the JobService class.

ref: #3604

@busma13 busma13 self-assigned this Jun 6, 2024
@busma13 busma13 marked this pull request as ready for review June 11, 2024 19:44
@busma13 busma13 changed the title Add external ports automatically Add external ports to job automatically when promMetrics are enabled Jun 11, 2024
@busma13 busma13 added this to the v2.1 milestone Jun 14, 2024
@busma13 busma13 force-pushed the add-external-ports-automatically branch from 4ea324b to 3724dcd Compare June 18, 2024 14:39
Copy link
Member

@godber godber left a comment

Choose a reason for hiding this comment

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

see comment about docs

* Check if prom_metrics_enabled is true on jobSpec or teraslice config.
* If so, add or update external_ports property with correct port.
* @param {Partial<JobConfig>} jobSpec
*/
Copy link
Member

Choose a reason for hiding this comment

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

You should describe the precedence behavior in the docs here:

https://terascope.github.io/teraslice/docs/configuration/clustering-k8s#prometheus-metrics

Otherwise this is good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The following properties will override the matching property set within the terafoundation configuration.

I'm guessing this sentence from the docs is not clear enough?

Copy link
Member

Choose a reason for hiding this comment

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

Actually, I need to think through that logic more carefully overall.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I know why this is hard.

Technically, I don't think we have enough properties to control all the conditions an operator/user may want. We have a single prom_metrics_enabled property, set either at the Terafoundation or the job level. But we may want the ability to trigger Prometheus independently on the master or on the jobs. That being the case what does the Terafoundation level prom_metrics_enabled represent? Is it the setting for the metrics on the master or is it the default for the jobs?

I hadn't really considered this until I saw your conditional:

        if (enabledInJob === true || (enabledInJob === undefined && enabledInTF)) {

and wondered what enabledInJob === false would imply.

I think the logic you have here is a great compromise.

Here are the conditions we hypothetically want to support:

  • master metrics off, job metrics off
    • no settings anywhere
    • good
  • master metrics on, job metrics off
    • enabledInTF: True and enabledInJob: False in all jobs
    • I can see this one potentially being a problem, lets say the metrics are costly somehow but we want them in the master, but not in the jobs, we will be forced to set this for prom_metrics_enabled: False in EVERY job to work around this.
  • master metrics on, job metrics on
    • enabledInTF: True
    • good
  • master metrics off, job metrics on
    • enabledInTF: False and enabledInJob: True in all jobs
    • this is pretty good, because the odds of not wanting master metrics is low

What I'm getting at is our properties were kind of wrong from the start, for completeness they might need to be:

  • Terafoundation
    • prom_metrics_enabled_master
    • prom_metrics_enabled_job_default
  • Job
    • prom_metrics_enabled

But really this all seems a little fussy, unless we really need it for that second scenario above.

Copy link
Member

@godber godber left a comment

Choose a reason for hiding this comment

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

Let's just proceed with this.

@godber godber merged commit 33ea601 into master Jul 1, 2024
59 checks passed
@godber godber deleted the add-external-ports-automatically branch July 1, 2024 23:37
@godber godber temporarily deployed to github-pages July 1, 2024 23:45 — with GitHub Actions Inactive
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.

2 participants