From b8e5b9557bef8ec39270eee6f95aed91b125ebb6 Mon Sep 17 00:00:00 2001 From: Mailo Arsac Date: Mon, 28 Jul 2025 12:36:40 -0700 Subject: [PATCH 1/3] feat: Add shared components to host distro --- .../THIRD_PARTY_NOTICES.md | 40 +++++++++++++++++++ .../nrdot-collector-host/manifest.yaml | 6 ++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/distributions/nrdot-collector-host/THIRD_PARTY_NOTICES.md b/distributions/nrdot-collector-host/THIRD_PARTY_NOTICES.md index bdaca396..19482a34 100644 --- a/distributions/nrdot-collector-host/THIRD_PARTY_NOTICES.md +++ b/distributions/nrdot-collector-host/THIRD_PARTY_NOTICES.md @@ -20,6 +20,14 @@ Distributed under the following license(s): +## [github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter](https://github.com/open-telemetry/opentelemetry-collector-contrib) + +Distributed under the following license(s): + +* Apache-2.0 + + + ## [github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension](https://github.com/open-telemetry/opentelemetry-collector-contrib) Distributed under the following license(s): @@ -52,6 +60,14 @@ Distributed under the following license(s): +## [github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbyattrsprocessor](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): @@ -68,6 +84,22 @@ Distributed under the following license(s): +## [github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor](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/tailsamplingprocessor](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): @@ -92,6 +124,14 @@ Distributed under the following license(s): +## [github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver](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): diff --git a/distributions/nrdot-collector-host/manifest.yaml b/distributions/nrdot-collector-host/manifest.yaml index 979f7238..f5de7868 100644 --- a/distributions/nrdot-collector-host/manifest.yaml +++ b/distributions/nrdot-collector-host/manifest.yaml @@ -8,19 +8,24 @@ receivers: - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.128.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filelogreceiver v0.128.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver v0.128.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.128.0 processors: - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.128.0 - gomod: go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.128.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.128.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.128.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.128.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbyattrsprocessor v0.128.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor v0.128.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.128.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.128.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.128.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor v0.128.0 exporters: - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.128.0 - gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.128.0 - gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.128.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter v0.128.0 connectors: - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector v0.128.0 extensions: @@ -31,7 +36,6 @@ providers: - gomod: go.opentelemetry.io/collector/confmap/provider/httpprovider v1.34.0 - gomod: go.opentelemetry.io/collector/confmap/provider/httpsprovider v1.34.0 - gomod: go.opentelemetry.io/collector/confmap/provider/yamlprovider v1.34.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` From 984e021becacbff9bd01573564811250413ab2de Mon Sep 17 00:00:00 2001 From: Mailo Arsac Date: Mon, 28 Jul 2025 12:41:24 -0700 Subject: [PATCH 2/3] feat: Ensure host and k8s have shared components --- .../nrdot-collector-k8s/THIRD_PARTY_NOTICES.md | 16 ++++++++++++++++ distributions/nrdot-collector-k8s/manifest.yaml | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/distributions/nrdot-collector-k8s/THIRD_PARTY_NOTICES.md b/distributions/nrdot-collector-k8s/THIRD_PARTY_NOTICES.md index 34eb0875..7fff9c93 100644 --- a/distributions/nrdot-collector-k8s/THIRD_PARTY_NOTICES.md +++ b/distributions/nrdot-collector-k8s/THIRD_PARTY_NOTICES.md @@ -20,6 +20,14 @@ Distributed under the following license(s): +## [github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter](https://github.com/open-telemetry/opentelemetry-collector-contrib) + +Distributed under the following license(s): + +* Apache-2.0 + + + ## [github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension](https://github.com/open-telemetry/opentelemetry-collector-contrib) Distributed under the following license(s): @@ -92,6 +100,14 @@ Distributed under the following license(s): +## [github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor](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): diff --git a/distributions/nrdot-collector-k8s/manifest.yaml b/distributions/nrdot-collector-k8s/manifest.yaml index 281bb93b..944fee1d 100644 --- a/distributions/nrdot-collector-k8s/manifest.yaml +++ b/distributions/nrdot-collector-k8s/manifest.yaml @@ -22,11 +22,13 @@ processors: - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor v0.128.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.128.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.128.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.128.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor v0.128.0 exporters: - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.128.0 - gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.128.0 - gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.128.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter v0.128.0 connectors: - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector v0.128.0 extensions: @@ -37,7 +39,6 @@ providers: - gomod: go.opentelemetry.io/collector/confmap/provider/httpprovider v1.34.0 - gomod: go.opentelemetry.io/collector/confmap/provider/httpsprovider v1.34.0 - gomod: go.opentelemetry.io/collector/confmap/provider/yamlprovider v1.34.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` From 09e89e5cb4fc358aeb5cbc11186d3b0e7d8fca08 Mon Sep 17 00:00:00 2001 From: Mailo Arsac Date: Wed, 30 Jul 2025 12:11:19 -0700 Subject: [PATCH 3/3] feat: migrating the nrdot-collector-host distribution to nrdot-collector --- .github/actions/gh-metrics.js | 2 +- .github/workflows/ci-host-config-drift.yaml | 6 +-- .github/workflows/ci-nightly.yaml | 8 ++-- .github/workflows/ci.yaml | 2 +- .github/workflows/release-draft.yaml | 2 +- .github/workflows/release-publish.yaml | 2 +- .github/workflows/security.yaml | 2 +- .github/workflows/terraform.yaml | 2 +- .goreleaser.yaml | 6 +-- Makefile | 2 +- Makefile.dev | 2 +- README.md | 2 +- cmd/goreleaser/internal/configure.go | 37 +++++++++++++++++-- .../testdata/test-config-invalid.yaml | 6 +-- distributions/README.md | 12 +++--- distributions/TROUBLESHOOTING.md | 24 ++++++------ .../nrdot-collector-host.conf | 4 -- .../nrdot-collector-host.service | 15 -------- .../nrdot-collector-k8s/TROUBLESHOOTING.md | 4 +- .../nrdot-collector-k8s/test/spec-local.yaml | 2 +- .../.goreleaser-nightly.yaml | 32 +++++++--------- .../.goreleaser.yaml | 32 +++++++--------- .../Dockerfile | 8 ++-- .../Makefile | 0 .../README.md | 8 ++-- .../THIRD_PARTY_NOTICES.md | 0 .../TROUBLESHOOTING.md | 8 ++-- .../assert-invariants-agent-control.sh | 8 ++-- .../config.yaml | 0 .../manifest.yaml | 6 +-- .../nrdot-collector/nrdot-collector.conf | 4 ++ .../nrdot-collector/nrdot-collector.service | 15 ++++++++ .../postinstall.sh | 10 ++--- .../preinstall.sh | 2 +- .../preremove.sh | 4 +- .../test/.gitignore | 0 .../test/host-collector-values.yaml | 8 ++-- .../test/host-expected-metrics.yaml | 0 .../test/internal-collector-values.yaml | 14 +++---- .../test/internal-expected-metrics.yaml | 0 .../test/spec-local.yaml | 31 ++++++++-------- .../test/spec-nightly.yaml | 0 scripts/generate-goreleaser.sh | 4 +- test/e2e/Makefile | 4 +- .../util/assert/nr_metric_assertion_test.go | 17 ++++++--- test/e2e/util/spec/test_case_spec_test.go | 8 ++-- 46 files changed, 198 insertions(+), 167 deletions(-) delete mode 100644 distributions/nrdot-collector-host/nrdot-collector-host.conf delete mode 100644 distributions/nrdot-collector-host/nrdot-collector-host.service rename distributions/{nrdot-collector-host => nrdot-collector}/.goreleaser-nightly.yaml (84%) rename distributions/{nrdot-collector-host => nrdot-collector}/.goreleaser.yaml (84%) rename distributions/{nrdot-collector-host => nrdot-collector}/Dockerfile (53%) rename distributions/{nrdot-collector-host => nrdot-collector}/Makefile (100%) rename distributions/{nrdot-collector-host => nrdot-collector}/README.md (90%) rename distributions/{nrdot-collector-host => nrdot-collector}/THIRD_PARTY_NOTICES.md (100%) rename distributions/{nrdot-collector-host => nrdot-collector}/TROUBLESHOOTING.md (95%) rename distributions/{nrdot-collector-host => nrdot-collector}/assert-invariants-agent-control.sh (77%) rename distributions/{nrdot-collector-host => nrdot-collector}/config.yaml (100%) rename distributions/{nrdot-collector-host => nrdot-collector}/manifest.yaml (97%) create mode 100644 distributions/nrdot-collector/nrdot-collector.conf create mode 100644 distributions/nrdot-collector/nrdot-collector.service rename distributions/{nrdot-collector-host => nrdot-collector}/postinstall.sh (66%) rename distributions/{nrdot-collector-host => nrdot-collector}/preinstall.sh (83%) rename distributions/{nrdot-collector-host => nrdot-collector}/preremove.sh (86%) rename distributions/{nrdot-collector-host => nrdot-collector}/test/.gitignore (100%) rename distributions/{nrdot-collector-host => nrdot-collector}/test/host-collector-values.yaml (78%) rename distributions/{nrdot-collector-host => nrdot-collector}/test/host-expected-metrics.yaml (100%) rename distributions/{nrdot-collector-host => nrdot-collector}/test/internal-collector-values.yaml (89%) rename distributions/{nrdot-collector-host => nrdot-collector}/test/internal-expected-metrics.yaml (100%) rename distributions/{nrdot-collector-host => nrdot-collector}/test/spec-local.yaml (94%) rename distributions/{nrdot-collector-host => nrdot-collector}/test/spec-nightly.yaml (100%) diff --git a/.github/actions/gh-metrics.js b/.github/actions/gh-metrics.js index c27b019a..4fa74433 100644 --- a/.github/actions/gh-metrics.js +++ b/.github/actions/gh-metrics.js @@ -31,7 +31,7 @@ const response = await octokit.request("GET /repos/{owner}/{repo}/releases", { }); // Generate regex from distributions to match the asset name and parts -// Example: {nrdot-collector-host}_{1.0.0}_{linux}_{amd64}.{tar.gz} +// Example: {nrdot-collector}_{1.0.0}_{linux}_{amd64}.{tar.gz} const regex = new RegExp(`^(${distributions.join("|")})_([0-9]+\.[0-9]+\.[0-9]+)_([a-z]+)_([a-z0-9_]+)\.([a-z0-9\.]+)$`); const currentTime = new Date().getTime(); diff --git a/.github/workflows/ci-host-config-drift.yaml b/.github/workflows/ci-host-config-drift.yaml index 26071a13..b0ec2e41 100644 --- a/.github/workflows/ci-host-config-drift.yaml +++ b/.github/workflows/ci-host-config-drift.yaml @@ -17,9 +17,9 @@ jobs: with: fetch-depth: 0 - - name: Assert nrdot-collector-host invariants + - name: Assert nrdot-collector invariants run: | - make -f ./distributions/nrdot-collector-host/Makefile assert-config-invariants + make -f ./distributions/nrdot-collector/Makefile assert-config-invariants notify-drift: needs: host-config-drift @@ -45,4 +45,4 @@ jobs: payload: | { "text": ":rotating_light: NRDOT Host artifacts on 'main' in conflict with Agent Control's expectations, check workflow logs of '${{github.workflow}}'. Needs to be addressed before next release!" - } \ No newline at end of file + } diff --git a/.github/workflows/ci-nightly.yaml b/.github/workflows/ci-nightly.yaml index b2fed363..ce36b940 100644 --- a/.github/workflows/ci-nightly.yaml +++ b/.github/workflows/ci-nightly.yaml @@ -15,7 +15,7 @@ jobs: strategy: matrix: distribution: - - nrdot-collector-host + - nrdot-collector - nrdot-collector-k8s uses: ./.github/workflows/ci-base.yaml with: @@ -41,7 +41,7 @@ jobs: strategy: matrix: distribution: - - nrdot-collector-host + - nrdot-collector - nrdot-collector-k8s steps: - name: Checkout @@ -137,7 +137,7 @@ jobs: strategy: matrix: distribution: - - nrdot-collector-host + - nrdot-collector - nrdot-collector-k8s concurrency: # concurrency limit of 1 b/c failed tf job cancelling each other causes tf state and locks to corrupt @@ -164,7 +164,7 @@ jobs: strategy: matrix: distribution: - - nrdot-collector-host + - nrdot-collector - nrdot-collector-k8s steps: - name: Checkout diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4c381b67..9244ae02 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,7 +16,7 @@ jobs: strategy: matrix: distribution: - - nrdot-collector-host + - nrdot-collector - nrdot-collector-k8s uses: ./.github/workflows/ci-base.yaml with: diff --git a/.github/workflows/release-draft.yaml b/.github/workflows/release-draft.yaml index 2182f5b8..35120a2a 100644 --- a/.github/workflows/release-draft.yaml +++ b/.github/workflows/release-draft.yaml @@ -38,7 +38,7 @@ jobs: strategy: matrix: distribution: - - nrdot-collector-host + - nrdot-collector - nrdot-collector-k8s steps: - name: Checkout diff --git a/.github/workflows/release-publish.yaml b/.github/workflows/release-publish.yaml index d0deeeb1..98cc92a2 100644 --- a/.github/workflows/release-publish.yaml +++ b/.github/workflows/release-publish.yaml @@ -16,7 +16,7 @@ jobs: strategy: matrix: distribution: - - nrdot-collector-host + - nrdot-collector - nrdot-collector-k8s steps: diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml index 9ce0e0e7..49a4e3de 100644 --- a/.github/workflows/security.yaml +++ b/.github/workflows/security.yaml @@ -18,7 +18,7 @@ jobs: strategy: matrix: image: - - nrdot-collector-host + - nrdot-collector - nrdot-collector-k8s steps: - name: Run Trivy image vulnerability scanner diff --git a/.github/workflows/terraform.yaml b/.github/workflows/terraform.yaml index 24ddfdf9..1da97d65 100644 --- a/.github/workflows/terraform.yaml +++ b/.github/workflows/terraform.yaml @@ -45,7 +45,7 @@ on: description: "List of distributions to test" type: string required: false - default: "nrdot-collector-host" + default: "nrdot-collector" nightly_docker_manifest_sha_artifact_name: description: "artifact name containing SHA256 to identify nightly docker manifest to use" type: string diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 08385201..af0130fd 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -12,16 +12,16 @@ release: - [ ] Tests from last nightly build have passed and are stable. - [ ] Release notes below have been reviewed and edited as needed. - [ ] Binaries from each distro have been built and are attached to the release. - - [ ] nrdot-collector-host + - [ ] nrdot-collector - [ ] nrdot-collector-k8s - [ ] Docker images for each distro have been published to ECR - - [ ] nrdot-collector-host image published and tagged + - [ ] nrdot-collector image published and tagged - [ ] nrdot-collector-k8s image published and tagged ### Publish Checklist - [ ] Checklist has been reviewed and all items are complete. - [ ] Draft header has been removed. - [ ] Docker images for each distro have been published to docker hub and tagged as latest - - [ ] [nrdot-collector-host](https://hub.docker.com/repository/docker/newrelic/nrdot-collector-host/tags) version {{ .Version }} tagged as latest + - [ ] [nrdot-collector](https://hub.docker.com/repository/docker/newrelic/nrdot-collector/tags) version {{ .Version }} tagged as latest - [ ] [nrdot-collector-k8s](https://hub.docker.com/repository/docker/newrelic/nrdot-collector-k8s/tags) version {{ .Version }} tagged as latest - [ ] Slack notifications have been sent to appropriate channels - [ ] PR has been generated to update docs in [docs.newrelic.com](https://github.com/newrelic/docs-website/pulls) diff --git a/Makefile b/Makefile index 7cacaac8..9564493c 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 ?= "nrdot-collector-host,nrdot-collector-k8s" +DISTRIBUTIONS ?= "nrdot-collector,nrdot-collector-k8s" ci: check build version-check licenses-check check: ensure-goreleaser-up-to-date diff --git a/Makefile.dev b/Makefile.dev index b88e7bd0..db4085a0 100644 --- a/Makefile.dev +++ b/Makefile.dev @@ -10,4 +10,4 @@ ci_custom_matrix: ci_nightly_custom_matrix: @# repeat --matrix arg for multiple distros act schedule -W .github/workflows/ci-nightly.yaml \ - --matrix distribution:nrdot-collector-host \ No newline at end of file + --matrix distribution:nrdot-collector diff --git a/README.md b/README.md index 30f2ad0d..870ec92c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Generated assets are available in the corresponding Github release page and as d Current list of distributions: -- [nrdot-collector-host](./distributions/nrdot-collector-host/): distribution focused on monitoring host metrics and logs +- [nrdot-collector](./distributions/nrdot-collector/): distribution focused on monitoring host metrics and logs - [nrdot-collector-k8s](./distributions/nrdot-collector-k8s/): distribution focused on monitoring a Kubernetes cluster Please refer to [this README](./distributions/README.md) for documentation. diff --git a/cmd/goreleaser/internal/configure.go b/cmd/goreleaser/internal/configure.go index e7c838f5..59298b63 100644 --- a/cmd/goreleaser/internal/configure.go +++ b/cmd/goreleaser/internal/configure.go @@ -28,7 +28,8 @@ import ( const ( ArmArch = "arm" - HostDistro = "nrdot-collector-host" + CoreDistro = "nrdot-collector" + LegacyHostDistro = "nrdot-collector-host" K8sDistro = "nrdot-collector-k8s" EnvRegistry = "{{ .Env.REGISTRY }}" @@ -44,11 +45,11 @@ var ( K8sDistro: true, } NfpmDefaultConfig = map[string]string{ - HostDistro: "config.yaml", + CoreDistro: "config.yaml", // k8s missing due to not packaged via nfpm } IncludedConfigs = map[string][]string{ - HostDistro: {"config.yaml"}, + CoreDistro: {"config.yaml"}, } K8sDockerSkipArchs = map[string]bool{"arm": true, "386": true} K8sGoos = []string{"linux"} @@ -266,6 +267,13 @@ func Package(dist string) config.NFPM { func DockerImages(dist string, nightly bool) []config.Docker { var r []config.Docker + + // First phase of migration: if dist is CoreDistro then we set it to LegacyHostDistro until we're ready to switch over. + // This ensures that we don't break existing tags while we transition. + if dist == CoreDistro { + dist = LegacyHostDistro + } + for _, arch := range Architectures { if dist == K8sDistro && K8sDockerSkipArchs[arch] { continue @@ -304,6 +312,15 @@ func DockerImage(dist string, nightly bool, arch string, armVersion string) conf fmt.Sprintf(prefixFormat, prefix, imageName(dist), dockerArchTag), fmt.Sprintf(latestPrefixFormat, prefix, imageName(dist), dockerArchTag), ) + + if dist == CoreDistro { + // Add legacy tags for core distro until we switch over. + imageTemplates = append( + imageTemplates, + fmt.Sprintf(prefixFormat, prefix, imageName(LegacyHostDistro), dockerArchTag), + fmt.Sprintf(latestPrefixFormat, prefix, imageName(LegacyHostDistro), dockerArchTag), + ) + } } label := func(name, template string) string { @@ -340,6 +357,12 @@ func DockerImage(dist string, nightly bool, arch string, armVersion string) conf func DockerManifests(dist string, nightly bool) []config.DockerManifest { r := make([]config.DockerManifest, 0) + // First phase of migration: if dist is CoreDistro then we set it to LegacyHostDistro until we're ready to switch over. + // This ensures that we don't break existing tags while we transition. + if dist == CoreDistro { + dist = LegacyHostDistro + } + imagePrefixes := ImagePrefixes for _, prefix := range imagePrefixes { @@ -348,6 +371,14 @@ func DockerManifests(dist string, nightly bool) []config.DockerManifest { } else { r = append(r, DockerManifest(prefix, `{{ .Version }}`, dist, nightly)) r = append(r, DockerManifest(prefix, "latest", dist, nightly)) + + // Second phase of migration will include legacy tags for core distro until we switch over. + // This is to ensure that both tags exist for a while before we switch over completely + if dist == CoreDistro { + // Add legacy tags for core distro until we switch over. + r = append(r, DockerManifest(prefix, `{{ .Version }}`, LegacyHostDistro, nightly)) + r = append(r, DockerManifest(prefix, "latest", LegacyHostDistro, nightly)) + } } } return r diff --git a/cmd/nrdot-collector-builder/cmd/manifest/testdata/test-config-invalid.yaml b/cmd/nrdot-collector-builder/cmd/manifest/testdata/test-config-invalid.yaml index 55b752f3..a0dd4359 100644 --- a/cmd/nrdot-collector-builder/cmd/manifest/testdata/test-config-invalid.yaml +++ b/cmd/nrdot-collector-builder/cmd/manifest/testdata/test-config-invalid.yaml @@ -2,8 +2,8 @@ # dist: - module: github.com/newrelic/nrdot-collector-releases/nrdot-collector-host - name: nrdot-collector-host - description: NRDOT Collector Host + module: github.com/newrelic/nrdot-collector-releases/nrdot-collector + name: nrdot-collector + description: NRDOT Collector version: 1.1.0 output_path: ./_build diff --git a/distributions/README.md b/distributions/README.md index 22236ab4..1c13a360 100644 --- a/distributions/README.md +++ b/distributions/README.md @@ -1,7 +1,7 @@ # Collector Distributions This README covers topics that apply to all distributions. For distribution-specific information please refer to: -- [nrdot-collector-host](./nrdot-collector-host/README.md) +- [nrdot-collector](./nrdot-collector/README.md) - [nrdot-collector-k8s](./nrdot-collector-k8s/README.md) ## Installation @@ -11,7 +11,7 @@ Each distribution is available as a Docker image under the [newrelic](https://hu In order to run the collector via docker, you'll have to supply the required environment variables, see also [Configuration](#configuration). Using the `host` distribution as an example: ```bash -docker run -e NEW_RELIC_LICENSE_KEY='your-ingest-license-key' newrelic/nrdot-collector-host +docker run -e NEW_RELIC_LICENSE_KEY='your-ingest-license-key' newrelic/nrdot-collector ``` ### Linux packages and Archives @@ -77,7 +77,7 @@ If a distribution provides linux packages (refer to its README), you can follow ##### DEB Installation ```bash -export collector_distro="nrdot-collector-host" +export collector_distro="nrdot-collector" export collector_version="1.2.0" export collector_arch="amd64" # or arm64 export license_key="YOUR_LICENSE_KEY" @@ -90,7 +90,7 @@ sudo systemctl reload-or-restart "${collector_distro}.service" ### RPM Installation ```bash -export collector_distro="nrdot-collector-host" +export collector_distro="nrdot-collector" export collector_version="1.2.0" export collector_arch="x86_64" # or arm64 export license_key="YOUR_LICENSE_KEY" @@ -104,13 +104,13 @@ sudo systemctl reload-or-restart "${collector_distro}.service" ### Archives Archives contain the binary and the default configuration which is usually `config.yaml` unless the distro packages multiple defaults, e.g. `nrdot-collector-k8s`. ```bash -export collector_distro="nrdot-collector-host" +export collector_distro="nrdot-collector" export collector_version="1.2.0" export collector_arch="amd64" # or arm64 export license_key="YOUR_LICENSE_KEY" curl "https://github.com/newrelic/nrdot-collector-releases/releases/download/${collector_version}/${collector_distro}_${collector_version}_linux_${collector_arch}.tar.gz" --location --output collector.tar.gz tar -xzf collector.tar.gz -NEW_RELIC_LICENSE_KEY="${license_key}" ./nrdot-collector-host --config ./config.yaml +NEW_RELIC_LICENSE_KEY="${license_key}" ./nrdot-collector --config ./config.yaml ``` ## Configuration diff --git a/distributions/TROUBLESHOOTING.md b/distributions/TROUBLESHOOTING.md index 2c5207a9..1e652edb 100644 --- a/distributions/TROUBLESHOOTING.md +++ b/distributions/TROUBLESHOOTING.md @@ -3,7 +3,7 @@ Please make sure to consult the [README](./README.md) first to ensure that you h The collector is extremely powerful but therefore also easily misconfigured. As we cannot cover all the customization possibilities, we recommend consulting the [OTel Collector troubleshooting documentation](https://opentelemetry.io/docs/collector/troubleshooting/) if this guide does not help you resolve your issue. At its core, NRDOT is a [custom distribution](https://opentelemetry.io/docs/collector/custom-collector/), so many of the same steps will apply. This guide covers general collector troubleshooting tools and common issues. Distribution-specific troubleshooting is available here: -- [nrdot-collector-host](./nrdot-collector-host/TROUBLESHOOTING.md) +- [nrdot-collector](./nrdot-collector/TROUBLESHOOTING.md) - [nrdot-collector-k8s](./nrdot-collector-k8s/TROUBLESHOOTING.md) However, note that those guides assume you are familiar with the tools mentioned in this guide. @@ -24,31 +24,31 @@ There are different types of input you can use, each enabled by its own [provide #### Binary ```bash -/usr/bin/nrdot-collector --config=/etc/nrdot-collector-host/config.yaml --config 'yaml:service::telemetry::logs::level: WARN'" +/usr/bin/nrdot-collector --config=/etc/nrdot-collector/config.yaml --config 'yaml:service::telemetry::logs::level: WARN'" ``` #### Docker ```bash -# docker without override implicitly adding `--config /etc/nrdot-collector-host/config.yaml` via CMD directive -docker run newrelic/nrdot-collector-host +# docker without override implicitly adding `--config /etc/nrdot-collector/config.yaml` via CMD directive +docker run newrelic/nrdot-collector # docker with config override -docker run newrelic/nrdot-collector-host --config /etc/nrdot-collector-host/config.yaml --config 'yaml:service::telemetry::logs::level: WARN' +docker run newrelic/nrdot-collector --config /etc/nrdot-collector/config.yaml --config 'yaml:service::telemetry::logs::level: WARN' ``` #### Kubernetes ```yaml -image: newrelic/nrdot-collector-host +image: newrelic/nrdot-collector # args can be fully omitted if no override as `CMD` directive supplies the default config -args: [ "--config", "/etc/nrdot-collector-host/config.yaml", "--config", "yaml:service::telemetry::logs::level: WARN" ] +args: [ "--config", "/etc/nrdot-collector/config.yaml", "--config", "yaml:service::telemetry::logs::level: WARN" ] ``` #### Linux packages Our linux packages (if available for the distro) are started as a `systemd` service, so you'd have to edit the `OTELCOL_OPTIONS` environment variable in the `.conf` file and restart the service via `systemctl` The exact location of this file and the default configuration is distribution-specific, but can be looked up in the `nfpms` section of the `goreleaser.yaml` in the respective distribution directory. ``` -# edit and save /etc/nrdot-collector-host/nrdot-collector-host.conf -OTELCOL_OPTIONS="--config=/etc/nrdot-collector-host/config.yaml --config 'yaml:service::telemetry::logs::level: WARN'" +# edit and save /etc/nrdot-collector/nrdot-collector.conf +OTELCOL_OPTIONS="--config=/etc/nrdot-collector/config.yaml --config 'yaml:service::telemetry::logs::level: WARN'" # restart NRDOT -systemctl reload-or-restart nrdot-collector-host.service +systemctl reload-or-restart nrdot-collector.service ``` @@ -74,7 +74,7 @@ having to wait for data being ingested by New Relic. All NRDOT collector distributions include the `debugexporter` but disable it by default due to its verbosity and performance overhead. In order to enable it, you'll have to add it as a component and use it in the pipeline you're trying to debug. ``` # Configure debugexporter (empty config is valid) and use it in pipeline 'metrics' ---config /etc/nrdot-collector-host/config.yaml --config 'yaml:exporters::debug: ' --config 'yaml:service::pipelines::metrics::exporters: [otlphttp, debug]' +--config /etc/nrdot-collector/config.yaml --config 'yaml:exporters::debug: ' --config 'yaml:service::pipelines::metrics::exporters: [otlphttp, debug]' ``` Additional configuration options to increase verbosity or enable sampling are available in the [exporter's docs](https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/debugexporter/README.md#getting-started). @@ -114,4 +114,4 @@ For addressing general OTLP connection issues, please refer to our [OTLP trouble #### 2. Check your config (if customized) - If you see some but not all telemetry types, double-check your [pipelines](https://opentelemetry.io/docs/collector/configuration/#pipelines). Each telemetry type (logs, metrics, traces) has a separate pipeline, so make sure the missing telemetry has a pipeline with the appropriate receiver. - Rule out processors dropping data. Add a debugging pipeline with just the receiver in question and the `debugexporter`. Add processors one at a time and ensure the `debugexporter` still observers logs any time you add one. -- Consult the receivers docs, e.g. [hostmetricsreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/hostmetricsreceiver/README.md). Some receivers need elevated access to scrape data (filesystem, credentials etc.). If they lack permissions, a `warn` log is usually written. \ No newline at end of file +- Consult the receivers docs, e.g. [hostmetricsreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/hostmetricsreceiver/README.md). Some receivers need elevated access to scrape data (filesystem, credentials etc.). If they lack permissions, a `warn` log is usually written. diff --git a/distributions/nrdot-collector-host/nrdot-collector-host.conf b/distributions/nrdot-collector-host/nrdot-collector-host.conf deleted file mode 100644 index deea37a7..00000000 --- a/distributions/nrdot-collector-host/nrdot-collector-host.conf +++ /dev/null @@ -1,4 +0,0 @@ -# Systemd environment file for the nrdot-collector-host service -# Command-line options for the nrdot-collector-host service. -# See https://opentelemetry.io/docs/collector/configuration/ to see all available options. -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 deleted file mode 100644 index 0095229b..00000000 --- a/distributions/nrdot-collector-host/nrdot-collector-host.service +++ /dev/null @@ -1,15 +0,0 @@ -[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-k8s/TROUBLESHOOTING.md b/distributions/nrdot-collector-k8s/TROUBLESHOOTING.md index aea2070b..dafa4c37 100644 --- a/distributions/nrdot-collector-k8s/TROUBLESHOOTING.md +++ b/distributions/nrdot-collector-k8s/TROUBLESHOOTING.md @@ -6,7 +6,7 @@ the troubleshooting tools mentioned. The following list of issues is provided fo ## Known issues ### No `root_path` in containerized environments -Same solution as in the [nrdot-collector-host troubleshooting guide](../nrdot-collector-host/TROUBLESHOOTING.md#no-root_path-in-containerized-environments) applies. +Same solution as in the [nrdot-collector troubleshooting guide](../nrdot-collector/TROUBLESHOOTING.md#no-root_path-in-containerized-environments) applies. ### Missing permissions There are many variations of this error due to all the different APIs the k8s components scrape. This is a log example indicating this issue: @@ -14,4 +14,4 @@ There are many variations of this error due to all the different APIs the k8s co reflector.go:569] k8s.io/client-go@v0.32.2/tools/cache/reflector.go:251: failed to list *v1.Node: nodes is forbidden: User "system:serviceaccount:demo-3:default" cannot list resource "nodes" in API group "" at the cluster scope ``` The collector is missing permissions to access the cluster-internal k8s APIs. -As mentioned in the [installation instructions](./README.md), we highly recommend NOT using this distro by itself but rather through our [helm-chart](https://github.com/newrelic/helm-charts/tree/master/charts/nr-k8s-otel-collector) which sets up the required permissions for you. Otherwise, you will have to consult the documentation of the k8s receivers enabled in the configuration you are running. The error message unfortunately does not mention which component is causing the issue, so you will have to deduce from the 'resource' and 'scope' in the error message which receiver is causing the issue. As an example, the [k8seventsreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/k8seventsreceiver/README.md#service-account) has a section about setting up a `ServiceAccount` with the required permissions. \ No newline at end of file +As mentioned in the [installation instructions](./README.md), we highly recommend NOT using this distro by itself but rather through our [helm-chart](https://github.com/newrelic/helm-charts/tree/master/charts/nr-k8s-otel-collector) which sets up the required permissions for you. Otherwise, you will have to consult the documentation of the k8s receivers enabled in the configuration you are running. The error message unfortunately does not mention which component is causing the issue, so you will have to deduce from the 'resource' and 'scope' in the error message which receiver is causing the issue. As an example, the [k8seventsreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/k8seventsreceiver/README.md#service-account) has a section about setting up a `ServiceAccount` with the required permissions. diff --git a/distributions/nrdot-collector-k8s/test/spec-local.yaml b/distributions/nrdot-collector-k8s/test/spec-local.yaml index e3a7fefb..a54eeb3a 100644 --- a/distributions/nrdot-collector-k8s/test/spec-local.yaml +++ b/distributions/nrdot-collector-k8s/test/spec-local.yaml @@ -1,4 +1,4 @@ -description: nrdot-collector-host E2E Test +description: nrdot-collector E2E Test # can't easily force usage of default 'testKey' as OTEL_RESOURCE_ATTRIBUTES is already used by chart custom_test_key: k8s.cluster.name diff --git a/distributions/nrdot-collector-host/.goreleaser-nightly.yaml b/distributions/nrdot-collector/.goreleaser-nightly.yaml similarity index 84% rename from distributions/nrdot-collector-host/.goreleaser-nightly.yaml rename to distributions/nrdot-collector/.goreleaser-nightly.yaml index 40791206..2a6ef561 100644 --- a/distributions/nrdot-collector-host/.goreleaser-nightly.yaml +++ b/distributions/nrdot-collector/.goreleaser-nightly.yaml @@ -5,7 +5,7 @@ release: use_existing_draft: true disable: "true" builds: - - id: nrdot-collector-host + - id: nrdot-collector goos: - linux - windows @@ -16,7 +16,7 @@ builds: - goos: windows goarch: arm64 dir: _build - binary: nrdot-collector-host + binary: nrdot-collector ldflags: - -s - -w @@ -25,9 +25,9 @@ builds: env: - CGO_ENABLED=0 archives: - - id: nrdot-collector-host + - id: nrdot-collector ids: - - nrdot-collector-host + - nrdot-collector name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}' format_overrides: - goos: windows @@ -37,15 +37,15 @@ archives: - src: config.yaml 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 + package_name: nrdot-collector 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 + - src: nrdot-collector.service + dst: /lib/systemd/system/nrdot-collector.service + - src: nrdot-collector.conf + dst: /etc/nrdot-collector/nrdot-collector.conf type: config|noreplace - src: config.yaml - dst: /etc/nrdot-collector-host/config.yaml + dst: /etc/nrdot-collector/config.yaml type: config scripts: preinstall: preinstall.sh @@ -61,14 +61,14 @@ nfpms: rpm: dependencies: - /bin/sh - id: nrdot-collector-host + id: nrdot-collector ids: - - nrdot-collector-host + - nrdot-collector formats: - deb - rpm maintainer: New Relic - description: NRDOT Collector - nrdot-collector-host + description: NRDOT Collector - nrdot-collector license: Apache 2.0 snapshot: version_template: '{{ incpatch .Version }}-SNAPSHOT-{{.ShortCommit}}' @@ -83,8 +83,6 @@ dockers: 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 @@ -101,8 +99,6 @@ dockers: 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 @@ -122,7 +118,7 @@ blobs: - bucket: nr-releases provider: s3 region: us-east-1 - directory: nrdot-collector-releases/nrdot-collector-host/nightly + directory: nrdot-collector-releases/nrdot-collector/nightly changelog: disable: "true" signs: diff --git a/distributions/nrdot-collector-host/.goreleaser.yaml b/distributions/nrdot-collector/.goreleaser.yaml similarity index 84% rename from distributions/nrdot-collector-host/.goreleaser.yaml rename to distributions/nrdot-collector/.goreleaser.yaml index 808c8dd8..089050f0 100644 --- a/distributions/nrdot-collector-host/.goreleaser.yaml +++ b/distributions/nrdot-collector/.goreleaser.yaml @@ -5,7 +5,7 @@ release: use_existing_draft: true disable: "false" builds: - - id: nrdot-collector-host + - id: nrdot-collector goos: - linux - windows @@ -16,7 +16,7 @@ builds: - goos: windows goarch: arm64 dir: _build - binary: nrdot-collector-host + binary: nrdot-collector ldflags: - -s - -w @@ -25,9 +25,9 @@ builds: env: - CGO_ENABLED=0 archives: - - id: nrdot-collector-host + - id: nrdot-collector ids: - - nrdot-collector-host + - nrdot-collector name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}' format_overrides: - goos: windows @@ -37,15 +37,15 @@ archives: - src: config.yaml 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 + package_name: nrdot-collector 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 + - src: nrdot-collector.service + dst: /lib/systemd/system/nrdot-collector.service + - src: nrdot-collector.conf + dst: /etc/nrdot-collector/nrdot-collector.conf type: config|noreplace - src: config.yaml - dst: /etc/nrdot-collector-host/config.yaml + dst: /etc/nrdot-collector/config.yaml type: config scripts: preinstall: preinstall.sh @@ -61,14 +61,14 @@ nfpms: rpm: dependencies: - /bin/sh - id: nrdot-collector-host + id: nrdot-collector ids: - - nrdot-collector-host + - nrdot-collector formats: - deb - rpm maintainer: New Relic - description: NRDOT Collector - nrdot-collector-host + description: NRDOT Collector - nrdot-collector license: Apache 2.0 snapshot: version_template: '{{ incpatch .Version }}-SNAPSHOT-{{.ShortCommit}}' @@ -83,8 +83,6 @@ dockers: image_templates: - '{{ .Env.REGISTRY }}/nrdot-collector-host:{{ .Version }}-amd64' - '{{ .Env.REGISTRY }}/nrdot-collector-host:latest-amd64' - extra_files: - - config.yaml build_flag_templates: - --pull - --platform=linux/amd64 @@ -101,8 +99,6 @@ dockers: image_templates: - '{{ .Env.REGISTRY }}/nrdot-collector-host:{{ .Version }}-arm64' - '{{ .Env.REGISTRY }}/nrdot-collector-host:latest-arm64' - extra_files: - - config.yaml build_flag_templates: - --pull - --platform=linux/arm64 @@ -126,7 +122,7 @@ blobs: - bucket: nr-releases provider: s3 region: us-east-1 - directory: nrdot-collector-releases/nrdot-collector-host/{{ .Version }} + directory: nrdot-collector-releases/nrdot-collector/{{ .Version }} changelog: disable: "true" signs: diff --git a/distributions/nrdot-collector-host/Dockerfile b/distributions/nrdot-collector/Dockerfile similarity index 53% rename from distributions/nrdot-collector-host/Dockerfile rename to distributions/nrdot-collector/Dockerfile index f25ed700..6cea0184 100644 --- a/distributions/nrdot-collector-host/Dockerfile +++ b/distributions/nrdot-collector/Dockerfile @@ -7,9 +7,9 @@ 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"] +COPY --chmod=755 nrdot-collector /nrdot-collector +COPY config.yaml /etc/nrdot-collector/config.yaml +ENTRYPOINT ["/nrdot-collector"] +CMD ["--config", "/etc/nrdot-collector/config.yaml"] # `4137` and `4318`: OTLP EXPOSE 4317 4318 diff --git a/distributions/nrdot-collector-host/Makefile b/distributions/nrdot-collector/Makefile similarity index 100% rename from distributions/nrdot-collector-host/Makefile rename to distributions/nrdot-collector/Makefile diff --git a/distributions/nrdot-collector-host/README.md b/distributions/nrdot-collector/README.md similarity index 90% rename from distributions/nrdot-collector-host/README.md rename to distributions/nrdot-collector/README.md index 7ba4a962..83e9e63b 100644 --- a/distributions/nrdot-collector-host/README.md +++ b/distributions/nrdot-collector/README.md @@ -1,10 +1,10 @@ -# nrdot-collector-host +# nrdot-collector | Status | | |-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Distro | `nrdot-collector-host` | +| Distro | `nrdot-collector` | | Stability | `public` | -| Artifacts | [Docker images on DockerHub](https://hub.docker.com/r/newrelic/nrdot-collector-host)
[Linux packages and archives under GitHub Releases](https://github.com/newrelic/nrdot-collector-releases/releases) | +| Artifacts | [Docker images on DockerHub](https://hub.docker.com/r/newrelic/nrdot-collector)
[Linux packages and archives under GitHub Releases](https://github.com/newrelic/nrdot-collector-releases/releases) | A distribution of the NRDOT collector focused on - monitoring the host the collector is deployed on via `hostmetricsreceiver` and `filelogreceiver` @@ -35,7 +35,7 @@ Note: See [general README](../README.md) for information that applies to all dis #### Enable process metrics Process metrics are disabled by default as they are quite noisy. If you want to enable them, you can do so by reconfiguring the `hostmetricsreceiver`, see also [receiver docs](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/hostmetricsreceiver#getting-started). Note that there is a [processesscraper (`system.processes.*` metrics)](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/hostmetricsreceiver/internal/scraper/processesscraper/documentation.md) and a [processscraper (`process.*` metrics)](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/hostmetricsreceiver/internal/scraper/processscraper/documentation.md) with separate options. An example configuration would look like this: ```shell -newrelic/nrdot-collector-host --config /etc/nrdot-collector-host/config.yaml \ +newrelic/nrdot-collector --config /etc/nrdot-collector/config.yaml \ --config='yaml:receivers::hostmetrics::scrapers::processes: ' \ --config='yaml:receivers::hostmetrics::scrapers::process: { metrics: { process.cpu.utilization: { enabled: true }, process.cpu.time: { enabled: false } } }' ``` diff --git a/distributions/nrdot-collector-host/THIRD_PARTY_NOTICES.md b/distributions/nrdot-collector/THIRD_PARTY_NOTICES.md similarity index 100% rename from distributions/nrdot-collector-host/THIRD_PARTY_NOTICES.md rename to distributions/nrdot-collector/THIRD_PARTY_NOTICES.md diff --git a/distributions/nrdot-collector-host/TROUBLESHOOTING.md b/distributions/nrdot-collector/TROUBLESHOOTING.md similarity index 95% rename from distributions/nrdot-collector-host/TROUBLESHOOTING.md rename to distributions/nrdot-collector/TROUBLESHOOTING.md index 38307faf..ec37f0a1 100644 --- a/distributions/nrdot-collector-host/TROUBLESHOOTING.md +++ b/distributions/nrdot-collector/TROUBLESHOOTING.md @@ -1,4 +1,4 @@ -# Troubleshooting for nrdot-collector-host +# Troubleshooting for nrdot-collector For general NRDOT troubleshooting, see [this guide](../TROUBLESHOOTING.md). This document assumes you are familiar with the troubleshooting tools mentioned. @@ -23,7 +23,7 @@ The `hostmetricsreceiver` auto-detects the files to scrape system metrics from. In order to resolve this, make sure to follow the [receiver's docs](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/hostmetricsreceiver/README.md#collecting-host-metrics-from-inside-a-container-linux-only) to mount the host file system into the container at the `root_path` and configure the `root_path` accordingly, e.g. ```bash docker run -v /:/hostfs \ --e NEW_RELIC_LICENSE_KEY='license-key' newrelic/nrdot-collector-host \ ---config /etc/nrdot-collector-host/config.yaml \ +-e NEW_RELIC_LICENSE_KEY='license-key' newrelic/nrdot-collector \ +--config /etc/nrdot-collector/config.yaml \ --config 'yaml:receivers::hostmetrics::root_path: /hostfs' -``` \ No newline at end of file +``` diff --git a/distributions/nrdot-collector-host/assert-invariants-agent-control.sh b/distributions/nrdot-collector/assert-invariants-agent-control.sh similarity index 77% rename from distributions/nrdot-collector-host/assert-invariants-agent-control.sh rename to distributions/nrdot-collector/assert-invariants-agent-control.sh index d8922cdd..d8a0ba83 100755 --- a/distributions/nrdot-collector-host/assert-invariants-agent-control.sh +++ b/distributions/nrdot-collector/assert-invariants-agent-control.sh @@ -33,10 +33,10 @@ yq -e '.processors.resourcedetection.system.resource_attributes["host.id"].enabl goreleaser_yamls=('.goreleaser.yaml' '.goreleaser-nightly.yaml') for goreleaser_yaml in "${goreleaser_yamls[@]}"; do echo "Checking ${goreleaser_yaml}" - yq -e '.builds[].binary == "nrdot-collector-host"' "${host_distro_dir}/${goreleaser_yaml}" || - { echo "expected binary name 'nrdot-collector-host' in ${goreleaser_yaml}"; exit 1; } - yq -e '.nfpms[].package_name == "nrdot-collector-host"' "${host_distro_dir}/${goreleaser_yaml}" || - { echo "expected package_name 'nrdot-collector-host' in ${goreleaser_yaml}"; exit 1; } + yq -e '.builds[].binary == "nrdot-collector"' "${host_distro_dir}/${goreleaser_yaml}" || + { echo "expected binary name 'nrdot-collector' in ${goreleaser_yaml}"; exit 1; } + yq -e '.nfpms[].package_name == "nrdot-collector"' "${host_distro_dir}/${goreleaser_yaml}" || + { echo "expected package_name 'nrdot-collector' in ${goreleaser_yaml}"; exit 1; } done diff --git a/distributions/nrdot-collector-host/config.yaml b/distributions/nrdot-collector/config.yaml similarity index 100% rename from distributions/nrdot-collector-host/config.yaml rename to distributions/nrdot-collector/config.yaml diff --git a/distributions/nrdot-collector-host/manifest.yaml b/distributions/nrdot-collector/manifest.yaml similarity index 97% rename from distributions/nrdot-collector-host/manifest.yaml rename to distributions/nrdot-collector/manifest.yaml index f5de7868..c3ef9b35 100644 --- a/distributions/nrdot-collector-host/manifest.yaml +++ b/distributions/nrdot-collector/manifest.yaml @@ -1,7 +1,7 @@ dist: - module: github.com/newrelic/nrdot-collector-releases/nrdot-collector-host - name: nrdot-collector-host - description: NRDOT Collector Host + module: github.com/newrelic/nrdot-collector-releases/nrdot-collector + name: nrdot-collector + description: NRDOT Collector version: 1.2.0 output_path: ./_build receivers: diff --git a/distributions/nrdot-collector/nrdot-collector.conf b/distributions/nrdot-collector/nrdot-collector.conf new file mode 100644 index 00000000..73d8d9c2 --- /dev/null +++ b/distributions/nrdot-collector/nrdot-collector.conf @@ -0,0 +1,4 @@ +# Systemd environment file for the nrdot-collector service +# Command-line options for the nrdot-collector service. +# See https://opentelemetry.io/docs/collector/configuration/ to see all available options. +OTELCOL_OPTIONS="--config=/etc/nrdot-collector/config.yaml" diff --git a/distributions/nrdot-collector/nrdot-collector.service b/distributions/nrdot-collector/nrdot-collector.service new file mode 100644 index 00000000..cdb69dda --- /dev/null +++ b/distributions/nrdot-collector/nrdot-collector.service @@ -0,0 +1,15 @@ +[Unit] +Description=NRDOT Collector +After=network.target + +[Service] +EnvironmentFile=/etc/nrdot-collector/nrdot-collector.conf +ExecStart=/usr/bin/nrdot-collector $OTELCOL_OPTIONS +KillMode=mixed +Restart=on-failure +Type=simple +User=nrdot-collector +Group=nrdot-collector + +[Install] +WantedBy=multi-user.target diff --git a/distributions/nrdot-collector-host/postinstall.sh b/distributions/nrdot-collector/postinstall.sh similarity index 66% rename from distributions/nrdot-collector-host/postinstall.sh rename to distributions/nrdot-collector/postinstall.sh index 0d69fe8f..97bdfbde 100755 --- a/distributions/nrdot-collector-host/postinstall.sh +++ b/distributions/nrdot-collector/postinstall.sh @@ -16,11 +16,11 @@ 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 + sed -i "/User=nrdot-collector/d" /lib/systemd/system/nrdot-collector.service + sed -i "/Group=nrdot-collector/d" /lib/systemd/system/nrdot-collector.service fi - systemctl enable nrdot-collector-host.service - if [ -f /etc/nrdot-collector-host/config.yaml ]; then - systemctl start nrdot-collector-host.service + systemctl enable nrdot-collector.service + if [ -f /etc/nrdot-collector/config.yaml ]; then + systemctl start nrdot-collector.service fi fi diff --git a/distributions/nrdot-collector-host/preinstall.sh b/distributions/nrdot-collector/preinstall.sh similarity index 83% rename from distributions/nrdot-collector-host/preinstall.sh rename to distributions/nrdot-collector/preinstall.sh index 859d7c0b..f8a8b456 100755 --- a/distributions/nrdot-collector-host/preinstall.sh +++ b/distributions/nrdot-collector/preinstall.sh @@ -16,5 +16,5 @@ # 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 + getent passwd nrdot-collector >/dev/null || useradd --system --user-group --no-create-home --shell /sbin/nologin nrdot-collector fi diff --git a/distributions/nrdot-collector-host/preremove.sh b/distributions/nrdot-collector/preremove.sh similarity index 86% rename from distributions/nrdot-collector-host/preremove.sh rename to distributions/nrdot-collector/preremove.sh index d240b67b..8eabfd79 100755 --- a/distributions/nrdot-collector-host/preremove.sh +++ b/distributions/nrdot-collector/preremove.sh @@ -15,6 +15,6 @@ # 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 + systemctl stop nrdot-collector.service + systemctl disable nrdot-collector.service fi diff --git a/distributions/nrdot-collector-host/test/.gitignore b/distributions/nrdot-collector/test/.gitignore similarity index 100% rename from distributions/nrdot-collector-host/test/.gitignore rename to distributions/nrdot-collector/test/.gitignore diff --git a/distributions/nrdot-collector-host/test/host-collector-values.yaml b/distributions/nrdot-collector/test/host-collector-values.yaml similarity index 78% rename from distributions/nrdot-collector-host/test/host-collector-values.yaml rename to distributions/nrdot-collector/test/host-collector-values.yaml index 39d9a109..bed24394 100644 --- a/distributions/nrdot-collector-host/test/host-collector-values.yaml +++ b/distributions/nrdot-collector/test/host-collector-values.yaml @@ -1,7 +1,7 @@ additionalLabels: - e2eTestLogSelector: nrdot-collector-host-e2e + e2eTestLogSelector: nrdot-collector-e2e podLabels: - e2eTestLogSelector: nrdot-collector-host-e2e + e2eTestLogSelector: nrdot-collector-e2e mode: daemonset @@ -10,7 +10,7 @@ configMap: command: extraArgs: - - --config=/etc/nrdot-collector-host/config.yaml + - --config=/etc/nrdot-collector/config.yaml # configure liveliness probe according to chart's expectations - '"--config=yaml:extensions::health_check::endpoint: ${env:MY_POD_IP}:13133"' @@ -31,4 +31,4 @@ extraEnvs: name: collector-secrets key: scenarioTag - name: OTEL_RESOURCE_ATTRIBUTES - value: "testKey=$(SCENARIO_TAG)" \ No newline at end of file + value: "testKey=$(SCENARIO_TAG)" diff --git a/distributions/nrdot-collector-host/test/host-expected-metrics.yaml b/distributions/nrdot-collector/test/host-expected-metrics.yaml similarity index 100% rename from distributions/nrdot-collector-host/test/host-expected-metrics.yaml rename to distributions/nrdot-collector/test/host-expected-metrics.yaml diff --git a/distributions/nrdot-collector-host/test/internal-collector-values.yaml b/distributions/nrdot-collector/test/internal-collector-values.yaml similarity index 89% rename from distributions/nrdot-collector-host/test/internal-collector-values.yaml rename to distributions/nrdot-collector/test/internal-collector-values.yaml index ad51aee0..581e2c5a 100644 --- a/distributions/nrdot-collector-host/test/internal-collector-values.yaml +++ b/distributions/nrdot-collector/test/internal-collector-values.yaml @@ -1,7 +1,7 @@ additionalLabels: - e2eTestLogSelector: nrdot-collector-host-e2e + e2eTestLogSelector: nrdot-collector-e2e podLabels: - e2eTestLogSelector: nrdot-collector-host-e2e + e2eTestLogSelector: nrdot-collector-e2e mode: daemonset @@ -11,7 +11,7 @@ configMap: command: extraArgs: - - --config=/etc/nrdot-collector-host/config.yaml + - --config=/etc/nrdot-collector/config.yaml - '"--config=yaml:service::telemetry::resource::testKey: ${env:SCENARIO_TAG}"' # configure liveliness probe according to chart's expectations - '"--config=yaml:extensions::health_check::endpoint: ${env:MY_POD_IP}:13133"' @@ -65,7 +65,7 @@ extraContainers: - --otlp-insecure - --otlp-http - "--otlp-endpoint=localhost:4318" - - "--otlp-attributes=service.name=\"telemetrygen-metrics\"" + - '--otlp-attributes=service.name="telemetrygen-metrics"' - --rate=10 - --duration=5m - name: telemetrygen-logs @@ -75,10 +75,10 @@ extraContainers: - --otlp-insecure # rpc.server.% - "--otlp-endpoint=localhost:4317" - - "--otlp-attributes=service.name=\"telemetrygen-logs\"" + - '--otlp-attributes=service.name="telemetrygen-logs"' - --rate=10 - --duration=5m - - "--body=\"short log\"" + - '--body="short log"' - name: telemetrygen-traces image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:v0.130.0 args: @@ -86,6 +86,6 @@ extraContainers: - --otlp-insecure - --otlp-http - "--otlp-endpoint=localhost:4318" - - "--otlp-attributes=service.name=\"telemetrygen-traces\"" + - '--otlp-attributes=service.name="telemetrygen-traces"' - --rate=5 - --duration=5m diff --git a/distributions/nrdot-collector-host/test/internal-expected-metrics.yaml b/distributions/nrdot-collector/test/internal-expected-metrics.yaml similarity index 100% rename from distributions/nrdot-collector-host/test/internal-expected-metrics.yaml rename to distributions/nrdot-collector/test/internal-expected-metrics.yaml diff --git a/distributions/nrdot-collector-host/test/spec-local.yaml b/distributions/nrdot-collector/test/spec-local.yaml similarity index 94% rename from distributions/nrdot-collector-host/test/spec-local.yaml rename to distributions/nrdot-collector/test/spec-local.yaml index 2d7daafd..02acb974 100644 --- a/distributions/nrdot-collector-host/test/spec-local.yaml +++ b/distributions/nrdot-collector/test/spec-local.yaml @@ -1,4 +1,4 @@ -description: nrdot-collector-host E2E Test +description: nrdot-collector E2E Test # scoping is achieved via an implicit attribute `testKey=${SCENARIO_TAG}` expected on all tested telemetry @@ -9,7 +9,7 @@ scenarios: - | kubectl create secret generic 'collector-secrets' --namespace=nr-${SCENARIO_TAG} \ --from-literal="nrIngestKey=${LICENSE_KEY}" --from-literal="nrBackendUrl=${NR_BACKEND_URL}" \ - --from-literal="serviceName=nrdot-collector-host-e2e-host" --from-literal="scenarioTag=${SCENARIO_TAG}" + --from-literal="serviceName=nrdot-collector-e2e-host" --from-literal="scenarioTag=${SCENARIO_TAG}" - "helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts || echo 'skipping repo add: open-telemetry repo already exists'" - | chart_version=$(../../../scripts/get-otel-collector-chart-version.sh) @@ -19,7 +19,7 @@ scenarios: --set image.tag=${IMAGE_TAG} \ --set image.repository=${IMAGE_REPO} after: - - kubectl logs -l e2eTestLogSelector=nrdot-collector-host-e2e -n nr-${SCENARIO_TAG} --all-containers --prefix=true + - kubectl logs -l e2eTestLogSelector=nrdot-collector-e2e -n nr-${SCENARIO_TAG} --all-containers --prefix=true - kubectl get all -o wide - helm uninstall ${SCENARIO_TAG} --namespace nr-${SCENARIO_TAG} - kubectl delete namespace nr-${SCENARIO_TAG} @@ -170,7 +170,7 @@ scenarios: - | kubectl create secret generic 'collector-secrets' --namespace=nr-${SCENARIO_TAG} \ --from-literal="nrIngestKey=${LICENSE_KEY}" --from-literal="nrBackendUrl=${NR_BACKEND_URL}" \ - --from-literal="serviceName=nrdot-collector-host-e2e-internal" --from-literal="scenarioTag=${SCENARIO_TAG}" + --from-literal="serviceName=nrdot-collector-e2e-internal" --from-literal="scenarioTag=${SCENARIO_TAG}" - "helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts || echo 'skipping repo add: open-telemetry repo already exists'" - | chart_version=$(../../../scripts/get-otel-collector-chart-version.sh) @@ -180,7 +180,7 @@ scenarios: --set image.tag=${IMAGE_TAG} \ --set image.repository=${IMAGE_REPO} after: - - kubectl logs -l e2eTestLogSelector=nrdot-collector-host-e2e -n nr-${SCENARIO_TAG} --all-containers --prefix=true + - kubectl logs -l e2eTestLogSelector=nrdot-collector-e2e -n nr-${SCENARIO_TAG} --all-containers --prefix=true - kubectl get all -o wide - helm uninstall ${SCENARIO_TAG} --namespace nr-${SCENARIO_TAG} - kubectl delete namespace nr-${SCENARIO_TAG} @@ -197,8 +197,8 @@ scenarios: lowerBoundedValue: 1 - query: FROM Log SELECT filter(count(*), otelcol.pipeline.id is not null) as logs_pipeline expected_results: - - key: logs_pipeline - lowerBoundedValue: 1 + - key: logs_pipeline + lowerBoundedValue: 1 - query: FROM Log SELECT filter(count(*), otelcol.signal is not null) as logs_signal expected_results: - key: logs_signal @@ -251,8 +251,8 @@ scenarios: # Batch processor metrics - query: FROM Metric SELECT filter(count(*), processor is not null) as batch_processor WHERE metricName like 'otelcol_processor_batch_%' expected_results: - - key: batch_processor - lowerBoundedValue: 1 + - key: batch_processor + lowerBoundedValue: 1 # Http metrics - query: FROM Metric SELECT filter(count(*), server.address is not null) as http_server_address WHERE metricName like 'http.client.request.duration' expected_results: @@ -264,18 +264,17 @@ scenarios: lowerBoundedValue: 1 - query: FROM Metric SELECT filter(count(*), http.response.status_code is not null) as http_code WHERE metricName like 'http.client.request.duration' expected_results: - - key: http_code - lowerBoundedValue: 1 + - key: http_code + lowerBoundedValue: 1 - query: FROM Metric SELECT filter(count(*), http.response.status_code is not null) as http_code WHERE metricName like 'http.server.request.duration' expected_results: - - key: http_code - lowerBoundedValue: 1 + - key: http_code + lowerBoundedValue: 1 - query: FROM Metric SELECT filter(count(*), server.port is not null) as http_port WHERE metricName = 'http.server.request.duration' expected_results: - - key: http_port - lowerBoundedValue: 1 + - key: http_port + lowerBoundedValue: 1 - query: FROM Metric SELECT filter(count(*), rpc.grpc.status_code is not null) as rpc_code WHERE metricName like 'rpc.%.duration' expected_results: - key: rpc_code lowerBoundedValue: 1 - diff --git a/distributions/nrdot-collector-host/test/spec-nightly.yaml b/distributions/nrdot-collector/test/spec-nightly.yaml similarity index 100% rename from distributions/nrdot-collector-host/test/spec-nightly.yaml rename to distributions/nrdot-collector/test/spec-nightly.yaml diff --git a/scripts/generate-goreleaser.sh b/scripts/generate-goreleaser.sh index 0e1e20fe..1d96baf3 100755 --- a/scripts/generate-goreleaser.sh +++ b/scripts/generate-goreleaser.sh @@ -15,7 +15,7 @@ done if [[ -z $distributions ]]; then echo "List of distributions to generate the goreleaser not provided. Use '-d' to specify the names of the distributions use. Ex.:" - echo "$0 -d nrdot-collector-host" + echo "$0 -d nrdot-collector" exit 1 fi @@ -25,4 +25,4 @@ for distribution in $(echo "$distributions" | tr "," "\n") do ${GO} run cmd/goreleaser/main.go -d "${distribution}" > "./distributions/${distribution}/.goreleaser.yaml" ${GO} run cmd/goreleaser/main.go -d "${distribution}" -n > "./distributions/${distribution}/.goreleaser-nightly.yaml" -done \ No newline at end of file +done diff --git a/test/e2e/Makefile b/test/e2e/Makefile index 296384a1..9a13aaf5 100644 --- a/test/e2e/Makefile +++ b/test/e2e/Makefile @@ -1,6 +1,6 @@ KIND_CLUSTER_NAME ?=e2etest K8S_CONTEXT_NAME ?=kind-${KIND_CLUSTER_NAME} -DISTRO ?=nrdot-collector-host +DISTRO ?=nrdot-collector THIS_MAKEFILE_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST))))) ROOT_DIR := $(realpath $(THIS_MAKEFILE_DIR)/../..) @@ -20,4 +20,4 @@ ci_test: E2E_TEST__NR_ACCOUNT_ID=${NR_ACCOUNT_ID} \ E2E_TEST__NR_API_BASE_URL=${NR_API_BASE_URL} \ E2E_TEST__TEST_MODE=${TEST_MODE} \ - go test ./... -count=1 -timeout=10m -parallel=50 \ No newline at end of file + go test ./... -count=1 -timeout=10m -parallel=50 diff --git a/test/e2e/util/assert/nr_metric_assertion_test.go b/test/e2e/util/assert/nr_metric_assertion_test.go index c2499f60..c90429a5 100644 --- a/test/e2e/util/assert/nr_metric_assertion_test.go +++ b/test/e2e/util/assert/nr_metric_assertion_test.go @@ -1,3 +1,5 @@ +// Copyright 2020 New Relic Corporation. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 package assert import ( @@ -9,7 +11,7 @@ import ( func TestAsQueryWithSingleAssertion(t *testing.T) { assertionFactory := NewNrMetricAssertionFactory( - fmt.Sprintf("WHERE host.name = 'nrdot-collector-host-foobar'"), + fmt.Sprintf("WHERE host.name = 'nrdot-collector-foobar'"), "5 minutes ago", ) singleAssertion := assertionFactory.NewNrMetricAssertion( @@ -21,14 +23,14 @@ func TestAsQueryWithSingleAssertion(t *testing.T) { SELECT max(^system.cpu.utilization^) FROM Metric WHERE state='user' -WHERE host.name = 'nrdot-collector-host-foobar' +WHERE host.name = 'nrdot-collector-foobar' SINCE 5 minutes ago UNTIL now `, t) } func TestAsQueryWithMultipleAssertions(t *testing.T) { assertionFactory := NewNrMetricAssertionFactory( - fmt.Sprintf("WHERE host.name = 'nrdot-collector-host-foobar'"), + fmt.Sprintf("WHERE host.name = 'nrdot-collector-foobar'"), "5 minutes ago", ) singleAssertion := assertionFactory.NewNrMetricAssertion(spec.NrMetric{Name: "system.cpu.utilization", WhereClause: "WHERE state='user'"}, []spec.NrAssertion{ @@ -41,7 +43,7 @@ func TestAsQueryWithMultipleAssertions(t *testing.T) { SELECT max(^system.cpu.utilization^),min(^system.cpu.utilization^),average(^system.cpu.utilization^) FROM Metric WHERE state='user' -WHERE host.name = 'nrdot-collector-host-foobar' +WHERE host.name = 'nrdot-collector-foobar' SINCE 5 minutes ago UNTIL now `, t) } @@ -51,6 +53,11 @@ func assertEqual(actual string, expected string, t *testing.T) { // no way to escape backticks, so we use '^' as a placeholder expectedTrimmed := strings.Replace(strings.TrimSpace(expected), "^", "`", -1) if actualTrimmed != expectedTrimmed { - t.Fatalf("\nExpected:\n[%s]\nbut received:\n[%s]\n", expectedTrimmed, actualTrimmed) + t.Fatalf(" +Expected: +[%s] +but received: +[%s] +", expectedTrimmed, actualTrimmed) } } diff --git a/test/e2e/util/spec/test_case_spec_test.go b/test/e2e/util/spec/test_case_spec_test.go index a9c36878..e422c9d9 100644 --- a/test/e2e/util/spec/test_case_spec_test.go +++ b/test/e2e/util/spec/test_case_spec_test.go @@ -1,3 +1,5 @@ +// Copyright 2020 New Relic Corporation. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 package spec import ( @@ -7,9 +9,9 @@ import ( func TestRenderWhereClause(t *testing.T) { testCaseSpec := LoadTestCaseSpec("host") actual := testCaseSpec.RenderWhereClause(map[string]string{ - "hostName": "nrdot-collector-host-foobar", + "hostName": "nrdot-collector-foobar", }) - if actual != "WHERE host.name like 'nrdot-collector-host-foobar'" { + if actual != "WHERE host.name like 'nrdot-collector-foobar'" { t.Fatalf("unexpected where clause: %s", actual) } } @@ -22,7 +24,7 @@ func TestRenderWhereClauseFailsIfExpectedVarMissing(t *testing.T) { } }() testCaseSpec.RenderWhereClause(map[string]string{ - "hostName1": "nrdot-collector-host-foobar", + "hostName1": "nrdot-collector-foobar", }) }