Skip to content

Commit

Permalink
Merge pull request #673 from solarwinds/updateCollectorTo105-part1
Browse files Browse the repository at this point in the history
Update OTEL Collector to v0.105.0
  • Loading branch information
pstranak-sw authored Jul 23, 2024
2 parents fa57ffe + c9b52e6 commit 00e40db
Show file tree
Hide file tree
Showing 35 changed files with 763 additions and 560 deletions.
10 changes: 5 additions & 5 deletions build/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM docker.io/library/golang:1.22.5-bookworm as base
FROM docker.io/library/golang:1.22.5-bookworm AS base
WORKDIR /src
COPY ["./src/", "./src/"]

FROM base as builder
FROM base AS builder

RUN cd src/cmd && CGO_ENABLED=0 GOEXPERIMENT=boringcrypto go build -trimpath -o ../../swi-k8s-opentelemetry-collector "-ldflags=-s -w"

Expand All @@ -11,18 +11,18 @@ SHELL ["/bin/bash", "-c"]
ARG CREATE_VENDOR_DIR
RUN if [[ -z "$CREATE_VENDOR_DIR" ]] ; then echo vendor creation skipped ; else cd src/cmd && go mod vendor -o /src/vendor ; fi

FROM builder as tests
FROM builder AS tests
# run all tests for all go modules in `src` folder
CMD cd src && find . -name go.mod -execdir go test ./... \;

FROM debian:12.6 as journal
FROM debian:12.6 AS journal
RUN apt update
RUN apt install -y systemd
COPY /build/docker/copy-journalbinary.sh /script.sh
RUN chmod +x /script.sh
RUN /script.sh

FROM base as wrapper
FROM base AS wrapper
WORKDIR /src/src/wrapper
RUN CGO_ENABLED=0 GOEXPERIMENT=boringcrypto go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o /bin/wrapper && chmod +x /bin/wrapper

Expand Down
6 changes: 3 additions & 3 deletions build/docker/Dockerfile.Windows-2022
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
FROM docker.io/library/golang:1.22.5-nanoserver-ltsc2022@sha256:0a134b8e83206a9b0d5374bea6982335727b3a1a375e53fe3917ba5faae59cf6 as base
FROM docker.io/library/golang:1.22.5-nanoserver-ltsc2022@sha256:0a134b8e83206a9b0d5374bea6982335727b3a1a375e53fe3917ba5faae59cf6 AS base
WORKDIR /src
COPY ["./src/", "./src/"]

FROM base as builder
FROM base AS builder

ARG CGO_ENABLED=0
ARG GOEXPERIMENT=boringcrypto

RUN cd src/cmd && go build -trimpath -o ../../swi-k8s-opentelemetry-collector "-ldflags=-s -w"

FROM base as wrapper
FROM base AS wrapper
WORKDIR /src/src/wrapper

ARG CGO_ENABLED=0
Expand Down
2 changes: 1 addition & 1 deletion build/docker/structure-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ commandTests:
- name: "swi-otelcol is working in the image"
command: "/swi-otelcol"
args: ["-v"]
expectedOutput: ["swi-k8s-opentelemetry-collector version 0.11.2"]
expectedOutput: ["swi-k8s-opentelemetry-collector version 0.11.3"]
3 changes: 2 additions & 1 deletion deploy/helm/events-collector-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ extensions:
file_storage/sending_queue:
directory: /var/lib/swo/sending_queue
{{- end }}
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
memory_ballast:
{{ toYaml .Values.otel.events.memory_ballast | indent 4 }}

Expand Down
3 changes: 2 additions & 1 deletion deploy/helm/metrics-collector-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ extensions:
file_storage/sending_queue:
directory: /var/lib/swo/sending_queue
{{- end }}
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
memory_ballast:
{{ toYaml .Values.otel.metrics.memory_ballast | indent 4 }}

