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

Introduce agent.monitoring.metrics_period #4961

Merged

Conversation

pkoutsovasilis
Copy link
Contributor

@pkoutsovasilis pkoutsovasilis commented Jun 19, 2024

What does this PR do?

This PR introduces agent.monitoring.metrics_period field

Why is it important?

I consider this PR important as it allows each user to control the sampling period of monitoring metrics according to them needs

Checklist

  • My code follows the style guidelines of this project
    - [ ] I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
    - [ ] I have added an integration test or an E2E test

Disruptive User Impact

None

How to test this PR locally

Spawn an agent with setting the config agent.monitoring.metrics_period

Related issues

@pkoutsovasilis pkoutsovasilis added enhancement New feature or request backport-skip labels Jun 19, 2024
@pkoutsovasilis pkoutsovasilis changed the title feat: introduce agent.monitoring.metrics_period Introduce agent.monitoring.metrics_period Jun 19, 2024
@pkoutsovasilis pkoutsovasilis force-pushed the pkoutsovasilis/metrics_interval branch from 9d640f9 to a017e01 Compare June 19, 2024 17:46
@pkoutsovasilis pkoutsovasilis marked this pull request as ready for review June 19, 2024 17:55
@pkoutsovasilis pkoutsovasilis requested a review from a team as a code owner June 19, 2024 17:55
@cmacknz cmacknz added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Jun 19, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

Copy link
Member

@cmacknz cmacknz left a comment

Choose a reason for hiding this comment

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

Thanks, confirmed it works by reloading a standalone agent configuration and overriding it in a Fleet managed agent using a request like:

PUT kbn:/api/fleet/agent_policies/4d16de58-695b-42f2-a006-c9f2f51d7ccd
{
    "name": "Agent policy 1",
    "namespace": "default",
    "overrides": {
      "agent": {
        "monitoring": {
          "metrics_period": "5s"
        }
      }
    }
}

Also confirmed the metrics documents are actually arriving at a 5s interval when I made the change above.

Copy link
Contributor

@alexsapran alexsapran left a comment

Choose a reason for hiding this comment

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

Thank you very much for the prompt support

@pkoutsovasilis pkoutsovasilis merged commit 6a45256 into elastic:main Jun 20, 2024
13 checks passed
@alexsapran
Copy link
Contributor

@cmacknz should we backport this to 8.14?

@pierrehilbert
Copy link
Contributor

As this is an enhancement and not a bug fix I would say we shouldn't.
On the other hand, this change is small enough to limit the risk and could accelerate its usage for our benchmark.
Will let @cmacknz decide on Monday what is the best option here.

@cmacknz
Copy link
Member

cmacknz commented Jun 24, 2024

Yes normally this wouldn't be backported. What problem does backport to 8.14 solve for us? It is small so if it solves a big enough problem we can backport it anyway.

@amitkanfer
Copy link
Contributor

What problem does backport to 8.14 solve for us?

solves 2 problems IMHO:

  • Will unblock a team member with a project we've been wanting to do for a long time now :)
  • One of the biggest asks is to have a performance benchmark for Agent, this is asked everywhere - and having this fix in place will allow us to start working on it.

So if not a risk - I'm +1 for backporting it ASAP.

@cmacknz cmacknz added the backport-v8.14.0 Automated backport with mergify label Jun 25, 2024
mergify bot pushed a commit that referenced this pull request Jun 25, 2024
* feat: introduce agent.monitoring.metrics_period

* doc: add changelog/fragments

* fix: TestDiagnosticLocalConfig unit-test

* doc: reword summary in changelog fragment

(cherry picked from commit 6a45256)

# Conflicts:
#	_meta/config/common.p2.yml.tmpl
#	_meta/config/common.reference.p2.yml.tmpl
#	_meta/config/elastic-agent.docker.yml.tmpl
#	elastic-agent.docker.yml
#	elastic-agent.reference.yml
#	elastic-agent.yml
#	internal/pkg/agent/application/monitoring/v1_monitor.go
#	internal/pkg/agent/application/monitoring/v1_monitor_test.go
@cmacknz
Copy link
Member

cmacknz commented Jun 25, 2024

Backport: #5003

cmacknz pushed a commit that referenced this pull request Jun 26, 2024
* Introduce agent.monitoring.metrics_period (#4961)

* feat: introduce agent.monitoring.metrics_period

* doc: add changelog/fragments

* fix: TestDiagnosticLocalConfig unit-test

* doc: reword summary in changelog fragment

(cherry picked from commit 6a45256)

# Conflicts:
#	_meta/config/common.p2.yml.tmpl
#	_meta/config/common.reference.p2.yml.tmpl
#	_meta/config/elastic-agent.docker.yml.tmpl
#	elastic-agent.docker.yml
#	elastic-agent.reference.yml
#	elastic-agent.yml
#	internal/pkg/agent/application/monitoring/v1_monitor.go
#	internal/pkg/agent/application/monitoring/v1_monitor_test.go

* fix conflicts

---------

Co-authored-by: Panos Koutsovasilis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip backport-v8.14.0 Automated backport with mergify enhancement New feature or request Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants