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.

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 !

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
Member

@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
Copy link
Contributor Author

Added changes to address @webern's comments.

@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
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