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

feat: Add a selector for runtime volume metrics #1486

Merged
merged 38 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
45ef301
add volume metrics selector to CRDs
shorim Oct 1, 2024
4585a50
add volume metric_group to kubeletstatsreceiver
shorim Oct 1, 2024
9536f01
auto-generate CRD docu
shorim Oct 2, 2024
e91e187
insert skip_enrichment attribute for volume metrics
shorim Oct 2, 2024
32eb270
drop volume metrics if disabled
shorim Oct 4, 2024
af00a2e
Merge remote-tracking branch 'origin/main' into volume_metrics
shorim Oct 4, 2024
6f4e9a0
add k8s.volume.type label
shorim Oct 7, 2024
81c3f2c
Merge remote-tracking branch 'origin/main' into volume_metrics
shorim Oct 7, 2024
dd9e3cb
avoid setting skip_enrichment attribute for volume metrics
shorim Oct 8, 2024
20ae194
drop non PVC volume metrics
shorim Oct 8, 2024
e3a1567
refactor metrics input enabled checks
shorim Oct 8, 2024
f2dffe9
generate metric groups in kubeletstats dynamically
shorim Oct 8, 2024
bd32f88
dynamically add the filter/drop-non-pvc-volumes-metrics processor
shorim Oct 9, 2024
f7dff04
Merge remote-tracking branch 'origin/main' into volume_metrics
shorim Oct 9, 2024
17efa31
refactor names of functions for checking inputs enabled
shorim Oct 9, 2024
685e0cb
refactor existing runtime input resources e2e test
shorim Oct 10, 2024
bdd0c97
add e2e tests for volume metrics
shorim Oct 10, 2024
09a952d
Merge remote-tracking branch 'origin/main' into volume_metrics
shorim Oct 10, 2024
27af43a
Merge remote-tracking branch 'origin/main' into volume_metrics
shorim Oct 10, 2024
cee3364
add removed io pkg in e2e test
shorim Oct 10, 2024
e77ffec
fix linting
shorim Oct 10, 2024
0a5dcc0
add unit tests for gateway
shorim Oct 10, 2024
aee8c4f
adjust agent rbac unit test
shorim Oct 10, 2024
57b1f96
adjust agent unit tests
shorim Oct 10, 2024
c3470d1
update docu
shorim Oct 10, 2024
15890b4
adjust metricpipeline busola configMap
shorim Oct 10, 2024
2af3965
Merge remote-tracking branch 'origin/main' into volume_metrics
shorim Oct 10, 2024
c0eabc4
split runtime input resources e2e test
shorim Oct 10, 2024
ebfe234
use raw strings in unit tests
shorim Oct 10, 2024
4d9226a
improve readability of metrics inputs checks
shorim Oct 10, 2024
4fc95bb
refactor some agent receivers unit tests into a table test
shorim Oct 10, 2024
5d6e01f
remove unnecessary suffix for resources names in e2e tests
shorim Oct 10, 2024
c6a5241
disable volume metrics e2e tests
shorim Oct 10, 2024
271affe
retrieve runtime input resources e2e test
shorim Oct 10, 2024
ff437ff
add volume metrics to runtime input resources e2e test
shorim Oct 10, 2024
060e08b
fix linting
shorim Oct 10, 2024
f570c4c
Merge branch 'main' into volume_metrics
skhalash Oct 11, 2024
51a14f7
Merge branch 'main' into volume_metrics
rakesh-garimella Oct 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion apis/telemetry/v1alpha1/metricpipeline_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ type MetricPipelineRuntimeInput struct {
Namespaces *MetricPipelineInputNamespaceSelector `json:"namespaces,omitempty"`
// Describes the Kubernetes resources for which runtime metrics are scraped.
// +optional
// +kubebuilder:default={pod: {enabled: true}, container: {enabled: true}, node: {enabled: false}}
// +kubebuilder:default={pod: {enabled: true}, container: {enabled: true}, node: {enabled: false}, volume: {enabled: false}}
Resources *MetricPipelineRuntimeInputResources `json:"resources,omitempty"`
}

Expand All @@ -121,6 +121,10 @@ type MetricPipelineRuntimeInputResources struct {
// +optional
// +kubebuilder:default={enabled: false}
Node *MetricPipelineRuntimeInputResourceDisabledByDefault `json:"node,omitempty"`
// Configures Volume runtime metrics scraping.
// +optional
// +kubebuilder:default={enabled: false}
Volume *MetricPipelineRuntimeInputResourceDisabledByDefault `json:"volume,omitempty"`
}