Expand Down
3 changes: 2 additions & 1 deletion deploy/helm/node-collector-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ extensions:
file_storage/sending_queue:
directory: {{ .Values.otel.node_collector.sending_queue.persistent_storage.directory }}
{{- end }}
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
{{- if .Values.otel.logs.memory_ballast }}
memory_ballast:
{{ toYaml .Values.otel.logs.memory_ballast | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Custom events filter with new syntax:
tls:
insecure: ${OTEL_ENVOY_ADDRESS_TLS_INSECURE}
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
memory_ballast:
size_mib: 300
processors:
Expand Down Expand Up @@ -343,7 +344,8 @@ Custom events filter with old syntax:
tls:
insecure: ${OTEL_ENVOY_ADDRESS_TLS_INSECURE}
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
memory_ballast:
size_mib: 300
processors:
Expand Down Expand Up @@ -671,7 +673,8 @@ Events config should match snapshot when using default values:
tls:
insecure: ${OTEL_ENVOY_ADDRESS_TLS_INSECURE}
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
memory_ballast:
size_mib: 300
processors:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ Metrics config should match snapshot when using default values:
tls:
insecure: ${OTEL_ENVOY_ADDRESS_TLS_INSECURE}
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
memory_ballast:
size_mib: 700
processors:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ Metrics config should match snapshot when fargate is enabled:
tls:
insecure: ${OTEL_ENVOY_ADDRESS_TLS_INSECURE}
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
memory_ballast:
size_mib: 700
processors:
Expand Down Expand Up @@ -2495,7 +2496,8 @@ Metrics config should match snapshot when using Prometheus url with extra_scrape
tls:
insecure: ${OTEL_ENVOY_ADDRESS_TLS_INSECURE}
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
memory_ballast:
size_mib: 700
processors:
Expand Down Expand Up @@ -4640,7 +4642,8 @@ Metrics config should match snapshot when using default values:
tls:
insecure: ${OTEL_ENVOY_ADDRESS_TLS_INSECURE}
extensions:
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
memory_ballast:
size_mib: 700
processors:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Node collector config for windows nodes should match snapshot when using default
file_storage/checkpoints:
directory: /var/lib/swo/checkpoints
timeout: 5s
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
k8s_observer:
auth_type: serviceAccount
node: ${NODE_NAME}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Custom logs filter with new syntax:
file_storage/checkpoints:
directory: /var/lib/swo/checkpoints
timeout: 5s
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
k8s_observer:
auth_type: serviceAccount
node: ${NODE_NAME}
Expand Down Expand Up @@ -1230,7 +1231,8 @@ Custom logs filter with old syntax:
file_storage/checkpoints:
directory: /var/lib/swo/checkpoints
timeout: 5s
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
k8s_observer:
auth_type: serviceAccount
node: ${NODE_NAME}
Expand Down Expand Up @@ -2437,7 +2439,8 @@ Node collector config should match snapshot when autodiscovery is disabled:
file_storage/checkpoints:
directory: /var/lib/swo/checkpoints
timeout: 5s
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
k8s_observer:
auth_type: serviceAccount
node: ${NODE_NAME}
Expand Down Expand Up @@ -3601,7 +3604,8 @@ Node collector config should match snapshot when fargate is enabled:
file_storage/checkpoints:
directory: /var/lib/swo/checkpoints
timeout: 5s
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
k8s_observer:
auth_type: serviceAccount
node: ${NODE_NAME}
Expand Down Expand Up @@ -4736,7 +4740,8 @@ Node collector config should match snapshot when fargate is enabled and autodisc
file_storage/checkpoints:
directory: /var/lib/swo/checkpoints
timeout: 5s
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
processors:
attributes/remove_prometheus_attributes:
actions:
Expand Down Expand Up @@ -5820,7 +5825,8 @@ Node collector config should match snapshot when using default values:
file_storage/checkpoints:
directory: /var/lib/swo/checkpoints
timeout: 5s
health_check: {}
health_check:
endpoint: 0.0.0.0:13133
k8s_observer:
auth_type: serviceAccount
node: ${NODE_NAME}
Expand Down
2 changes: 2 additions & 0 deletions skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ deploy:
otel:
endpoint: timeseries-mock-service:9082
tls_insecure: true
# OTEL collector requires the SOLARWINDS_API_TOKEN env variable to be set to some not empty string
api_token: "not_set"
image:
repository: "swi-k8s-opentelemetry-collector"
tag: ""
Expand Down
38 changes: 38 additions & 0 deletions src/cmd/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
simpleprometheusreceiver "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/simpleprometheusreceiver"
windowseventlogreceiver "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/windowseventlogreceiver"
swk8sattributesprocessor "github.com/solarwinds/swi-k8s-opentelemetry-collector/processor/swk8sattributesprocessor"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/connector"
forwardconnector "go.opentelemetry.io/collector/connector/forwardconnector"
"go.opentelemetry.io/collector/exporter"
Expand Down Expand Up @@ -64,6 +65,12 @@ func components() (otelcol.Factories, error) {
return otelcol.Factories{}, err
}

factories.ExtensionModules = make(map[component.Type]string, len(factories.Extensions))
factories.ExtensionModules[healthcheckextension.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.105.0"
factories.ExtensionModules[filestorage.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage/filestorage v0.105.0"
factories.ExtensionModules[ballastextension.NewFactory().Type()] = "go.opentelemetry.io/collector/extension/ballastextension v0.105.0"
factories.ExtensionModules[k8sobserver.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/k8sobserver v0.105.0"

factories.Receivers, err = receiver.MakeFactoryMap(
prometheusreceiver.NewFactory(),
k8seventsreceiver.NewFactory(),
Expand All @@ -79,13 +86,27 @@ func components() (otelcol.Factories, error) {
return otelcol.Factories{}, err
}

factories.ReceiverModules = make(map[component.Type]string, len(factories.Receivers))
factories.ReceiverModules[prometheusreceiver.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.105.0"
factories.ReceiverModules[k8seventsreceiver.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8seventsreceiver v0.105.0"
factories.ReceiverModules[k8sobjectsreceiver.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sobjectsreceiver v0.105.0"
factories.ReceiverModules[filelogreceiver.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filelogreceiver v0.105.0"
factories.ReceiverModules[journaldreceiver.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/journaldreceiver v0.105.0"
factories.ReceiverModules[windowseventlogreceiver.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/windowseventlogreceiver v0.105.0"
factories.ReceiverModules[otlpreceiver.NewFactory().Type()] = "go.opentelemetry.io/collector/receiver/otlpreceiver v0.105.0"
factories.ReceiverModules[receivercreator.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator v0.105.0"
factories.ReceiverModules[simpleprometheusreceiver.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/simpleprometheusreceiver v0.105.0"

factories.Exporters, err = exporter.MakeFactoryMap(
otlpexporter.NewFactory(),
)
if err != nil {
return otelcol.Factories{}, err
}

factories.ExporterModules = make(map[component.Type]string, len(factories.Exporters))
factories.ExporterModules[otlpexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/otlpexporter v0.105.0"

factories.Processors, err = processor.MakeFactoryMap(
batchprocessor.NewFactory(),
memorylimiterprocessor.NewFactory(),
Expand All @@ -104,12 +125,29 @@ func components() (otelcol.Factories, error) {
return otelcol.Factories{}, err
}

factories.ProcessorModules = make(map[component.Type]string, len(factories.Processors))
factories.ProcessorModules[batchprocessor.NewFactory().Type()] = "go.opentelemetry.io/collector/processor/batchprocessor v0.105.0"
factories.ProcessorModules[memorylimiterprocessor.NewFactory().Type()] = "go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.105.0"
factories.ProcessorModules[metricstransformprocessor.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor v0.105.0"
factories.ProcessorModules[transformprocessor.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor v0.105.0"
factories.ProcessorModules[groupbyattrsprocessor.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbyattrsprocessor v0.105.0"
factories.ProcessorModules[resourceprocessor.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.105.0"
factories.ProcessorModules[deltatorateprocessor.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor v0.105.0"
factories.ProcessorModules[cumulativetodeltaprocessor.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.105.0"
factories.ProcessorModules[metricsgenerationprocessor.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor v0.105.0"
factories.ProcessorModules[filterprocessor.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.105.0"
factories.ProcessorModules[attributesprocessor.NewFactory().Type()] = "github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.105.0"
factories.ProcessorModules[swk8sattributesprocessor.NewFactory().Type()] = "github.com/solarwinds/swi-k8s-opentelemetry-collector/processor/swk8sattributesprocessor v0.105.0"

factories.Connectors, err = connector.MakeFactoryMap(
forwardconnector.NewFactory(),
)
if err != nil {
return otelcol.Factories{}, err
}

factories.ConnectorModules = make(map[component.Type]string, len(factories.Connectors))
factories.ConnectorModules[forwardconnector.NewFactory().Type()] = "go.opentelemetry.io/collector/connector/forwardconnector v0.105.0"

return factories, nil
}
Loading

0 comments on commit 00e40db

Please sign in to comment.