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 missing cluster metadata to multiple k8s metricsests #32979

Merged
merged 5 commits into from
Sep 8, 2022

Conversation

tetianakravchenko
Copy link
Contributor

What does this PR do?

Add orchestrator.cluster.name and orchestrator.cluster.ip fields to the datasets: proxy, system, apiserver, scheduler and controllermanager.

Why is it important?

orchestrator.cluster.name is used for kubernetes dashboards

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.

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Screenshot 2022-09-05 at 16 47 45

Screenshot 2022-09-05 at 16 48 01

Screenshot 2022-09-05 at 16 46 50

Screenshot 2022-09-05 at 16 47 16

Screenshot 2022-09-05 at 16 47 31

Logs

Signed-off-by: Tetiana Kravchenko <[email protected]>
Signed-off-by: Tetiana Kravchenko <[email protected]>
@tetianakravchenko tetianakravchenko requested a review from a team as a code owner September 5, 2022 16:17
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Sep 5, 2022
@mergify
Copy link
Contributor

mergify bot commented Sep 5, 2022

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @tetianakravchenko? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@tetianakravchenko tetianakravchenko requested a review from a team September 5, 2022 16:23
@tetianakravchenko tetianakravchenko added the Team:Cloudnative-Monitoring Label for the Cloud Native Monitoring team label Sep 5, 2022
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Sep 5, 2022
@elasticmachine
Copy link
Collaborator

elasticmachine commented Sep 5, 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-09-07T15:01:25.032+0000

  • Duration: 50 min 46 sec

Test stats 🧪

Test Results
Failed 0
Passed 3725
Skipped 873
Total 4598

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

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

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@tetianakravchenko tetianakravchenko marked this pull request as draft September 5, 2022 18:57
Signed-off-by: Tetiana Kravchenko <[email protected]>
Signed-off-by: Tetiana Kravchenko <[email protected]>
@tetianakravchenko tetianakravchenko marked this pull request as ready for review September 6, 2022 14:00
@tetianakravchenko
Copy link
Contributor Author

/package

@tetianakravchenko tetianakravchenko added backport-v8.3.0 Automated backport with mergify backport-v8.4.0 Automated backport with mergify labels Sep 7, 2022
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.

lgtm, left one minor comment.

@@ -574,3 +574,24 @@ func GetClusterECSMeta(cfg *conf.C, client k8sclient.Interface, logger *logp.Log
}
return ecsClusterMeta, nil
}

// AddClusterECSMeta adds ECS orchestrator fields
func AddClusterECSMeta(base mb.BaseMetricSet) mapstr.M {
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@tetianakravchenko tetianakravchenko Sep 7, 2022

Choose a reason for hiding this comment

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

@ChrsMark I think no, for event is used different default config - https://github.com/elastic/beats/blob/main/metricbeat/module/kubernetes/event/event.go#L65, comparing to other metricsets.

I've replaced adding ECS orchestratop for volume - afa7fc6, as it is the same as for proxy, system, apiserver, scheduler and controllermanager

"apiserver_audit_requests_rejected_total": prometheus.Metric("audit.rejected.count"),
"rest_client_requests_total": prometheus.Metric("client.request.count"),
},
var mapping = &prometheus.MetricsMapping{
Copy link
Contributor

Choose a reason for hiding this comment

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

As long as you correctly moved them out just you can consider use the bulk var definition as we have them here: https://github.com/elastic/beats/blob/main/metricbeat/module/kubernetes/state_pod/state_pod.go#L36

Just to be the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as we have here just one variable mapping I would keep it as is

@tetianakravchenko tetianakravchenko merged commit 1f5b863 into elastic:main Sep 8, 2022
mergify bot pushed a commit that referenced this pull request Sep 8, 2022
* add missing field

Signed-off-by: Tetiana Kravchenko <[email protected]>

* update log message

Signed-off-by: Tetiana Kravchenko <[email protected]>

* fix tests

Signed-off-by: Tetiana Kravchenko <[email protected]>

* add pr number

Signed-off-by: Tetiana Kravchenko <[email protected]>

* volume metricset: replace adding ECS orchestrator fields with util.AddClusterECSMeta

Signed-off-by: Tetiana Kravchenko <[email protected]>

Signed-off-by: Tetiana Kravchenko <[email protected]>
(cherry picked from commit 1f5b863)

# Conflicts:
#	metricbeat/module/kubernetes/apiserver/_meta/test/metrics.1.14.expected
#	metricbeat/module/kubernetes/apiserver/apiserver.go
#	metricbeat/module/kubernetes/apiserver/metricset.go
#	metricbeat/module/kubernetes/controllermanager/_meta/test/metrics.1.20.expected
#	metricbeat/module/kubernetes/controllermanager/controllermanager.go
mergify bot pushed a commit that referenced this pull request Sep 8, 2022
* add missing field

Signed-off-by: Tetiana Kravchenko <[email protected]>

* update log message

Signed-off-by: Tetiana Kravchenko <[email protected]>

* fix tests

Signed-off-by: Tetiana Kravchenko <[email protected]>

* add pr number

Signed-off-by: Tetiana Kravchenko <[email protected]>

* volume metricset: replace adding ECS orchestrator fields with util.AddClusterECSMeta

Signed-off-by: Tetiana Kravchenko <[email protected]>

Signed-off-by: Tetiana Kravchenko <[email protected]>
(cherry picked from commit 1f5b863)
tetianakravchenko added a commit that referenced this pull request Sep 8, 2022
…3020)

