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 a markdown with high level kubernetes metadata enrichment explanation #38757

Merged

Conversation

MichaelKatsoulis
Copy link
Contributor

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.

@MichaelKatsoulis MichaelKatsoulis requested a review from a team as a code owner April 8, 2024 07:32
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Apr 8, 2024
@botelastic
Copy link

botelastic bot commented Apr 8, 2024

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

Copy link
Contributor

mergify bot commented Apr 8, 2024

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @MichaelKatsoulis? 🙏.
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

@elasticmachine
Copy link
Collaborator

elasticmachine commented Apr 8, 2024

💚 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

  • Duration: 52 min 44 sec

❕ Flaky test report

No test was executed to be analysed.

🤖 GitHub comments

Expand to view the 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!)

@@ -0,0 +1,51 @@
## Kubernetes Metadata enrichment

[metadata diag](../_meta/images/enrichers.png)
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't see the image in the preview, can you see it @MichaelKatsoulis ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I also don't understand what the image is trying to say... Is it just an example using 3 metricsets on what they are doing?

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 is supposed to show an example of different metricsets having their own metadata enricher but sharing same watchers which use the k8s API to watch for a resource.
I am open to all kind of suggestions !!

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok! Maybe you can just write a sentence below the image saying that?

@constanca-m
Copy link
Contributor

Should this part:

for key := range resourceMetaWatcher.metadataObjects {
obj, exists, err := resourceMetaWatcher.watcher.Store().GetByKey(key)
if err != nil {
log.Errorf("Error trying to get the object from the store: %s", err)
} else {
if exists {
newMetadataEvents := enricher.updateFunc(obj.(kubernetes.Resource))
// add the new metadata to the watcher received metadata
for id, metadata := range newMetadataEvents {
enricher.metadata[id] = metadata
}
}
}
}
, be mentioned somehow or do you think it's too specific?


### Key Components:

1. **Metricsets:**
Copy link
Contributor

Choose a reason for hiding this comment

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

To differentiate with datasets. Just writ something same term is called datasets in elastic-agent.
https://www.elastic.co/blog/an-introduction-to-the-elastic-data-stream-naming-scheme

@gizas
Copy link
Contributor

gizas commented Apr 12, 2024

I think that the image is a little confusing. Maybe to put arrows to identify direction?
How about removing it and adding a table with what watchers are being created per metricset?

@MichaelKatsoulis
Copy link
Contributor Author

Should this part:

for key := range resourceMetaWatcher.metadataObjects {
obj, exists, err := resourceMetaWatcher.watcher.Store().GetByKey(key)
if err != nil {
log.Errorf("Error trying to get the object from the store: %s", err)
} else {
if exists {
newMetadataEvents := enricher.updateFunc(obj.(kubernetes.Resource))
// add the new metadata to the watcher received metadata
for id, metadata := range newMetadataEvents {
enricher.metadata[id] = metadata
}
}
}
}

, be mentioned somehow or do you think it's too specific?

Yes, I will add more info.

@MichaelKatsoulis
Copy link
Contributor Author

@constanca-m and @gizas I answered all your review comments. Can you give it another go?

### Key Components:

1. **Metricsets/Datasets:**
- Metricsets/Datasets are responsible for collecting metrics and events from various sources within Kubernetes, such as kubelet and kube-state-metrics.
Copy link
Contributor

Choose a reason for hiding this comment

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

Still dont explain why we have two terms. Users dont understand why this changes in beats vs agents. I think we should make this clear

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gizas This markdown is in beats repo, under kubernetes module. There, only metricsets exist. Personally I would remove the dataset as it is confusing. What kind of sentence do you want me to add?

Copy link
Contributor

Choose a reason for hiding this comment

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

Missed that we are under beats. I had in my mind that this could be a more general doc.
So ok you can remove datasets overall

@gizas
Copy link
Contributor

gizas commented Apr 15, 2024

LGTM @MichaelKatsoulis ! Some last minor comments

@MichaelKatsoulis MichaelKatsoulis merged commit 7387eb3 into elastic:main Apr 15, 2024
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs_team Indicates that the issue/PR needs a Team:* label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants