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 containerd package and cpu,memory,blkio data streams #2522

Merged
merged 13 commits into from
Jan 25, 2022

Conversation

MichaelKatsoulis
Copy link
Contributor

@MichaelKatsoulis MichaelKatsoulis commented Jan 12, 2022

What does this PR do?

After merging elastic/beats#29247 which introduced containerd module this PR
creates containerd package with cpu, memory and blkio data streams.

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

  1. Bring up the elastic-stack version 8.1.0-SNAPSHOT
    elastic-package up --version=8.1.0-SNAPSHOT -v -d
  2. Bring up a Kubernetes cluster with kind and containerd runtime kind create cluster --image 'kindest/node:v1.21.1
  3. Docker exec in the kind kubernetes node and configure containerd to server metrics. Follow instructions here.
  4. Deploy elastic agent with the same version and enrol it to fleet.
  5. Add containerd integration in a policy and assign it to the agent.
  6. Watch containerd cpu, memory and blkio metrics being populated.

Related issues

Screenshots

containerd_integration

containerd_readme

containerd_configuration

containerd_data_streams

discover_cpu

discover_memory

discover_blkio

containerd_dash

@MichaelKatsoulis MichaelKatsoulis marked this pull request as draft January 12, 2022 13:53
@MichaelKatsoulis MichaelKatsoulis self-assigned this Jan 12, 2022
@MichaelKatsoulis MichaelKatsoulis added the Team:Integrations Label for the Integrations team label Jan 12, 2022
@elasticmachine
Copy link

elasticmachine commented Jan 12, 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-01-24T16:13:25.174+0000

  • Duration: 17 min 44 sec

  • Commit: 3418b4b

Test stats 🧪

Test Results
Failed 0
Passed 10
Skipped 0
Total 10

🤖 GitHub comments

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

  • /test : Re-trigger the build.


- name: write.bytes
type: long
format: bytes
Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -0,0 +1,2 @@
- external: ecs
name: container.id
Copy link
Contributor

@tetianakravchenko tetianakravchenko Jan 18, 2022

Choose a reason for hiding this comment

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

should dimension: true be set for this fields? as I see usually it is set on *.name field - https://github.com/elastic/integrations/blob/master/packages/kubernetes/data_stream/container/fields/base-fields.yml#L127-L128, but it is not possible to expose name, right?

the same for memory and cpu datastreams

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes right it is not possible. But I think that container.id is the best place.

@@ -0,0 +1,2 @@
- external: ecs
Copy link
Contributor

@tetianakravchenko tetianakravchenko Jan 18, 2022

Choose a reason for hiding this comment

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

in sample event there is an ecs.version, should it be added here?

actually I thought that those fields are more or less a default for each integration - https://github.com/elastic/integrations/blob/master/packages/kubernetes/data_stream/container/fields/ecs.yml, or?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems that some are added by default like the ecs.version, service.address and service.type. The rest are not default. For example containerd adds container.id while kubernetes adds orchestrator.cluster.name


- name: usage.user.ns
type: double
metric_type: gauge
Copy link
Contributor

@tetianakravchenko tetianakravchenko Jan 18, 2022

Choose a reason for hiding this comment

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

@MichaelKatsoulis MichaelKatsoulis marked this pull request as ready for review January 19, 2022 10:07
@elasticmachine
Copy link

Pinging @elastic/integrations (Team:Integrations)

@MichaelKatsoulis
Copy link
Contributor Author

/test

@MichaelKatsoulis
Copy link
Contributor Author

@akshay-saraswat could you take a look at the screenshot of the dashboard I have created for containerd? Unfortunately we cannot extract informations from the metrics like containers' statuses which would be something nice to see in a dashboard.

Copy link
Member

@ChrsMark ChrsMark left a comment

Choose a reason for hiding this comment

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

Overall looks good. Just 2 comments:

  1. In the visualisations Read/Write Bytes Per Container the Y axis has too big numbers, wondering if we could somehow curate it and make it be shown like 2M instead of 2.000.000 etc. Not sure if possible through Kibana though, maybe there is a setting in the Visualisation options. Also I see that you are using Lens Line charts. I remember in the past we prefered using TSVB charts though for many reasons. @kaiyan-sheng does it happen to have more context here?
  2. I see the package has not tests, but you can add them with a mock server already and ensure that package is tested. See https://github.com/elastic/integrations/tree/master/packages/docker/_dev/deploy/docker as an example and a past k8s version https://github.com/elastic/integrations/tree/b189a92444c4dfc33a3462fdad21b40a5bf8ae4e/packages/kubernetes/_dev/deploy/docker

@MichaelKatsoulis
Copy link
Contributor Author

Overall looks good. Just 2 comments:

  1. In the visualisations Read/Write Bytes Per Container the Y axis has too big numbers, wondering if we could somehow curate it and make it be shown like 2M instead of 2.000.000 etc. Not sure if possible through Kibana though, maybe there is a setting in the Visualisation options. Also I see that you are using Lens Line charts. I remember in the past we prefered using TSVB charts though for many reasons. @kaiyan-sheng does it happen to have more context here?

Yes we can. I had set the value type to default instead of bytes. Also I have created the same dashboard with TSVB as well. So I am good either way.

@kaiyan-sheng
Copy link
Contributor

@ChrsMark Yep @MichaelKatsoulis got it, setting the value type to bytes will give 2M instead of 2,000,000 🙂

@MichaelKatsoulis
Copy link
Contributor Author

@ChrsMark , @tetianakravchenko could do a final review? I decided to go with the TSVB dashboard. I also added mock tests.

@tetianakravchenko
Copy link
Contributor

@MichaelKatsoulis did you update the screenshot after the latest dashboard changes?

@MichaelKatsoulis
Copy link
Contributor Author

@MichaelKatsoulis did you update the screenshot after the latest dashboard changes?

Yes the screenshot is correct , just without the TSVB word in the dashboard name

Copy link
Contributor

@tetianakravchenko tetianakravchenko left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@ChrsMark ChrsMark left a comment

Choose a reason for hiding this comment

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

:shipit:

@MichaelKatsoulis MichaelKatsoulis merged commit b11ebb1 into elastic:main Jan 25, 2022
eyalkraft pushed a commit to build-security/integrations that referenced this pull request Mar 30, 2022
* Add containerd package and cpu,memory,blkio data streams
@ChrsMark ChrsMark mentioned this pull request Sep 26, 2022
5 tasks
@andrewkroh andrewkroh added Integration:containerd Containerd New Integration Issue or pull request for creating a new integration package. labels Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Integration:containerd Containerd New Integration Issue or pull request for creating a new integration package. Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create integration for containerd module
6 participants