// MetricPipelineRuntimeInputResourceEnabledByDefault defines if the scraping of runtime metrics is enabled for a specific resource. The scraping is enabled by default.
Expand Down
5 changes: 5 additions & 0 deletions apis/telemetry/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion apis/telemetry/v1beta1/metricpipeline_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ type MetricPipelineRuntimeInput struct {
Namespaces *MetricPipelineInputNamespaceSelector `json:"namespaces,omitempty"`
// Describes the Kubernetes resources for which runtime metrics are scraped.
// +optional
// +kubebuilder:default={pod: {enabled: true}, container: {enabled: true}, node: {enabled: false}}
// +kubebuilder:default={pod: {enabled: true}, container: {enabled: true}, node: {enabled: false}, volume: {enabled: false}}
Resources *MetricPipelineRuntimeInputResources `json:"resources,omitempty"`
}

Expand All @@ -108,6 +108,10 @@ type MetricPipelineRuntimeInputResources struct {
// +optional
// +kubebuilder:default={enabled: false}
Node *MetricPipelineRuntimeInputResourceDisabledByDefault `json:"node,omitempty"`
// Configures Volume runtime metrics scraping.
// +optional
// +kubebuilder:default={enabled: false}
Volume *MetricPipelineRuntimeInputResourceDisabledByDefault `json:"volume,omitempty"`
}

