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 system tests to logstash package #4443

Merged

Conversation

crespocarlos
Copy link
Contributor

@crespocarlos crespocarlos commented Oct 11, 2022

What does this PR do?

This PR adds system tests to the Logstash package

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

How to test this PR locally

  • Run cd packages/logstash && elastic-package test system

Related issues

(cherry picked from commit 4df6b991a6db0cb851598c34063363d90f1c0749)
@elasticmachine
Copy link

elasticmachine commented Oct 11, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-10-14T11:04:06.024+0000

  • Duration: 18 min 6 sec

Test stats 🧪

Test Results
Failed 0
Passed 25
Skipped 0
Total 25

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@elasticmachine
Copy link

elasticmachine commented Oct 11, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (2/2) 💚
Files 100.0% (6/6) 💚 2.783
Classes 100.0% (6/6) 💚 2.783
Methods 100.0% (46/46) 💚 10.188
Lines 87.558% (190/217) 👎 -3.909
Conditionals 100.0% (0/0) 💚

@crespocarlos
Copy link
Contributor Author

/test

@crespocarlos crespocarlos changed the title Add system tests for logstash package Add system tests to logstash package Oct 11, 2022
@elasticmachine
Copy link

elasticmachine commented Oct 12, 2022

🚀 Benchmarks report

Package logstash 👍(0) 💚(1) 💔(1)

Expand to view
Data stream Previous EPS New EPS Diff (%) Result
slowlog 4098.36 3344.48 -753.88 (-18.39%) 💔

To see the full report comment with /test benchmark fullreport

@crespocarlos crespocarlos force-pushed the 4008-logstash-package-system-tests branch 5 times, most recently from 7d91acc to f050889 Compare October 12, 2022 18:44
@crespocarlos crespocarlos force-pushed the 4008-logstash-package-system-tests branch from f050889 to 8bb0994 Compare October 12, 2022 19:12
@crespocarlos crespocarlos marked this pull request as ready for review October 14, 2022 08:35
@crespocarlos crespocarlos requested a review from a team as a code owner October 14, 2022 08:35
services:
logstash:
image: "docker.elastic.co/logstash/logstash:${ELASTIC_VERSION}"
user: root
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 container needs to be accessed by root user to have permission to write in the ${SERVICE_LOGS_DIR} folder

services:
logstash:
image: "docker.elastic.co/logstash/logstash:${ELASTIC_VERSION}"
user: root
image: "docker.elastic.co/logstash/logstash:${ELASTIC_VERSION:-8.5.0-SNAPSHOT}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

.env file doesn't work in the CI, 8.5.0-SNAPSHOT is the default value, in case the var is null. We need to figure out how to make this a dynamic value.

Copy link
Contributor

@klacabane klacabane Oct 14, 2022

Choose a reason for hiding this comment

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

Looks like we can create a variants.yml file that defines all the versions we want to run the test suite against. The variable defined in the variants file are then available in the docker compose - see #4013 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah. nice! I'll try this

@@ -55,7 +55,7 @@
type: group
fields:
- name: stat
type: group
type: object
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any difference between object and group types ?

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 only difference here is that the static tests won't fail in case stat receives a null value. It will act as a json object too https://www.elastic.co/guide/en/elasticsearch/reference/current/object.html. In practice, I didn't see any difference

- name: load_average
type: group
fields:
- name: 15m
type: long
type: half_float
Copy link
Contributor

Choose a reason for hiding this comment

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

The agent mappings will become the source of truth and we should eventually align the metricbeat mappings (in ES and in metricbeat repo) on this version once we're confident. We could potentially improve the existing mappings tooling to be smarter so it can interpret the diffs and patch the repos accordingly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. This change was actually from a PR @matschaffer worked on, which I happen to have reviewed and remembered about. We need to be careful now when updating metricbeat mappings. Do we have any tooling to keep them aligned?

Copy link
Contributor

Choose a reason for hiding this comment

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

There's a script here but it only detects the deltas and we'd need something to act on them. With .monitoring-* being source of truth it's difficult to automatically apply deltas to agent or metricbeat mappings because the latter have one definition per metricset while the former is just one json object, so we don't know the target metricset to patch unless we have a manual step in between. With the agent mappings being source of truth we could do the following:

  1. update agent mapping
  2. detect delta with .monitoring-* mapping and add/update/delete the entry. We can simply patch the json blob here
  3. detect delta with the metricset's mappings in the metricbeat module. We have 1:1 relationship with data stream/metricset so we know which fields to update in the metricbeat module

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm thinking we should open a follow up issue to sweep mappings for other mis-alignments. We've had a number of recent tweaks to fix bugs that were ultimately rooted in things not being in sync between metricbeat and the ES-shipped templates.

Copy link
Contributor

Choose a reason for hiding this comment

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

nice, @miltonhultgren beat me to it elastic/kibana#143439 :)

@crespocarlos crespocarlos added Integration:logstash Logstash Team:Infra Monitoring UI - DEPRECATED Label for the Infrastructure Monitoring UI team. - DEPRECATED - Use Team:obs-ux-infra_services labels Oct 27, 2022
@crespocarlos crespocarlos merged commit 094a533 into elastic:main Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Integration:logstash Logstash Team:Infra Monitoring UI - DEPRECATED Label for the Infrastructure Monitoring UI team. - DEPRECATED - Use Team:obs-ux-infra_services
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Stack Monitoring] Add system tests
4 participants