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 metricbeat benchmark module #41801

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

leehinman
Copy link
Contributor

@leehinman leehinman commented Nov 26, 2024

Proposed commit message

Add a metricbeat benchmark module.

This module will generate a synthetic metric every period. It can be configured to send multiple events by setting the count option.

This is useful if you need to write integration tests that produce metrics without having to setup something to monitor. It is also useful for testing output configuration and sizing of systems.

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.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Disruptive User Impact

None. New module.

Author's Checklist

  • [ ]

How to test this PR locally

Unit tests

cd x-pack/metricbeat/module/benchmark/info
go test -v .

By Hand

build metricbeat from this PR, and then run with the following metricbeat.yml

metricbeat:
  modules:
    - module: benchmark
      metricsets:
        - info
      count: 1
      enabled: true
      period: 1s
output:
  console:
    pretty: true

Related issues

  • closes elastic/ingest-dev#4438

Use cases

Screenshots

Logs

@leehinman leehinman requested a review from a team as a code owner November 26, 2024 21:25
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Nov 26, 2024
@leehinman leehinman added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Nov 26, 2024
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Nov 26, 2024
@leehinman leehinman added needs_team Indicates that the issue/PR needs a Team:* label backport-8.x Automated backport to the 8.x branch with mergify labels Nov 26, 2024
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Nov 26, 2024
@leehinman leehinman force-pushed the onweek_metricbeat_benchmark branch 2 times, most recently from 593d87c to 158f2b2 Compare November 26, 2024 21:52
The nth info metric emitted by the benchmark module


type: keyword
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a numeric type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not. Even though it is numeric "data", it is unlikely we would use range searches, it is much more likely we want fast retrieval. ie you search to make sure that benchmark metric number 13 was actually indexed.

Here is the tip from elasticsearch docs I'm basing this off of.

Mapping numeric identifiers

Not all numeric data should be mapped as a numeric field data type. Elasticsearch optimizes numeric fields, such as integer or long, for range queries. However, keyword fields are better for term and other term-level queries.

Identifiers, such as an ISBN or a product ID, are rarely used in range queries. However, they are often retrieved using term-level queries.

Consider mapping a numeric identifier as a keyword if:

  • You don’t plan to search for the identifier data using range queries.
  • Fast retrieval is important. term query searches on keyword fields are often faster than term searches on numeric fields.

If you’re unsure which to use, you can use a multi-field to map the data as both a keyword and a numeric data type.

- module: prometheus
period: 10s
metricsets: ["collector"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to change as part of this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, in that it isn't part of this change. But Yes in that mage config generates it. I don't know why #40411 didn't already pull this change in.

info
fields:
- name: counter
type: keyword
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a numeric type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See previous comment on why "numeric" data shouldn't always have a numeric type in elasticsearch.

@leehinman leehinman requested a review from a team as a code owner November 28, 2024 16:26
Copy link
Contributor

mergify bot commented Dec 2, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b onweek_metricbeat_benchmark upstream/onweek_metricbeat_benchmark
git merge upstream/main
git push upstream onweek_metricbeat_benchmark

@leehinman
Copy link
Contributor Author

@ycombinator how do you feel about the numeric vs keyword reasoning?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants