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

Cherry-pick #23730 to 7.x: Enrich k8s state service events & add selector meta #23806

Merged
merged 2 commits into from
Feb 2, 2021

Conversation

ChrsMark
Copy link
Member

@ChrsMark ChrsMark commented Feb 2, 2021

Cherry-pick of PR #23730 to 7.x branch. Original message:

What does this PR do?

  1. adds metadata enricher on state_service metrics so as to enrich metrics with Service objects metadata.
  2. make use of ServiceMetadataGenerator to enrich Service related events and not the generic ResourceMetadataGenerator
  3. Improves ServiceMetadataGenerator so as to include selector information (if exist) for a Service object.

Note that with this implementation selector's key:val maps are added similarly with labels like kubernetes.service.selectors.* but we can add them differently if Metrics UI requires that, @sorantis just let me know what you think.

Why is it important?

So as to properly enrich state_service events with Service metadata and include selector information in these metadata.

Example:

apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  selector:
    app: MyApp
  ports:
    - protocol: TCP
      port: 80
      targetPort: 9376

This service will be enriched with kubernetes.service.selectors.app: MyApp which will give us to the option to correlate the service with all the pods that are selected/exposed by this service and are labeled with kubernetes.labels.app: MyApp.

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.

How to test this PR locally

  1. Deploy Metricbeat on k8s to collect metrics from kube_state_metrics and specifically using state_service metricset.
  2. Ensure that metadata are included (ie labels) as well as selector information.

Related issues

@ChrsMark ChrsMark requested a review from a team as a code owner February 2, 2021 12:46
@ChrsMark ChrsMark added [zube]: In Review backport Team:Integrations Label for the Integrations team labels Feb 2, 2021
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Feb 2, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Feb 2, 2021
@botelastic
Copy link

botelastic bot commented Feb 2, 2021

This pull request doesn't have a Team:<team> label.

@elasticmachine
Copy link
Collaborator

elasticmachine commented Feb 2, 2021

💚 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

Expand to view the summary

Build stats

  • Build Cause: Pull request #23806 updated

    • Start Time: 2021-02-02T14:20:25.737+0000
  • Duration: 47 min 11 sec

  • Commit: 2e66811

Test stats 🧪

Test Results
Failed 0
Passed 44779
Skipped 4647
Total 49426

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 44779
Skipped 4647
Total 49426

Signed-off-by: chrismark <chrismarkou92@gmail.com>
@ChrsMark ChrsMark merged commit 7729cd7 into elastic:7.x Feb 2, 2021
@zube zube bot removed the [zube]: Done label May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants