-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Metricbeat][Kubernetes] Add metricset for state_namespace #36406
Merged
constanca-m
merged 21 commits into
elastic:main
from
constanca-m:kubernetes-state_namespace
Oct 4, 2023
Merged
Changes from 16 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
23321a9
Add metricset.
constanca-m 443805c
Update changelog
constanca-m 7c85573
Remove println.
constanca-m e8adb2b
Update expected files.
constanca-m b846be7
Update metricbeat/module/kubernetes/util/kubernetes.go
constanca-m 5fe0b2f
Rename kubernetes.namespace.name to kubernetes.namespace
constanca-m 9ca7330
Change name to namespace_state.
constanca-m dc5add7
Change name to namespace_state.
constanca-m 5e3edf5
Change name to namespace_state.
constanca-m 2fadbd0
Change name to namespace_state.
constanca-m f5d758b
Change name to namespace_state.
constanca-m 57242e9
undo changes on openmetric data.json
constanca-m eb4a063
undo changes on openmetric and prometheus data.json
constanca-m 039f002
Update data.json
constanca-m 1c19a3d
Update docs.
constanca-m b120c82
Merge remote-tracking branch 'origin/kubernetes-state_namespace' into…
constanca-m cf927b4
Update metricset name.
constanca-m 511913c
Update metricset name.
constanca-m add12fe
Update metricbeat.yaml
constanca-m 5221f0b
Rename to state_namespace.
constanca-m e559998
Merge branch 'main' into kubernetes-state_namespace
constanca-m File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
metricbeat/module/kubernetes/namespace_state/_meta/data.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"@timestamp": "2019-03-01T08:05:34.853Z", | ||
"event": { | ||
"dataset": "kubernetes.namespace_state", | ||
"duration": 115000, | ||
"module": "kubernetes" | ||
}, | ||
"kubernetes": { | ||
"namespace": "kube-system", | ||
"namespace_state": { | ||
"created": { | ||
"sec": 1691566337 | ||
}, | ||
"status": { | ||
"active": true, | ||
"terminating": false | ||
} | ||
} | ||
}, | ||
"metricset": { | ||
"name": "namespace_state", | ||
"period": 10000 | ||
}, | ||
"service": { | ||
"address": "127.0.0.1:55555", | ||
"type": "kubernetes" | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
metricbeat/module/kubernetes/namespace_state/_meta/fields.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
- name: namespace_state | ||
type: group | ||
release: ga | ||
description: > | ||
Kubernetes namespace metrics. | ||
fields: | ||
- name: created.sec | ||
type: double | ||
description: > | ||
Unix creation timestamp. | ||
- name: status | ||
type: group | ||
fields: | ||
- name: active | ||
type: boolean | ||
description: Whether the namespace is active (true or false). | ||
- name: terminating | ||
type: boolean | ||
description: Whether the namespace is terminating (true or false). |
127 changes: 127 additions & 0 deletions
127
metricbeat/module/kubernetes/namespace_state/_meta/test/ksm.v2.7.0.plain.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
[ | ||
{ | ||
"RootFields": null, | ||
"ModuleFields": { | ||
"namespace": "kube-node-lease" | ||
}, | ||
"MetricSetFields": { | ||
"created": { | ||
"sec": 1673879559 | ||
}, | ||
"status": { | ||
"active": true, | ||
"terminating": false | ||
} | ||
}, | ||
"Index": "", | ||
"ID": "", | ||
"Namespace": "kubernetes.namespace_state", | ||
"Timestamp": "0001-01-01T00:00:00Z", | ||
"Error": null, | ||
"Host": "", | ||
"Service": "", | ||
"Took": 0, | ||
"Period": 0, | ||
"DisableTimeSeries": false | ||
}, | ||
{ | ||
"RootFields": null, | ||
"ModuleFields": { | ||
"namespace": "default" | ||
}, | ||
"MetricSetFields": { | ||
"created": { | ||
"sec": 1673879561 | ||
}, | ||
"status": { | ||
"active": true, | ||
"terminating": false | ||
} | ||
}, | ||
"Index": "", | ||
"ID": "", | ||
"Namespace": "kubernetes.namespace_state", | ||
"Timestamp": "0001-01-01T00:00:00Z", | ||
"Error": null, | ||
"Host": "", | ||
"Service": "", | ||
"Took": 0, | ||
"Period": 0, | ||
"DisableTimeSeries": false | ||
}, | ||
{ | ||
"RootFields": null, | ||
"ModuleFields": { | ||
"namespace": "local-path-storage" | ||
}, | ||
"MetricSetFields": { | ||
"created": { | ||
"sec": 1673879567 | ||
}, | ||
"status": { | ||
"active": true, | ||
"terminating": false | ||
} | ||
}, | ||
"Index": "", | ||
"ID": "", | ||
"Namespace": "kubernetes.namespace_state", | ||
"Timestamp": "0001-01-01T00:00:00Z", | ||
"Error": null, | ||
"Host": "", | ||
"Service": "", | ||
"Took": 0, | ||
"Period": 0, | ||
"DisableTimeSeries": false | ||
}, | ||
{ | ||
"RootFields": null, | ||
"ModuleFields": { | ||
"namespace": "kube-public" | ||
}, | ||
"MetricSetFields": { | ||
"created": { | ||
"sec": 1673879559 | ||
}, | ||
"status": { | ||
"active": true, | ||
"terminating": false | ||
} | ||
}, | ||
"Index": "", | ||
"ID": "", | ||
"Namespace": "kubernetes.namespace_state", | ||
"Timestamp": "0001-01-01T00:00:00Z", | ||
"Error": null, | ||
"Host": "", | ||
"Service": "", | ||
"Took": 0, | ||
"Period": 0, | ||
"DisableTimeSeries": false | ||
}, | ||
{ | ||
"RootFields": null, | ||
"ModuleFields": { | ||
"namespace": "kube-system" | ||
}, | ||
"MetricSetFields": { | ||
"created": { | ||
"sec": 1673879559 | ||
}, | ||
"status": { | ||
"active": true, | ||
"terminating": false | ||
} | ||
}, | ||
"Index": "", | ||
"ID": "", | ||
"Namespace": "kubernetes.namespace_state", | ||
"Timestamp": "0001-01-01T00:00:00Z", | ||
"Error": null, | ||
"Host": "", | ||
"Service": "", | ||
"Took": 0, | ||
"Period": 0, | ||
"DisableTimeSeries": false | ||
} | ||
] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this comment #36406 (comment) was related only to the field name, where metrics are store
kubernetes.state_namespace.*
- >kubernetes.namespace_state.*
, not to the name of the metricset itself.I think that the
state_*
in the metricset name is a reference to the metrics source - that they are scraped from thekube_state_metrics
, if it is correct module name should bestate_namespace
for consistency. @MichaelKatsoulis @ChrsMark is my assumption regarding naming correct?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tetianakravchenko, you are right, I misunderstood. So now the document looks like this:
I could not change the
event.dataset
, I am not sure what this field means and elastic docs are not very clear either. I am guessing it is the "family" of fields that caused the metrics on the document.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
event.dataset
should bekubernetes.namespace
. I explain this at #36406 (comment). I'm not sure if that line there also has impact in other places butevent.namespace
should bekubernetes.namespace
if we want to be more accurate.