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

settings: add metrics settings extension #3963

Merged

Conversation

sumukhballal
Copy link
Contributor

Issue number:

Closes #3656

Description of changes:

Creates a metrics settings extension and uses it in every variant's settings model.

Testing done:

Built an aws-ecs-1 variant with the settings-metrics package installed. Called apiclient to verify that the aws settings worked as before. Also called the settings extension to verify that it was behaving as expected.

$ apiclient get settings.metrics
{
  "settings": {
    "metrics": {
      "metrics-url": "https://metrics.bottlerocket.aws/v1/metrics",
      "send-metrics": true,
      "service-checks": [
        "apiserver",
        "chronyd",
        "containerd",
        "host-containerd",
        "docker",
        "ecs"
      ]
    }
  }
}

Setting the URL: Happy case

[ssm-user@control]$ apiclient set settings.metrics.metrics-url="https://metrics.bottlerocket.aws/v2/metrics-test"
[ssm-user@control]$ apiclient get settings.metrics.metrics-url
{
  "settings": {
    "metrics": {
      "metrics-url": "https://metrics.bottlerocket.aws/v2/metrics-test"
    }
  }
}

Setting the service-checks

[ssm-user@control]$ apiclient set --json '{"settings": {"metrics": { "service-checks": ["test", "test2"]}}}'
[ssm-user@control]$
[ssm-user@control]$
[ssm-user@control]$ apiclient get settings.metrics.service-checks
{
  "settings": {
    "metrics": {
      "service-checks": [
        "test",
        "test2"
      ]
    }
  }
}

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

@sumukhballal sumukhballal requested a review from sam-berning May 16, 2024 10:32
sources/settings-extensions/metrics/Cargo.toml Outdated Show resolved Hide resolved
sources/models/src/aws-k8s-1.30-nvidia/mod.rs Outdated Show resolved Hide resolved
sources/Cargo.toml Outdated Show resolved Hide resolved
@sumukhballal
Copy link
Contributor Author

Addressed comments from @sam-berning !

@sumukhballal sumukhballal force-pushed the metrics-settings-extension branch from 1421fc3 to 6f5ba25 Compare May 20, 2024 19:16
packages/settings-metrics/Cargo.toml Outdated Show resolved Hide resolved
sources/Cargo.toml Outdated Show resolved Hide resolved
sources/settings-extensions/metrics/metrics.toml Outdated Show resolved Hide resolved
Copy link
Contributor

@webern webern left a comment

Choose a reason for hiding this comment

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

You need to run cd sources && cargo check (it may error, but it's ok) then check in the Cargo.lock changes.

@sumukhballal sumukhballal force-pushed the metrics-settings-extension branch from 6f5ba25 to 439be0b Compare May 20, 2024 20:44
@sumukhballal
Copy link
Contributor Author

Added changes to address @webern's comments.

@sumukhballal sumukhballal force-pushed the metrics-settings-extension branch from 439be0b to 0a46a57 Compare May 20, 2024 21:05
@sumukhballal
Copy link
Contributor Author

Fixed some rustfmt issues.

@sumukhballal sumukhballal marked this pull request as ready for review May 20, 2024 21:17
@sumukhballal sumukhballal force-pushed the metrics-settings-extension branch from 0a46a57 to 509475a Compare May 20, 2024 23:58
@sumukhballal sumukhballal force-pushed the metrics-settings-extension branch from 509475a to 10f4df0 Compare May 21, 2024 00:17
@sumukhballal
Copy link
Contributor Author

Fixed merge conflicts.

@sumukhballal sumukhballal merged commit 1353ea1 into bottlerocket-os:develop May 21, 2024
33 checks passed
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.

OOTB: Port metrics settings model to settings extensions
3 participants