Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: newrelic/nri-docker
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.2.0
Choose a base ref
...
head repository: newrelic/nri-docker
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.3.0
Choose a head ref
  • 3 commits
  • 54 files changed
  • 3 contributors

Commits on Feb 6, 2025

  1. chore(deps): update golang patch version to v1.23.6 (#270)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 6, 2025
    Copy the full SHA
    8865ed4 View commit details

Commits on Mar 10, 2025

  1. feat(windows): add support for windows containers (#279)

    * feat(docker-win): add main for windows (#271)
        * feat(docker-win): add main for windows
        * improve help message for arg
        * improve function name
    * feat(docker-win): build, release windows binary and archive (#272)
        * feat(docker-win): build, release windows binary and archive
    * feat(windows): add platform as a member to decide os specific metrics (#274)
    * feat(windows): add memory metrics for windows (#276)
        * feat(windows): add memory metrics for windows
        * refactor memory calculation for windows
    * feat(windows): add cpu metrics for docker on windows (#277)
        * feat(windows): add cpu metrics for docker on windows
        * address pr comment
        * update todo
        * add tests for windows cpu calculation
    * feat(windows): add io metrics for docker on windows (#278)
        * feat(windows): add io metrics for docker on windows
        * remove unused functions
    * update changelog
    rajrohanyadav authored Mar 10, 2025
    Copy the full SHA
    4ba4f6a View commit details

Commits on Mar 11, 2025

  1. Update changelog with changes from v2.3.0

    newrelic-coreint-bot committed Mar 11, 2025
    Copy the full SHA
    489bdf1 View commit details
Showing with 1,311 additions and 512 deletions.
  1. +0 −1 .github/workflows/on_prerelease.yaml
  2. +0 −2 .github/workflows/on_push_pr.yaml
  3. +8 −0 CHANGELOG.md
  4. +1 −1 Dockerfile
  5. +31 −0 build/.goreleaser.yml
  6. +2 −0 build/release.mk
  7. +8 −0 build/s3-publish-schema.yml
  8. +41 −0 build/windows/fix_archives.sh
  9. +36 −0 build/windows/set_exe_properties.sh
  10. +8 −0 build/windows/unit_tests.ps1
  11. +44 −0 build/windows/versioninfo.json.template
  12. +11 −0 docker-win-definition.yml
  13. +7 −1 go.mod
  14. +7 −0 go.sum
  15. +13 −204 src/biz/metrics.go
  16. +216 −0 src/biz/metrics_all.go
  17. +88 −90 src/biz/{metrics_test.go → metrics_all_test.go}
  18. 0 src/biz/{metrics_aws_test.go → metrics_aws_linux_test.go}
  19. +121 −0 src/biz/metrics_windows.go
  20. +214 −0 src/biz/metrics_windows_test.go
  21. +1 −1 src/config/config.go
  22. +7 −0 src/constants/constants.go
  23. +12 −85 src/docker.go
  24. +55 −0 src/driver/driver.go
  25. +37 −0 src/driver/driver_all.go
  26. +55 −0 src/driver/driver_linux.go
  27. +7 −0 src/nri/metrics.go
  28. +0 −75 src/nri/sampler.go
  29. +83 −0 src/nri/sampler_all.go
  30. +42 −23 src/nri/sampler_test.go
  31. +48 −0 src/nri/sampler_windows.go
  32. +2 −2 src/raw/aws/fargate_raw_metrics.go
  33. +2 −0 src/raw/cgroup.go
  34. +2 −0 src/raw/cgroup_detect.go
  35. +2 −0 src/raw/cgroup_test.go
  36. +4 −2 src/raw/cgroupv1.go
  37. +2 −0 src/raw/cgroupv1_detect.go
  38. +2 −0 src/raw/cgroupv1_detect_test.go
  39. +7 −2 src/raw/cgroupv2.go
  40. +2 −0 src/raw/cgroupv2_detect.go
  41. +2 −0 src/raw/cgroupv2_detect_test.go
  42. +29 −10 src/raw/dockerapi/fetcher.go
  43. +6 −4 src/raw/dockerapi/fetcher_test.go
  44. +13 −2 src/raw/metrics.go
  45. +2 −0 src/raw/network_stats_getter.go
  46. +2 −0 src/raw/network_stats_getter_test.go
  47. +2 −0 src/raw/system_cpu_reader.go
  48. +2 −0 src/raw/system_cpu_reader_test.go
  49. +2 −0 src/raw/util_test.go
  50. +6 −0 src/utils/utils.go
  51. +2 −1 test/integration/dockerapi_fetcher_test.go
  52. +5 −2 test/integration/metrics_cgroupsv2_test.go
  53. +8 −4 test/integration/metrics_test.go
  54. +2 −0 test/integration/mocks.go
1 change: 0 additions & 1 deletion .github/workflows/on_prerelease.yaml
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@ jobs:
tag: ${{ github.event.release.tag_name }}
integration: "docker"
test_package: false
run_test_windows: false
run_build-win-packages: false
publish_schema: custom
dest_prefix: "infrastructure_agent/" # path prefix where the artifacts will be stored in the S3 bucket (use for testing)
2 changes: 0 additions & 2 deletions .github/workflows/on_push_pr.yaml
Original file line number Diff line number Diff line change
@@ -10,8 +10,6 @@ on:
jobs:
push-pr:
uses: newrelic/coreint-automation/.github/workflows/reusable_push_pr.yaml@v3
with:
run_test_windows: false

test-integration-nix-cgroups-v1:
name: Run integration tests on *Nix cgroups-v1
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -9,6 +9,14 @@ Unreleased section should follow [Release Toolkit](https://github.com/newrelic/r

## Unreleased

## v2.3.0 - 2025-03-11

### 🚀 Enhancements
- Add support for windows containers

### ⛓️ Dependencies
- Updated golang patch version to v1.23.6

## v2.2.0 - 2024-12-19

### 🚀 Enhancements
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG infra_image=newrelic/infrastructure-bundle

FROM golang:1.23.4 as builder
FROM golang:1.23.6 as builder

WORKDIR /go/src/github.com/newrelic/nri-docker
COPY . .
31 changes: 31 additions & 0 deletions build/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -11,11 +11,16 @@ builds:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- 386
- amd64
- arm
- arm64
ignore:
- goos: darwin
goarch: 386

- id: nri-nix-fips
main: ./src
binary: nri-docker
@@ -35,6 +40,22 @@ builds:
- arm64
tags:
- fips

- id: nri-win
main: ./src
binary: nri-docker
ldflags:
- -s -w -X main.integrationVersion={{.Version}} -X main.gitCommit={{.Commit}} -X main.buildDate={{.Date}}
env:
- CGO_ENABLED=0
goos:
- windows
goarch:
- 386
- amd64
hooks:
pre: build/windows/set_exe_properties.sh {{ .Env.TAG }} "docker"

archives:
- id: nri-nix
builds:
@@ -44,6 +65,7 @@ archives:
- docker-config.yml
- docker-definition.yml
format: tar.gz

- id: nri-nix-fips
builds:
- nri-nix-fips
@@ -53,6 +75,15 @@ archives:
- docker-definition.yml
format: tar.gz

- id: nri-win
builds:
- nri-win
name_template: "{{ .ProjectName }}-{{ .Arch }}.{{ .Version }}_dirty"
files:
- docker-config.yml
- docker-win-definition.yml
format: zip

# we use custom publisher for fixing archives and signing them
release:
disable: true
2 changes: 2 additions & 0 deletions build/release.mk
Original file line number Diff line number Diff line change
@@ -37,6 +37,8 @@ endif
release/fix-archive:
@echo "===> $(INTEGRATION) === [release/fix-archive] fixing tar.gz archives internal structure"
@bash $(CURDIR)/build/nix/fix_archives.sh $(CURDIR)
@echo "===> $(INTEGRATION) === [release/fix-archive] fixing zip archives internal structure"
@bash $(CURDIR)/build/windows/fix_archives.sh $(CURDIR)

.PHONY : release/publish
release/publish:
8 changes: 8 additions & 0 deletions build/s3-publish-schema.yml
Original file line number Diff line number Diff line change
@@ -12,6 +12,14 @@
- arm
- arm64

- src: "{app_name}-{arch}.{version}.zip"
uploads:
- type: file
dest: "{dest_prefix}binaries/windows/{arch}/{src}"
arch:
- amd64
- 386

- src: "{app_name}-fips_linux_{version}_{arch}.tar.gz"
uploads:
- type: file
41 changes: 41 additions & 0 deletions build/windows/fix_archives.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
set -e
#
#
# Gets dist/zip_dirty created by Goreleaser and reorganize inside files
#
#
PROJECT_PATH=$1

find dist -regex ".*_dirty\.zip" | while read zip_dirty; do
zip_file_name=${zip_dirty/_dirty.zip} # Strips suffix
zip_file_name=${zip_file_name/dist\/} # Strip folder name
ZIP_CLEAN="${zip_file_name}.zip"
ZIP_TMP="dist/zip_temp"
ZIP_CONTENT_PATH="${ZIP_TMP}/${zip_file_name}_content"

mkdir -p "${ZIP_CONTENT_PATH}"

AGENT_DIR_IN_ZIP_PATH="${ZIP_CONTENT_PATH}/New Relic/newrelic-infra/newrelic-integrations/"
CONF_IN_ZIP_PATH="${ZIP_CONTENT_PATH}/New Relic/newrelic-infra/integrations.d/"

mkdir -p "${AGENT_DIR_IN_ZIP_PATH}/bin"
mkdir -p "${CONF_IN_ZIP_PATH}"

echo "===> Decompress ${zip_file_name} in ${ZIP_CONTENT_PATH}"
unzip ${zip_dirty} -d ${ZIP_CONTENT_PATH}

echo "===> Move files inside ${zip_file_name}"
mv ${ZIP_CONTENT_PATH}/nri-${INTEGRATION}.exe "${AGENT_DIR_IN_ZIP_PATH}/bin"
mv ${ZIP_CONTENT_PATH}/${INTEGRATION}-win-definition.yml "${AGENT_DIR_IN_ZIP_PATH}"
mv ${ZIP_CONTENT_PATH}/${INTEGRATION}-config.yml "${CONF_IN_ZIP_PATH}"

echo "===> Creating zip ${ZIP_CLEAN}"
cd "${ZIP_CONTENT_PATH}"
zip -r ../${ZIP_CLEAN} .
cd $PROJECT_PATH
echo "===> Moving zip ${ZIP_CLEAN}"
mv "${ZIP_TMP}/${ZIP_CLEAN}" dist/
echo "===> Cleaning dirty zip ${zip_dirty}"
rm "${zip_dirty}"
done
36 changes: 36 additions & 0 deletions build/windows/set_exe_properties.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
set -e
#
#
# Create the metadata for the exe's files, called by .goreleser as a hook in the build section
#
#
TAG=$1
INTEGRATION=$2

if [ -n "$1" ]; then
echo "===> Tag is ${TAG}"
else
echo "===> Tag not specified will be 0.0.0"
TAG='0.0.0'
fi

MajorVersion=$(echo ${TAG:1} | cut -d "." -f 1)
MinorVersion=$(echo ${TAG:1} | cut -d "." -f 2)
PatchVersion=$(echo ${TAG:1} | cut -d "." -f 3)
BuildVersion='0'

Year=$(date +"%Y")
INTEGRATION_EXE="nri-${INTEGRATION}.exe"

sed \
-e "s/{MajorVersion}/$MajorVersion/g" \
-e "s/{MinorVersion}/$MinorVersion/g" \
-e "s/{PatchVersion}/$PatchVersion/g" \
-e "s/{BuildVersion}/$BuildVersion/g" \
-e "s/{Year}/$Year/g" \
-e "s/{Integration}/nri-$INTEGRATION/g" \
-e "s/{IntegrationExe}/$INTEGRATION_EXE/g" \
./build/windows/versioninfo.json.template > ./src/versioninfo.json

go generate github.com/newrelic/nri-${INTEGRATION}/src/
8 changes: 8 additions & 0 deletions build/windows/unit_tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
echo "--- Running tests"

go test ./src/...
if (-not $?)
{
echo "Failed running tests"
exit -1
}
44 changes: 44 additions & 0 deletions build/windows/versioninfo.json.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"FixedFileInfo":
{
"FileVersion": {
"Major": {MajorVersion},
"Minor": {MinorVersion},
"Patch": {PatchVersion},
"Build": {BuildVersion}
},
"ProductVersion": {
"Major": {MajorVersion},
"Minor": {MinorVersion},
"Patch": {PatchVersion},
"Build": {BuildVersion}
},
"FileFlagsMask": "3f",
"FileFlags ": "00",
"FileOS": "040004",
"FileType": "01",
"FileSubType": "00"
},
"StringFileInfo":
{
"Comments": "(c) {Year} New Relic, Inc.",
"CompanyName": "New Relic, Inc.",
"FileDescription": "",
"FileVersion": "{MajorVersion}.{MinorVersion}.{PatchVersion}.{BuildVersion}",
"InternalName": "{Integration}",
"LegalCopyright": "(c) {Year} New Relic, Inc.",
"LegalTrademarks": "",
"OriginalFilename": "{IntegrationExe}",
"PrivateBuild": "",
"ProductName": "New Relic Infrastructure Integration, {Integration}",
"ProductVersion": "{MajorVersion}.{MinorVersion}.{PatchVersion}.{BuildVersion}",
"SpecialBuild": ""
},
"VarFileInfo":
{
"Translation": {
"LangID": "0409",
"CharsetID": "04B0"
}
}
}
11 changes: 11 additions & 0 deletions docker-win-definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: com.newrelic.docker
description: Reports status and metrics for nri-docker service
protocol_version: 1
os: windows

commands:
all_data:
command:
- ./bin/nri-docker
interval: 15

8 changes: 7 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/newrelic/nri-docker

go 1.23.4
go 1.23.6

require (
github.com/containerd/cgroups v1.1.0
@@ -10,6 +10,11 @@ require (
github.com/stretchr/testify v1.10.0
)

require (
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
)

require (
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/cilium/ebpf v0.10.0 // indirect
@@ -32,6 +37,7 @@ require (
github.com/opencontainers/runtime-spec v1.1.0-rc.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/stretchr/objx v0.5.2 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
7 changes: 7 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -34,6 +34,8 @@ github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
@@ -75,6 +77,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -87,6 +91,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw=
go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo=
@@ -127,6 +133,7 @@ golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Loading