diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index eac3ff5f..59636688 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,6 +21,7 @@ jobs: matrix: dist: - nr-otel-collector + - nrdot-collector-host steps: - name: Checkout uses: actions/checkout@v4 diff --git a/Makefile b/Makefile index b66274df..939afb04 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ TOOLS_BIN_NAMES := $(addprefix $(TOOLS_BIN_DIR)/, $(notdir $(shell echo $(TOOLS_ GO_LICENCE_DETECTOR := $(TOOLS_BIN_DIR)/go-licence-detector GO_LICENCE_DETECTOR_CONFIG := $(SRC_ROOT)/internal/assets/license/rules.json -DISTRIBUTIONS ?= "nr-otel-collector,nrdot-collector-k8s" +DISTRIBUTIONS ?= "nr-otel-collector,nrdot-collector-host" ci: check build licenses-check check: ensure-goreleaser-up-to-date diff --git a/Makefile.dev b/Makefile.dev new file mode 100644 index 00000000..ca1791e5 --- /dev/null +++ b/Makefile.dev @@ -0,0 +1,8 @@ +.PHONY: ci +ci: + act -W .github/workflows/ci.yaml + +ci_custom_matrix: + @# repeat --matrix arg for multiple distros + act -W .github/workflows/ci.yaml \ + --matrix dist:nrdot-collector-host \ No newline at end of file diff --git a/README.md b/README.md index 3a2fd1b7..c7a22288 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,15 @@ New Relic Open Source community project banner. -# New Relic OpenTelemetry collector releases +# New Relic Distribution of OpenTelemetry (NRDOT) Releases -This repository assembles New Relic's OpenTelemetry Collector distributions. All generated assets are available in the corresponding Github release page. +This repository assembles various [custom distributions](https://opentelemetry.io/docs/collector/distributions/#custom-distributions) of the [OpenTelemetry Collector](https://opentelemetry.io/docs/collector/) focused on specific use cases and pre-configured to work with NewRelic out-of-the-box. + +Generated assets are available in the corresponding Github release page and as docker images published within the [newrelic organization on Docker Hub](https://hub.docker.com/u/newrelic). Current list of distributions: -- [New Relic OpenTelemetry Collector](./distributions/nr-otel-collector/) +- [nr-otel-collector](./distributions/nr-otel-collector/): (Deprecated) legacy general-purpose distribution +- [nrdot-collector-host](./distributions/nrdot-collector-host/): distribution focused on monitoring host metrics and logs ## Support diff --git a/cmd/goreleaser/internal/configure.go b/cmd/goreleaser/internal/configure.go index 2d29ba4c..4af686c0 100644 --- a/cmd/goreleaser/internal/configure.go +++ b/cmd/goreleaser/internal/configure.go @@ -28,8 +28,9 @@ import ( const ( ArmArch = "arm" - HostDistro = "nr-otel-collector" - K8sDistro = "nrdot-collector-k8s" + LegacyDistro = "nr-otel-collector" + HostDistro = "nrdot-collector-host" + K8sDistro = "nrdot-collector-k8s" DockerHub = "newrelic" EnvRegistry = "{{ .Env.REGISTRY }}" @@ -43,7 +44,7 @@ var ( NightlyImagePrefixes = []string{EnvRegistry} Architectures = []string{"amd64", "arm64"} - DefaultConfigDists = map[string]bool{HostDistro: true} + DefaultConfigDists = map[string]bool{LegacyDistro: true, HostDistro: true} K8sDockerSkipArchs = map[string]bool{"arm": true, "386": true} K8sGoos = []string{"linux"} K8sArchs = []string{"amd64", "arm64"} diff --git a/distributions/README.md b/distributions/README.md new file mode 100644 index 00000000..f906a7b2 --- /dev/null +++ b/distributions/README.md @@ -0,0 +1,18 @@ +# Collector Distributions + +## Installation + +### General + +#### Environment variables +- `NEW_RELIC_LICENSE_KEY`: New Relic ingest key. +- `NEW_RELIC_MEMORY_LIMIT_MIB`: Maximum amount of memory to be used. +- `OTEL_EXPORTER_OTLP_ENDPOINT`: New Relic OTLP endpoint to export metrics to, see [official docs](https://docs.newrelic.com/docs/opentelemetry/best-practices/opentelemetry-otlp/) + +### Components + +The full list of components is available in the respective `manifest.yaml` + +### Configuration + +The default configuration is `config.yaml` which is embedded in the `Dockerfile` and any OS-specific packaging (if available). diff --git a/distributions/nr-otel-collector/Makefile b/distributions/nr-otel-collector/Makefile deleted file mode 100644 index 720752f1..00000000 --- a/distributions/nr-otel-collector/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../../Makefile.common diff --git a/distributions/nr-otel-collector/README.md b/distributions/nr-otel-collector/README.md index 041bb746..71885bbf 100644 --- a/distributions/nr-otel-collector/README.md +++ b/distributions/nr-otel-collector/README.md @@ -1,7 +1,5 @@ -# New Relic OpenTelemetry Collector Distro +# nr-otel-collector -TODO +Note: See [general README](../README.md) for information that applies to all distributions. -## Components - -The full list of components is available in the [manifest](manifest.yaml) +The legacy general-purpose distribution of the NRDOT collector. Will be deprecated in favor of more specialized distributions. diff --git a/distributions/nr-otel-collector/config.yaml b/distributions/nr-otel-collector/config.yaml index 3d5ab7d3..4c529498 100644 --- a/distributions/nr-otel-collector/config.yaml +++ b/distributions/nr-otel-collector/config.yaml @@ -1,12 +1,3 @@ -# The following environment variables require manual modification: -# - NEW_RELIC_LICENSE_KEY: New Relic ingest key. - -# If the collector is not installed through a package manager, the following -# environment variables need to be set: -# - NEW_RELIC_MEMORY_LIMIT_MIB: Maximum amount of memory to be used. (default: 100) -# - OTEL_EXPORTER_OTLP_ENDPOINT: New Relic OTLP endpoint to export metrics to (see: https://docs.newrelic.com/docs/opentelemetry/best-practices/opentelemetry-otlp/) - -# Keep host monitoring configuration in sync with: https://github.com/newrelic/newrelic-opentelemetry-examples/blob/main/other-examples/collector/host-monitoring/k8s/collector.yaml extensions: health_check: diff --git a/distributions/nr-otel-collector/manifest.yaml b/distributions/nr-otel-collector/manifest.yaml index 0b5242cc..b5836c42 100644 --- a/distributions/nr-otel-collector/manifest.yaml +++ b/distributions/nr-otel-collector/manifest.yaml @@ -41,11 +41,11 @@ receivers: - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver v0.118.0 providers: - - gomod: go.opentelemetry.io/collector/confmap/provider/envprovider v1.18.0 - - gomod: go.opentelemetry.io/collector/confmap/provider/fileprovider v1.18.0 - - gomod: go.opentelemetry.io/collector/confmap/provider/httpprovider v1.18.0 - - gomod: go.opentelemetry.io/collector/confmap/provider/httpsprovider v1.18.0 - - gomod: go.opentelemetry.io/collector/confmap/provider/yamlprovider v1.18.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/envprovider v1.24.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/fileprovider v1.24.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/httpprovider v1.24.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/httpsprovider v1.24.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/yamlprovider v1.24.0 # When adding a replace, add a comment before it to document why it's needed and when it can be removed replaces: diff --git a/distributions/nrdot-collector-host/.goreleaser-nightly.yaml b/distributions/nrdot-collector-host/.goreleaser-nightly.yaml new file mode 100644 index 00000000..d277de4c --- /dev/null +++ b/distributions/nrdot-collector-host/.goreleaser-nightly.yaml @@ -0,0 +1,138 @@ +version: 2 +project_name: nrdot-collector-releases-nightly +builds: + - id: nrdot-collector-host + goos: + - linux + - windows + goarch: + - amd64 + - arm64 + ignore: + - goos: windows + goarch: arm64 + dir: _build + binary: nrdot-collector-host + ldflags: + - -s + - -w + flags: + - -trimpath + env: + - CGO_ENABLED=0 +archives: + - id: nrdot-collector-host + builds: + - nrdot-collector-host + name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}' + format_overrides: + - goos: windows + formats: + - zip +nfpms: + - file_name_template: '{{ .PackageName }}_{{ .Version }}_{{ .Os }}_{{- if not (eq (filter .ConventionalFileName "\\.rpm$") "") }}{{- replace .Arch "amd64" "x86_64" }}{{- else }}{{- .Arch }}{{- end }}{{- with .Arm }}v{{ . }}{{- end }}{{- with .Mips }}_{{ . }}{{- end }}{{- if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{- end }}' + package_name: nrdot-collector-host + contents: + - src: nrdot-collector-host.service + dst: /lib/systemd/system/nrdot-collector-host.service + - src: nrdot-collector-host.conf + dst: /etc/nrdot-collector-host/nrdot-collector-host.conf + type: config|noreplace + - src: config.yaml + dst: /etc/nrdot-collector-host/config.yaml + type: config + scripts: + preinstall: preinstall.sh + postinstall: postinstall.sh + preremove: preremove.sh + rpm: + signature: + key_file: '{{ .Env.GPG_KEY_PATH }}' + deb: + signature: + key_file: '{{ .Env.GPG_KEY_PATH }}' + overrides: + rpm: + dependencies: + - /bin/sh + id: nrdot-collector-host + builds: + - nrdot-collector-host + formats: + - deb + - rpm + maintainer: New Relic + description: NRDOT Collector - nrdot-collector-host + license: Apache 2.0 +snapshot: + version_template: '{{ incpatch .Version }}-SNAPSHOT-{{.ShortCommit}}' +checksum: + name_template: '{{ .ArtifactName }}.sum' + algorithm: sha256 + split: true +dockers: + - goos: linux + goarch: amd64 + dockerfile: Dockerfile + image_templates: + - '{{ .Env.REGISTRY }}/nrdot-collector-host:{{ .Version }}-nightly-amd64' + - '{{ .Env.REGISTRY }}/nrdot-collector-host:nightly-amd64' + extra_files: + - config.yaml + build_flag_templates: + - --pull + - --platform=linux/amd64 + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: buildx + - goos: linux + goarch: arm64 + dockerfile: Dockerfile + image_templates: + - '{{ .Env.REGISTRY }}/nrdot-collector-host:{{ .Version }}-nightly-arm64' + - '{{ .Env.REGISTRY }}/nrdot-collector-host:nightly-arm64' + extra_files: + - config.yaml + build_flag_templates: + - --pull + - --platform=linux/arm64 + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: buildx +docker_manifests: + - name_template: '{{ .Env.REGISTRY }}/nrdot-collector-host:nightly' + image_templates: + - '{{ .Env.REGISTRY }}/nrdot-collector-host:nightly-amd64' + - '{{ .Env.REGISTRY }}/nrdot-collector-host:nightly-arm64' +blobs: + - bucket: nr-releases + provider: s3 + region: us-east-1 + directory: nrdot-collector-releases/nrdot-collector-host/nightly +changelog: + disable: "true" +signs: + - args: + - --batch + - -u + - '{{ .Env.GPG_FINGERPRINT }}' + - --output + - ${signature} + - --detach-sign + - ${artifact} + signature: ${artifact}.sig + artifacts: all + certificate: ${artifact}.pem +docker_signs: + - args: + - sign + - ${artifact} + artifacts: all diff --git a/distributions/nrdot-collector-host/.goreleaser.yaml b/distributions/nrdot-collector-host/.goreleaser.yaml new file mode 100644 index 00000000..e7d2820b --- /dev/null +++ b/distributions/nrdot-collector-host/.goreleaser.yaml @@ -0,0 +1,142 @@ +version: 2 +project_name: nrdot-collector-releases +builds: + - id: nrdot-collector-host + goos: + - linux + - windows + goarch: + - amd64 + - arm64 + ignore: + - goos: windows + goarch: arm64 + dir: _build + binary: nrdot-collector-host + ldflags: + - -s + - -w + flags: + - -trimpath + env: + - CGO_ENABLED=0 +archives: + - id: nrdot-collector-host + builds: + - nrdot-collector-host + name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}' + format_overrides: + - goos: windows + formats: + - zip +nfpms: + - file_name_template: '{{ .PackageName }}_{{ .Version }}_{{ .Os }}_{{- if not (eq (filter .ConventionalFileName "\\.rpm$") "") }}{{- replace .Arch "amd64" "x86_64" }}{{- else }}{{- .Arch }}{{- end }}{{- with .Arm }}v{{ . }}{{- end }}{{- with .Mips }}_{{ . }}{{- end }}{{- if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{- end }}' + package_name: nrdot-collector-host + contents: + - src: nrdot-collector-host.service + dst: /lib/systemd/system/nrdot-collector-host.service + - src: nrdot-collector-host.conf + dst: /etc/nrdot-collector-host/nrdot-collector-host.conf + type: config|noreplace + - src: config.yaml + dst: /etc/nrdot-collector-host/config.yaml + type: config + scripts: + preinstall: preinstall.sh + postinstall: postinstall.sh + preremove: preremove.sh + rpm: + signature: + key_file: '{{ .Env.GPG_KEY_PATH }}' + deb: + signature: + key_file: '{{ .Env.GPG_KEY_PATH }}' + overrides: + rpm: + dependencies: + - /bin/sh + id: nrdot-collector-host + builds: + - nrdot-collector-host + formats: + - deb + - rpm + maintainer: New Relic + description: NRDOT Collector - nrdot-collector-host + license: Apache 2.0 +snapshot: + version_template: '{{ incpatch .Version }}-SNAPSHOT-{{.ShortCommit}}' +checksum: + name_template: '{{ .ArtifactName }}.sum' + algorithm: sha256 + split: true +dockers: + - goos: linux + goarch: amd64 + dockerfile: Dockerfile + image_templates: + - newrelic/nrdot-collector-host:{{ .Version }}-amd64 + - newrelic/nrdot-collector-host:latest-amd64 + extra_files: + - config.yaml + build_flag_templates: + - --pull + - --platform=linux/amd64 + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: buildx + - goos: linux + goarch: arm64 + dockerfile: Dockerfile + image_templates: + - newrelic/nrdot-collector-host:{{ .Version }}-arm64 + - newrelic/nrdot-collector-host:latest-arm64 + extra_files: + - config.yaml + build_flag_templates: + - --pull + - --platform=linux/arm64 + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: buildx +docker_manifests: + - name_template: newrelic/nrdot-collector-host:{{ .Version }} + image_templates: + - newrelic/nrdot-collector-host:{{ .Version }}-amd64 + - newrelic/nrdot-collector-host:{{ .Version }}-arm64 + - name_template: newrelic/nrdot-collector-host:latest + image_templates: + - newrelic/nrdot-collector-host:latest-amd64 + - newrelic/nrdot-collector-host:latest-arm64 +blobs: + - bucket: nr-releases + provider: s3 + region: us-east-1 + directory: nrdot-collector-releases/nrdot-collector-host/{{ .Version }} +changelog: + disable: "true" +signs: + - args: + - --batch + - -u + - '{{ .Env.GPG_FINGERPRINT }}' + - --output + - ${signature} + - --detach-sign + - ${artifact} + signature: ${artifact}.sig + artifacts: all + certificate: ${artifact}.pem +docker_signs: + - args: + - sign + - ${artifact} + artifacts: all diff --git a/distributions/nrdot-collector-host/Dockerfile b/distributions/nrdot-collector-host/Dockerfile new file mode 100644 index 00000000..f25ed700 --- /dev/null +++ b/distributions/nrdot-collector-host/Dockerfile @@ -0,0 +1,15 @@ +FROM alpine:3.21 as certs +RUN apk --update add ca-certificates + +FROM scratch + +ARG USER_UID=10001 +USER ${USER_UID} + +COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --chmod=755 nrdot-collector-host /nrdot-collector-host +COPY config.yaml /etc/nrdot-collector-host/config.yaml +ENTRYPOINT ["/nrdot-collector-host"] +CMD ["--config", "/etc/nrdot-collector-host/config.yaml"] +# `4137` and `4318`: OTLP +EXPOSE 4317 4318 diff --git a/distributions/nrdot-collector-host/README.md b/distributions/nrdot-collector-host/README.md new file mode 100644 index 00000000..c8b9191e --- /dev/null +++ b/distributions/nrdot-collector-host/README.md @@ -0,0 +1,7 @@ +# nrdot-collector-host + +Note: See [general README](../README.md) for information that applies to all distributions. + +A distribution of the NRDOT collector focused on +- monitoring the host the collector is deployed on via `hostmetricsreceiver` and `filelogreceiver` +- support piping other telemetry through it via the `otlpreceiver` diff --git a/distributions/nrdot-collector-host/THIRD_PARTY_NOTICES.md b/distributions/nrdot-collector-host/THIRD_PARTY_NOTICES.md new file mode 100644 index 00000000..cb1c4b2c --- /dev/null +++ b/distributions/nrdot-collector-host/THIRD_PARTY_NOTICES.md @@ -0,0 +1,247 @@ +# Third Party Notices + +The New Relic infrastructure agent uses source code from third party libraries which carry their own copyright notices +and license terms. These notices are provided below. + +In the event that a required notice is missing or incorrect, please notify us by e-mailing +[open-source@newrelic.com](mailto:open-source@newrelic.com). + +For any licenses that require the disclosure of source code, the source code +can be found at https://github.com/newrelic/opentelemetry-collector-releases. + + + + +## [github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension](https://github.com/open-telemetry/opentelemetry-collector-contrib) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor](https://github.com/open-telemetry/opentelemetry-collector-contrib) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor](https://github.com/open-telemetry/opentelemetry-collector-contrib) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor](https://github.com/open-telemetry/opentelemetry-collector-contrib) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor](https://github.com/open-telemetry/opentelemetry-collector-contrib) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor](https://github.com/open-telemetry/opentelemetry-collector-contrib) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor](https://github.com/open-telemetry/opentelemetry-collector-contrib) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filelogreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/component](https://go.opentelemetry.io/collector/component) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/confmap](https://go.opentelemetry.io/collector/confmap) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/confmap/provider/envprovider](https://go.opentelemetry.io/collector/confmap/provider/envprovider) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/confmap/provider/fileprovider](https://go.opentelemetry.io/collector/confmap/provider/fileprovider) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/confmap/provider/httpprovider](https://go.opentelemetry.io/collector/confmap/provider/httpprovider) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/confmap/provider/httpsprovider](https://go.opentelemetry.io/collector/confmap/provider/httpsprovider) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/confmap/provider/yamlprovider](https://go.opentelemetry.io/collector/confmap/provider/yamlprovider) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/connector](https://go.opentelemetry.io/collector/connector) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/exporter](https://go.opentelemetry.io/collector/exporter) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/exporter/debugexporter](https://go.opentelemetry.io/collector/exporter/debugexporter) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/exporter/otlpexporter](https://go.opentelemetry.io/collector/exporter/otlpexporter) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/exporter/otlphttpexporter](https://go.opentelemetry.io/collector/exporter/otlphttpexporter) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/extension](https://go.opentelemetry.io/collector/extension) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/otelcol](https://go.opentelemetry.io/collector/otelcol) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/processor](https://go.opentelemetry.io/collector/processor) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/processor/batchprocessor](https://go.opentelemetry.io/collector/processor/batchprocessor) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/processor/memorylimiterprocessor](https://go.opentelemetry.io/collector/processor/memorylimiterprocessor) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/receiver](https://go.opentelemetry.io/collector/receiver) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [go.opentelemetry.io/collector/receiver/otlpreceiver](https://go.opentelemetry.io/collector/receiver/otlpreceiver) + +Distributed under the following license(s): + +* Apache-2.0 + + + +## [golang.org/x/sys](https://golang.org/x/sys) + +Distributed under the following license(s): + +* BSD-3-Clause + + + + diff --git a/configs/nr-otel-collector-agent-linux.yaml b/distributions/nrdot-collector-host/config.yaml similarity index 92% rename from configs/nr-otel-collector-agent-linux.yaml rename to distributions/nrdot-collector-host/config.yaml index 3d5ab7d3..4c529498 100644 --- a/configs/nr-otel-collector-agent-linux.yaml +++ b/distributions/nrdot-collector-host/config.yaml @@ -1,12 +1,3 @@ -# The following environment variables require manual modification: -# - NEW_RELIC_LICENSE_KEY: New Relic ingest key. - -# If the collector is not installed through a package manager, the following -# environment variables need to be set: -# - NEW_RELIC_MEMORY_LIMIT_MIB: Maximum amount of memory to be used. (default: 100) -# - OTEL_EXPORTER_OTLP_ENDPOINT: New Relic OTLP endpoint to export metrics to (see: https://docs.newrelic.com/docs/opentelemetry/best-practices/opentelemetry-otlp/) - -# Keep host monitoring configuration in sync with: https://github.com/newrelic/newrelic-opentelemetry-examples/blob/main/other-examples/collector/host-monitoring/k8s/collector.yaml extensions: health_check: diff --git a/distributions/nrdot-collector-host/manifest.yaml b/distributions/nrdot-collector-host/manifest.yaml new file mode 100644 index 00000000..0f65ddbc --- /dev/null +++ b/distributions/nrdot-collector-host/manifest.yaml @@ -0,0 +1,45 @@ +dist: + module: github.com/newrelic/opentelemetry-collector-releases/nrdot-collector-host + name: nrdot-collector-host + description: New Relic OpenTelemetry Collector + version: 0.8.10 + output_path: ./_build + +receivers: + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filelogreceiver v0.118.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver v0.118.0 + - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.118.0 + +processors: + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.118.0 + - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.118.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.118.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.118.0 + - gomod: go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.118.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor v0.118.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.118.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor v0.118.0 + +exporters: + - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.118.0 + - gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.118.0 + - gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.118.0 + +extensions: + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.118.0 + +providers: + - gomod: go.opentelemetry.io/collector/confmap/provider/envprovider v1.24.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/fileprovider v1.24.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/httpprovider v1.24.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/httpsprovider v1.24.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/yamlprovider v1.24.0 + +# When adding a replace, add a comment before it to document why it's needed and when it can be removed +replaces: + # Why: Fixes CVE-2024-45337 + # Transitive dep of: x/net, hostmetricsreceiver + - golang.org/x/crypto v0.28.0 => golang.org/x/crypto v0.31.0 + # Why: Fixes CVE-2024-45338 + # Transitive dep of: almost all components + - golang.org/x/net v0.30.0 => golang.org/x/net v0.33.0 diff --git a/distributions/nrdot-collector-host/nrdot-collector-host.conf b/distributions/nrdot-collector-host/nrdot-collector-host.conf new file mode 100644 index 00000000..62e3e336 --- /dev/null +++ b/distributions/nrdot-collector-host/nrdot-collector-host.conf @@ -0,0 +1,12 @@ +# Systemd environment file for the nrdot-collector-host service + +# New Relic default variables +OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp.nr-data.net:4317 +NEW_RELIC_MEMORY_LIMIT_MIB=100 + +# Command-line options for the nrdot-collector-host service. +# Run `/usr/bin/nrdot-collector-host --help` to see all available options. +# +# pkg.translator.prometheus.NormalizeName feature-gate is disabled by default to avoid altering prometheus metrics +# names when reported through non-prometheus exporters. +OTELCOL_OPTIONS="--config=/etc/nrdot-collector-host/config.yaml" diff --git a/distributions/nrdot-collector-host/nrdot-collector-host.service b/distributions/nrdot-collector-host/nrdot-collector-host.service new file mode 100644 index 00000000..0095229b --- /dev/null +++ b/distributions/nrdot-collector-host/nrdot-collector-host.service @@ -0,0 +1,15 @@ +[Unit] +Description=NRDOT Collector Host +After=network.target + +[Service] +EnvironmentFile=/etc/nrdot-collector-host/nrdot-collector-host.conf +ExecStart=/usr/bin/nrdot-collector-host $OTELCOL_OPTIONS +KillMode=mixed +Restart=on-failure +Type=simple +User=nrdot-collector-host +Group=nrdot-collector-host + +[Install] +WantedBy=multi-user.target diff --git a/distributions/nrdot-collector-host/postinstall.sh b/distributions/nrdot-collector-host/postinstall.sh new file mode 100755 index 00000000..0d69fe8f --- /dev/null +++ b/distributions/nrdot-collector-host/postinstall.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if command -v systemctl >/dev/null 2>&1; then + if [ "${NRDOT_MODE}" = "ROOT" ]; then + sed -i "/User=nrdot-collector-host/d" /lib/systemd/system/nrdot-collector-host.service + sed -i "/Group=nrdot-collector-host/d" /lib/systemd/system/nrdot-collector-host.service + fi + systemctl enable nrdot-collector-host.service + if [ -f /etc/nrdot-collector-host/config.yaml ]; then + systemctl start nrdot-collector-host.service + fi +fi diff --git a/distributions/nrdot-collector-host/preinstall.sh b/distributions/nrdot-collector-host/preinstall.sh new file mode 100755 index 00000000..859d7c0b --- /dev/null +++ b/distributions/nrdot-collector-host/preinstall.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Create the user if NRDOT_MODE is not set to root +if [ "${NRDOT_MODE}" != "ROOT" ]; then + getent passwd nrdot-collector-host >/dev/null || useradd --system --user-group --no-create-home --shell /sbin/nologin nrdot-collector-host +fi diff --git a/distributions/nrdot-collector-host/preremove.sh b/distributions/nrdot-collector-host/preremove.sh new file mode 100755 index 00000000..d240b67b --- /dev/null +++ b/distributions/nrdot-collector-host/preremove.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if command -v systemctl >/dev/null 2>&1; then + systemctl stop nrdot-collector-host.service + systemctl disable nrdot-collector-host.service +fi diff --git a/distributions/nrdot-collector-host/test-spec.yaml b/distributions/nrdot-collector-host/test-spec.yaml new file mode 100644 index 00000000..891ce7cc --- /dev/null +++ b/distributions/nrdot-collector-host/test-spec.yaml @@ -0,0 +1,3 @@ +nightly: + ec2: + enabled: true \ No newline at end of file diff --git a/distributions/nrdot-collector-k8s/manifest.yaml b/distributions/nrdot-collector-k8s/manifest.yaml index 468993e2..74cb9f35 100644 --- a/distributions/nrdot-collector-k8s/manifest.yaml +++ b/distributions/nrdot-collector-k8s/manifest.yaml @@ -34,6 +34,14 @@ exporters: extensions: - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.118.0 + +providers: + - gomod: go.opentelemetry.io/collector/confmap/provider/envprovider v1.24.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/fileprovider v1.24.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/httpprovider v1.24.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/httpsprovider v1.24.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/yamlprovider v1.24.0 + # When adding a replace, add a comment before it to document why it's needed and when it can be removed replaces: ### Transitive deps determined via `go mod graph | grep $dep@$dep_replace_version` diff --git a/test/terraform/permanent/main.tf b/test/terraform/permanent/main.tf index fa5ba9e7..5b822df9 100644 --- a/test/terraform/permanent/main.tf +++ b/test/terraform/permanent/main.tf @@ -1,6 +1,6 @@ locals { distros = toset(distinct(flatten([ - for _, v in fileset(path.module, "../../../distributions/**") : + for _, v in fileset(path.module, "../../../distributions/*/**") : regex("../../../distributions/([^/]*).*", dirname(v)) ]))) test_specs = { diff --git a/test/terraform/permanent/outputs.tf b/test/terraform/permanent/outputs.tf index d0fa762b..cfe86c91 100644 --- a/test/terraform/permanent/outputs.tf +++ b/test/terraform/permanent/outputs.tf @@ -1,3 +1,7 @@ output "ecr_repository_urls" { value = [for key, value in module.ecr : value.repository_url] } + +output "distros" { + value = local.distros +}