// MetricPipelineRuntimeInputResourceEnabledByDefault defines if the scraping of runtime metrics is enabled for a specific resource. The scraping is enabled by default.
Expand Down
5 changes: 5 additions & 0 deletions apis/telemetry/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions config/busola/metricpipeline_busola_extension_cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ data:
- name: Node
visibility: $exists(spec.input.runtime.resources.node)
source: spec.input.runtime.resources.node.enabled
- name: Volume
visibility: $exists(spec.input.runtime.resources.volume)
source: spec.input.runtime.resources.volume.enabled
- name: OTLP
widget: Panel
visibility: $exists(spec.input.otlp)
Expand Down Expand Up @@ -344,6 +347,9 @@ data:
- name: Enable Node Metrics
path: node.enabled
simple: true
- name: Enable Volume Metrics
path: volume.enabled
simple: true
- name: OTLP
path: otlp
widget: FormGroup
Expand Down
13 changes: 13 additions & 0 deletions config/crd/bases/telemetry.kyma-project.io_metricpipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ spec:
enabled: false
pod:
enabled: true
volume:
enabled: false
description: Describes the Kubernetes resources for which
runtime metrics are scraped.
properties:
Expand Down Expand Up @@ -259,6 +261,17 @@ spec:
resource are scraped. The default is `true`.
type: boolean
type: object
volume:
default:
enabled: false
description: Configures Volume runtime metrics scraping.
properties:
enabled:
default: false
description: If enabled, the runtime metrics for the
resource are scraped. The default is `false`.
type: boolean
type: object
type: object
type: object
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ spec:
enabled: false
pod:
enabled: true
volume:
enabled: false
description: Describes the Kubernetes resources for which
runtime metrics are scraped.
properties:
Expand Down Expand Up @@ -259,6 +261,17 @@ spec:
resource are scraped. The default is `true`.
type: boolean
type: object
volume:
default:
enabled: false
description: Configures Volume runtime metrics scraping.
properties:
enabled:
default: false
description: If enabled, the runtime metrics for the
resource are scraped. The default is `false`.
type: boolean
type: object
type: object
type: object
type: object
Expand Down Expand Up @@ -825,6 +838,8 @@ spec:
enabled: false
pod:
enabled: true
volume:
enabled: false
description: Describes the Kubernetes resources for which
runtime metrics are scraped.
properties:
Expand Down Expand Up @@ -861,6 +876,17 @@ spec:
resource are scraped. The default is `true`.
type: boolean
type: object
volume:
default:
enabled: false
description: Configures Volume runtime metrics scraping.
properties:
enabled:
default: false
description: If enabled, the runtime metrics for the
resource are scraped. The default is `false`.
type: boolean
type: object
type: object
type: object
type: object
Expand Down
1 change: 1 addition & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ rules:
- namespaces/status
- nodes
- nodes/metrics
- nodes/proxy
- nodes/spec
- nodes/stats
- pods
Expand Down
13 changes: 11 additions & 2 deletions docs/user/04-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Optionally, the Telemetry module provides a DaemonSet of an OTel Collector actin
1. An application (exposing metrics in OTLP) sends metrics to the central metric gateway service.
2. An application (exposing metrics in Prometheus protocol) activates the agent to scrape the metrics with an annotation-based configuration.
3. Additionally, you can activate the agent to pull metrics of each Istio sidecar.
4. The agent supports collecting container metrics from the Kubelet and Kubernetes APIServer.
4. The agent supports collecting metrics from the Kubelet and Kubernetes APIServer.
5. The agent converts and sends all collected metric data to the gateway in OTLP.
6. The gateway discovers the metadata and enriches all received data with typical metadata of the source by communicating with the Kubernetes APIServer. Furthermore, it filters data according to the pipeline configuration.
7. Telemetry Manager configures the agent and gateway according to the `MetricPipeline` resource specification, including the target backend for the metric gateway. Also, it observes the metrics flow to the backend and reports problems in the MetricPipeline status.
Expand Down Expand Up @@ -414,13 +414,15 @@ The following example collects only the Pod metrics:
enabled: false
node:
enabled: false
volume:
enabled: false
output:
otlp:
endpoint:
value: https://backend.example.com:4317
```

If you enable Pod metrics, the following metrics are collected:
If Pod metrics are enabled, the following metrics are collected:

- From the [kubletstatsreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/kubeletstatsreceiver):
- `k8s.pod.cpu.capacity`
Expand Down Expand Up @@ -470,6 +472,13 @@ If Node metrics are enabled, the following metrics are collected:
- `k8s.node.memory.rss`
- `k8s.node.memory.working_set`

If Volume metrics are enabled, the following metrics are collected:
- From the [kubletstatsreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/kubeletstatsreceiver):
- `k8s.volume.available`
- `k8s.volume.capacity`
- `k8s.volume.inodes`
- `k8s.volume.inodes.free`
- `k8s.volume.inodes.used`

### 7. Activate Istio Metrics

Expand Down
2 changes: 1 addition & 1 deletion docs/user/assets/metrics-arch.drawio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/user/resources/05-metricpipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ For details, see the [MetricPipeline specification file](https://github.com/kyma
| **input.​runtime.​resources.​node.​enabled** | boolean | If enabled, the runtime metrics for the resource are scraped. The default is `false`. |
| **input.​runtime.​resources.​pod** | object | Configures Pod runtime metrics scraping. |
| **input.​runtime.​resources.​pod.​enabled** | boolean | If enabled, the runtime metrics for the resource are scraped. The default is `true`. |
| **input.​runtime.​resources.​volume** | object | Configures Volume runtime metrics scraping. |
| **input.​runtime.​resources.​volume.​enabled** | boolean | If enabled, the runtime metrics for the resource are scraped. The default is `false`. |
| **output** | object | Configures the metric gateway. |
| **output.​otlp** (required) | object | Defines an output using the OpenTelemetry protocol. |
| **output.​otlp.​authentication** | object | Defines authentication options for the OTLP output |
Expand Down
15 changes: 9 additions & 6 deletions internal/otelcollector/config/metric/agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ type Receivers struct {
}

type KubeletStatsReceiver struct {
CollectionInterval string `yaml:"collection_interval"`
AuthType string `yaml:"auth_type"`
Endpoint string `yaml:"endpoint"`
InsecureSkipVerify bool `yaml:"insecure_skip_verify"`
MetricGroups []MetricGroupType `yaml:"metric_groups"`
Metrics KubeletStatsMetricsConfig `yaml:"metrics"`
CollectionInterval string `yaml:"collection_interval"`
AuthType string `yaml:"auth_type"`
Endpoint string `yaml:"endpoint"`
InsecureSkipVerify bool `yaml:"insecure_skip_verify"`
MetricGroups []MetricGroupType `yaml:"metric_groups"`
Metrics KubeletStatsMetricsConfig `yaml:"metrics"`
ExtraMetadataLabels []string `yaml:"extra_metadata_labels,omitempty"`
}

type MetricConfig struct {
Expand All @@ -55,6 +56,7 @@ const (
MetricGroupTypeContainer MetricGroupType = "container"
MetricGroupTypePod MetricGroupType = "pod"
MetricGroupTypeNode MetricGroupType = "node"
MetricGroupTypeVolume MetricGroupType = "volume"
)

type PrometheusReceiver struct {
Expand Down Expand Up @@ -128,6 +130,7 @@ type Processors struct {
SetInstrumentationScopePrometheus *metric.TransformProcessor `yaml:"transform/set-instrumentation-scope-prometheus,omitempty"`
SetInstrumentationScopeIstio *metric.TransformProcessor `yaml:"transform/set-instrumentation-scope-istio,omitempty"`
InsertSkipEnrichmentAttribute *metric.TransformProcessor `yaml:"transform/insert-skip-enrichment-attribute,omitempty"`
DropNonPVCVolumesMetrics *FilterProcessor `yaml:"filter/drop-non-pvc-volumes-metrics,omitempty"`
}

type Exporters struct {
Expand Down
Loading
Loading