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 nrdot-collector-host distro #202

Merged
merged 2 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
matrix:
dist:
- nr-otel-collector
- nrdot-collector-host
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions Makefile.dev
Original file line number Diff line number Diff line change
@@ -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
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<a href="https://opensource.newrelic.com/oss-category/#community-project"><picture><source media="(prefers-color-scheme: dark)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/dark/Community_Project.png"><source media="(prefers-color-scheme: light)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Project.png"><img alt="New Relic Open Source community project banner." src="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Project.png"></picture></a>

# 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

Expand Down
7 changes: 4 additions & 3 deletions cmd/goreleaser/internal/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand All @@ -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"}
Expand Down
18 changes: 18 additions & 0 deletions distributions/README.md
Original file line number Diff line number Diff line change
@@ -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).
1 change: 0 additions & 1 deletion distributions/nr-otel-collector/Makefile

This file was deleted.

8 changes: 3 additions & 5 deletions distributions/nr-otel-collector/README.md
Original file line number Diff line number Diff line change
@@ -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.
9 changes: 0 additions & 9 deletions distributions/nr-otel-collector/config.yaml
Original file line number Diff line number Diff line change
@@ -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:

Expand Down
10 changes: 5 additions & 5 deletions distributions/nr-otel-collector/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
138 changes: 138 additions & 0 deletions distributions/nrdot-collector-host/.goreleaser-nightly.yaml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
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
Loading
Loading