* add missing field

Signed-off-by: Tetiana Kravchenko <[email protected]>

* update log message

Signed-off-by: Tetiana Kravchenko <[email protected]>

* fix tests

Signed-off-by: Tetiana Kravchenko <[email protected]>

* add pr number

Signed-off-by: Tetiana Kravchenko <[email protected]>

* volume metricset: replace adding ECS orchestrator fields with util.AddClusterECSMeta

Signed-off-by: Tetiana Kravchenko <[email protected]>

Signed-off-by: Tetiana Kravchenko <[email protected]>
(cherry picked from commit 1f5b863)

Co-authored-by: Tetiana Kravchenko <[email protected]>
tetianakravchenko added a commit that referenced this pull request Sep 12, 2022
…etricsests (#33019)

* Add missing cluster metadata to multiple k8s metricsests (#32979)

* add missing field

Signed-off-by: Tetiana Kravchenko <[email protected]>

* update log message

Signed-off-by: Tetiana Kravchenko <[email protected]>

* fix tests

Signed-off-by: Tetiana Kravchenko <[email protected]>

* add pr number

Signed-off-by: Tetiana Kravchenko <[email protected]>

* volume metricset: replace adding ECS orchestrator fields with util.AddClusterECSMeta

Signed-off-by: Tetiana Kravchenko <[email protected]>

Signed-off-by: Tetiana Kravchenko <[email protected]>
(cherry picked from commit 1f5b863)

# Conflicts:
#	metricbeat/module/kubernetes/apiserver/_meta/test/metrics.1.14.expected
#	metricbeat/module/kubernetes/apiserver/apiserver.go
#	metricbeat/module/kubernetes/apiserver/metricset.go
#	metricbeat/module/kubernetes/controllermanager/_meta/test/metrics.1.20.expected
#	metricbeat/module/kubernetes/controllermanager/controllermanager.go

* Update CHANGELOG.next.asciidoc

* Update metrics.1.14.expected

* Update apiserver.go

* Update metricset.go

* Update controllermanager.go

* Update metrics.1.8.expected

* Update metrics.1.20.expected

* Update metrics.1.14.expected

* Update metrics.1.8.expected

* Update metrics.1.14.expected

* Update metrics.1.14.expected

* Delete metrics.1.20.expected

* Update metrics.1.8.expected

* Update metrics.1.8.expected

* Update metrics.1.14.expected

* Update metrics.controllermanager.1.14.expected

Co-authored-by: Tetiana Kravchenko <[email protected]>
chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
* add missing field

Signed-off-by: Tetiana Kravchenko <[email protected]>

* update log message

Signed-off-by: Tetiana Kravchenko <[email protected]>

* fix tests

Signed-off-by: Tetiana Kravchenko <[email protected]>

* add pr number

Signed-off-by: Tetiana Kravchenko <[email protected]>

* volume metricset: replace adding ECS orchestrator fields with util.AddClusterECSMeta

Signed-off-by: Tetiana Kravchenko <[email protected]>

Signed-off-by: Tetiana Kravchenko <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.3.0 Automated backport with mergify backport-v8.4.0 Automated backport with mergify Team:Cloudnative-Monitoring Label for the Cloud Native Monitoring team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants