Skip to content

Commit

Permalink
Merge branch 'sample-app' of https://github.com/kyma-project/telemetr…
Browse files Browse the repository at this point in the history
…y-manager into sample-app

* 'sample-app' of https://github.com/kyma-project/telemetry-manager:
  fix: MetricPipeline inputs defaults with ArgoCD (#1737)
  chore: Revert removed Telemetry override e2e test (#1703)
  chore: Update to prometheus 3.1.0 (#1739)
  • Loading branch information
a-thaler committed Jan 15, 2025
2 parents e1b6e80 + 5418c13 commit be1acce
Show file tree
Hide file tree
Showing 20 changed files with 168 additions and 117 deletions.
2 changes: 2 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ linters-settings:
alias: slicesutils
- pkg: github.com/kyma-project/telemetry-manager/internal/utils/test
alias: testutils
- pkg: github.com/kyma-project/telemetry-manager/internal/utils/metricpipeline
alias: metricpipelineutils

errcheck:
check-type-assertions: true # Reports type assertions: `a := b.(SomeStruct)`.
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go mod tidy && go build -a -o manager

FROM scratch

LABEL org.opencontainers.image.source="https://github.com/kyma-project/telemetry-manager"

WORKDIR /

COPY --from=builder /telemetry-manager-workspace/manager .
Expand Down
6 changes: 3 additions & 3 deletions apis/telemetry/v1alpha1/metricpipeline_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type MetricPipelineInput struct {
// MetricPipelinePrometheusInput defines the Prometheus scraping section.
type MetricPipelinePrometheusInput struct {
// If enabled, Services and Pods marked with `prometheus.io/scrape=true` annotation are scraped. The default is `false`.
Enabled bool `json:"enabled,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
// Describes whether Prometheus metrics from specific namespaces are selected. System namespaces are disabled by default.
// +optional
Namespaces *NamespaceSelector `json:"namespaces,omitempty"`
Expand All @@ -94,7 +94,7 @@ type MetricPipelinePrometheusInput struct {
// MetricPipelineRuntimeInput defines the runtime scraping section.
type MetricPipelineRuntimeInput struct {
// If enabled, runtime metrics are scraped. The default is `false`.
Enabled bool `json:"enabled,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
// Describes whether runtime metrics from specific namespaces are selected. System namespaces are disabled by default.
// +optional
Namespaces *NamespaceSelector `json:"namespaces,omitempty"`
Expand Down Expand Up @@ -141,7 +141,7 @@ type MetricPipelineRuntimeInputResource struct {
// MetricPipelineIstioInput defines the Istio scraping section.
type MetricPipelineIstioInput struct {
// If enabled, istio-proxy metrics are scraped from Pods that have the istio-proxy sidecar injected. The default is `false`.
Enabled bool `json:"enabled,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
// Describes whether istio-proxy metrics from specific namespaces are selected. System namespaces are enabled by default.
// +optional
Namespaces *NamespaceSelector `json:"namespaces,omitempty"`
Expand Down
15 changes: 15 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: 3 additions & 3 deletions apis/telemetry/v1beta1/metricpipeline_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type MetricPipelineInput struct {
// MetricPipelinePrometheusInput defines the Prometheus scraping section.
type MetricPipelinePrometheusInput struct {
// If enabled, Pods marked with `prometheus.io/scrape=true` annotation are scraped. The default is `false`.
Enabled bool `json:"enabled,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
// Describes whether Prometheus metrics from specific namespaces are selected. System namespaces are disabled by default.
// +optional
Namespaces *NamespaceSelector `json:"namespaces,omitempty"`
Expand All @@ -94,7 +94,7 @@ type MetricPipelinePrometheusInput struct {
// MetricPipelineRuntimeInput defines the runtime scraping section.
type MetricPipelineRuntimeInput struct {
// If enabled, runtime metrics are scraped. The default is `false`.
Enabled bool `json:"enabled,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
// Describes whether runtime metrics from specific namespaces are selected. System namespaces are disabled by default.
// +optional
Namespaces *NamespaceSelector `json:"namespaces,omitempty"`
Expand Down Expand Up @@ -141,7 +141,7 @@ type MetricPipelineRuntimeInputResource struct {
// MetricPipelineIstioInput defines the Istio scraping section.
type MetricPipelineIstioInput struct {
// If enabled, metrics for istio-proxy containers are scraped from Pods that have had the istio-proxy sidecar injected. The default is `false`.
Enabled bool `json:"enabled,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
// Describes whether istio-proxy metrics from specific namespaces are selected. System namespaces are enabled by default.
// +optional
Namespaces *NamespaceSelector `json:"namespaces,omitempty"`
Expand Down
15 changes: 15 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.

2 changes: 2 additions & 0 deletions dependencies/telemetry-self-monitor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ RUN make build

FROM scratch

LABEL org.opencontainers.image.source="https://github.com/kyma-project/telemetry-manager"

COPY --from=builder /prometheus/prometheus /bin/prometheus

USER nobody
Expand Down
4 changes: 2 additions & 2 deletions dependencies/telemetry-self-monitor/envs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
PROMETHEUS_VERSION=3.0.1
ALPINE_VERSION=3.20
PROMETHEUS_VERSION=3.1.0
ALPINE_VERSION=3.21
1 change: 1 addition & 0 deletions docs/contributor/benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,4 +450,5 @@ of the self-monitor Pods.
| 2.53.2 | 20 | 367 | 138347 | 0 | 40 | 0 |
| 2.53.3 | 20 | 307 | 127673 | 0 | 35 | 0 |
| 3.0.1 | 21 | 333 | 138210 | 0 | 43 | 0 |
| 3.1.0 | 21 | 352 | 146150 | 0 | 38 | 0 |
</div>
24 changes: 12 additions & 12 deletions internal/otelcollector/config/metric/agent/config_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1"
"github.com/kyma-project/telemetry-manager/internal/otelcollector/config"
"github.com/kyma-project/telemetry-manager/internal/otelcollector/config/metric"
"github.com/kyma-project/telemetry-manager/internal/otelcollector/ports"
metricpipelineutils "github.com/kyma-project/telemetry-manager/internal/utils/metricpipeline"
)

type BuilderConfig struct {
Expand Down Expand Up @@ -66,7 +66,7 @@ func (b *Builder) Build(pipelines []telemetryv1alpha1.MetricPipeline, opts Build
func enableRuntimeMetricsScraping(pipelines []telemetryv1alpha1.MetricPipeline) bool {
for i := range pipelines {
input := pipelines[i].Spec.Input
if input.Runtime != nil && input.Runtime.Enabled {
if metricpipelineutils.IsRuntimeInputEnabled(input) {
return true
}
}
Expand All @@ -90,7 +90,7 @@ func enableRuntimeResourcesMetricsScraping(pipelines []telemetryv1alpha1.MetricP
func enableRuntimePodMetricsScraping(pipelines []telemetryv1alpha1.MetricPipeline) bool {
for i := range pipelines {
input := pipelines[i].Spec.Input
if metric.IsRuntimeInputEnabled(input) && metric.IsRuntimePodInputEnabled(input) {
if metricpipelineutils.IsRuntimeInputEnabled(input) && metricpipelineutils.IsRuntimePodInputEnabled(input) {
return true
}
}
Expand All @@ -101,7 +101,7 @@ func enableRuntimePodMetricsScraping(pipelines []telemetryv1alpha1.MetricPipelin
func enableRuntimeContainerMetricsScraping(pipelines []telemetryv1alpha1.MetricPipeline) bool {
for i := range pipelines {
input := pipelines[i].Spec.Input
if metric.IsRuntimeInputEnabled(input) && metric.IsRuntimeContainerInputEnabled(input) {
if metricpipelineutils.IsRuntimeInputEnabled(input) && metricpipelineutils.IsRuntimeContainerInputEnabled(input) {
return true
}
}
Expand All @@ -112,7 +112,7 @@ func enableRuntimeContainerMetricsScraping(pipelines []telemetryv1alpha1.MetricP
func enableRuntimeNodeMetricsScraping(pipelines []telemetryv1alpha1.MetricPipeline) bool {
for i := range pipelines {
input := pipelines[i].Spec.Input
if metric.IsRuntimeInputEnabled(input) && metric.IsRuntimeNodeInputEnabled(input) {
if metricpipelineutils.IsRuntimeInputEnabled(input) && metricpipelineutils.IsRuntimeNodeInputEnabled(input) {
return true
}
}
Expand All @@ -123,7 +123,7 @@ func enableRuntimeNodeMetricsScraping(pipelines []telemetryv1alpha1.MetricPipeli
func enableRuntimeVolumeMetricsScraping(pipelines []telemetryv1alpha1.MetricPipeline) bool {
for i := range pipelines {
input := pipelines[i].Spec.Input
if metric.IsRuntimeInputEnabled(input) && metric.IsRuntimeVolumeInputEnabled(input) {
if metricpipelineutils.IsRuntimeInputEnabled(input) && metricpipelineutils.IsRuntimeVolumeInputEnabled(input) {
return true
}
}
Expand All @@ -134,7 +134,7 @@ func enableRuntimeVolumeMetricsScraping(pipelines []telemetryv1alpha1.MetricPipe
func enableRuntimeStatefulSetMetricsScraping(pipelines []telemetryv1alpha1.MetricPipeline) bool {
for i := range pipelines {
input := pipelines[i].Spec.Input
if metric.IsRuntimeInputEnabled(input) && metric.IsRuntimeStatefulSetInputEnabled(input) {
if metricpipelineutils.IsRuntimeInputEnabled(input) && metricpipelineutils.IsRuntimeStatefulSetInputEnabled(input) {
return true
}
}
Expand All @@ -145,7 +145,7 @@ func enableRuntimeStatefulSetMetricsScraping(pipelines []telemetryv1alpha1.Metri
func enableRuntimeDeploymentMetricsScraping(pipelines []telemetryv1alpha1.MetricPipeline) bool {
for i := range pipelines {
input := pipelines[i].Spec.Input
if metric.IsRuntimeInputEnabled(input) && metric.IsRuntimeDeploymentInputEnabled(input) {
if metricpipelineutils.IsRuntimeInputEnabled(input) && metricpipelineutils.IsRuntimeDeploymentInputEnabled(input) {
return true
}
}
Expand All @@ -156,7 +156,7 @@ func enableRuntimeDeploymentMetricsScraping(pipelines []telemetryv1alpha1.Metric
func enableRuntimeDaemonSetMetricsScraping(pipelines []telemetryv1alpha1.MetricPipeline) bool {
for i := range pipelines {
input := pipelines[i].Spec.Input
if metric.IsRuntimeInputEnabled(input) && metric.IsRuntimeDaemonSetInputEnabled(input) {
if metricpipelineutils.IsRuntimeInputEnabled(input) && metricpipelineutils.IsRuntimeDaemonSetInputEnabled(input) {
return true
}
}
Expand All @@ -167,7 +167,7 @@ func enableRuntimeDaemonSetMetricsScraping(pipelines []telemetryv1alpha1.MetricP
func enableRuntimeJobMetricsScraping(pipelines []telemetryv1alpha1.MetricPipeline) bool {
for i := range pipelines {
input := pipelines[i].Spec.Input
if metric.IsRuntimeInputEnabled(input) && metric.IsRuntimeJobInputEnabled(input) {
if metricpipelineutils.IsRuntimeInputEnabled(input) && metricpipelineutils.IsRuntimeJobInputEnabled(input) {
return true
}
}
Expand All @@ -178,7 +178,7 @@ func enableRuntimeJobMetricsScraping(pipelines []telemetryv1alpha1.MetricPipelin
func enablePrometheusMetricsScraping(pipelines []telemetryv1alpha1.MetricPipeline) bool {
for i := range pipelines {
input := pipelines[i].Spec.Input
if input.Prometheus != nil && input.Prometheus.Enabled {
if metricpipelineutils.IsPrometheusInputEnabled(input) {
return true
}
}
Expand All @@ -189,7 +189,7 @@ func enablePrometheusMetricsScraping(pipelines []telemetryv1alpha1.MetricPipelin
func enableIstioMetricsScraping(pipelines []telemetryv1alpha1.MetricPipeline) bool {
for i := range pipelines {
input := pipelines[i].Spec.Input
if input.Istio != nil && input.Istio.Enabled {
if metricpipelineutils.IsIstioInputEnabled(input) {
return true
}
}
Expand Down
Loading

0 comments on commit be1acce

Please sign in to comment.