diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 1d1906b..b7190cb 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -8,16 +8,17 @@ on: push: tags: - '**' + workflow_dispatch: jobs: # - # Build on AlmaLinux 8.5 using go-toolset + # Build on AlmaLinux 8 using go-toolset # AlmaLinux-RPM-build: runs-on: ubuntu-latest # See: https://hub.docker.com/_/almalinux - container: almalinux:8.5 + container: almalinux:8 # The job outputs link to the outputs of the 'rpmrename' step # Only job outputs can be used in child jobs outputs: @@ -35,7 +36,7 @@ jobs: # fetch-depth must be 0 to use git describe # See: https://github.com/marketplace/actions/checkout - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 @@ -43,28 +44,30 @@ jobs: # Use dnf to install build dependencies - name: Install build dependencies run: | - wget -q http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-1.18.2-1.module_el8.7.0+1173+5d37c0fd.x86_64.rpm \ - http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-bin-1.18.2-1.module_el8.7.0+1173+5d37c0fd.x86_64.rpm \ - http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-src-1.18.2-1.module_el8.7.0+1173+5d37c0fd.noarch.rpm \ - http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/go-toolset-1.18.2-1.module_el8.7.0+1173+5d37c0fd.x86_64.rpm - rpm -i go*.rpm + dnf --assumeyes install \ + http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-1.20.6-2.module_el8+658+f14b2092.x86_64.rpm \ + http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-bin-1.20.6-2.module_el8+658+f14b2092.x86_64.rpm \ + http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-src-1.20.6-2.module_el8+658+f14b2092.noarch.rpm \ + http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/go-toolset-1.20.6-1.module_el8+602+8bb8a8d6.x86_64.rpm - name: RPM build MetricCollector id: rpmbuild - run: make RPM + run: | + git config --global --add safe.directory /__w/cc-metric-collector/cc-metric-collector + make RPM - # AlmaLinux 8.5 is a derivate of RedHat Enterprise Linux 8 (UBI8), + # AlmaLinux 8 is a derivate of RedHat Enterprise Linux 8 (UBI8), # so the created RPM both contain the substring 'el8' in the RPM file names - # This step replaces the substring 'el8' to 'alma85'. It uses the move operation - # because it is unclear whether the default AlmaLinux 8.5 container contains the + # This step replaces the substring 'el8' to 'alma8'. It uses the move operation + # because it is unclear whether the default AlmaLinux 8 container contains the # 'rename' command. This way we also get the new names for output. - - name: Rename RPMs (s/el8/alma85/) + - name: Rename RPMs (s/el8/alma8/) id: rpmrename run: | OLD_RPM="${{steps.rpmbuild.outputs.RPM}}" OLD_SRPM="${{steps.rpmbuild.outputs.SRPM}}" - NEW_RPM="${OLD_RPM/el8/alma85}" - NEW_SRPM=${OLD_SRPM/el8/alma85} + NEW_RPM="${OLD_RPM/el8/alma8}" + NEW_SRPM=${OLD_SRPM/el8/alma8} mv "${OLD_RPM}" "${NEW_RPM}" mv "${OLD_SRPM}" "${NEW_SRPM}" echo "::set-output name=SRPM::${NEW_SRPM}" @@ -74,12 +77,12 @@ jobs: - name: Save RPM as artifact uses: actions/upload-artifact@v2 with: - name: cc-metric-collector RPM for AlmaLinux 8.5 + name: cc-metric-collector RPM for AlmaLinux 8 path: ${{ steps.rpmrename.outputs.RPM }} - name: Save SRPM as artifact uses: actions/upload-artifact@v2 with: - name: cc-metric-collector SRPM for AlmaLinux 8.5 + name: cc-metric-collector SRPM for AlmaLinux 8 path: ${{ steps.rpmrename.outputs.SRPM }} # @@ -87,8 +90,8 @@ jobs: # UBI-8-RPM-build: runs-on: ubuntu-latest - # See: https://catalog.redhat.com/software/containers/ubi8/ubi/5c359854d70cc534b3a3784e?container-tabs=gti - container: registry.access.redhat.com/ubi8/ubi:8.5-226.1645809065 + # See: https://catalog.redhat.com/software/containers/ubi8/ubi/5c35984d70cc534b3a3784e?container-tabs=gti + container: registry.access.redhat.com/ubi8/ubi:8.8-1032.1692772289 # The job outputs link to the outputs of the 'rpmbuild' step outputs: rpm : ${{steps.rpmbuild.outputs.RPM}} @@ -103,7 +106,7 @@ jobs: # fetch-depth must be 0 to use git describe # See: https://github.com/marketplace/actions/checkout - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 @@ -111,15 +114,17 @@ jobs: # Use dnf to install build dependencies - name: Install build dependencies run: | - wget -q http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-1.18.2-1.module_el8.7.0+1173+5d37c0fd.x86_64.rpm \ - http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-bin-1.18.2-1.module_el8.7.0+1173+5d37c0fd.x86_64.rpm \ - http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-src-1.18.2-1.module_el8.7.0+1173+5d37c0fd.noarch.rpm \ - http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/go-toolset-1.18.2-1.module_el8.7.0+1173+5d37c0fd.x86_64.rpm - rpm -i go*.rpm + dnf --assumeyes --disableplugin=subscription-manager install \ + http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-1.20.6-2.module_el8+658+f14b2092.x86_64.rpm \ + http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-bin-1.20.6-2.module_el8+658+f14b2092.x86_64.rpm \ + http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-src-1.20.6-2.module_el8+658+f14b2092.noarch.rpm \ + http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/go-toolset-1.20.6-1.module_el8+602+8bb8a8d6.x86_64.rpm - name: RPM build MetricCollector id: rpmbuild - run: make RPM + run: | + git config --global --add safe.directory /__w/cc-metric-collector/cc-metric-collector + make RPM # See: https://github.com/actions/upload-artifact - name: Save RPM as artifact @@ -134,11 +139,11 @@ jobs: path: ${{ steps.rpmbuild.outputs.SRPM }} # - # Build on Ubuntu 20.04 using official go package + # Build on Ubuntu 22.04 using official go package # - Ubuntu-focal-build: + Ubuntu-jammy-build: runs-on: ubuntu-latest - container: ubuntu:20.04 + container: ubuntu:22.04 # The job outputs link to the outputs of the 'debrename' step # Only job outputs can be used in child jobs outputs: @@ -153,34 +158,35 @@ jobs: # fetch-depth must be 0 to use git describe # See: https://github.com/marketplace/actions/checkout - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 # Use official golang package - name: Install Golang run: | - wget -q https://go.dev/dl/go1.19.1.linux-amd64.tar.gz - tar -C /usr/local -xzf go1.19.1.linux-amd64.tar.gz + wget -q https://go.dev/dl/go1.21.1.linux-amd64.tar.gz --output-document=- | \ + tar --directory=/usr/local --extract --gzip export PATH=/usr/local/go/bin:/usr/local/go/pkg/tool/linux_amd64:$PATH go version - name: DEB build MetricCollector id: dpkg-build run: | export PATH=/usr/local/go/bin:/usr/local/go/pkg/tool/linux_amd64:$PATH + git config --global --add safe.directory /__w/cc-metric-collector/cc-metric-collector make DEB - - name: Rename DEB (add '_ubuntu20.04') + - name: Rename DEB (add '_ubuntu22.04') id: debrename run: | OLD_DEB_NAME=$(echo "${{steps.dpkg-build.outputs.DEB}}" | rev | cut -d '.' -f 2- | rev) - NEW_DEB_FILE="${OLD_DEB_NAME}_ubuntu20.04.deb" + NEW_DEB_FILE="${OLD_DEB_NAME}_ubuntu22.04.deb" mv "${{steps.dpkg-build.outputs.DEB}}" "${NEW_DEB_FILE}" echo "::set-output name=DEB::${NEW_DEB_FILE}" # See: https://github.com/actions/upload-artifact - name: Save DEB as artifact uses: actions/upload-artifact@v2 with: - name: cc-metric-collector DEB for Ubuntu 20.04 + name: cc-metric-collector DEB for Ubuntu 22.04 path: ${{ steps.debrename.outputs.DEB }} # @@ -193,15 +199,15 @@ jobs: steps: # See: https://github.com/actions/download-artifact - - name: Download AlmaLinux 8.5 RPM + - name: Download AlmaLinux 8 RPM uses: actions/download-artifact@v2 with: - name: cc-metric-collector RPM for AlmaLinux 8.5 - - name: Download AlmaLinux 8.5 SRPM + name: cc-metric-collector RPM for AlmaLinux 8 + - name: Download AlmaLinux 8 SRPM uses: actions/download-artifact@v2 with: - name: cc-metric-collector SRPM for AlmaLinux 8.5 - + name: cc-metric-collector SRPM for AlmaLinux 8 + - name: Download UBI 8 RPM uses: actions/download-artifact@v2 with: @@ -211,10 +217,10 @@ jobs: with: name: cc-metric-collector SRPM for UBI 8 - - name: Download Ubuntu 20.04 DEB + - name: Download Ubuntu 22.04 DEB uses: actions/download-artifact@v2 with: - name: cc-metric-collector DEB for Ubuntu 20.04 + name: cc-metric-collector DEB for Ubuntu 22.04 # The download actions do not publish the name of the downloaded file, # so we re-use the job outputs of the parent jobs. The files are all @@ -225,18 +231,18 @@ jobs: - name: Set RPM variables id: files run: | - ALMA_85_RPM=$(basename "${{ needs.AlmaLinux-RPM-build.outputs.rpm}}") - ALMA_85_SRPM=$(basename "${{ needs.AlmaLinux-RPM-build.outputs.srpm}}") + ALMA_8_RPM=$(basename "${{ needs.AlmaLinux-RPM-build.outputs.rpm}}") + ALMA_8_SRPM=$(basename "${{ needs.AlmaLinux-RPM-build.outputs.srpm}}") UBI_8_RPM=$(basename "${{ needs.UBI-8-RPM-build.outputs.rpm}}") UBI_8_SRPM=$(basename "${{ needs.UBI-8-RPM-build.outputs.srpm}}") U_2004_DEB=$(basename "${{ needs.Ubuntu-focal-build.outputs.deb}}") - echo "ALMA_85_RPM::${ALMA_85_RPM}" - echo "ALMA_85_SRPM::${ALMA_85_SRPM}" + echo "ALMA_8_RPM::${ALMA_8_RPM}" + echo "ALMA_8_SRPM::${ALMA_8_SRPM}" echo "UBI_8_RPM::${UBI_8_RPM}" echo "UBI_8_SRPM::${UBI_8_SRPM}" echo "U_2004_DEB::${U_2004_DEB}" - echo "::set-output name=ALMA_85_RPM::${ALMA_85_RPM}" - echo "::set-output name=ALMA_85_SRPM::${ALMA_85_SRPM}" + echo "::set-output name=ALMA_8_RPM::${ALMA_8_RPM}" + echo "::set-output name=ALMA_8_SRPM::${ALMA_8_SRPM}" echo "::set-output name=UBI_8_RPM::${UBI_8_RPM}" echo "::set-output name=UBI_8_SRPM::${UBI_8_SRPM}" echo "::set-output name=U_2004_DEB::${U_2004_DEB}" @@ -248,8 +254,8 @@ jobs: with: name: cc-metric-collector-${{github.ref_name}} files: | - ${{ steps.files.outputs.ALMA_85_RPM }} - ${{ steps.files.outputs.ALMA_85_SRPM }} + ${{ steps.files.outputs.ALMA_8_RPM }} + ${{ steps.files.outputs.ALMA_8_SRPM }} ${{ steps.files.outputs.UBI_8_RPM }} ${{ steps.files.outputs.UBI_8_SRPM }} ${{ steps.files.outputs.U_2004_DEB }} diff --git a/.github/workflows/runonce.yml b/.github/workflows/runonce.yml index 5218145..878d92c 100644 --- a/.github/workflows/runonce.yml +++ b/.github/workflows/runonce.yml @@ -4,28 +4,31 @@ name: Run Test # Run on event push -on: push +on: + push: + workflow_dispatch: jobs: + # - # Job build-1-18 - # Build on latest Ubuntu using golang version 1.18 + # Job build-1-20 + # Build on latest Ubuntu using golang version 1.20 # - build-1-18: + build-1-20: runs-on: ubuntu-latest steps: # See: https://github.com/marketplace/actions/checkout # Checkout git repository and submodules - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: recursive # See: https://github.com/marketplace/actions/setup-go-environment - name: Setup Golang - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: - go-version: '1.18.2' + go-version: '1.20' - name: Build MetricCollector run: make @@ -34,27 +37,141 @@ jobs: run: ./cc-metric-collector --once --config .github/ci-config.json # - # Job build-1-19 - # Build on latest Ubuntu using golang version 1.19 + # Job build-1-21 + # Build on latest Ubuntu using golang version 1.21 # - build-1-19: + build-1-21: runs-on: ubuntu-latest steps: # See: https://github.com/marketplace/actions/checkout # Checkout git repository and submodules - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: recursive # See: https://github.com/marketplace/actions/setup-go-environment - name: Setup Golang - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: - go-version: '1.19' + go-version: '1.21' - name: Build MetricCollector run: make - name: Run MetricCollector once run: ./cc-metric-collector --once --config .github/ci-config.json + + # + # Build on AlmaLinux 8 using go-toolset + # + AlmaLinux-RPM-build: + runs-on: ubuntu-latest + # See: https://hub.docker.com/_/almalinux + container: almalinux:8 + # The job outputs link to the outputs of the 'rpmrename' step + # Only job outputs can be used in child jobs + steps: + + # Use dnf to install development packages + - name: Install development packages + run: | + dnf --assumeyes group install "Development Tools" "RPM Development Tools" + dnf --assumeyes install wget openssl-devel diffutils delve which + + # Checkout git repository and submodules + # fetch-depth must be 0 to use git describe + # See: https://github.com/marketplace/actions/checkout + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + + # Use dnf to install build dependencies + - name: Install build dependencies + run: | + dnf --assumeyes install \ + http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-1.20.6-2.module_el8+658+f14b2092.x86_64.rpm \ + http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-bin-1.20.6-2.module_el8+658+f14b2092.x86_64.rpm \ + http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-src-1.20.6-2.module_el8+658+f14b2092.noarch.rpm \ + http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/go-toolset-1.20.6-1.module_el8+602+8bb8a8d6.x86_64.rpm + + - name: RPM build MetricCollector + id: rpmbuild + run: | + git config --global --add safe.directory /__w/cc-metric-collector/cc-metric-collector + make RPM + + # + # Build on UBI 8 using go-toolset + # + UBI-8-RPM-build: + runs-on: ubuntu-latest + # See: https://catalog.redhat.com/software/containers/ubi8/ubi/5c359854d70cc534b3a3784e?container-tabs=gti + container: registry.access.redhat.com/ubi8/ubi:8.8-1032.1692772289 + # The job outputs link to the outputs of the 'rpmbuild' step + steps: + + # Use dnf to install development packages + - name: Install development packages + run: dnf --assumeyes --disableplugin=subscription-manager install rpm-build go-srpm-macros rpm-build-libs rpm-libs gcc make python38 git wget openssl-devel diffutils delve which + + # Checkout git repository and submodules + # fetch-depth must be 0 to use git describe + # See: https://github.com/marketplace/actions/checkout + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + + # Use dnf to install build dependencies + - name: Install build dependencies + run: | + dnf --assumeyes --disableplugin=subscription-manager install \ + http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-1.20.6-2.module_el8+658+f14b2092.x86_64.rpm \ + http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-bin-1.20.6-2.module_el8+658+f14b2092.x86_64.rpm \ + http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/golang-src-1.20.6-2.module_el8+658+f14b2092.noarch.rpm \ + http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/go-toolset-1.20.6-1.module_el8+602+8bb8a8d6.x86_64.rpm + + - name: RPM build MetricCollector + id: rpmbuild + run: | + git config --global --add safe.directory /__w/cc-metric-collector/cc-metric-collector + make RPM + + # + # Build on Ubuntu 22.04 using official go package + # + Ubuntu-jammy-build: + runs-on: ubuntu-latest + container: ubuntu:22.04 + + steps: + # Use apt to install development packages + - name: Install development packages + run: | + apt update && apt --assume-yes upgrade + apt --assume-yes install build-essential sed git wget bash + # Checkout git repository and submodules + # fetch-depth must be 0 to use git describe + # See: https://github.com/marketplace/actions/checkout + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + # Use official golang package + - name: Install Golang + run: | + wget -q https://go.dev/dl/go1.21.1.linux-amd64.tar.gz --output-document=- | \ + tar --directory=/usr/local --extract --gzip + export PATH=/usr/local/go/bin:/usr/local/go/pkg/tool/linux_amd64:$PATH + go version + - name: DEB build MetricCollector + id: dpkg-build + run: | + export PATH=/usr/local/go/bin:/usr/local/go/pkg/tool/linux_amd64:$PATH + git config --global --add safe.directory /__w/cc-metric-collector/cc-metric-collector + make DEB \ No newline at end of file diff --git a/collectors/Makefile b/collectors/Makefile index de98eb6..b73d917 100644 --- a/collectors/Makefile +++ b/collectors/Makefile @@ -1,31 +1,33 @@ # LIKWID version -LIKWID_VERSION = 5.2.2 -LIKWID_INSTALLED_FOLDER=$(shell dirname $(shell which likwid-topology 2>/dev/null) 2>/dev/null) +LIKWID_VERSION := 5.2.2 +LIKWID_INSTALLED_FOLDER := $(shell dirname $$(which likwid-topology 2>/dev/null) 2>/dev/null) -LIKWID_FOLDER="$(shell pwd)/likwid" +LIKWID_FOLDER := $(CURDIR)/likwid -all: $(LIKWID_FOLDER)/likwid.h +all: likwid .ONESHELL: -.PHONY: $(LIKWID_FOLDER)/likwid.h -$(LIKWID_FOLDER)/likwid.h: - if [ "$(LIKWID_INSTALLED_FOLDER)" != "" ]; then \ - BASE="$(LIKWID_INSTALLED_FOLDER)/../include"; \ - mkdir -p $(LIKWID_FOLDER); \ - cp $$BASE/*.h $(LIKWID_FOLDER); \ - else \ - BUILD_FOLDER="$${PWD}/likwidbuild"; \ - if [ -d $(LIKWID_FOLDER) ]; then rm -r $(LIKWID_FOLDER); fi; \ - mkdir --parents --verbose $(LIKWID_FOLDER) $${BUILD_FOLDER}; \ - wget -P "$${BUILD_FOLDER}" http://ftp.rrze.uni-erlangen.de/mirrors/likwid/likwid-$(LIKWID_VERSION).tar.gz; \ - tar -C $${BUILD_FOLDER} -xf $${BUILD_FOLDER}/likwid-$(LIKWID_VERSION).tar.gz; \ - install -Dpm 0644 $${BUILD_FOLDER}/likwid-$(LIKWID_VERSION)/src/includes/likwid*.h $(LIKWID_FOLDER)/; \ - install -Dpm 0644 $${BUILD_FOLDER}/likwid-$(LIKWID_VERSION)/src/includes/bstrlib.h $(LIKWID_FOLDER)/; \ - rm -r $${BUILD_FOLDER}; \ +.PHONY: likwid +likwid: + if [ -n "$(LIKWID_INSTALLED_FOLDER)" ]; then + # Using likwid include files from system installation + INCLUDE_DIR="$(LIKWID_INSTALLED_FOLDER)/../include" + mkdir --parents --verbose "$(LIKWID_FOLDER)" + cp "$${INCLUDE_DIR}"/*.h "$(LIKWID_FOLDER)" + else + # Using likwid include files from downloaded tar archive + if [ -d "$(LIKWID_FOLDER)" ]; then + rm --recursive "$(LIKWID_FOLDER)" + fi + BUILD_FOLDER="$${PWD}/likwidbuild" + mkdir --parents --verbose "$${BUILD_FOLDER}" + wget --output-document=- http://ftp.rrze.uni-erlangen.de/mirrors/likwid/likwid-$(LIKWID_VERSION).tar.gz | + tar --directory="$${BUILD_FOLDER}" --extract --gz + install -D --verbose --preserve-timestamps --mode=0644 --target-directory="$(LIKWID_FOLDER)" "$${BUILD_FOLDER}/likwid-$(LIKWID_VERSION)/src/includes"/likwid*.h "$${BUILD_FOLDER}/likwid-$(LIKWID_VERSION)/src/includes"/bstrlib.h + rm --recursive "$${BUILD_FOLDER}" fi +.PHONY: clean clean: rm -rf likwid - -.PHONY: clean diff --git a/collectors/collectorManager.go b/collectors/collectorManager.go index 11b501a..4cf3435 100644 --- a/collectors/collectorManager.go +++ b/collectors/collectorManager.go @@ -40,6 +40,7 @@ var AvailableCollectors = map[string]MetricCollector{ "rocm_smi": new(RocmSmiCollector), "self": new(SelfCollector), "schedstat": new(SchedstatCollector), + "nfsiostat": new(NfsIOStatCollector), } // Metric collector manager data structure diff --git a/collectors/cpufreqCpuinfoMetric.go b/collectors/cpufreqCpuinfoMetric.go index 85f6d9e..ce3e1dd 100644 --- a/collectors/cpufreqCpuinfoMetric.go +++ b/collectors/cpufreqCpuinfoMetric.go @@ -14,29 +14,18 @@ import ( lp "github.com/ClusterCockpit/cc-metric-collector/pkg/ccMetric" ) -// // CPUFreqCollector // a metric collector to measure the current frequency of the CPUs // as obtained from /proc/cpuinfo // Only measure on the first hyperthread -// type CPUFreqCpuInfoCollectorTopology struct { - processor string // logical processor number (continuous, starting at 0) - coreID string // socket local core ID - coreID_int int64 - physicalPackageID string // socket / package ID - physicalPackageID_int int64 - numPhysicalPackages string // number of sockets / packages - numPhysicalPackages_int int64 - isHT bool - numNonHT string // number of non hyperthreading processors - numNonHT_int int64 - tagSet map[string]string + isHT bool + tagSet map[string]string } type CPUFreqCpuInfoCollector struct { metricCollector - topology []*CPUFreqCpuInfoCollectorTopology + topology []CPUFreqCpuInfoCollectorTopology } func (m *CPUFreqCpuInfoCollector) Init(config json.RawMessage) error { @@ -65,11 +54,9 @@ func (m *CPUFreqCpuInfoCollector) Init(config json.RawMessage) error { // Collect topology information from file cpuinfo foundFreq := false processor := "" - var numNonHT_int int64 = 0 coreID := "" physicalPackageID := "" - var maxPhysicalPackageID int64 = 0 - m.topology = make([]*CPUFreqCpuInfoCollectorTopology, 0) + m.topology = make([]CPUFreqCpuInfoCollectorTopology, 0) coreSeenBefore := make(map[string]bool) // Read cpuinfo file, line by line @@ -98,41 +85,22 @@ func (m *CPUFreqCpuInfoCollector) Init(config json.RawMessage) error { len(coreID) > 0 && len(physicalPackageID) > 0 { - topology := new(CPUFreqCpuInfoCollectorTopology) - - // Processor - topology.processor = processor - - // Core ID - topology.coreID = coreID - topology.coreID_int, err = strconv.ParseInt(coreID, 10, 64) - if err != nil { - return fmt.Errorf("unable to convert coreID '%s' to int64: %v", coreID, err) - } - - // Physical package ID - topology.physicalPackageID = physicalPackageID - topology.physicalPackageID_int, err = strconv.ParseInt(physicalPackageID, 10, 64) - if err != nil { - return fmt.Errorf("unable to convert physicalPackageID '%s' to int64: %v", physicalPackageID, err) - } - - // increase maximun socket / package ID, when required - if topology.physicalPackageID_int > maxPhysicalPackageID { - maxPhysicalPackageID = topology.physicalPackageID_int - } - - // is hyperthread? globalID := physicalPackageID + ":" + coreID - topology.isHT = coreSeenBefore[globalID] - coreSeenBefore[globalID] = true - if !topology.isHT { - // increase number on non hyper thread cores - numNonHT_int++ - } // store collected topology information - m.topology = append(m.topology, topology) + m.topology = append(m.topology, + CPUFreqCpuInfoCollectorTopology{ + isHT: coreSeenBefore[globalID], + tagSet: map[string]string{ + "type": "hwthread", + "type-id": processor, + "package_id": physicalPackageID, + }, + }, + ) + + // mark core as seen before + coreSeenBefore[globalID] = true // reset topology information foundFreq = false @@ -142,24 +110,9 @@ func (m *CPUFreqCpuInfoCollector) Init(config json.RawMessage) error { } } - // Check if at least one CPU with frequency information was detected - if len(m.topology) == 0 { - return fmt.Errorf("No CPU frequency info found in %s", cpuInfoFile) - } - - numPhysicalPackageID_int := maxPhysicalPackageID + 1 - numPhysicalPackageID := fmt.Sprint(numPhysicalPackageID_int) - numNonHT := fmt.Sprint(numNonHT_int) - for _, t := range m.topology { - t.numPhysicalPackages = numPhysicalPackageID - t.numPhysicalPackages_int = numPhysicalPackageID_int - t.numNonHT = numNonHT - t.numNonHT_int = numNonHT_int - t.tagSet = map[string]string{ - "type": "hwthread", - "type-id": t.processor, - "package_id": t.physicalPackageID, - } + // Check if at least one CPU with frequency information was detected + if len(m.topology) == 0 { + return fmt.Errorf("No CPU frequency info found in %s", cpuInfoFile) } m.init = true diff --git a/collectors/cpufreqCpuinfoMetric.md b/collectors/cpufreqCpuinfoMetric.md index de93176..fe43bd8 100644 --- a/collectors/cpufreqCpuinfoMetric.md +++ b/collectors/cpufreqCpuinfoMetric.md @@ -1,5 +1,5 @@ - ## `cpufreq_cpuinfo` collector + ```json "cpufreq_cpuinfo": {} ``` @@ -7,4 +7,5 @@ The `cpufreq_cpuinfo` collector reads the clock frequency from `/proc/cpuinfo` and outputs a handful **hwthread** metrics. Metrics: + * `cpufreq` diff --git a/collectors/cpufreqMetric.go b/collectors/cpufreqMetric.go index d55b4c1..61caf10 100644 --- a/collectors/cpufreqMetric.go +++ b/collectors/cpufreqMetric.go @@ -11,22 +11,13 @@ import ( cclog "github.com/ClusterCockpit/cc-metric-collector/pkg/ccLogger" lp "github.com/ClusterCockpit/cc-metric-collector/pkg/ccMetric" + "github.com/ClusterCockpit/cc-metric-collector/pkg/ccTopology" "golang.org/x/sys/unix" ) type CPUFreqCollectorTopology struct { - processor string // logical processor number (continuous, starting at 0) - coreID string // socket local core ID - coreID_int int64 - physicalPackageID string // socket / package ID - physicalPackageID_int int64 - numPhysicalPackages string // number of sockets / packages - numPhysicalPackages_int int64 - isHT bool - numNonHT string // number of non hyper-threading processors - numNonHT_int int64 - scalingCurFreqFile string - tagSet map[string]string + scalingCurFreqFile string + tagSet map[string]string } // CPUFreqCollector @@ -64,112 +55,38 @@ func (m *CPUFreqCollector) Init(config json.RawMessage) error { "unit": "Hz", } - // Loop for all CPU directories - baseDir := "/sys/devices/system/cpu" - globPattern := filepath.Join(baseDir, "cpu[0-9]*") - cpuDirs, err := filepath.Glob(globPattern) - if err != nil { - return fmt.Errorf("unable to glob files with pattern '%s': %v", globPattern, err) - } - if cpuDirs == nil { - return fmt.Errorf("unable to find any files with pattern '%s'", globPattern) - } + m.topology = make([]CPUFreqCollectorTopology, 0) + for _, c := range ccTopology.CpuData() { - // Initialize CPU topology - m.topology = make([]CPUFreqCollectorTopology, len(cpuDirs)) - for _, cpuDir := range cpuDirs { - processor := strings.TrimPrefix(cpuDir, "/sys/devices/system/cpu/cpu") - processor_int, err := strconv.ParseInt(processor, 10, 64) - if err != nil { - return fmt.Errorf("unable to convert cpuID '%s' to int64: %v", processor, err) - } - - // Read package ID - physicalPackageIDFile := filepath.Join(cpuDir, "topology", "physical_package_id") - line, err := os.ReadFile(physicalPackageIDFile) - if err != nil { - return fmt.Errorf("unable to read physical package ID from file '%s': %v", physicalPackageIDFile, err) - } - physicalPackageID := strings.TrimSpace(string(line)) - physicalPackageID_int, err := strconv.ParseInt(physicalPackageID, 10, 64) - if err != nil { - return fmt.Errorf("unable to convert packageID '%s' to int64: %v", physicalPackageID, err) - } - - // Read core ID - coreIDFile := filepath.Join(cpuDir, "topology", "core_id") - line, err = os.ReadFile(coreIDFile) - if err != nil { - return fmt.Errorf("unable to read core ID from file '%s': %v", coreIDFile, err) - } - coreID := strings.TrimSpace(string(line)) - coreID_int, err := strconv.ParseInt(coreID, 10, 64) - if err != nil { - return fmt.Errorf("unable to convert coreID '%s' to int64: %v", coreID, err) + // Skip hyper threading CPUs + if c.CpuID != c.CoreCPUsList[0] { + continue } // Check access to current frequency file - scalingCurFreqFile := filepath.Join(cpuDir, "cpufreq", "scaling_cur_freq") - err = unix.Access(scalingCurFreqFile, unix.R_OK) + scalingCurFreqFile := filepath.Join("/sys/devices/system/cpu", fmt.Sprintf("cpu%d", c.CpuID), "cpufreq/scaling_cur_freq") + err := unix.Access(scalingCurFreqFile, unix.R_OK) if err != nil { return fmt.Errorf("unable to access file '%s': %v", scalingCurFreqFile, err) } - t := &m.topology[processor_int] - t.processor = processor - t.physicalPackageID = physicalPackageID - t.physicalPackageID_int = physicalPackageID_int - t.coreID = coreID - t.coreID_int = coreID_int - t.scalingCurFreqFile = scalingCurFreqFile - } - - // is processor a hyper-thread? - coreSeenBefore := make(map[string]bool) - for i := range m.topology { - t := &m.topology[i] - - globalID := t.physicalPackageID + ":" + t.coreID - t.isHT = coreSeenBefore[globalID] - coreSeenBefore[globalID] = true - } - - // number of non hyper-thread cores and packages / sockets - var numNonHT_int int64 = 0 - PhysicalPackageIDs := make(map[int64]struct{}) - for i := range m.topology { - t := &m.topology[i] - - if !t.isHT { - numNonHT_int++ - } - - PhysicalPackageIDs[t.physicalPackageID_int] = struct{}{} - } - - numPhysicalPackageID_int := int64(len(PhysicalPackageIDs)) - numPhysicalPackageID := fmt.Sprint(numPhysicalPackageID_int) - numNonHT := fmt.Sprint(numNonHT_int) - for i := range m.topology { - t := &m.topology[i] - t.numPhysicalPackages = numPhysicalPackageID - t.numPhysicalPackages_int = numPhysicalPackageID_int - t.numNonHT = numNonHT - t.numNonHT_int = numNonHT_int - t.tagSet = map[string]string{ - "type": "hwthread", - "type-id": t.processor, - "package_id": t.physicalPackageID, - } + m.topology = append(m.topology, + CPUFreqCollectorTopology{ + tagSet: map[string]string{ + "type": "hwthread", + "type-id": fmt.Sprint(c.CpuID), + "package_id": fmt.Sprint(c.Socket), + }, + scalingCurFreqFile: scalingCurFreqFile, + }, + ) } // Initialized cclog.ComponentDebug( m.name, "initialized", - numPhysicalPackageID_int, "physical packages,", - len(cpuDirs), "CPUs,", - numNonHT, "non-hyper-threading CPUs") + len(m.topology), "non-hyper-threading CPUs") m.init = true return nil } @@ -184,11 +101,6 @@ func (m *CPUFreqCollector) Read(interval time.Duration, output chan lp.CCMetric) for i := range m.topology { t := &m.topology[i] - // skip hyper-threads - if t.isHT { - continue - } - // Read current frequency line, err := os.ReadFile(t.scalingCurFreqFile) if err != nil { diff --git a/collectors/gpfsMetric.go b/collectors/gpfsMetric.go index b3f9fc4..98720b8 100644 --- a/collectors/gpfsMetric.go +++ b/collectors/gpfsMetric.go @@ -31,6 +31,7 @@ type GpfsCollector struct { Mmpmon string `json:"mmpmon_path,omitempty"` ExcludeFilesystem []string `json:"exclude_filesystem,omitempty"` SendBandwidths bool `json:"send_bandwidths"` + SendTotalValues bool `json:"send_total_values"` } skipFS map[string]struct{} lastTimestamp time.Time // Store time stamp of last tick to derive bandwidths @@ -216,13 +217,33 @@ func (m *GpfsCollector) Read(interval time.Duration, output chan lp.CCMetric) { fmt.Sprintf("Read(): Failed to convert bytes read '%s' to int64: %v", key_value["_br_"], err)) continue } - if y, err := lp.New("gpfs_bytes_read", m.tags, m.meta, map[string]interface{}{"value": bytesRead}, timestamp); err == nil { + if y, err := + lp.New( + "gpfs_bytes_read", + m.tags, + m.meta, + map[string]interface{}{ + "value": bytesRead, + }, + timestamp, + ); err == nil { + y.AddMeta("unit", "bytes") output <- y } if m.config.SendBandwidths { if lastBytesRead := m.lastState[filesystem].bytesRead; lastBytesRead >= 0 { bwRead := float64(bytesRead-lastBytesRead) / timeDiff - if y, err := lp.New("gpfs_bw_read", m.tags, m.meta, map[string]interface{}{"value": bwRead}, timestamp); err == nil { + if y, err := + lp.New( + "gpfs_bw_read", + m.tags, + m.meta, + map[string]interface{}{ + "value": bwRead, + }, + timestamp, + ); err == nil { + y.AddMeta("unit", "bytes/sec") output <- y } } @@ -236,13 +257,33 @@ func (m *GpfsCollector) Read(interval time.Duration, output chan lp.CCMetric) { fmt.Sprintf("Read(): Failed to convert bytes written '%s' to int64: %v", key_value["_bw_"], err)) continue } - if y, err := lp.New("gpfs_bytes_written", m.tags, m.meta, map[string]interface{}{"value": bytesWritten}, timestamp); err == nil { + if y, err := + lp.New( + "gpfs_bytes_written", + m.tags, + m.meta, + map[string]interface{}{ + "value": bytesWritten, + }, + timestamp, + ); err == nil { + y.AddMeta("unit", "bytes") output <- y } if m.config.SendBandwidths { if lastBytesWritten := m.lastState[filesystem].bytesRead; lastBytesWritten >= 0 { bwWrite := float64(bytesWritten-lastBytesWritten) / timeDiff - if y, err := lp.New("gpfs_bw_write", m.tags, m.meta, map[string]interface{}{"value": bwWrite}, timestamp); err == nil { + if y, err := + lp.New( + "gpfs_bw_write", + m.tags, + m.meta, + map[string]interface{}{ + "value": bwWrite, + }, + timestamp, + ); err == nil { + y.AddMeta("unit", "bytes/sec") output <- y } } @@ -326,6 +367,47 @@ func (m *GpfsCollector) Read(interval time.Duration, output chan lp.CCMetric) { if y, err := lp.New("gpfs_num_inode_updates", m.tags, m.meta, map[string]interface{}{"value": numInodeUpdates}, timestamp); err == nil { output <- y } + + // Total values + if m.config.SendTotalValues { + bytesTotal := bytesRead + bytesWritten + if y, err := + lp.New("gpfs_bytes_total", + m.tags, + m.meta, + map[string]interface{}{ + "value": bytesTotal, + }, + timestamp, + ); err == nil { + y.AddMeta("unit", "bytes") + output <- y + } + iops := numReads + numWrites + if y, err := + lp.New("gpfs_iops", + m.tags, + m.meta, + map[string]interface{}{ + "value": iops, + }, + timestamp, + ); err == nil { + output <- y + } + metaops := numInodeUpdates + numCloses + numOpens + numReaddirs + if y, err := + lp.New("gpfs_metaops", + m.tags, + m.meta, + map[string]interface{}{ + "value": metaops, + }, + timestamp, + ); err == nil { + output <- y + } + } } } diff --git a/collectors/gpfsMetric.md b/collectors/gpfsMetric.md index 30a5a40..ece9a1f 100644 --- a/collectors/gpfsMetric.md +++ b/collectors/gpfsMetric.md @@ -6,7 +6,8 @@ "exclude_filesystem": [ "fs1" ], - "send_bandwidths" : true + "send_bandwidths": true, + "send_total_values": true } ``` @@ -26,8 +27,12 @@ Metrics: * `gpfs_num_opens` * `gpfs_num_closes` * `gpfs_num_reads` +* `gpfs_num_writes` * `gpfs_num_readdirs` * `gpfs_num_inode_updates` +* `gpfs_bytes_total = gpfs_bytes_read + gpfs_bytes_written` (if `send_total_values == true`) +* `gpfs_iops = gpfs_num_reads + gpfs_num_writes` (if `send_total_values == true`) +* `gpfs_metaops = gpfs_num_inode_updates + gpfs_num_closes + gpfs_num_opens + gpfs_num_readdirs` (if `send_total_values == true`) * `gpfs_bw_read` (if `send_bandwidths == true`) * `gpfs_bw_write` (if `send_bandwidths == true`) diff --git a/collectors/infinibandMetric.go b/collectors/infinibandMetric.go index 7560af9..13b76a0 100644 --- a/collectors/infinibandMetric.go +++ b/collectors/infinibandMetric.go @@ -18,18 +18,22 @@ import ( const IB_BASEPATH = "/sys/class/infiniband/" type InfinibandCollectorMetric struct { - path string - unit string - scale int64 + name string + path string + unit string + scale int64 + addToIBTotal bool + addToIBTotalPkgs bool + currentState int64 + lastState int64 } type InfinibandCollectorInfo struct { - LID string // IB local Identifier (LID) - device string // IB device - port string // IB device port - portCounterFiles map[string]InfinibandCollectorMetric // mapping counter name -> InfinibandCollectorMetric - tagSet map[string]string // corresponding tag list - lastState map[string]int64 // State from last measurement + LID string // IB local Identifier (LID) + device string // IB device + port string // IB device port + portCounterFiles []InfinibandCollectorMetric // mapping counter name -> InfinibandCollectorMetric + tagSet map[string]string // corresponding tag list } type InfinibandCollector struct { @@ -37,9 +41,10 @@ type InfinibandCollector struct { config struct { ExcludeDevices []string `json:"exclude_devices,omitempty"` // IB device to exclude e.g. mlx5_0 SendAbsoluteValues bool `json:"send_abs_values"` // Send absolut values as read from sys filesystem + SendTotalValues bool `json:"send_total_values"` // Send computed total values SendDerivedValues bool `json:"send_derived_values"` // Send derived values e.g. rates } - info []*InfinibandCollectorInfo + info []InfinibandCollectorInfo lastTimestamp time.Time // Store time stamp of last tick to derive bandwidths } @@ -112,11 +117,39 @@ func (m *InfinibandCollector) Init(config json.RawMessage) error { // Check access to counter files countersDir := filepath.Join(path, "counters") - portCounterFiles := map[string]InfinibandCollectorMetric{ - "ib_recv": {path: filepath.Join(countersDir, "port_rcv_data"), unit: "bytes", scale: 4}, - "ib_xmit": {path: filepath.Join(countersDir, "port_xmit_data"), unit: "bytes", scale: 4}, - "ib_recv_pkts": {path: filepath.Join(countersDir, "port_rcv_packets"), unit: "packets", scale: 1}, - "ib_xmit_pkts": {path: filepath.Join(countersDir, "port_xmit_packets"), unit: "packets", scale: 1}, + portCounterFiles := []InfinibandCollectorMetric{ + { + name: "ib_recv", + path: filepath.Join(countersDir, "port_rcv_data"), + unit: "bytes", + scale: 4, + addToIBTotal: true, + lastState: -1, + }, + { + name: "ib_xmit", + path: filepath.Join(countersDir, "port_xmit_data"), + unit: "bytes", + scale: 4, + addToIBTotal: true, + lastState: -1, + }, + { + name: "ib_recv_pkts", + path: filepath.Join(countersDir, "port_rcv_packets"), + unit: "packets", + scale: 1, + addToIBTotalPkgs: true, + lastState: -1, + }, + { + name: "ib_xmit_pkts", + path: filepath.Join(countersDir, "port_xmit_packets"), + unit: "packets", + scale: 1, + addToIBTotalPkgs: true, + lastState: -1, + }, } for _, counter := range portCounterFiles { err := unix.Access(counter.path, unix.R_OK) @@ -125,14 +158,8 @@ func (m *InfinibandCollector) Init(config json.RawMessage) error { } } - // Initialize last state - lastState := make(map[string]int64) - for counter := range portCounterFiles { - lastState[counter] = -1 - } - m.info = append(m.info, - &InfinibandCollectorInfo{ + InfinibandCollectorInfo{ LID: LID, device: device, port: port, @@ -143,7 +170,6 @@ func (m *InfinibandCollector) Init(config json.RawMessage) error { "port": port, "lid": LID, }, - lastState: lastState, }) } @@ -170,8 +196,12 @@ func (m *InfinibandCollector) Read(interval time.Duration, output chan lp.CCMetr // Save current timestamp m.lastTimestamp = now - for _, info := range m.info { - for counterName, counterDef := range info.portCounterFiles { + for i := range m.info { + info := &m.info[i] + + var ib_total, ib_total_pkts int64 + for i := range info.portCounterFiles { + counterDef := &info.portCounterFiles[i] // Read counter file line, err := os.ReadFile(counterDef.path) @@ -188,15 +218,26 @@ func (m *InfinibandCollector) Read(interval time.Duration, output chan lp.CCMetr if err != nil { cclog.ComponentError( m.name, - fmt.Sprintf("Read(): Failed to convert Infininiband metrice %s='%s' to int64: %v", counterName, data, err)) + fmt.Sprintf("Read(): Failed to convert Infininiband metrice %s='%s' to int64: %v", counterDef.name, data, err)) continue } // Scale raw value v *= counterDef.scale + // Save current state + counterDef.currentState = v + // Send absolut values if m.config.SendAbsoluteValues { - if y, err := lp.New(counterName, info.tagSet, m.meta, map[string]interface{}{"value": v}, now); err == nil { + if y, err := + lp.New( + counterDef.name, + info.tagSet, + m.meta, + map[string]interface{}{ + "value": counterDef.currentState, + }, + now); err == nil { y.AddMeta("unit", counterDef.unit) output <- y } @@ -204,18 +245,64 @@ func (m *InfinibandCollector) Read(interval time.Duration, output chan lp.CCMetr // Send derived values if m.config.SendDerivedValues { - if info.lastState[counterName] >= 0 { - rate := float64((v - info.lastState[counterName])) / timeDiff - if y, err := lp.New(counterName+"_bw", info.tagSet, m.meta, map[string]interface{}{"value": rate}, now); err == nil { + if counterDef.lastState >= 0 { + rate := float64((counterDef.currentState - counterDef.lastState)) / timeDiff + if y, err := + lp.New( + counterDef.name+"_bw", + info.tagSet, + m.meta, + map[string]interface{}{ + "value": rate, + }, + now); err == nil { y.AddMeta("unit", counterDef.unit+"/sec") output <- y + } } - // Save current state - info.lastState[counterName] = v + counterDef.lastState = counterDef.currentState + } + + // Sum up total values + if m.config.SendTotalValues { + switch { + case counterDef.addToIBTotal: + ib_total += counterDef.currentState + case counterDef.addToIBTotalPkgs: + ib_total_pkts += counterDef.currentState + } } } + // Send total values + if m.config.SendTotalValues { + if y, err := + lp.New( + "ib_total", + info.tagSet, + m.meta, + map[string]interface{}{ + "value": ib_total, + }, + now); err == nil { + y.AddMeta("unit", "bytes") + output <- y + } + + if y, err := + lp.New( + "ib_total_pkts", + info.tagSet, + m.meta, + map[string]interface{}{ + "value": ib_total_pkts, + }, + now); err == nil { + y.AddMeta("unit", "packets") + output <- y + } + } } } diff --git a/collectors/infinibandMetric.md b/collectors/infinibandMetric.md index f129aad..c965ea8 100644 --- a/collectors/infinibandMetric.md +++ b/collectors/infinibandMetric.md @@ -17,13 +17,16 @@ LID file (`/sys/class/infiniband//ports//lid`) The devices can be filtered with the `exclude_devices` option in the configuration. -For each found LID the collector reads data through the sysfs files below `/sys/class/infiniband/`. +For each found LID the collector reads data through the sysfs files below `/sys/class/infiniband/`. (See: ) Metrics: + * `ib_recv` * `ib_xmit` * `ib_recv_pkts` * `ib_xmit_pkts` +* `ib_total = ib_recv + ib_xmit` (if `send_total_values == true`) +* `ib_total_pkts = ib_recv_pkts + ib_xmit_pkts` (if `send_total_values == true`) * `ib_recv_bw` (if `send_derived_values == true`) * `ib_xmit_bw` (if `send_derived_values == true`) * `ib_recv_pkts_bw` (if `send_derived_values == true`) diff --git a/collectors/likwidMetric.go b/collectors/likwidMetric.go index 339c5ba..606f6a6 100644 --- a/collectors/likwidMetric.go +++ b/collectors/likwidMetric.go @@ -29,8 +29,8 @@ import ( lp "github.com/ClusterCockpit/cc-metric-collector/pkg/ccMetric" topo "github.com/ClusterCockpit/cc-metric-collector/pkg/ccTopology" "github.com/NVIDIA/go-nvml/pkg/dl" + "github.com/fsnotify/fsnotify" "golang.design/x/thread" - fsnotify "gopkg.in/fsnotify.v0" ) const ( @@ -41,11 +41,14 @@ const ( ) type LikwidCollectorMetricConfig struct { - Name string `json:"name"` // Name of the metric - Calc string `json:"calc"` // Calculation for the metric using - Type string `json:"type"` // Metric type (aka node, socket, cpu, ...) - Publish bool `json:"publish"` - Unit string `json:"unit"` // Unit of metric if any + Name string `json:"name"` // Name of the metric + Calc string `json:"calc"` // Calculation for the metric using + Type string `json:"type"` // Metric type (aka node, socket, cpu, ...) + Publish bool `json:"publish"` + SendCoreTotalVal bool `json:"send_core_total_values,omitempty"` + SendSocketTotalVal bool `json:"send_socket_total_values,omitempty"` + SendNodeTotalVal bool `json:"send_node_total_values,omitempty"` + Unit string `json:"unit"` // Unit of metric if any } type LikwidCollectorEventsetConfig struct { @@ -59,7 +62,7 @@ type LikwidEventsetConfig struct { eorder []*C.char estr *C.char go_estr string - results map[int]map[string]interface{} + results map[int]map[string]float64 metrics map[int]map[string]float64 } @@ -79,10 +82,11 @@ type LikwidCollector struct { cpulist []C.int cpu2tid map[int]int sock2tid map[int]int + tid2core map[int]int + tid2socket map[int]int metrics map[C.int]map[string]int groups []C.int config LikwidCollectorConfig - gmresults map[int]map[string]float64 basefreq float64 running bool initialized bool @@ -134,10 +138,10 @@ func genLikwidEventSet(input LikwidCollectorEventsetConfig) LikwidEventsetConfig elist = append(elist, c_counter) } estr := strings.Join(tmplist, ",") - res := make(map[int]map[string]interface{}) + res := make(map[int]map[string]float64) met := make(map[int]map[string]float64) for _, i := range topo.CpuList() { - res[i] = make(map[string]interface{}) + res[i] = make(map[string]float64) for k := range input.Events { res[i][k] = 0.0 } @@ -157,7 +161,7 @@ func genLikwidEventSet(input LikwidCollectorEventsetConfig) LikwidEventsetConfig } func testLikwidMetricFormula(formula string, params []string) bool { - myparams := make(map[string]interface{}) + myparams := make(map[string]float64) for _, p := range params { myparams[p] = float64(1.0) } @@ -236,13 +240,6 @@ func (m *LikwidCollector) Init(config json.RawMessage) error { m.likwidGroups = make(map[C.int]LikwidEventsetConfig) - // m.results = make(map[int]map[int]map[string]interface{}) - // m.mresults = make(map[int]map[int]map[string]float64) - m.gmresults = make(map[int]map[string]float64) - for _, tid := range m.cpu2tid { - m.gmresults[tid] = make(map[string]float64) - } - // This is for the global metrics computation test totalMetrics := 0 // Generate parameter list for the metric computing test @@ -306,6 +303,7 @@ func (m *LikwidCollector) Init(config json.RawMessage) error { cclog.ComponentError(m.name, err.Error()) return err } + m.measureThread = thread.New() switch m.config.AccessMode { case "direct": C.HPMmode(0) @@ -315,8 +313,20 @@ func (m *LikwidCollector) Init(config json.RawMessage) error { os.Setenv("PATH", m.config.DaemonPath+":"+p) } C.HPMmode(1) + retCode := C.HPMinit() + if retCode != 0 { + err := fmt.Errorf("C.HPMinit() failed with return code %v", retCode) + cclog.ComponentError(m.name, err.Error()) + } for _, c := range m.cpulist { - C.HPMaddThread(c) + m.measureThread.Call( + func() { + retCode := C.HPMaddThread(c) + if retCode != 0 { + err := fmt.Errorf("C.HPMaddThread(%v) failed with return code %v", c, retCode) + cclog.ComponentError(m.name, err.Error()) + } + }) } } m.sock2tid = make(map[int]int) @@ -330,8 +340,22 @@ func (m *LikwidCollector) Init(config json.RawMessage) error { C.free(unsafe.Pointer(cstr)) } + cpuData := topo.CpuData() + m.tid2core = make(map[int]int, len(cpuData)) + m.tid2socket = make(map[int]int, len(cpuData)) + for i := range cpuData { + c := &cpuData[i] + // Hardware thread ID to core ID mapping + if len(c.CoreCPUsList) > 0 { + m.tid2core[c.CpuID] = c.CoreCPUsList[0] + } else { + m.tid2core[c.CpuID] = c.CpuID + } + // Hardware thead ID to socket ID mapping + m.tid2socket[c.CpuID] = c.Socket + } + m.basefreq = getBaseFreq() - m.measureThread = thread.New() m.init = true return nil } @@ -341,9 +365,12 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig, var ret C.int var gid C.int = -1 sigchan := make(chan os.Signal, 1) + + // Watch changes for the lock file () watcher, err := fsnotify.NewWatcher() if err != nil { cclog.ComponentError(m.name, err.Error()) + return true, err } defer watcher.Close() if len(m.config.LockfilePath) > 0 { @@ -351,26 +378,28 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig, if err != nil { return true, err } - stat := info.Sys().(*syscall.Stat_t) - if stat.Uid != uint32(os.Getuid()) { - usr, err := user.LookupId(strconv.FormatUint(uint64(stat.Uid), 10)) + uid := info.Sys().(*syscall.Stat_t).Uid + if uid != uint32(os.Getuid()) { + usr, err := user.LookupId(fmt.Sprint(uid)) if err == nil { return true, fmt.Errorf("Access to performance counters locked by %s", usr.Username) } else { - return true, fmt.Errorf("Access to performance counters locked by %d", stat.Uid) + return true, fmt.Errorf("Access to performance counters locked by %d", uid) } } - err = watcher.Watch(m.config.LockfilePath) + err = watcher.Add(m.config.LockfilePath) if err != nil { cclog.ComponentError(m.name, err.Error()) } } m.lock.Lock() defer m.lock.Unlock() + + // Initialize the performance monitoring feature by creating basic data structures select { - case e := <-watcher.Event: + case e := <-watcher.Events: ret = -1 - if !e.IsAttrib() { + if e.Op != fsnotify.Chmod { ret = C.perfmon_init(C.int(len(m.cpulist)), &m.cpulist[0]) } default: @@ -381,12 +410,14 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig, } signal.Notify(sigchan, os.Interrupt) signal.Notify(sigchan, syscall.SIGCHLD) + + // Add an event string to LIKWID select { case <-sigchan: gid = -1 - case e := <-watcher.Event: + case e := <-watcher.Events: gid = -1 - if !e.IsAttrib() { + if e.Op != fsnotify.Chmod { gid = C.perfmon_addEventSet(evset.estr) } default: @@ -396,13 +427,14 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig, return true, fmt.Errorf("failed to add events %s, error %d", evset.go_estr, gid) } else { evset.gid = gid - //m.likwidGroups[gid] = evset } + + // Setup all performance monitoring counters of an eventSet select { case <-sigchan: ret = -1 - case e := <-watcher.Event: - if !e.IsAttrib() { + case e := <-watcher.Events: + if e.Op != fsnotify.Chmod { ret = C.perfmon_setupCounters(gid) } default: @@ -411,11 +443,13 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig, if ret != 0 { return true, fmt.Errorf("failed to setup events '%s', error %d", evset.go_estr, ret) } + + // Start counters select { case <-sigchan: ret = -1 - case e := <-watcher.Event: - if !e.IsAttrib() { + case e := <-watcher.Events: + if e.Op != fsnotify.Chmod { ret = C.perfmon_startCounters() } default: @@ -427,8 +461,8 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig, select { case <-sigchan: ret = -1 - case e := <-watcher.Event: - if !e.IsAttrib() { + case e := <-watcher.Events: + if e.Op != fsnotify.Chmod { ret = C.perfmon_readCounters() } default: @@ -437,12 +471,16 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig, if ret != 0 { return true, fmt.Errorf("failed to read events '%s', error %d", evset.go_estr, ret) } + + // Wait time.Sleep(interval) + + // Read counters select { case <-sigchan: ret = -1 - case e := <-watcher.Event: - if !e.IsAttrib() { + case e := <-watcher.Events: + if e.Op != fsnotify.Chmod { ret = C.perfmon_readCounters() } default: @@ -451,6 +489,8 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig, if ret != 0 { return true, fmt.Errorf("failed to read events '%s', error %d", evset.go_estr, ret) } + + // Store counters for eidx, counter := range evset.eorder { gctr := C.GoString(counter) for _, tid := range m.cpu2tid { @@ -462,14 +502,18 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig, evset.results[tid][gctr] = fres } } + + // Store time in seconds the event group was measured the last time for _, tid := range m.cpu2tid { evset.results[tid]["time"] = float64(C.perfmon_getLastTimeOfGroup(gid)) } + + // Stop counters select { case <-sigchan: ret = -1 - case e := <-watcher.Event: - if !e.IsAttrib() { + case e := <-watcher.Events: + if e.Op != fsnotify.Chmod { ret = C.perfmon_stopCounters() } default: @@ -478,10 +522,12 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig, if ret != 0 { return true, fmt.Errorf("failed to stop events '%s', error %d", evset.go_estr, ret) } + + // Deallocates all internal data that is used during performance monitoring signal.Stop(sigchan) select { - case e := <-watcher.Event: - if !e.IsAttrib() { + case e := <-watcher.Events: + if e.Op != fsnotify.Chmod { C.perfmon_finalize() } default: @@ -506,6 +552,9 @@ func (m *LikwidCollector) calcEventsetMetrics(evset LikwidEventsetConfig, interv if metric.Type == "socket" { scopemap = m.sock2tid } + // Send all metrics with same time stamp + // This function does only computiation, counter measurement is done before + now := time.Now() for domain, tid := range scopemap { if tid >= 0 && len(metric.Calc) > 0 { value, err := agg.EvalFloat64Condition(metric.Calc, evset.results[tid]) @@ -518,23 +567,137 @@ func (m *LikwidCollector) calcEventsetMetrics(evset LikwidEventsetConfig, interv } evset.metrics[tid][metric.Name] = value // Now we have the result, send it with the proper tags - if !math.IsNaN(value) { - if metric.Publish { - fields := map[string]interface{}{"value": value} - y, err := lp.New(metric.Name, map[string]string{"type": metric.Type}, m.meta, fields, time.Now()) - if err == nil { - if metric.Type != "node" { - y.AddTag("type-id", fmt.Sprintf("%d", domain)) - } - if len(metric.Unit) > 0 { - y.AddMeta("unit", metric.Unit) - } - output <- y + if !math.IsNaN(value) && metric.Publish { + fields := map[string]interface{}{"value": value} + y, err := + lp.New( + metric.Name, + map[string]string{ + "type": metric.Type, + }, + m.meta, + fields, + now, + ) + if err == nil { + if metric.Type != "node" { + y.AddTag("type-id", fmt.Sprintf("%d", domain)) } + if len(metric.Unit) > 0 { + y.AddMeta("unit", metric.Unit) + } + output <- y } } } } + + // Send per core aggregated values + if metric.SendCoreTotalVal { + totalCoreValues := make(map[int]float64) + for _, tid := range scopemap { + if tid >= 0 && len(metric.Calc) > 0 { + coreID := m.tid2core[tid] + value := evset.metrics[tid][metric.Name] + if !math.IsNaN(value) && metric.Publish { + totalCoreValues[coreID] += value + } + } + } + + for coreID, value := range totalCoreValues { + y, err := + lp.New( + metric.Name, + map[string]string{ + "type": "core", + "type-id": fmt.Sprintf("%d", coreID), + }, + m.meta, + map[string]interface{}{ + "value": value, + }, + now, + ) + if err != nil { + continue + } + if len(metric.Unit) > 0 { + y.AddMeta("unit", metric.Unit) + } + output <- y + } + } + + // Send per socket aggregated values + if metric.SendSocketTotalVal { + totalSocketValues := make(map[int]float64) + for _, tid := range scopemap { + if tid >= 0 && len(metric.Calc) > 0 { + socketID := m.tid2socket[tid] + value := evset.metrics[tid][metric.Name] + if !math.IsNaN(value) && metric.Publish { + totalSocketValues[socketID] += value + } + } + } + + for socketID, value := range totalSocketValues { + y, err := + lp.New( + metric.Name, + map[string]string{ + "type": "socket", + "type-id": fmt.Sprintf("%d", socketID), + }, + m.meta, + map[string]interface{}{ + "value": value, + }, + now, + ) + if err != nil { + continue + } + if len(metric.Unit) > 0 { + y.AddMeta("unit", metric.Unit) + } + output <- y + } + } + + // Send per node aggregated value + if metric.SendNodeTotalVal { + var totalNodeValue float64 = 0.0 + for _, tid := range scopemap { + if tid >= 0 && len(metric.Calc) > 0 { + value := evset.metrics[tid][metric.Name] + if !math.IsNaN(value) && metric.Publish { + totalNodeValue += value + } + } + } + + y, err := + lp.New( + metric.Name, + map[string]string{ + "type": "node", + }, + m.meta, + map[string]interface{}{ + "value": totalNodeValue, + }, + now, + ) + if err != nil { + continue + } + if len(metric.Unit) > 0 { + y.AddMeta("unit", metric.Unit) + } + output <- y + } } return nil @@ -542,7 +705,13 @@ func (m *LikwidCollector) calcEventsetMetrics(evset LikwidEventsetConfig, interv // Go over the global metrics, derive the value out of the event sets' metric values and send it func (m *LikwidCollector) calcGlobalMetrics(groups []LikwidEventsetConfig, interval time.Duration, output chan lp.CCMetric) error { + // Send all metrics with same time stamp + // This function does only computiation, counter measurement is done before + now := time.Now() + for _, metric := range m.config.Metrics { + // The metric scope is determined in the Init() function + // Get the map scope-id -> tids scopemap := m.cpu2tid if metric.Type == "socket" { scopemap = m.sock2tid @@ -550,7 +719,7 @@ func (m *LikwidCollector) calcGlobalMetrics(groups []LikwidEventsetConfig, inter for domain, tid := range scopemap { if tid >= 0 { // Here we generate parameter list - params := make(map[string]interface{}) + params := make(map[string]float64) for _, evset := range groups { for mname, mres := range evset.metrics[tid] { params[mname] = mres @@ -565,13 +734,21 @@ func (m *LikwidCollector) calcGlobalMetrics(groups []LikwidEventsetConfig, inter if m.config.InvalidToZero && (math.IsNaN(value) || math.IsInf(value, 0)) { value = 0.0 } - //m.gmresults[tid][metric.Name] = value // Now we have the result, send it with the proper tags if !math.IsNaN(value) { if metric.Publish { - tags := map[string]string{"type": metric.Type} - fields := map[string]interface{}{"value": value} - y, err := lp.New(metric.Name, tags, m.meta, fields, time.Now()) + y, err := + lp.New( + metric.Name, + map[string]string{ + "type": metric.Type, + }, + m.meta, + map[string]interface{}{ + "value": value, + }, + now, + ) if err == nil { if metric.Type != "node" { y.AddTag("type-id", fmt.Sprintf("%d", domain)) @@ -589,7 +766,6 @@ func (m *LikwidCollector) calcGlobalMetrics(groups []LikwidEventsetConfig, inter return nil } - func (m *LikwidCollector) ReadThread(interval time.Duration, output chan lp.CCMetric) { var err error = nil groups := make([]LikwidEventsetConfig, 0) @@ -619,8 +795,6 @@ func (m *LikwidCollector) ReadThread(interval time.Duration, output chan lp.CCMe // main read function taking multiple measurement rounds, each 'interval' seconds long func (m *LikwidCollector) Read(interval time.Duration, output chan lp.CCMetric) { - //var skip bool = false - //var err error if !m.init { return } diff --git a/collectors/likwidMetric.md b/collectors/likwidMetric.md index 62ef3c5..7740543 100644 --- a/collectors/likwidMetric.md +++ b/collectors/likwidMetric.md @@ -41,10 +41,12 @@ The `likwid` collector is probably the most complicated collector. The LIKWID li ``` The `likwid` configuration consists of two parts, the `eventsets` and `globalmetrics`: + - An event set list itself has two parts, the `events` and a set of derivable `metrics`. Each of the `events` is a `counter:event` pair in LIKWID's syntax. The `metrics` are a list of formulas to derive the metric value from the measurements of the `events`' values. Each metric has a name, the formula, a type and a publish flag. There is an optional `unit` field. Counter names can be used like variables in the formulas, so `PMC0+PMC1` sums the measurements for the both events configured in the counters `PMC0` and `PMC1`. You can optionally use `time` for the measurement time and `inverseClock` for `1.0/baseCpuFrequency`. The type tells the LikwidCollector whether it is a metric for each hardware thread (`cpu`) or each CPU socket (`socket`). You may specify a unit for the metric with `unit`. The last one is the publishing flag. It tells the LikwidCollector whether a metric should be sent to the router or is only used internally to compute a global metric. - The `globalmetrics` are metrics which require data from multiple event set measurements to be derived. The inputs are the metrics in the event sets. Similar to the metrics in the event sets, the global metrics are defined by a name, a formula, a type and a publish flag. See event set metrics for details. The only difference is that there is no access to the raw event measurements anymore but only to the metrics. Also `time` and `inverseClock` cannot be used anymore. So, the idea is to derive a metric in the `eventsets` section and reuse it in the `globalmetrics` part. If you need a metric only for deriving the global metrics, disable forwarding of the event set metrics (`"publish": false`). **Be aware** that the combination might be misleading because the "behavior" of a metric changes over time and the multiple measurements might count different computing phases. Similar to the metrics in the eventset, you can specify a metric unit with the `unit` field. Additional options: + - `force_overwrite`: Same as setting `LIKWID_FORCE=1`. In case counters are already in-use, LIKWID overwrites their configuration to do its measurements - `invalid_to_zero`: In some cases, the calculations result in `NaN` or `Inf`. With this option, all `NaN` and `Inf` values are replaces with `0.0`. See below in [seperate section](./likwidMetric.md#invalid_to_zero-option) - `access_mode`: Specify LIKWID access mode: `direct` for direct register access as root user or `accessdaemon`. The access mode `perf_event` is current untested. @@ -62,6 +64,7 @@ Hardware performance counters are scattered all over the system nowadays. A coun **Note:** You cannot specify `socket` type for a metric that is measured at `hwthread` type, so some kind of expert knowledge or lookup work in the [Likwid Wiki](https://github.com/RRZE-HPC/likwid/wiki) is required. Get the type of each counter from the *Architecture* pages and as soon as one counter in a metric is socket-specific, the whole metric is socket-specific. As a guideline: + - All counters `FIXCx`, `PMCy` and `TMAz` have the type `hwthread` - All counters names containing `BOX` have the type `socket` - All `PWRx` counters have type `socket`, except `"PWR1" : "RAPL_CORE_ENERGY"` has `hwthread` type @@ -70,6 +73,7 @@ As a guideline: ### Help with the configuration The configuration for the `likwid` collector is quite complicated. Most users don't use LIKWID with the event:counter notation but rely on the performance groups defined by the LIKWID team for each architecture. In order to help with the `likwid` collector configuration, we included a script `scripts/likwid_perfgroup_to_cc_config.py` that creates the configuration of an `eventset` from a performance group (using a LIKWID installation in `$PATH`): + ``` $ likwid-perfctr -i [...] @@ -111,20 +115,28 @@ You can copy this JSON and add it to the `eventsets` list. If you specify multip LIKWID checks the file `/var/run/likwid.lock` before performing any interfering operations. Who is allowed to access the counters is determined by the owner of the file. If it does not exist, it is created for the current user. So, if you want to temporarly allow counter access to a user (e.g. in a job): Before (SLURM prolog, ...) -``` -$ chown $JOBUSER /var/run/likwid.lock + +```bash +chown $JOBUSER /var/run/likwid.lock ``` After (SLURM epilog, ...) -``` -$ chown $CCUSER /var/run/likwid.lock + +```bash +chown $CCUSER /var/run/likwid.lock ``` ### `invalid_to_zero` option + In some cases LIKWID returns `0.0` for some events that are further used in processing and maybe used as divisor in a calculation. After evaluation of a metric, the result might be `NaN` or `+-Inf`. These resulting metrics are commonly not created and forwarded to the router because the [InfluxDB line protocol](https://docs.influxdata.com/influxdb/cloud/reference/syntax/line-protocol/#float) does not support these special floating-point values. If you want to have them sent, this option forces these metric values to be `0.0` instead. One might think this does not happen often but often used metrics in the world of performance engineering like Instructions-per-Cycle (IPC) or more frequently the actual CPU clock are derived with events like `CPU_CLK_UNHALTED_CORE` (Intel) which do not increment in halted state (as the name implies). In there are different power management systems in a chip which can cause a hardware thread to go in such a state. Moreover, if no cycles are executed by the core, also many other events are not incremented as well (like `INSTR_RETIRED_ANY` for retired instructions and part of IPC). +### `send_*_total values` option + +- `send_core_total_values`: Metrics, which are usually collected on a per hardware thread basis, are additionally summed up per CPU core. +- `send_socket_total_values` Metrics, which are usually collected on a per hardware thread basis, are additionally summed up per CPU socket. +- `send_node_total_values` Metrics, which are usually collected on a per hardware thread basis, are additionally summed up per node. ### Example configuration @@ -229,6 +241,7 @@ One might think this does not happen often but often used metrics in the world o The `likwid` collector reads hardware performance counters at a **hwthread** and **socket** level. The configuration looks quite complicated but it is basically copy&paste from [LIKWID's performance groups](https://github.com/RRZE-HPC/likwid/tree/master/groups). The collector made multiple iterations and tried to use the performance groups but it lacked flexibility. The current way of configuration provides most flexibility. The logic is as following: There are multiple eventsets, each consisting of a list of counters+events and a list of metrics. If you compare a common performance group with the example setting above, there is not much difference: + ``` EVENTSET -> "events": { FIXC1 ACTUAL_CPU_CLOCK -> "FIXC1": "ACTUAL_CPU_CLOCK", diff --git a/collectors/lustreMetric.go b/collectors/lustreMetric.go index bcb9ca6..02ce572 100644 --- a/collectors/lustreMetric.go +++ b/collectors/lustreMetric.go @@ -101,7 +101,7 @@ func getMetricData(lines []string, prefix string, offset int) (int64, error) { // llitedir := filepath.Join(LUSTRE_SYSFS, "llite") // devdir := filepath.Join(llitedir, device) // statsfile := filepath.Join(devdir, "stats") -// buffer, err := ioutil.ReadFile(statsfile) +// buffer, err := os.ReadFile(statsfile) // if err != nil { // return make([]string, 0) // } diff --git a/collectors/netstatMetric.go b/collectors/netstatMetric.go index 8428df1..2ae1764 100644 --- a/collectors/netstatMetric.go +++ b/collectors/netstatMetric.go @@ -102,7 +102,7 @@ func (m *NetstatCollector) Init(config json.RawMessage) error { // Check if device is a included device if _, ok := stringArrayContains(m.config.IncludeDevices, dev); ok { - tags := map[string]string{"device": dev, "type": "node"} + tags := map[string]string{"stype": "network", "stype-id": dev, "type": "node"} meta_unit_byte := map[string]string{"source": m.name, "group": "Network", "unit": "bytes"} meta_unit_byte_per_sec := map[string]string{"source": m.name, "group": "Network", "unit": "bytes/sec"} meta_unit_pkts := map[string]string{"source": m.name, "group": "Network", "unit": "packets"} diff --git a/collectors/netstatMetric.md b/collectors/netstatMetric.md index 424cf77..7ce0af9 100644 --- a/collectors/netstatMetric.md +++ b/collectors/netstatMetric.md @@ -23,5 +23,5 @@ Metrics: * `net_pkts_in_bw` (`unit=packets/sec` if `send_derived_values == true`) * `net_pkts_out_bw` (`unit=packets/sec` if `send_derived_values == true`) -The device name is added as tag `device`. +The device name is added as tag `stype=network,stype-id=`. diff --git a/collectors/nvidiaMetric.go b/collectors/nvidiaMetric.go index a1fed03..369f12b 100644 --- a/collectors/nvidiaMetric.go +++ b/collectors/nvidiaMetric.go @@ -71,6 +71,14 @@ func (m *NvidiaCollector) Init(config json.RawMessage) error { // Initialize NVIDIA Management Library (NVML) ret := nvml.Init() + + // Error: NVML library not found + // (nvml.ErrorString can not be used in this case) + if ret == nvml.ERROR_LIBRARY_NOT_FOUND { + err = fmt.Errorf("NVML library not found") + cclog.ComponentError(m.name, err.Error()) + return err + } if ret != nvml.SUCCESS { err = errors.New(nvml.ErrorString(ret)) cclog.ComponentError(m.name, "Unable to initialize NVML", err.Error()) diff --git a/go.mod b/go.mod index 3908213..9c3c228 100644 --- a/go.mod +++ b/go.mod @@ -1,42 +1,105 @@ module github.com/ClusterCockpit/cc-metric-collector -go 1.18 +go 1.20 require ( - github.com/ClusterCockpit/cc-units v0.3.0 + github.com/ClusterCockpit/cc-units v0.4.0 github.com/ClusterCockpit/go-rocm-smi v0.3.0 - github.com/NVIDIA/go-nvml v0.11.6-0 - github.com/PaesslerAG/gval v1.2.1 + github.com/NVIDIA/go-nvml v0.12.0-1 + github.com/PaesslerAG/gval v1.2.2 + github.com/fsnotify/fsnotify v1.6.0 github.com/gorilla/mux v1.8.0 - github.com/influxdata/influxdb-client-go/v2 v2.12.1 + github.com/influxdata/influxdb-client-go/v2 v2.12.3 github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf - github.com/nats-io/nats.go v1.22.1 - github.com/prometheus/client_golang v1.14.0 - github.com/stmcginnis/gofish v0.13.0 - github.com/tklauser/go-sysconf v0.3.11 + github.com/influxdata/line-protocol/v2 v2.2.1 + github.com/nats-io/nats.go v1.30.2 + github.com/prometheus/client_golang v1.17.0 + github.com/stmcginnis/gofish v0.14.0 + github.com/tklauser/go-sysconf v0.3.12 golang.design/x/thread v0.0.0-20210122121316-335e9adffdf1 - golang.org/x/sys v0.3.0 - gopkg.in/fsnotify.v0 v0.9.3 + golang.org/x/exp v0.0.0-20231006140011-7918f672742d + golang.org/x/sys v0.13.0 ) require ( + github.com/BurntSushi/toml v1.3.2 // indirect + github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 // indirect + github.com/CloudyKit/jet/v6 v6.2.0 // indirect + github.com/Joker/jade v1.1.3 // indirect + github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06 // indirect + github.com/andybalholm/brotli v1.0.5 // indirect github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect + github.com/aymerick/douceur v0.2.0 // indirect github.com/beorn7/perks v1.0.1 // indirect + github.com/bytedance/sonic v1.10.2 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/deepmap/oapi-codegen v1.12.4 // indirect - github.com/golang/protobuf v1.5.2 // indirect - github.com/google/uuid v1.3.0 // indirect + github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect + github.com/chenzhuoyu/iasm v0.9.0 // indirect + github.com/deepmap/oapi-codegen v1.15.0 // indirect + github.com/fatih/structs v1.1.0 // indirect + github.com/flosch/pongo2/v4 v4.0.2 // indirect + github.com/gabriel-vasile/mimetype v1.4.2 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/gin-gonic/gin v1.9.1 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.15.5 // indirect + github.com/goccy/go-json v0.10.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/gomarkdown/markdown v0.0.0-20230922112808-5421fefb8386 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/gorilla/css v1.0.0 // indirect + github.com/iris-contrib/schema v0.0.6 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/kataras/blocks v0.0.8 // indirect + github.com/kataras/golog v0.1.9 // indirect + github.com/kataras/iris/v12 v12.2.7 // indirect + github.com/kataras/pio v0.0.12 // indirect + github.com/kataras/sitemap v0.0.6 // indirect + github.com/kataras/tunnel v0.0.4 // indirect + github.com/klauspost/compress v1.17.0 // indirect + github.com/klauspost/cpuid/v2 v2.2.5 // indirect + github.com/labstack/echo/v4 v4.11.1 // indirect + github.com/labstack/gommon v0.4.0 // indirect + github.com/leodido/go-urn v1.2.4 // indirect + github.com/mailgun/raymond/v2 v2.0.48 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/microcosm-cc/bluemonday v1.0.25 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect github.com/nats-io/nats-server/v2 v2.8.4 // indirect - github.com/nats-io/nkeys v0.3.0 // indirect + github.com/nats-io/nkeys v0.4.5 // indirect github.com/nats-io/nuid v1.0.1 // indirect + github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.39.0 // indirect - github.com/prometheus/procfs v0.9.0 // indirect + github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/common v0.44.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/schollz/closestmatch v2.1.0+incompatible // indirect github.com/shopspring/decimal v1.3.1 // indirect - github.com/tklauser/numcpus v0.6.0 // indirect - golang.org/x/crypto v0.4.0 // indirect - golang.org/x/net v0.4.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect + github.com/tdewolff/minify/v2 v2.12.9 // indirect + github.com/tdewolff/parse/v2 v2.6.8 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.11 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/valyala/fasttemplate v1.2.2 // indirect + github.com/vmihailenco/msgpack/v5 v5.4.0 // indirect + github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect + github.com/yosssi/ace v0.0.5 // indirect + golang.org/x/arch v0.5.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.16.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/time v0.3.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 03d7b08..c40a1b8 100644 --- a/go.sum +++ b/go.sum @@ -1,624 +1,295 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/ClusterCockpit/cc-units v0.3.0 h1:JEKgEyvN4GABheKIReW2siDXgpYf2zf4STXV2ip418Y= -github.com/ClusterCockpit/cc-units v0.3.0/go.mod h1:3S3PAhAayS3pbgcT4q9Vn9VJw22Op51X0YimtG77zBw= +github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= +github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 h1:sR+/8Yb4slttB4vD+b9btVEnWgL3Q00OBTzVT8B9C0c= +github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= +github.com/CloudyKit/jet/v6 v6.2.0 h1:EpcZ6SR9n28BUGtNJSvlBqf90IpjeFr36Tizxhn/oME= +github.com/CloudyKit/jet/v6 v6.2.0/go.mod h1:d3ypHeIRNo2+XyqnGA8s+aphtcVpjP5hPwP/Lzo7Ro4= +github.com/ClusterCockpit/cc-units v0.4.0 h1:zP5DOu99GmErW0tCDf0gcLrlWt42RQ9dpoONEOh4cI0= +github.com/ClusterCockpit/cc-units v0.4.0/go.mod h1:3S3PAhAayS3pbgcT4q9Vn9VJw22Op51X0YimtG77zBw= github.com/ClusterCockpit/go-rocm-smi v0.3.0 h1:1qZnSpG7/NyLtc7AjqnUL9Jb8xtqG1nMVgp69rJfaR8= github.com/ClusterCockpit/go-rocm-smi v0.3.0/go.mod h1:+I3UMeX3OlizXDf1WpGD43W4KGZZGVSGmny6rTeOnWA= -github.com/NVIDIA/go-nvml v0.11.6-0 h1:tugQzmaX84Y/6+03wZ/MAgcpfSKDkvkAWeuxFNLHmxY= +github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= +github.com/Joker/jade v1.1.3 h1:Qbeh12Vq6BxURXT1qZBRHsDxeURB8ztcL6f3EXSGeHk= +github.com/Joker/jade v1.1.3/go.mod h1:T+2WLyt7VH6Lp0TRxQrUYEs64nRc83wkMQrfeIQKduM= github.com/NVIDIA/go-nvml v0.11.6-0/go.mod h1:hy7HYeQy335x6nEss0Ne3PYqleRa6Ct+VKD9RQ4nyFs= -github.com/PaesslerAG/gval v1.2.0 h1:DA7PsxmtzlUU4bYxV35MKp9KDDVWcrJJRhlaCohMhsM= -github.com/PaesslerAG/gval v1.2.0/go.mod h1:XRFLwvmkTEdYziLdaCeCa5ImcGVrfQbeNUbVR+C6xac= -github.com/PaesslerAG/jsonpath v0.1.0 h1:gADYeifvlqK3R3i2cR5B4DGgxLXIPb3TRTH1mGi0jPI= +github.com/NVIDIA/go-nvml v0.12.0-1 h1:6mdjtlFo+17dWL7VFPfuRMtf0061TF4DKls9pkSw6uM= +github.com/NVIDIA/go-nvml v0.12.0-1/go.mod h1:hy7HYeQy335x6nEss0Ne3PYqleRa6Ct+VKD9RQ4nyFs= +github.com/PaesslerAG/gval v1.2.2 h1:Y7iBzhgE09IGTt5QgGQ2IdaYYYOU134YGHBThD+wm9E= +github.com/PaesslerAG/gval v1.2.2/go.mod h1:XRFLwvmkTEdYziLdaCeCa5ImcGVrfQbeNUbVR+C6xac= github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= +github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06 h1:KkH3I3sJuOLP3TjA/dfr4NAY8bghDwnXiU7cTKxQqo0= +github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06/go.mod h1:7erjKLwalezA0k99cWs5L11HWOAPNjdUZ6RxH1BXbbM= +github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= +github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ= +github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk= +github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= +github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= +github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= +github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM= +github.com/bytedance/sonic v1.10.2 h1:GQebETVBxYB7JGWJtLBi07OVzWwt+8dWA00gEVW2ZFE= +github.com/bytedance/sonic v1.10.2/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= +github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= +github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0= +github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpVsBuRksnlj1mLy4AWzRNQYxauNi62uWcE3to6eA= +github.com/chenzhuoyu/iasm v0.9.0 h1:9fhXjVzq5hUy2gkhhgHl95zG2cEAhw9OSGs8toWWAwo= +github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0-20210816181553-5444fa50b93d/go.mod h1:tmAIfUFEirG/Y8jhZ9M+h36obRZAk/1fcSpXwAVlfqE= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= -github.com/deepmap/oapi-codegen v1.11.0 h1:f/X2NdIkaBKsSdpeuwLnY/vDI0AtPUrmB5LMgc7YD+A= -github.com/deepmap/oapi-codegen v1.11.0/go.mod h1:k+ujhoQGxmQYBZBbxhOZNZf4j08qv5mC+OH+fFTnKxM= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/getkin/kin-openapi v0.94.0/go.mod h1:LWZfzOd7PRy8GJ1dJ6mCU6tNdSfOwRac1BUPam4aw6Q= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/deepmap/oapi-codegen v1.15.0 h1:SQqViaeb4k2vMul8gx12oDOIadEtoRqTdLkxjzqtQ90= +github.com/deepmap/oapi-codegen v1.15.0/go.mod h1:a6KoHV7lMRwsPoEg2C6NDHiXYV3EQfiFocOlJ8dgJQE= +github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/flosch/pongo2/v4 v4.0.2 h1:gv+5Pe3vaSVmiJvh/BZa82b7/00YUGm0PIyVVLop0Hw= +github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8= +github.com/frankban/quicktest v1.11.0/go.mod h1:K+q6oSqb0W0Ininfk863uOk1lMy69l/P6txr3mVT54s= +github.com/frankban/quicktest v1.11.2/go.mod h1:K+q6oSqb0W0Ininfk863uOk1lMy69l/P6txr3mVT54s= +github.com/frankban/quicktest v1.13.0/go.mod h1:qLE0fzW0VuyUAJgPU19zByoIr0HtCHN/r/VLSOOIySU= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= +github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U= -github.com/go-chi/chi/v5 v5.0.7/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= -github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/go-playground/validator/v10 v10.11.0/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= +github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.15.5 h1:LEBecTWb/1j5TNY1YYG2RcOUN3R7NLylN+x8TTueE24= +github.com/go-playground/validator/v10 v10.15.5/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/gomarkdown/markdown v0.0.0-20230922112808-5421fefb8386 h1:EcQR3gusLHN46TAD+G+EbaaqJArt5vHhNpXAa12PQf4= +github.com/gomarkdown/markdown v0.0.0-20230922112808-5421fefb8386/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= +github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/influxdata/influxdb-client-go/v2 v2.9.1 h1:5kbH226fmmiV0MMTs7a8L7/ECCKdJWBi1QZNNv4/TkI= -github.com/influxdata/influxdb-client-go/v2 v2.9.1/go.mod h1:x7Jo5UHHl+w8wu8UnGiNobDDHygojXwJX4mx7rXGKMk= +github.com/influxdata/influxdb-client-go/v2 v2.12.3 h1:28nRlNMRIV4QbtIUvxhWqaxn0IpXeMSkY/uJa/O/vC4= +github.com/influxdata/influxdb-client-go/v2 v2.12.3/go.mod h1:IrrLUbCjjfkmRuaCiGQg4m2GbkaeJDcuWoxiWdQEbA0= github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf h1:7JTmneyiNEwVBOHSjoMxiWAqB992atOeepeFYegn5RU= github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= +github.com/influxdata/line-protocol-corpus v0.0.0-20210519164801-ca6fa5da0184/go.mod h1:03nmhxzZ7Xk2pdG+lmMd7mHDfeVOYFyhOgwO61qWU98= +github.com/influxdata/line-protocol-corpus v0.0.0-20210922080147-aa28ccfb8937/go.mod h1:BKR9c0uHSmRgM/se9JhFHtTT7JTO67X23MtKMHtZcpo= +github.com/influxdata/line-protocol/v2 v2.0.0-20210312151457-c52fdecb625a/go.mod h1:6+9Xt5Sq1rWx+glMgxhcg2c0DUaehK+5TDcPZ76GypY= +github.com/influxdata/line-protocol/v2 v2.1.0/go.mod h1:QKw43hdUBg3GTk2iC3iyCxksNj7PX9aUSeYOYE/ceHY= +github.com/influxdata/line-protocol/v2 v2.2.1 h1:EAPkqJ9Km4uAxtMRgUubJyqAr6zgWM0dznKMLRauQRE= +github.com/influxdata/line-protocol/v2 v2.2.1/go.mod h1:DmB3Cnh+3oxmG6LOBIxce4oaL4CPj3OmMPgvauXh+tM= +github.com/iris-contrib/schema v0.0.6 h1:CPSBLyx2e91H2yJzPuhGuifVRnZBBJ3pCOMbOvPZaTw= +github.com/iris-contrib/schema v0.0.6/go.mod h1:iYszG0IOsuIsfzjymw1kMzTL8YQcCWlm65f3wX8J5iA= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.14.4 h1:eijASRJcobkVtSt81Olfh7JX43osYLwy5krOJo6YEu4= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= +github.com/kataras/blocks v0.0.8 h1:MrpVhoFTCR2v1iOOfGng5VJSILKeZZI+7NGfxEh3SUM= +github.com/kataras/blocks v0.0.8/go.mod h1:9Jm5zx6BB+06NwA+OhTbHW1xkMOYxahnqTN5DveZ2Yg= +github.com/kataras/golog v0.1.9 h1:vLvSDpP7kihFGKFAvBSofYo7qZNULYSHOH2D7rPTKJk= +github.com/kataras/golog v0.1.9/go.mod h1:jlpk/bOaYCyqDqH18pgDHdaJab72yBE6i0O3s30hpWY= +github.com/kataras/iris/v12 v12.2.7 h1:C9KWZmZT5pB5f2ot1XYWDBdi5XeTz0CGweHRXCDARZg= +github.com/kataras/iris/v12 v12.2.7/go.mod h1:mD76k/tIBFy8pHTFIgUPrVrkI4lTKvFbIcfbStJSBnA= +github.com/kataras/pio v0.0.12 h1:o52SfVYauS3J5X08fNjlGS5arXHjW/ItLkyLcKjoH6w= +github.com/kataras/pio v0.0.12/go.mod h1:ODK/8XBhhQ5WqrAhKy+9lTPS7sBf6O3KcLhc9klfRcY= +github.com/kataras/sitemap v0.0.6 h1:w71CRMMKYMJh6LR2wTgnk5hSgjVNB9KL60n5e2KHvLY= +github.com/kataras/sitemap v0.0.6/go.mod h1:dW4dOCNs896OR1HmG+dMLdT7JjDk7mYBzoIRwuj5jA4= +github.com/kataras/tunnel v0.0.4 h1:sCAqWuJV7nPzGrlb0os3j49lk2JhILT0rID38NHNLpA= +github.com/kataras/tunnel v0.0.4/go.mod h1:9FkU4LaeifdMWqZu7o20ojmW4B7hdhv2CMLwfnHGpYw= +github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= +github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= +github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/labstack/echo/v4 v4.7.2/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20Ltm0OvSks= -github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= -github.com/lestrrat-go/backoff/v2 v2.0.8/go.mod h1:rHP/q/r9aT27n24JQLa7JhSQZCKBBOiM/uP402WwN8Y= -github.com/lestrrat-go/blackmagic v1.0.0/go.mod h1:TNgH//0vYSs8VXDCfkZLgIrVTTXQELZffUV0tz3MtdQ= -github.com/lestrrat-go/blackmagic v1.0.1/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= -github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= -github.com/lestrrat-go/iter v1.0.1/go.mod h1:zIdgO1mRKhn8l9vrZJZz9TUMMFbQbLeTsbqPDrJ/OJc= -github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= -github.com/lestrrat-go/jwx v1.2.24/go.mod h1:zoNuZymNl5lgdcu6P7K6ie2QRll5HVfF4xwxBBK1NxY= -github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/labstack/echo/v4 v4.11.1 h1:dEpLU2FLg4UVmvCGPuk/APjlH6GDpbEPti61srUUUs4= +github.com/labstack/echo/v4 v4.11.1/go.mod h1:YuYRTSM3CHs2ybfrL8Px48bO6BAnYIN4l8wSTMP6BDQ= +github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= +github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= +github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= +github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= +github.com/mailgun/raymond/v2 v2.0.48 h1:5dmlB680ZkFG2RN/0lvTAghrSxIESeu9/2aeDqACtjw= +github.com/mailgun/raymond/v2 v2.0.48/go.mod h1:lsgvL50kgt1ylcFJYZiULi5fjPBkkhNfj4KA0W54Z18= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/matryer/moq v0.2.7/go.mod h1:kITsx543GOENm48TUAQyJ9+SAvFSr7iGQXPoth/VUBk= github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/microcosm-cc/bluemonday v1.0.25 h1:4NEwSfiJ+Wva0VxN5B8OwMicaJvD8r9tlJWm9rtloEg= +github.com/microcosm-cc/bluemonday v1.0.25/go.mod h1:ZIOjCQp1OrzBBPIJmfX4qDYFuhU02nx4bn030ixfHLE= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nats-io/jwt/v2 v2.2.1-0.20220330180145-442af02fd36a h1:lem6QCvxR0Y28gth9P+wV2K/zYUUAkJ+55U8cpS0p5I= -github.com/nats-io/nats-server/v2 v2.8.4 h1:0jQzze1T9mECg8YZEl8+WYUXb9JKluJfCBriPUtluB4= github.com/nats-io/nats-server/v2 v2.8.4/go.mod h1:8zZa+Al3WsESfmgSs98Fi06dRWLH5Bnq90m5bKD/eT4= -github.com/nats-io/nats.go v1.16.0 h1:zvLE7fGBQYW6MWaFaRdsgm9qT39PJDQoju+DS8KsO1g= -github.com/nats-io/nats.go v1.16.0/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w= -github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8= -github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= +github.com/nats-io/nats.go v1.30.2 h1:aloM0TGpPorZKQhbAkdCzYDj+ZmsJDyeo3Gkbr72NuY= +github.com/nats-io/nats.go v1.30.2/go.mod h1:dcfhUgmQNN4GJEfIb2f9R7Fow+gzBF4emzDHrVBd5qM= +github.com/nats-io/nkeys v0.4.5 h1:Zdz2BUlFm4fJlierwvGK+yl20IAKUm7eV6AAZXEhkPk= +github.com/nats-io/nkeys v0.4.5/go.mod h1:XUkxdLPTufzlihbamfzQ7mw/VGx6ObUs+0bN5sNvt64= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= +github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34= -github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= -github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= -github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= -github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= +github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= +github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= +github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/schollz/closestmatch v2.1.0+incompatible h1:Uel2GXEpJqOWBrlyI+oY9LTiyyjYS17cCYRqP13/SHk= +github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/stmcginnis/gofish v0.13.0 h1:qq6q3yNt9vw7ZuJxiw87hq9+BdPLsuRQBwl+XoZSz60= -github.com/stmcginnis/gofish v0.13.0/go.mod h1:BLDSFTp8pDlf/xDbLZa+F7f7eW0E/CHCboggsu8CznI= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= +github.com/stmcginnis/gofish v0.14.0 h1:geECNAiG33JDB2x2xDkerpOOuXFqxp5YP3EFE3vd5iM= +github.com/stmcginnis/gofish v0.14.0/go.mod h1:BLDSFTp8pDlf/xDbLZa+F7f7eW0E/CHCboggsu8CznI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw= -github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= -github.com/tklauser/numcpus v0.4.0 h1:E53Dm1HjH1/R2/aoCtXtPgzmElmn51aOkhCFSuZq//o= -github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/tdewolff/minify/v2 v2.12.9 h1:dvn5MtmuQ/DFMwqf5j8QhEVpPX6fi3WGImhv8RUB4zA= +github.com/tdewolff/minify/v2 v2.12.9/go.mod h1:qOqdlDfL+7v0/fyymB+OP497nIxJYSvX4MQWA8OoiXU= +github.com/tdewolff/parse/v2 v2.6.8 h1:mhNZXYCx//xG7Yq2e/kVLNZw4YfYmeHbhx+Zc0OvFMA= +github.com/tdewolff/parse/v2 v2.6.8/go.mod h1:XHDhaU6IBgsryfdnpzUXBlT6leW/l25yrFBTEb4eIyM= +github.com/tdewolff/test v1.0.9/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= +github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= +github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= +github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/vmihailenco/msgpack/v5 v5.4.0 h1:hRM0digJwyR6vll33NNAwCFguy5JuBD6jxDmQP3l608= +github.com/vmihailenco/msgpack/v5 v5.4.0/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= +github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= +github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= +github.com/yosssi/ace v0.0.5 h1:tUkIP/BLdKqrlrPwcmH0shwEEhTRHoGnc1wFIWmaBUA= +github.com/yosssi/ace v0.0.5/go.mod h1:ALfIzm2vT7t5ZE7uoIZqF3TQ7SAOyupFZnkrF5id+K0= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.design/x/thread v0.0.0-20210122121316-335e9adffdf1 h1:P7S/GeHBAFEZIYp0ePPs2kHXoazz8q2KsyxHyQVGCJg= +golang.design/x/thread v0.0.0-20210122121316-335e9adffdf1/go.mod h1:9CWpnTUmlQkfdpdutA1nNf4iE5lAVt3QZOu0Z6hahBE= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.5.0 h1:jpGode6huXQxcskEIpOCvrU+tzo81b6+oFLUYXWtH/Y= +golang.org/x/arch v0.5.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY= -golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= +golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220513224357-95641704303c/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220708220712-1185a9018129 h1:vucSRfWwTsoXro7P+3Cjlr6flUMtzCwzlvkxEQtHHB0= -golang.org/x/net v0.0.0-20220708220712-1185a9018129/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos= +golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210122093101-04d7465088b8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220513210249-45d2b4557a2a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220712014510-0a85c31ab51e h1:NHvCuwuS43lGnYhten69ZWqi2QOj/CiDNcKbVqwVoew= -golang.org/x/sys v0.0.0-20220712014510-0a85c31ab51e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20220411224347-583f2d630306 h1:+gHMid33q6pen7kv9xvT+JRinntgeXO2AeZVd0AWD3w= -golang.org/x/time v0.0.0-20220411224347-583f2d630306/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= +golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U= -golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/internal/metricAggregator/metricAggregator.go b/internal/metricAggregator/metricAggregator.go index 50bc963..170b13e 100644 --- a/internal/metricAggregator/metricAggregator.go +++ b/internal/metricAggregator/metricAggregator.go @@ -121,7 +121,12 @@ func (c *metricAggregator) Eval(starttime time.Time, endtime time.Time, metrics vars["endtime"] = endtime for _, f := range c.functions { cclog.ComponentDebug("MetricCache", "COLLECT", f.Name, "COND", f.Condition) - values := make([]float64, 0) + var valuesFloat64 []float64 + var valuesFloat32 []float32 + var valuesInt []int + var valuesInt32 []int32 + var valuesInt64 []int64 + var valuesBool []bool matches := make([]lp.CCMetric, 0) for _, m := range metrics { vars["metric"] = m @@ -136,17 +141,17 @@ func (c *metricAggregator) Eval(starttime time.Time, endtime time.Time, metrics if valid { switch x := v.(type) { case float64: - values = append(values, x) + valuesFloat64 = append(valuesFloat64, x) case float32: + valuesFloat32 = append(valuesFloat32, x) case int: + valuesInt = append(valuesInt, x) + case int32: + valuesInt32 = append(valuesInt32, x) case int64: - values = append(values, float64(x)) + valuesInt64 = append(valuesInt64, x) case bool: - if x { - values = append(values, float64(1.0)) - } else { - values = append(values, float64(0.0)) - } + valuesBool = append(valuesBool, x) default: cclog.ComponentError("MetricCache", "COLLECT ADD VALUE", v, "FAILED") } @@ -155,13 +160,59 @@ func (c *metricAggregator) Eval(starttime time.Time, endtime time.Time, metrics } } delete(vars, "metric") - cclog.ComponentDebug("MetricCache", "EVALUATE", f.Name, "METRICS", len(values), "CALC", f.Function) - vars["values"] = values + + // Check, that only values of one type were collected + countValueTypes := 0 + if len(valuesFloat64) > 0 { + countValueTypes += 1 + } + if len(valuesFloat32) > 0 { + countValueTypes += 1 + } + if len(valuesInt) > 0 { + countValueTypes += 1 + } + if len(valuesInt32) > 0 { + countValueTypes += 1 + } + if len(valuesInt64) > 0 { + countValueTypes += 1 + } + if len(valuesBool) > 0 { + countValueTypes += 1 + } + if countValueTypes > 1 { + cclog.ComponentError("MetricCache", "Collected values of different types") + } + + var len_values int + switch { + case len(valuesFloat64) > 0: + vars["values"] = valuesFloat64 + len_values = len(valuesFloat64) + case len(valuesFloat32) > 0: + vars["values"] = valuesFloat32 + len_values = len(valuesFloat32) + case len(valuesInt) > 0: + vars["values"] = valuesInt + len_values = len(valuesInt) + case len(valuesInt32) > 0: + vars["values"] = valuesInt32 + len_values = len(valuesInt32) + case len(valuesInt64) > 0: + vars["values"] = valuesInt64 + len_values = len(valuesInt64) + case len(valuesBool) > 0: + vars["values"] = valuesBool + len_values = len(valuesBool) + } + cclog.ComponentDebug("MetricCache", "EVALUATE", f.Name, "METRICS", len_values, "CALC", f.Function) + vars["metrics"] = matches - if len(values) > 0 { + if len_values > 0 { value, err := gval.Evaluate(f.Function, vars, c.language) if err != nil { - cclog.ComponentError("MetricCache", "EVALUATE", f.Name, "METRICS", len(values), "CALC", f.Function, ":", err.Error()) + cclog.ComponentError("MetricCache", "EVALUATE", f.Name, "METRICS", len_values, "CALC", f.Function, ":", err.Error()) break } @@ -316,7 +367,7 @@ func EvalBoolCondition(condition string, params map[string]interface{}) (bool, e return value, err } -func EvalFloat64Condition(condition string, params map[string]interface{}) (float64, error) { +func EvalFloat64Condition(condition string, params map[string]float64) (float64, error) { evaluables.mutex.Lock() evaluable, ok := evaluables.mapping[condition] evaluables.mutex.Unlock() diff --git a/internal/metricAggregator/metricAggregatorFunctions.go b/internal/metricAggregator/metricAggregatorFunctions.go index 68d205b..0f1468b 100644 --- a/internal/metricAggregator/metricAggregatorFunctions.go +++ b/internal/metricAggregator/metricAggregatorFunctions.go @@ -3,12 +3,11 @@ package metricAggregator import ( "errors" "fmt" - "math" "regexp" - "sort" "strings" - cclog "github.com/ClusterCockpit/cc-metric-collector/pkg/ccLogger" + "golang.org/x/exp/slices" + topo "github.com/ClusterCockpit/cc-metric-collector/pkg/ccTopology" ) @@ -16,149 +15,155 @@ import ( * Arithmetic functions on value arrays */ -// Sum up values -func sumfunc(args ...interface{}) (interface{}, error) { - s := 0.0 - values, ok := args[0].([]float64) - if ok { - cclog.ComponentDebug("MetricCache", "SUM FUNC START") - for _, x := range values { - s += x - } - cclog.ComponentDebug("MetricCache", "SUM FUNC END", s) - } else { - cclog.ComponentDebug("MetricCache", "SUM FUNC CAST FAILED") +func sumAnyType[T float64 | float32 | int | int32 | int64](values []T) (T, error) { + if len(values) == 0 { + return 0.0, errors.New("sum function requires at least one argument") } - return s, nil + var sum T + for _, value := range values { + sum += value + } + return sum, nil } -// Get the minimum value -func minfunc(args ...interface{}) (interface{}, error) { - var err error = nil - switch values := args[0].(type) { +// Sum up values +func sumfunc(args interface{}) (interface{}, error) { + + var err error + switch values := args.(type) { case []float64: - var s float64 = math.MaxFloat64 - for _, x := range values { - if x < s { - s = x - } - } - return s, nil + return sumAnyType(values) case []float32: - var s float32 = math.MaxFloat32 - for _, x := range values { - if x < s { - s = x - } - } - return s, nil + return sumAnyType(values) case []int: - var s int = int(math.MaxInt32) - for _, x := range values { - if x < s { - s = x - } - } - return s, nil + return sumAnyType(values) case []int64: - var s int64 = math.MaxInt64 - for _, x := range values { - if x < s { - s = x - } - } - return s, nil + return sumAnyType(values) case []int32: - var s int32 = math.MaxInt32 - for _, x := range values { - if x < s { - s = x - } - } - return s, nil + return sumAnyType(values) default: - err = errors.New("function 'min' only on list of values (float64, float32, int, int32, int64)") + err = errors.New("function 'sum' only on list of values (float64, float32, int, int32, int64)") } return 0.0, err } -// Get the average or mean value -func avgfunc(args ...interface{}) (interface{}, error) { - switch values := args[0].(type) { - case []float64: - var s float64 = 0 - for _, x := range values { - s += x - } - return s / float64(len(values)), nil - case []float32: - var s float32 = 0 - for _, x := range values { - s += x - } - return s / float32(len(values)), nil - case []int: - var s int = 0 - for _, x := range values { - s += x - } - return s / len(values), nil - case []int64: - var s int64 = 0 - for _, x := range values { - s += x - } - return s / int64(len(values)), nil +func minAnyType[T float64 | float32 | int | int32 | int64](values []T) (T, error) { + if len(values) == 0 { + return 0.0, errors.New("min function requires at least one argument") } - return 0.0, nil + return slices.Min(values), nil +} + +// Get the minimum value +func minfunc(args interface{}) (interface{}, error) { + switch values := args.(type) { + case []float64: + return minAnyType(values) + case []float32: + return minAnyType(values) + case []int: + return minAnyType(values) + case []int64: + return minAnyType(values) + case []int32: + return minAnyType(values) + default: + return 0.0, errors.New("function 'min' only on list of values (float64, float32, int, int32, int64)") + } +} + +func avgAnyType[T float64 | float32 | int | int32 | int64](values []T) (float64, error) { + if len(values) == 0 { + return 0.0, errors.New("average function requires at least one argument") + } + sum, err := sumAnyType[T](values) + return float64(sum) / float64(len(values)), err +} + +// Get the average or mean value +func avgfunc(args interface{}) (interface{}, error) { + switch values := args.(type) { + case []float64: + return avgAnyType(values) + case []float32: + return avgAnyType(values) + case []int: + return avgAnyType(values) + case []int64: + return avgAnyType(values) + case []int32: + return avgAnyType(values) + default: + return 0.0, errors.New("function 'average' only on list of values (float64, float32, int, int32, int64)") + } +} + +func maxAnyType[T float64 | float32 | int | int32 | int64](values []T) (T, error) { + if len(values) == 0 { + return 0.0, errors.New("max function requires at least one argument") + } + return slices.Max(values), nil } // Get the maximum value -func maxfunc(args ...interface{}) (interface{}, error) { - s := 0.0 - values, ok := args[0].([]float64) - if ok { - for _, x := range values { - if x > s { - s = x - } - } +func maxfunc(args interface{}) (interface{}, error) { + switch values := args.(type) { + case []float64: + return maxAnyType(values) + case []float32: + return maxAnyType(values) + case []int: + return maxAnyType(values) + case []int64: + return maxAnyType(values) + case []int32: + return maxAnyType(values) + default: + return 0.0, errors.New("function 'max' only on list of values (float64, float32, int, int32, int64)") } - return s, nil +} + +func medianAnyType[T float64 | float32 | int | int32 | int64](values []T) (T, error) { + if len(values) == 0 { + return 0.0, errors.New("median function requires at least one argument") + } + slices.Sort(values) + var median T + if midPoint := len(values) % 2; midPoint == 0 { + median = (values[midPoint-1] + values[midPoint]) / 2 + } else { + median = values[midPoint] + } + return median, nil } // Get the median value -func medianfunc(args ...interface{}) (interface{}, error) { - switch values := args[0].(type) { +func medianfunc(args interface{}) (interface{}, error) { + switch values := args.(type) { case []float64: - sort.Float64s(values) - return values[len(values)/2], nil - // case []float32: - // sort.Float64s(values) - // return values[len(values)/2], nil + return medianAnyType(values) + case []float32: + return medianAnyType(values) case []int: - sort.Ints(values) - return values[len(values)/2], nil - - // case []int64: - // sort.Ints(values) - // return values[len(values)/2], nil - // case []int32: - // sort.Ints(values) - // return values[len(values)/2], nil + return medianAnyType(values) + case []int64: + return medianAnyType(values) + case []int32: + return medianAnyType(values) + default: + return 0.0, errors.New("function 'median' only on list of values (float64, float32, int, int32, int64)") } - return 0.0, errors.New("function 'median()' only on lists of type float64 and int") } /* * Get number of values in list. Returns always an int */ -func lenfunc(args ...interface{}) (interface{}, error) { +func lenfunc(args interface{}) (interface{}, error) { var err error = nil var length int = 0 - switch values := args[0].(type) { + switch values := args.(type) { case []float64: length = len(values) case []float32: @@ -243,8 +248,8 @@ func matchfunc(args ...interface{}) (interface{}, error) { */ // for a given cpuid, it returns the core id -func getCpuCoreFunc(args ...interface{}) (interface{}, error) { - switch cpuid := args[0].(type) { +func getCpuCoreFunc(args interface{}) (interface{}, error) { + switch cpuid := args.(type) { case int: return topo.GetHwthreadCore(cpuid), nil } @@ -252,8 +257,8 @@ func getCpuCoreFunc(args ...interface{}) (interface{}, error) { } // for a given cpuid, it returns the socket id -func getCpuSocketFunc(args ...interface{}) (interface{}, error) { - switch cpuid := args[0].(type) { +func getCpuSocketFunc(args interface{}) (interface{}, error) { + switch cpuid := args.(type) { case int: return topo.GetHwthreadSocket(cpuid), nil } @@ -261,8 +266,8 @@ func getCpuSocketFunc(args ...interface{}) (interface{}, error) { } // for a given cpuid, it returns the id of the NUMA node -func getCpuNumaDomainFunc(args ...interface{}) (interface{}, error) { - switch cpuid := args[0].(type) { +func getCpuNumaDomainFunc(args interface{}) (interface{}, error) { + switch cpuid := args.(type) { case int: return topo.GetHwthreadNumaDomain(cpuid), nil } @@ -270,8 +275,8 @@ func getCpuNumaDomainFunc(args ...interface{}) (interface{}, error) { } // for a given cpuid, it returns the id of the CPU die -func getCpuDieFunc(args ...interface{}) (interface{}, error) { - switch cpuid := args[0].(type) { +func getCpuDieFunc(args interface{}) (interface{}, error) { + switch cpuid := args.(type) { case int: return topo.GetHwthreadDie(cpuid), nil } @@ -279,13 +284,13 @@ func getCpuDieFunc(args ...interface{}) (interface{}, error) { } // for a given core id, it returns the list of cpuids -func getCpuListOfCoreFunc(args ...interface{}) (interface{}, error) { +func getCpuListOfCoreFunc(args interface{}) (interface{}, error) { cpulist := make([]int, 0) - switch in := args[0].(type) { + switch in := args.(type) { case int: for _, c := range topo.CpuData() { if c.Core == in { - cpulist = append(cpulist, c.Cpuid) + cpulist = append(cpulist, c.CpuID) } } } @@ -293,13 +298,13 @@ func getCpuListOfCoreFunc(args ...interface{}) (interface{}, error) { } // for a given socket id, it returns the list of cpuids -func getCpuListOfSocketFunc(args ...interface{}) (interface{}, error) { +func getCpuListOfSocketFunc(args interface{}) (interface{}, error) { cpulist := make([]int, 0) - switch in := args[0].(type) { + switch in := args.(type) { case int: for _, c := range topo.CpuData() { if c.Socket == in { - cpulist = append(cpulist, c.Cpuid) + cpulist = append(cpulist, c.CpuID) } } } @@ -307,13 +312,13 @@ func getCpuListOfSocketFunc(args ...interface{}) (interface{}, error) { } // for a given id of a NUMA domain, it returns the list of cpuids -func getCpuListOfNumaDomainFunc(args ...interface{}) (interface{}, error) { +func getCpuListOfNumaDomainFunc(args interface{}) (interface{}, error) { cpulist := make([]int, 0) - switch in := args[0].(type) { + switch in := args.(type) { case int: for _, c := range topo.CpuData() { - if c.Numadomain == in { - cpulist = append(cpulist, c.Cpuid) + if c.NumaDomain == in { + cpulist = append(cpulist, c.CpuID) } } } @@ -321,13 +326,13 @@ func getCpuListOfNumaDomainFunc(args ...interface{}) (interface{}, error) { } // for a given CPU die id, it returns the list of cpuids -func getCpuListOfDieFunc(args ...interface{}) (interface{}, error) { +func getCpuListOfDieFunc(args interface{}) (interface{}, error) { cpulist := make([]int, 0) - switch in := args[0].(type) { + switch in := args.(type) { case int: for _, c := range topo.CpuData() { if c.Die == in { - cpulist = append(cpulist, c.Cpuid) + cpulist = append(cpulist, c.CpuID) } } } @@ -335,7 +340,7 @@ func getCpuListOfDieFunc(args ...interface{}) (interface{}, error) { } // wrapper function to get a list of all cpuids of the node -func getCpuListOfNode(args ...interface{}) (interface{}, error) { +func getCpuListOfNode() (interface{}, error) { return topo.HwthreadList(), nil } diff --git a/pkg/ccMetric/ccMetric.go b/pkg/ccMetric/ccMetric.go index 8ad18cc..767888e 100644 --- a/pkg/ccMetric/ccMetric.go +++ b/pkg/ccMetric/ccMetric.go @@ -7,6 +7,7 @@ import ( influxdb2 "github.com/influxdata/influxdb-client-go/v2" write "github.com/influxdata/influxdb-client-go/v2/api/write" lp "github.com/influxdata/line-protocol" // MIT license + "golang.org/x/exp/maps" ) // Most functions are derived from github.com/influxdata/line-protocol/metric.go @@ -64,9 +65,11 @@ func (m *ccMetric) String() string { // ToLineProtocol generates influxDB line protocol for data type ccMetric func (m *ccMetric) ToPoint(metaAsTags map[string]bool) (p *write.Point) { p = influxdb2.NewPoint(m.name, m.tags, m.fields, m.tm) - for key, ok1 := range metaAsTags { - if val, ok2 := m.GetMeta(key); ok1 && ok2 { - p.AddTag(key, val) + for key, use_as_tag := range metaAsTags { + if use_as_tag { + if value, ok := m.GetMeta(key); ok { + p.AddTag(key, value) + } } } return p @@ -193,19 +196,13 @@ func New( ) (CCMetric, error) { m := &ccMetric{ name: name, - tags: make(map[string]string, len(tags)), - meta: make(map[string]string, len(meta)), + tags: maps.Clone(tags), + meta: maps.Clone(meta), fields: make(map[string]interface{}, len(fields)), tm: tm, } - // deep copy tags, meta data tags and fields - for k, v := range tags { - m.tags[k] = v - } - for k, v := range meta { - m.meta[k] = v - } + // deep copy fields for k, v := range fields { v := convertField(v) if v == nil { @@ -219,28 +216,14 @@ func New( // FromMetric copies the metric func FromMetric(other CCMetric) CCMetric { - otags := other.Tags() - ometa := other.Meta() - ofields := other.Fields() - m := &ccMetric{ + + return &ccMetric{ name: other.Name(), - tags: make(map[string]string, len(otags)), - meta: make(map[string]string, len(ometa)), - fields: make(map[string]interface{}, len(ofields)), + tags: maps.Clone(other.Tags()), + meta: maps.Clone(other.Meta()), + fields: maps.Clone(other.Fields()), tm: other.Time(), } - - // deep copy tags, meta data tags and fields - for key, value := range otags { - m.tags[key] = value - } - for key, value := range ometa { - m.meta[key] = value - } - for key, value := range ofields { - m.fields[key] = value - } - return m } // FromInfluxMetric copies the influxDB line protocol metric @@ -264,8 +247,10 @@ func FromInfluxMetric(other lp.Metric) CCMetric { } // convertField converts data types of fields by the following schemata: -// *float32, *float64, float32, float64 -> float64 -// *int, *int8, *int16, *int32, *int64, int, int8, int16, int32, int64 -> int64 +// +// *float32, *float64, float32, float64 -> float64 +// *int, *int8, *int16, *int32, *int64, int, int8, int16, int32, int64 -> int64 +// // *uint, *uint8, *uint16, *uint32, *uint64, uint, uint8, uint16, uint32, uint64 -> uint64 // *[]byte, *string, []byte, string -> string // *bool, bool -> bool diff --git a/pkg/ccTopology/ccTopology.go b/pkg/ccTopology/ccTopology.go index f7d7092..a3ebec6 100644 --- a/pkg/ccTopology/ccTopology.go +++ b/pkg/ccTopology/ccTopology.go @@ -2,7 +2,6 @@ package ccTopology import ( "fmt" - "io/ioutil" "log" "os" "path/filepath" @@ -11,93 +10,247 @@ import ( "strings" cclogger "github.com/ClusterCockpit/cc-metric-collector/pkg/ccLogger" + "golang.org/x/exp/slices" ) -const SYSFS_NUMABASE = `/sys/devices/system/node` const SYSFS_CPUBASE = `/sys/devices/system/cpu` -const PROCFS_CPUINFO = `/proc/cpuinfo` -// intArrayContains scans an array of ints if the value str is present in the array -// If the specified value is found, the corresponding array index is returned. -// The bool value is used to signal success or failure -func intArrayContains(array []int, str int) (int, bool) { - for i, a := range array { - if a == str { - return i, true - } - } - return -1, false +// Structure holding all information about a hardware thread +// See https://www.kernel.org/doc/Documentation/ABI/stable/sysfs-devices-system-cpu +type HwthreadEntry struct { + // for each CPUx: + CpuID int // CPU / hardware thread ID + SMT int // Simultaneous Multithreading ID + CoreCPUsList []int // CPUs within the same core + Core int // Socket local core ID + Socket int // Sockets (physical) ID + Die int // Die ID + NumaDomain int // NUMA Domain } -// Used internally for sysfs file reads +var cache struct { + HwthreadList []int // List of CPU hardware threads + SMTList []int // List of symmetric hyper threading IDs + CoreList []int // List of CPU core IDs + SocketList []int // List of CPU sockets (physical) IDs + DieList []int // List of CPU Die IDs + NumaDomainList []int // List of NUMA Domains + + CpuData []HwthreadEntry +} + +// fileToInt reads an integer value from a sysfs file +// In case of an error -1 is returned func fileToInt(path string) int { - buffer, err := ioutil.ReadFile(path) + buffer, err := os.ReadFile(path) if err != nil { log.Print(err) - cclogger.ComponentError("ccTopology", "Reading", path, ":", err.Error()) + cclogger.ComponentError("ccTopology", "fileToInt", "Reading", path, ":", err.Error()) return -1 } - sbuffer := strings.Replace(string(buffer), "\n", "", -1) - var id int64 - //_, err = fmt.Scanf("%d", sbuffer, &id) - id, err = strconv.ParseInt(sbuffer, 10, 32) + stringBuffer := strings.TrimSpace(string(buffer)) + id, err := strconv.Atoi(stringBuffer) if err != nil { - cclogger.ComponentError("ccTopology", "Parsing", path, ":", sbuffer, err.Error()) + cclogger.ComponentError("ccTopology", "fileToInt", "Parsing", path, ":", stringBuffer, err.Error()) return -1 } - return int(id) + return id } -// Get list of CPU socket IDs +// fileToList reads a list from a sysfs file +// A list consists of value ranges separated by colon +// A range can be a single value or a range of values given by a startValue-endValue +// In case of an error nil is returned +func fileToList(path string) []int { + // Read list + buffer, err := os.ReadFile(path) + if err != nil { + log.Print(err) + cclogger.ComponentError("ccTopology", "fileToList", "Reading", path, ":", err.Error()) + return nil + } + + // Create list + list := make([]int, 0) + stringBuffer := strings.TrimSpace(string(buffer)) + for _, valueRangeString := range strings.Split(stringBuffer, ",") { + valueRange := strings.Split(valueRangeString, "-") + switch len(valueRange) { + case 1: + singleValue, err := strconv.Atoi(valueRange[0]) + if err != nil { + cclogger.ComponentError("CCTopology", "fileToList", "Parsing", valueRange[0], ":", err.Error()) + return nil + } + list = append(list, singleValue) + case 2: + startValue, err := strconv.Atoi(valueRange[0]) + if err != nil { + cclogger.ComponentError("CCTopology", "fileToList", "Parsing", valueRange[0], ":", err.Error()) + return nil + } + endValue, err := strconv.Atoi(valueRange[1]) + if err != nil { + cclogger.ComponentError("CCTopology", "fileToList", "Parsing", valueRange[1], ":", err.Error()) + return nil + } + for value := startValue; value <= endValue; value++ { + list = append(list, value) + } + } + } + + return list +} + +// init initializes the cache structure +func init() { + + getHWThreads := + func() []int { + globPath := filepath.Join(SYSFS_CPUBASE, "cpu[0-9]*") + regexPath := filepath.Join(SYSFS_CPUBASE, "cpu([[:digit:]]+)") + regex := regexp.MustCompile(regexPath) + + // File globbing for hardware threads + files, err := filepath.Glob(globPath) + if err != nil { + cclogger.ComponentError("CCTopology", "init:getHWThreads", err.Error()) + return nil + } + + hwThreadIDs := make([]int, len(files)) + for i, file := range files { + // Extract hardware thread ID + matches := regex.FindStringSubmatch(file) + if len(matches) != 2 { + cclogger.ComponentError("CCTopology", "init:getHWThreads: Failed to extract hardware thread ID from ", file) + return nil + } + + // Convert hardware thread ID to int + id, err := strconv.Atoi(matches[1]) + if err != nil { + cclogger.ComponentError("CCTopology", "init:getHWThreads: Failed to convert to int hardware thread ID ", matches[1]) + return nil + } + + hwThreadIDs[i] = id + } + + // Sort hardware thread IDs + slices.Sort(hwThreadIDs) + return hwThreadIDs + } + + getNumaDomain := + func(basePath string) int { + globPath := filepath.Join(basePath, "node*") + regexPath := filepath.Join(basePath, "node([[:digit:]]+)") + regex := regexp.MustCompile(regexPath) + + // File globbing for NUMA node + files, err := filepath.Glob(globPath) + if err != nil { + cclogger.ComponentError("CCTopology", "init:getNumaDomain", err.Error()) + return -1 + } + + // Check, that exactly one NUMA domain was found + if len(files) != 1 { + cclogger.ComponentError("CCTopology", "init:getNumaDomain", "Number of NUMA domains != 1: ", len(files)) + return -1 + } + + // Extract NUMA node ID + matches := regex.FindStringSubmatch(files[0]) + if len(matches) != 2 { + cclogger.ComponentError("CCTopology", "init:getNumaDomain", "Failed to extract NUMA node ID from: ", files[0]) + return -1 + } + + id, err := strconv.Atoi(matches[1]) + if err != nil { + cclogger.ComponentError("CCTopology", "init:getNumaDomain", "Failed to parse NUMA node ID from: ", matches[1]) + return -1 + } + + return id + } + + cache.HwthreadList = getHWThreads() + cache.CoreList = make([]int, len(cache.HwthreadList)) + cache.SocketList = make([]int, len(cache.HwthreadList)) + cache.DieList = make([]int, len(cache.HwthreadList)) + cache.SMTList = make([]int, len(cache.HwthreadList)) + cache.NumaDomainList = make([]int, len(cache.HwthreadList)) + cache.CpuData = make([]HwthreadEntry, len(cache.HwthreadList)) + for i, c := range cache.HwthreadList { + // Set cpuBase directory for topology lookup + cpuBase := filepath.Join(SYSFS_CPUBASE, fmt.Sprintf("cpu%d", c)) + topoBase := filepath.Join(cpuBase, "topology") + + // Lookup Core ID + cache.CoreList[i] = fileToInt(filepath.Join(topoBase, "core_id")) + + // Lookup socket / physical package ID + cache.SocketList[i] = fileToInt(filepath.Join(topoBase, "physical_package_id")) + + // Lookup CPU die id + cache.DieList[i] = fileToInt(filepath.Join(topoBase, "die_id")) + if cache.DieList[i] < 0 { + cache.DieList[i] = cache.SocketList[i] + } + + // Lookup List of CPUs within the same core + coreCPUsList := fileToList(filepath.Join(topoBase, "core_cpus_list")) + + // Find index of CPU ID in List of CPUs within the same core + // if not found return -1 + cache.SMTList[i] = slices.Index(coreCPUsList, c) + + // Lookup NUMA domain id + cache.NumaDomainList[i] = getNumaDomain(cpuBase) + + cache.CpuData[i] = + HwthreadEntry{ + CpuID: cache.HwthreadList[i], + SMT: cache.SMTList[i], + CoreCPUsList: coreCPUsList, + Socket: cache.SocketList[i], + NumaDomain: cache.NumaDomainList[i], + Die: cache.DieList[i], + Core: cache.CoreList[i], + } + } + + slices.Sort(cache.HwthreadList) + cache.HwthreadList = slices.Compact(cache.HwthreadList) + + slices.Sort(cache.SMTList) + cache.SMTList = slices.Compact(cache.SMTList) + + slices.Sort(cache.CoreList) + cache.CoreList = slices.Compact(cache.CoreList) + + slices.Sort(cache.SocketList) + cache.SocketList = slices.Compact(cache.SocketList) + + slices.Sort(cache.DieList) + cache.DieList = slices.Compact(cache.DieList) + + slices.Sort(cache.NumaDomainList) + cache.NumaDomainList = slices.Compact(cache.NumaDomainList) +} + +// SocketList gets the list of CPU socket IDs func SocketList() []int { - buffer, err := ioutil.ReadFile(string(PROCFS_CPUINFO)) - if err != nil { - log.Print(err) - return nil - } - ll := strings.Split(string(buffer), "\n") - packs := make([]int, 0) - for _, line := range ll { - if strings.HasPrefix(line, "physical id") { - lv := strings.Fields(line) - id, err := strconv.ParseInt(lv[3], 10, 32) - if err != nil { - log.Print(err) - return packs - } - _, found := intArrayContains(packs, int(id)) - if !found { - packs = append(packs, int(id)) - } - } - } - return packs + return slices.Clone(cache.SocketList) } -// Get list of hardware thread IDs in the order of listing in /proc/cpuinfo +// HwthreadList gets the list of hardware thread IDs in the order of listing in /proc/cpuinfo func HwthreadList() []int { - buffer, err := ioutil.ReadFile(string(PROCFS_CPUINFO)) - if err != nil { - log.Print(err) - return nil - } - ll := strings.Split(string(buffer), "\n") - cpulist := make([]int, 0) - for _, line := range ll { - if strings.HasPrefix(line, "processor") { - lv := strings.Fields(line) - id, err := strconv.ParseInt(lv[2], 10, 32) - if err != nil { - log.Print(err) - return cpulist - } - _, found := intArrayContains(cpulist, int(id)) - if !found { - cpulist = append(cpulist, int(id)) - } - } - } - return cpulist + return slices.Clone(cache.HwthreadList) } // Get list of hardware thread IDs in the order of listing in /proc/cpuinfo @@ -106,88 +259,25 @@ func CpuList() []int { return HwthreadList() } -// Get list of CPU core IDs in the order of listing in /proc/cpuinfo +// CoreList gets the list of CPU core IDs in the order of listing in /proc/cpuinfo func CoreList() []int { - buffer, err := ioutil.ReadFile(string(PROCFS_CPUINFO)) - if err != nil { - log.Print(err) - return nil - } - ll := strings.Split(string(buffer), "\n") - corelist := make([]int, 0) - for _, line := range ll { - if strings.HasPrefix(line, "core id") { - lv := strings.Fields(line) - id, err := strconv.ParseInt(lv[3], 10, 32) - if err != nil { - log.Print(err) - return corelist - } - _, found := intArrayContains(corelist, int(id)) - if !found { - corelist = append(corelist, int(id)) - } - } - } - return corelist + return slices.Clone(cache.CoreList) } // Get list of NUMA node IDs func NumaNodeList() []int { - numaList := make([]int, 0) - globPath := filepath.Join(string(SYSFS_NUMABASE), "node*") - regexPath := filepath.Join(string(SYSFS_NUMABASE), "node(\\d+)") - regex := regexp.MustCompile(regexPath) - files, err := filepath.Glob(globPath) - if err != nil { - cclogger.ComponentError("CCTopology", "NumaNodeList", err.Error()) - } - for _, f := range files { - if !regex.MatchString(f) { - continue - } - finfo, err := os.Lstat(f) - if err != nil { - continue - } - if !finfo.IsDir() { - continue - } - matches := regex.FindStringSubmatch(f) - if len(matches) == 2 { - id, err := strconv.Atoi(matches[1]) - if err == nil { - if _, found := intArrayContains(numaList, id); !found { - numaList = append(numaList, id) - } - } - } - - } - return numaList + return slices.Clone(cache.NumaDomainList) } -// Get list of CPU die IDs +// DieList gets the list of CPU die IDs func DieList() []int { - cpulist := HwthreadList() - dielist := make([]int, 0) - for _, c := range cpulist { - diepath := filepath.Join(string(SYSFS_CPUBASE), fmt.Sprintf("cpu%d", c), "topology/die_id") - dieid := fileToInt(diepath) - if dieid > 0 { - _, found := intArrayContains(dielist, int(dieid)) - if !found { - dielist = append(dielist, int(dieid)) - } - } - } - if len(dielist) > 0 { - return dielist + if len(cache.DieList) > 0 { + return slices.Clone(cache.DieList) } return SocketList() } -// Get list of specified type using the naming format inside ClusterCockpit +// GetTypeList gets the list of specified type using the naming format inside ClusterCockpit func GetTypeList(topology_type string) []int { switch topology_type { case "node": @@ -206,128 +296,14 @@ func GetTypeList(topology_type string) []int { return []int{} } -// Structure holding all information about a hardware thread -type HwthreadEntry struct { - Cpuid int - SMT int - Core int - Socket int - Numadomain int - Die int -} - +// CpuData returns CPU data for each hardware thread func CpuData() []HwthreadEntry { - - // fileToInt := func(path string) int { - // buffer, err := ioutil.ReadFile(path) - // if err != nil { - // log.Print(err) - // //cclogger.ComponentError("ccTopology", "Reading", path, ":", err.Error()) - // return -1 - // } - // sbuffer := strings.Replace(string(buffer), "\n", "", -1) - // var id int64 - // //_, err = fmt.Scanf("%d", sbuffer, &id) - // id, err = strconv.ParseInt(sbuffer, 10, 32) - // if err != nil { - // cclogger.ComponentError("ccTopology", "Parsing", path, ":", sbuffer, err.Error()) - // return -1 - // } - // return int(id) - // } - getCore := func(basepath string) int { - return fileToInt(fmt.Sprintf("%s/core_id", basepath)) + // return a deep copy to protect cache data + c := slices.Clone(cache.CpuData) + for i := range c { + c[i].CoreCPUsList = slices.Clone(cache.CpuData[i].CoreCPUsList) } - - getSocket := func(basepath string) int { - return fileToInt(fmt.Sprintf("%s/physical_package_id", basepath)) - } - - getDie := func(basepath string) int { - return fileToInt(fmt.Sprintf("%s/die_id", basepath)) - } - - getSMT := func(cpuid int, basepath string) int { - buffer, err := ioutil.ReadFile(fmt.Sprintf("%s/thread_siblings_list", basepath)) - if err != nil { - cclogger.ComponentError("CCTopology", "CpuData:getSMT", err.Error()) - } - threadlist := make([]int, 0) - sbuffer := strings.Replace(string(buffer), "\n", "", -1) - for _, x := range strings.Split(sbuffer, ",") { - id, err := strconv.ParseInt(x, 10, 32) - if err != nil { - cclogger.ComponentError("CCTopology", "CpuData:getSMT", err.Error()) - } - threadlist = append(threadlist, int(id)) - } - for i, x := range threadlist { - if x == cpuid { - return i - } - } - return 1 - } - - getNumaDomain := func(basepath string) int { - globPath := filepath.Join(basepath, "node*") - regexPath := filepath.Join(basepath, "node(\\d+)") - regex := regexp.MustCompile(regexPath) - files, err := filepath.Glob(globPath) - if err != nil { - cclogger.ComponentError("CCTopology", "CpuData:getNumaDomain", err.Error()) - } - for _, f := range files { - finfo, err := os.Lstat(f) - if err == nil && finfo.IsDir() { - matches := regex.FindStringSubmatch(f) - if len(matches) == 2 { - id, err := strconv.Atoi(matches[1]) - if err == nil { - return id - } - } - } - } - return 0 - } - - clist := make([]HwthreadEntry, 0) - for _, c := range HwthreadList() { - clist = append(clist, HwthreadEntry{Cpuid: c}) - } - for i, centry := range clist { - centry.Socket = -1 - centry.Numadomain = -1 - centry.Die = -1 - centry.Core = -1 - // Set base directory for topology lookup - cpustr := fmt.Sprintf("cpu%d", centry.Cpuid) - base := filepath.Join("/sys/devices/system/cpu", cpustr) - topoBase := filepath.Join(base, "topology") - - // Lookup CPU core id - centry.Core = getCore(topoBase) - - // Lookup CPU socket id - centry.Socket = getSocket(topoBase) - - // Lookup CPU die id - centry.Die = getDie(topoBase) - if centry.Die < 0 { - centry.Die = centry.Socket - } - - // Lookup SMT thread id - centry.SMT = getSMT(centry.Cpuid, topoBase) - - // Lookup NUMA domain id - centry.Numadomain = getNumaDomain(base) - - // Update values in output list - clist[i] = centry - } - return clist + return c } // Structure holding basic information about a CPU @@ -340,130 +316,110 @@ type CpuInformation struct { NumNumaDomains int } -// Get basic information about the CPU +// CpuInformation reports basic information about the CPU func CpuInfo() CpuInformation { - var c CpuInformation - - smtList := make([]int, 0) - numaList := make([]int, 0) - dieList := make([]int, 0) - socketList := make([]int, 0) - coreList := make([]int, 0) - cdata := CpuData() - for _, d := range cdata { - if _, ok := intArrayContains(smtList, d.SMT); !ok { - smtList = append(smtList, d.SMT) - } - if _, ok := intArrayContains(numaList, d.Numadomain); !ok { - numaList = append(numaList, d.Numadomain) - } - if _, ok := intArrayContains(dieList, d.Die); !ok { - dieList = append(dieList, d.Die) - } - if _, ok := intArrayContains(socketList, d.Socket); !ok { - socketList = append(socketList, d.Socket) - } - if _, ok := intArrayContains(coreList, d.Core); !ok { - coreList = append(coreList, d.Core) - } + return CpuInformation{ + NumNumaDomains: len(cache.NumaDomainList), + SMTWidth: len(cache.SMTList), + NumDies: len(cache.DieList), + NumCores: len(cache.CoreList), + NumSockets: len(cache.SocketList), + NumHWthreads: len(cache.HwthreadList), } - c.NumNumaDomains = len(numaList) - c.SMTWidth = len(smtList) - c.NumDies = len(dieList) - c.NumCores = len(coreList) - c.NumSockets = len(socketList) - c.NumHWthreads = len(cdata) - return c } -// Get the CPU socket ID for a given hardware thread ID -func GetHwthreadSocket(cpuid int) int { - cdata := CpuData() - for _, d := range cdata { - if d.Cpuid == cpuid { +// GetHwthreadSocket gets the CPU socket ID for a given hardware thread ID +// In case hardware thread ID is not found -1 is returned +func GetHwthreadSocket(cpuID int) int { + for i := range cache.CpuData { + d := &cache.CpuData[i] + if d.CpuID == cpuID { return d.Socket } } return -1 } -// Get the NUMA node ID for a given hardware thread ID -func GetHwthreadNumaDomain(cpuid int) int { - cdata := CpuData() - for _, d := range cdata { - if d.Cpuid == cpuid { - return d.Numadomain +// GetHwthreadNumaDomain gets the NUMA domain ID for a given hardware thread ID +// In case hardware thread ID is not found -1 is returned +func GetHwthreadNumaDomain(cpuID int) int { + for i := range cache.CpuData { + d := &cache.CpuData[i] + if d.CpuID == cpuID { + return d.NumaDomain } } return -1 } -// Get the CPU die ID for a given hardware thread ID -func GetHwthreadDie(cpuid int) int { - cdata := CpuData() - for _, d := range cdata { - if d.Cpuid == cpuid { +// GetHwthreadDie gets the CPU die ID for a given hardware thread ID +// In case hardware thread ID is not found -1 is returned +func GetHwthreadDie(cpuID int) int { + for i := range cache.CpuData { + d := &cache.CpuData[i] + if d.CpuID == cpuID { return d.Die } } return -1 } -// Get the CPU core ID for a given hardware thread ID -func GetHwthreadCore(cpuid int) int { - cdata := CpuData() - for _, d := range cdata { - if d.Cpuid == cpuid { +// GetHwthreadCore gets the CPU core ID for a given hardware thread ID +// In case hardware thread ID is not found -1 is returned +func GetHwthreadCore(cpuID int) int { + for i := range cache.CpuData { + d := &cache.CpuData[i] + if d.CpuID == cpuID { return d.Core } } return -1 } -// Get the all hardware thread ID associated with a CPU socket +// GetSocketHwthreads gets all hardware thread IDs associated with a CPU socket func GetSocketHwthreads(socket int) []int { - all := CpuData() - cpulist := make([]int, 0) - for _, d := range all { + cpuList := make([]int, 0) + for i := range cache.CpuData { + d := &cache.CpuData[i] if d.Socket == socket { - cpulist = append(cpulist, d.Cpuid) + cpuList = append(cpuList, d.CpuID) } } - return cpulist + return cpuList } -// Get the all hardware thread ID associated with a NUMA node -func GetNumaDomainHwthreads(domain int) []int { - all := CpuData() - cpulist := make([]int, 0) - for _, d := range all { - if d.Numadomain == domain { - cpulist = append(cpulist, d.Cpuid) +// GetNumaDomainHwthreads gets the all hardware thread IDs associated with a NUMA domain +func GetNumaDomainHwthreads(numaDomain int) []int { + cpuList := make([]int, 0) + for i := range cache.CpuData { + d := &cache.CpuData[i] + if d.NumaDomain == numaDomain { + cpuList = append(cpuList, d.CpuID) } } - return cpulist + return cpuList } -// Get the all hardware thread ID associated with a CPU die +// GetDieHwthreads gets all hardware thread IDs associated with a CPU die func GetDieHwthreads(die int) []int { - all := CpuData() - cpulist := make([]int, 0) - for _, d := range all { + cpuList := make([]int, 0) + for i := range cache.CpuData { + d := &cache.CpuData[i] if d.Die == die { - cpulist = append(cpulist, d.Cpuid) + cpuList = append(cpuList, d.CpuID) } } - return cpulist + return cpuList } -// Get the all hardware thread ID associated with a CPU core +// GetCoreHwthreads get all hardware thread IDs associated with a CPU core func GetCoreHwthreads(core int) []int { - all := CpuData() - cpulist := make([]int, 0) - for _, d := range all { + cpuList := make([]int, 0) + for i := range cache.CpuData { + d := &cache.CpuData[i] if d.Core == core { - cpulist = append(cpulist, d.Cpuid) + cpuList = append(cpuList, d.CpuID) } } - return cpulist + return cpuList } diff --git a/receivers/README.md b/receivers/README.md index 3599a93..1f135fe 100644 --- a/receivers/README.md +++ b/receivers/README.md @@ -2,7 +2,7 @@ This folder contains the ReceiveManager and receiver implementations for the cc-metric-collector. -# Configuration +## Configuration The configuration file for the receivers is a list of configurations. The `type` field in each specifies which receiver to initialize. @@ -22,8 +22,11 @@ This allows to specify - [`nats`](./natsReceiver.md): Receive metrics from the NATS network - [`prometheus`](./prometheusReceiver.md): Scrape data from a Prometheus client - [`http`](./httpReceiver.md): Listen for HTTP Post requests transporting metrics in InfluxDB line protocol +- [`ipmi`](./ipmiReceiver.md): Read IPMI sensor readings +- [`redfish`](redfishReceiver.md) Use the Redfish (specification) to query thermal and power metrics + +## Contributing own receivers -# Contributing own receivers A receiver contains a few functions and is derived from the type `Receiver` (in `metricReceiver.go`): For an example, check the [sample receiver](./sampleReceiver.go) diff --git a/receivers/httpReceiver.go b/receivers/httpReceiver.go index efd31ac..f37c629 100644 --- a/receivers/httpReceiver.go +++ b/receivers/httpReceiver.go @@ -5,15 +5,14 @@ import ( "encoding/json" "errors" "fmt" - "io" "net/http" "strings" "sync" + "time" cclog "github.com/ClusterCockpit/cc-metric-collector/pkg/ccLogger" lp "github.com/ClusterCockpit/cc-metric-collector/pkg/ccMetric" - "github.com/gorilla/mux" - influx "github.com/influxdata/line-protocol" + influx "github.com/influxdata/line-protocol/v2/lineprotocol" ) const HTTP_RECEIVER_PORT = "8080" @@ -23,22 +22,39 @@ type HttpReceiverConfig struct { Addr string `json:"address"` Port string `json:"port"` Path string `json:"path"` + + // Maximum amount of time to wait for the next request when keep-alives are enabled + // should be larger than the measurement interval to keep the connection open + IdleTimeout string `json:"idle_timeout"` + idleTimeout time.Duration + + // Controls whether HTTP keep-alives are enabled. By default, keep-alives are enabled + KeepAlivesEnabled bool `json:"keep_alives_enabled"` + + // Basic authentication + Username string `json:"username"` + Password string `json:"password"` + useBasicAuth bool } type HttpReceiver struct { receiver - handler *influx.MetricHandler - parser *influx.Parser - meta map[string]string - config HttpReceiverConfig - router *mux.Router - server *http.Server - wg sync.WaitGroup + meta map[string]string + config HttpReceiverConfig + server *http.Server + wg sync.WaitGroup } func (r *HttpReceiver) Init(name string, config json.RawMessage) error { r.name = fmt.Sprintf("HttpReceiver(%s)", name) + + // Set default values r.config.Port = HTTP_RECEIVER_PORT + r.config.KeepAlivesEnabled = true + // should be larger than the measurement interval to keep the connection open + r.config.IdleTimeout = "120s" + + // Read config if len(config) > 0 { err := json.Unmarshal(config, &r.config) if err != nil { @@ -49,20 +65,47 @@ func (r *HttpReceiver) Init(name string, config json.RawMessage) error { if len(r.config.Port) == 0 { return errors.New("not all configuration variables set required by HttpReceiver") } + + // Check idle timeout config + if len(r.config.IdleTimeout) > 0 { + t, err := time.ParseDuration(r.config.IdleTimeout) + if err == nil { + cclog.ComponentDebug(r.name, "idleTimeout", t) + r.config.idleTimeout = t + } + } + + // Check basic authentication config + if len(r.config.Username) > 0 || len(r.config.Password) > 0 { + r.config.useBasicAuth = true + } + if r.config.useBasicAuth && len(r.config.Username) == 0 { + return errors.New("basic authentication requires username") + } + if r.config.useBasicAuth && len(r.config.Password) == 0 { + return errors.New("basic authentication requires password") + } + r.meta = map[string]string{"source": r.name} p := r.config.Path if !strings.HasPrefix(p, "/") { p = "/" + p } - uri := fmt.Sprintf("%s:%s%s", r.config.Addr, r.config.Port, p) - cclog.ComponentDebug(r.name, "INIT", uri) - r.handler = influx.NewMetricHandler() - r.parser = influx.NewParser(r.handler) - r.parser.SetTimeFunc(DefaultTime) + addr := fmt.Sprintf("%s:%s", r.config.Addr, r.config.Port) + uri := addr + p + cclog.ComponentDebug(r.name, "INIT", "listen on:", uri) + + // Register handler function r.ServerHttp for path p in the DefaultServeMux + http.HandleFunc(p, r.ServerHttp) + + // Create http server + r.server = &http.Server{ + Addr: addr, + Handler: nil, // handler to invoke, http.DefaultServeMux if nil + IdleTimeout: r.config.idleTimeout, + } + r.server.SetKeepAlivesEnabled(r.config.KeepAlivesEnabled) - r.router = mux.NewRouter() - r.router.Path(p).HandlerFunc(r.ServerHttp) - r.server = &http.Server{Addr: uri, Handler: r.router} return nil } @@ -79,31 +122,97 @@ func (r *HttpReceiver) Start() { } func (r *HttpReceiver) ServerHttp(w http.ResponseWriter, req *http.Request) { + + // Check request method, only post method is handled if req.Method != http.MethodPost { http.Error(w, "Method Not Allowed", http.StatusMethodNotAllowed) return } - body, err := io.ReadAll(req.Body) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - metrics, err := r.parser.Parse(body) - if err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) + // Check basic authentication + if r.config.useBasicAuth { + username, password, ok := req.BasicAuth() + if !ok || username != r.config.Username || password != r.config.Password { + http.Error(w, "Unauthorized", http.StatusUnauthorized) + return + } } - for _, m := range metrics { - y := lp.FromInfluxMetric(m) - for k, v := range r.meta { - y.AddMeta(k, v) + d := influx.NewDecoder(req.Body) + for d.Next() { + + // Decode measurement name + measurement, err := d.Measurement() + if err != nil { + msg := "ServerHttp: Failed to decode measurement: " + err.Error() + cclog.ComponentError(r.name, msg) + http.Error(w, msg, http.StatusInternalServerError) + return } + + // Decode tags + tags := make(map[string]string) + for { + key, value, err := d.NextTag() + if err != nil { + msg := "ServerHttp: Failed to decode tag: " + err.Error() + cclog.ComponentError(r.name, msg) + http.Error(w, msg, http.StatusInternalServerError) + return + } + if key == nil { + break + } + tags[string(key)] = string(value) + } + + // Decode fields + fields := make(map[string]interface{}) + for { + key, value, err := d.NextField() + if err != nil { + msg := "ServerHttp: Failed to decode field: " + err.Error() + cclog.ComponentError(r.name, msg) + http.Error(w, msg, http.StatusInternalServerError) + return + } + if key == nil { + break + } + fields[string(key)] = value.Interface() + } + + // Decode time stamp + t, err := d.Time(influx.Nanosecond, time.Time{}) + if err != nil { + msg := "ServerHttp: Failed to decode time stamp: " + err.Error() + cclog.ComponentError(r.name, msg) + http.Error(w, msg, http.StatusInternalServerError) + return + } + + y, _ := lp.New( + string(measurement), + tags, + r.meta, + fields, + t, + ) + if r.sink != nil { r.sink <- y } } + // Check for IO errors + err := d.Err() + if err != nil { + msg := "ServerHttp: Failed to decode: " + err.Error() + cclog.ComponentError(r.name, msg) + http.Error(w, msg, http.StatusInternalServerError) + return + } + w.WriteHeader(http.StatusOK) } diff --git a/receivers/httpReceiver.md b/receivers/httpReceiver.md index ed1e1bf..6d277c0 100644 --- a/receivers/httpReceiver.md +++ b/receivers/httpReceiver.md @@ -10,7 +10,10 @@ The `http` receiver can be used receive metrics through HTTP POST requests. "type": "http", "address" : "", "port" : "8080", - "path" : "/write" + "path" : "/write", + "idle_timeout": "120s", + "username": "myUser", + "password": "myPW" } } ``` @@ -19,5 +22,22 @@ The `http` receiver can be used receive metrics through HTTP POST requests. - `address`: Listen address - `port`: Listen port - `path`: URL path for the write endpoint +- `idle_timeout`: Maximum amount of time to wait for the next request when keep-alives are enabled should be larger than the measurement interval to keep the connection open +- `keep_alives_enabled`: Controls whether HTTP keep-alives are enabled. By default, keep-alives are enabled. +- `username`: username for basic authentication +- `password`: password for basic authentication The HTTP endpoint listens to `http://
:/` + +### Debugging + +- Install [curl](https://curl.se/) +- Use curl to send message to `http` receiver + + ```bash + curl http://localhost:8080/write \ + --user "myUser:myPW" \ + --data \ + "myMetric,hostname=myHost,type=hwthread,type-id=0,unit=Hz value=400000i 1694777161164284635 + myMetric,hostname=myHost,type=hwthread,type-id=1,unit=Hz value=400001i 1694777161164284635" + ``` diff --git a/receivers/natsReceiver.go b/receivers/natsReceiver.go index 095a7ee..ea0cc3b 100644 --- a/receivers/natsReceiver.go +++ b/receivers/natsReceiver.go @@ -8,7 +8,7 @@ import ( cclog "github.com/ClusterCockpit/cc-metric-collector/pkg/ccLogger" lp "github.com/ClusterCockpit/cc-metric-collector/pkg/ccMetric" - influx "github.com/influxdata/line-protocol" + influx "github.com/influxdata/line-protocol/v2/lineprotocol" nats "github.com/nats-io/nats.go" ) @@ -21,37 +21,85 @@ type NatsReceiverConfig struct { type NatsReceiver struct { receiver - nc *nats.Conn - handler *influx.MetricHandler - parser *influx.Parser - meta map[string]string - config NatsReceiverConfig -} - -var DefaultTime = func() time.Time { - return time.Unix(42, 0) + nc *nats.Conn + meta map[string]string + config NatsReceiverConfig } +// Start subscribes to the configured NATS subject +// Messages wil be handled by r._NatsReceive func (r *NatsReceiver) Start() { cclog.ComponentDebug(r.name, "START") r.nc.Subscribe(r.config.Subject, r._NatsReceive) } +// _NatsReceive receives subscribed messages from the NATS server func (r *NatsReceiver) _NatsReceive(m *nats.Msg) { - metrics, err := r.parser.Parse(m.Data) - if err == nil { - for _, m := range metrics { - y := lp.FromInfluxMetric(m) - for k, v := range r.meta { - y.AddMeta(k, v) + + d := influx.NewDecoderWithBytes(m.Data) + for d.Next() { + + // Decode measurement name + measurement, err := d.Measurement() + if err != nil { + msg := "_NatsReceive: Failed to decode measurement: " + err.Error() + cclog.ComponentError(r.name, msg) + return + } + + // Decode tags + tags := make(map[string]string) + for { + key, value, err := d.NextTag() + if err != nil { + msg := "_NatsReceive: Failed to decode tag: " + err.Error() + cclog.ComponentError(r.name, msg) + return } - if r.sink != nil { - r.sink <- y + if key == nil { + break } + tags[string(key)] = string(value) + } + + // Decode fields + fields := make(map[string]interface{}) + for { + key, value, err := d.NextField() + if err != nil { + msg := "_NatsReceive: Failed to decode field: " + err.Error() + cclog.ComponentError(r.name, msg) + return + } + if key == nil { + break + } + fields[string(key)] = value.Interface() + } + + // Decode time stamp + t, err := d.Time(influx.Nanosecond, time.Time{}) + if err != nil { + msg := "_NatsReceive: Failed to decode time: " + err.Error() + cclog.ComponentError(r.name, msg) + return + } + + y, _ := lp.New( + string(measurement), + tags, + r.meta, + fields, + t, + ) + + if r.sink != nil { + r.sink <- y } } } +// Close closes the connection to the NATS server func (r *NatsReceiver) Close() { if r.nc != nil { cclog.ComponentDebug(r.name, "CLOSE") @@ -59,10 +107,13 @@ func (r *NatsReceiver) Close() { } } +// NewNatsReceiver creates a new Receiver which subscribes to messages from a NATS server func NewNatsReceiver(name string, config json.RawMessage) (Receiver, error) { r := new(NatsReceiver) r.name = fmt.Sprintf("NatsReceiver(%s)", name) - r.config.Addr = nats.DefaultURL + + // Read configuration file, allow overwriting default config + r.config.Addr = "localhost" r.config.Port = "4222" if len(config) > 0 { err := json.Unmarshal(config, &r.config) @@ -76,17 +127,21 @@ func NewNatsReceiver(name string, config json.RawMessage) (Receiver, error) { len(r.config.Subject) == 0 { return nil, errors.New("not all configuration variables set required by NatsReceiver") } - r.meta = map[string]string{"source": r.name} - uri := fmt.Sprintf("%s:%s", r.config.Addr, r.config.Port) - cclog.ComponentDebug(r.name, "NewNatsReceiver", uri, "Subject", r.config.Subject) - if nc, err := nats.Connect(uri); err == nil { + + // Set metadata + r.meta = map[string]string{ + "source": r.name, + } + + // Connect to NATS server + url := fmt.Sprintf("nats://%s:%s", r.config.Addr, r.config.Port) + cclog.ComponentDebug(r.name, "NewNatsReceiver", url, "Subject", r.config.Subject) + if nc, err := nats.Connect(url); err == nil { r.nc = nc } else { r.nc = nil return nil, err } - r.handler = influx.NewMetricHandler() - r.parser = influx.NewParser(r.handler) - r.parser.SetTimeFunc(DefaultTime) + return r, nil } diff --git a/receivers/natsReceiver.md b/receivers/natsReceiver.md index 4a7b7a4..d0b2166 100644 --- a/receivers/natsReceiver.md +++ b/receivers/natsReceiver.md @@ -19,3 +19,32 @@ The `nats` receiver can be used receive metrics from the NATS network. The `nats - `address`: Address of the NATS control server - `port`: Port of the NATS control server - `subject`: Subscribes to this subject and receive metrics + +### Debugging + +- Install NATS server and command line client +- Start NATS server + + ```bash + nats-server --net nats-server.example.org --port 4222 + ``` + +- Check NATS server works as expected + + ```bash + nats --server=nats-server-db.example.org:4222 server check + ``` + +- Use NATS command line client to subscribe to all messages + + ```bash + nats --server=nats-server-db.example.org:4222 sub ">" + ``` + +- Use NATS command line client to send message to NATS receiver + + ```bash + nats --server=nats-server-db.example.org:4222 pub subject \ + "myMetric,hostname=myHost,type=hwthread,type-id=0,unit=Hz value=400000i 1694777161164284635 + myMetric,hostname=myHost,type=hwthread,type-id=1,unit=Hz value=400001i 1694777161164284635" + ``` diff --git a/receivers/receiveManager.go b/receivers/receiveManager.go index 31853fe..47325b2 100644 --- a/receivers/receiveManager.go +++ b/receivers/receiveManager.go @@ -11,6 +11,7 @@ import ( ) var AvailableReceivers = map[string]func(name string, config json.RawMessage) (Receiver, error){ + "http": NewHttpReceiver, "ipmi": NewIPMIReceiver, "nats": NewNatsReceiver, "redfish": NewRedfishReceiver, diff --git a/scripts/cc-metric-collector.service b/scripts/cc-metric-collector.service index 9c2fd1e..a8400ea 100644 --- a/scripts/cc-metric-collector.service +++ b/scripts/cc-metric-collector.service @@ -13,7 +13,7 @@ Restart=on-failure WorkingDirectory=/tmp RuntimeDirectory=cc-metric-collector RuntimeDirectoryMode=0750 -ExecStart=/usr/sbin/cc-metric-collector --config=${CONF_FILE} +ExecStart=/usr/bin/cc-metric-collector --config=${CONF_FILE} LimitNOFILE=10000 TimeoutStopSec=20 UMask=0027 diff --git a/scripts/cc-metric-collector.spec b/scripts/cc-metric-collector.spec index b1b405e..6a5e219 100644 --- a/scripts/cc-metric-collector.spec +++ b/scripts/cc-metric-collector.spec @@ -29,7 +29,7 @@ make %install -install -Dpm 0750 %{name} %{buildroot}%{_sbindir}/%{name} +install -Dpm 0750 %{name} %{buildroot}%{_bindir}/%{name} install -Dpm 0600 config.json %{buildroot}%{_sysconfdir}/%{name}/%{name}.json install -Dpm 0600 collectors.json %{buildroot}%{_sysconfdir}/%{name}/collectors.json install -Dpm 0600 sinks.json %{buildroot}%{_sysconfdir}/%{name}/sinks.json @@ -44,7 +44,7 @@ install -Dpm 0644 scripts/%{name}.sysusers %{buildroot}%{_sysusersdir}/%{name}.c # go test should be here... :) %pre -%sysusers_create_package scripts/%{name}.sysusers +%sysusers_create_package %{name} scripts/%{name}.sysusers %post %systemd_post %{name}.service @@ -54,7 +54,7 @@ install -Dpm 0644 scripts/%{name}.sysusers %{buildroot}%{_sysusersdir}/%{name}.c %files # Binary -%attr(-,clustercockpit,clustercockpit) %{_sbindir}/%{name} +%attr(-,clustercockpit,clustercockpit) %{_bindir}/%{name} # Config %dir %{_sysconfdir}/%{name} %attr(0600,clustercockpit,clustercockpit) %config(noreplace) %{_sysconfdir}/%{name}/%{name}.json diff --git a/sinks/gangliaSink.go b/sinks/gangliaSink.go index b6a0646..b510003 100644 --- a/sinks/gangliaSink.go +++ b/sinks/gangliaSink.go @@ -1,6 +1,7 @@ package sinks import ( + "bytes" "encoding/json" "errors" "fmt" @@ -94,9 +95,10 @@ func NewGangliaSink(name string, config json.RawMessage) (Sink, error) { s.config.AddTagsAsDesc = false s.config.AddGangliaGroup = false if len(config) > 0 { - err := json.Unmarshal(config, &s.config) - if err != nil { - cclog.ComponentError(s.name, "Error reading config for", s.name, ":", err.Error()) + d := json.NewDecoder(bytes.NewReader(config)) + d.DisallowUnknownFields() + if err := d.Decode(&s.config); err != nil { + cclog.ComponentError(s.name, "Error reading config:", err.Error()) return nil, err } } diff --git a/sinks/httpSink.go b/sinks/httpSink.go index 49d98b0..a9bcc96 100644 --- a/sinks/httpSink.go +++ b/sinks/httpSink.go @@ -11,79 +11,196 @@ import ( cclog "github.com/ClusterCockpit/cc-metric-collector/pkg/ccLogger" lp "github.com/ClusterCockpit/cc-metric-collector/pkg/ccMetric" - influx "github.com/influxdata/line-protocol" + influx "github.com/influxdata/line-protocol/v2/lineprotocol" + "golang.org/x/exp/slices" ) type HttpSinkConfig struct { defaultSinkConfig - URL string `json:"url,omitempty"` - JWT string `json:"jwt,omitempty"` - Timeout string `json:"timeout,omitempty"` + + // The full URL of the endpoint + URL string `json:"url"` + + // JSON web tokens for authentication (Using the *Bearer* scheme) + JWT string `json:"jwt,omitempty"` + + // Basic authentication + Username string `json:"username"` + Password string `json:"password"` + useBasicAuth bool + + // time limit for requests made by the http client + Timeout string `json:"timeout,omitempty"` + timeout time.Duration + + // Maximum amount of time an idle (keep-alive) connection will remain idle before closing itself + // should be larger than the measurement interval to keep the connection open IdleConnTimeout string `json:"idle_connection_timeout,omitempty"` - FlushDelay string `json:"flush_delay,omitempty"` - MaxRetries int `json:"max_retries,omitempty"` + idleConnTimeout time.Duration + + // Batch all writes arriving in during this duration + // (default '5s', batching can be disabled by setting it to 0) + FlushDelay string `json:"flush_delay,omitempty"` + flushDelay time.Duration + + // Maximum number of retries to connect to the http server (default: 3) + MaxRetries int `json:"max_retries,omitempty"` +} + +type key_value_pair struct { + key string + value string } type HttpSink struct { sink - client *http.Client - encoder *influx.Encoder - lock sync.Mutex // Flush() runs in another goroutine, so this lock has to protect the buffer - buffer *bytes.Buffer - flushTimer *time.Timer - config HttpSinkConfig - idleConnTimeout time.Duration - timeout time.Duration - flushDelay time.Duration + client *http.Client + // influx line protocol encoder + encoder influx.Encoder + // List of tags and meta data tags which should be used as tags + extended_tag_list []key_value_pair + // Flush() runs in another goroutine and accesses the influx line protocol encoder, + // so this encoderLock has to protect the encoder + encoderLock sync.Mutex + + // timer to run Flush() + flushTimer *time.Timer + // Lock to assure that only one timer is running at a time + timerLock sync.Mutex + + config HttpSinkConfig } +// Write sends metric m as http message func (s *HttpSink) Write(m lp.CCMetric) error { - p := m.ToPoint(s.meta_as_tags) - s.lock.Lock() - firstWriteOfBatch := s.buffer.Len() == 0 - _, err := s.encoder.Encode(p) - s.lock.Unlock() + + // Lock for encoder usage + s.encoderLock.Lock() + + // Encode measurement name + s.encoder.StartLine(m.Name()) + + // copy tags and meta data which should be used as tags + s.extended_tag_list = s.extended_tag_list[:0] + for key, value := range m.Tags() { + s.extended_tag_list = + append( + s.extended_tag_list, + key_value_pair{ + key: key, + value: value, + }, + ) + } + for _, key := range s.config.MetaAsTags { + if value, ok := m.GetMeta(key); ok { + s.extended_tag_list = + append( + s.extended_tag_list, + key_value_pair{ + key: key, + value: value, + }, + ) + } + } + + // Encode tags (they musts be in lexical order) + slices.SortFunc( + s.extended_tag_list, + func(a key_value_pair, b key_value_pair) int { + if a.key < b.key { + return -1 + } + if a.key > b.key { + return +1 + } + return 0 + }, + ) + for i := range s.extended_tag_list { + s.encoder.AddTag( + s.extended_tag_list[i].key, + s.extended_tag_list[i].value, + ) + } + + // Encode fields + for key, value := range m.Fields() { + s.encoder.AddField(key, influx.MustNewValue(value)) + } + + // Encode time stamp + s.encoder.EndLine(m.Time()) + + // Check for encoder errors + err := s.encoder.Err() + + // Unlock encoder usage + s.encoderLock.Unlock() + + // Check that encoding worked if err != nil { - cclog.ComponentError(s.name, "encoding failed:", err.Error()) - return err + return fmt.Errorf("Encoding failed: %v", err) } - if s.flushDelay == 0 { + if s.config.flushDelay == 0 { + + // Directly flush if no flush delay is configured return s.Flush() - } + } else if s.timerLock.TryLock() { - if firstWriteOfBatch { - if s.flushTimer == nil { - s.flushTimer = time.AfterFunc(s.flushDelay, func() { - if err := s.Flush(); err != nil { - cclog.ComponentError(s.name, "flush failed:", err.Error()) - } - }) + // Setup flush timer when flush delay is configured + // and no other timer is already running + if s.flushTimer != nil { + + // Restarting existing flush timer + cclog.ComponentDebug(s.name, "Write(): Restarting flush timer") + s.flushTimer.Reset(s.config.flushDelay) } else { - s.flushTimer.Reset(s.flushDelay) + + // Creating and starting flush timer + cclog.ComponentDebug(s.name, "Write(): Starting new flush timer") + s.flushTimer = time.AfterFunc( + s.config.flushDelay, + func() { + defer s.timerLock.Unlock() + cclog.ComponentDebug(s.name, "Starting flush triggered by flush timer") + if err := s.Flush(); err != nil { + cclog.ComponentError(s.name, "Flush triggered by flush timer: flush failed:", err) + } + }) } } return nil } +// Flush sends all metrics stored in encoder to HTTP server func (s *HttpSink) Flush() error { - // Own lock for as short as possible: the time it takes to copy the buffer. - s.lock.Lock() - buf := make([]byte, s.buffer.Len()) - copy(buf, s.buffer.Bytes()) - s.buffer.Reset() - s.lock.Unlock() + + // Lock for encoder usage + // Own lock for as short as possible: the time it takes to clone the buffer. + s.encoderLock.Lock() + + buf := slices.Clone(s.encoder.Bytes()) + s.encoder.Reset() + + // Unlock encoder usage + s.encoderLock.Unlock() + if len(buf) == 0 { return nil } + cclog.ComponentDebug(s.name, "Flush(): Flushing") + var res *http.Response for i := 0; i < s.config.MaxRetries; i++ { // Create new request to send buffer req, err := http.NewRequest(http.MethodPost, s.config.URL, bytes.NewReader(buf)) if err != nil { - cclog.ComponentError(s.name, "failed to create request:", err.Error()) + cclog.ComponentError(s.name, "Flush(): Failed to create HTTP request:", err) return err } @@ -92,10 +209,15 @@ func (s *HttpSink) Flush() error { req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", s.config.JWT)) } + // Set basic authentication + if s.config.useBasicAuth { + req.SetBasicAuth(s.config.Username, s.config.Password) + } + // Do request res, err = s.client.Do(req) if err != nil { - cclog.ComponentError(s.name, "transport/tcp error:", err.Error()) + cclog.ComponentError(s.name, "Flush(): transport/tcp error:", err) // Wait between retries time.Sleep(time.Duration(i+1) * (time.Second / 2)) continue @@ -111,7 +233,7 @@ func (s *HttpSink) Flush() error { // Handle application errors if res.StatusCode != http.StatusOK { err := errors.New(res.Status) - cclog.ComponentError(s.name, "application error:", err.Error()) + cclog.ComponentError(s.name, "Flush(): Application error:", err) return err } @@ -119,62 +241,93 @@ func (s *HttpSink) Flush() error { } func (s *HttpSink) Close() { - s.flushTimer.Stop() - if err := s.Flush(); err != nil { - cclog.ComponentError(s.name, "flush failed:", err.Error()) + cclog.ComponentDebug(s.name, "Closing HTTP connection") + + // Stop existing timer and immediately flush + if s.flushTimer != nil { + if ok := s.flushTimer.Stop(); ok { + s.timerLock.Unlock() + } } + + // Flush + if err := s.Flush(); err != nil { + cclog.ComponentError(s.name, "Close(): Flush failed:", err) + } + s.client.CloseIdleConnections() } +// NewHttpSink creates a new http sink func NewHttpSink(name string, config json.RawMessage) (Sink, error) { s := new(HttpSink) // Set default values s.name = fmt.Sprintf("HttpSink(%s)", name) - s.config.IdleConnTimeout = "120s" // should be larger than the measurement interval. + // should be larger than the measurement interval to keep the connection open + s.config.IdleConnTimeout = "120s" s.config.Timeout = "5s" s.config.FlushDelay = "5s" s.config.MaxRetries = 3 + cclog.ComponentDebug(s.name, "Init()") // Read config if len(config) > 0 { - err := json.Unmarshal(config, &s.config) - if err != nil { + d := json.NewDecoder(bytes.NewReader(config)) + d.DisallowUnknownFields() + if err := d.Decode(&s.config); err != nil { + cclog.ComponentError(s.name, "Error reading config:", err.Error()) return nil, err } } if len(s.config.URL) == 0 { return nil, errors.New("`url` config option is required for HTTP sink") } + + // Check basic authentication config + if len(s.config.Username) > 0 || len(s.config.Password) > 0 { + s.config.useBasicAuth = true + } + if s.config.useBasicAuth && len(s.config.Username) == 0 { + return nil, errors.New("basic authentication requires username") + } + if s.config.useBasicAuth && len(s.config.Password) == 0 { + return nil, errors.New("basic authentication requires password") + } + if len(s.config.IdleConnTimeout) > 0 { t, err := time.ParseDuration(s.config.IdleConnTimeout) if err == nil { - s.idleConnTimeout = t + cclog.ComponentDebug(s.name, "Init(): idleConnTimeout", t) + s.config.idleConnTimeout = t } } if len(s.config.Timeout) > 0 { t, err := time.ParseDuration(s.config.Timeout) if err == nil { - s.timeout = t + s.config.timeout = t + cclog.ComponentDebug(s.name, "Init(): timeout", t) } } if len(s.config.FlushDelay) > 0 { t, err := time.ParseDuration(s.config.FlushDelay) if err == nil { - s.flushDelay = t + s.config.flushDelay = t + cclog.ComponentDebug(s.name, "Init(): flushDelay", t) } } - // Create lookup map to use meta infos as tags in the output metric - s.meta_as_tags = make(map[string]bool) - for _, k := range s.config.MetaAsTags { - s.meta_as_tags[k] = true + + // Create http client + s.client = &http.Client{ + Transport: &http.Transport{ + MaxIdleConns: 1, // We will only ever talk to one host. + IdleConnTimeout: s.config.idleConnTimeout, + }, + Timeout: s.config.timeout, } - tr := &http.Transport{ - MaxIdleConns: 1, // We will only ever talk to one host. - IdleConnTimeout: s.idleConnTimeout, - } - s.client = &http.Client{Transport: tr, Timeout: s.timeout} - s.buffer = &bytes.Buffer{} - s.encoder = influx.NewEncoder(s.buffer) - s.encoder.SetPrecision(time.Second) + + // Configure influx line protocol encoder + s.encoder.SetPrecision(influx.Nanosecond) + s.extended_tag_list = make([]key_value_pair, 0) + return s, nil } diff --git a/sinks/httpSink.md b/sinks/httpSink.md index 7251ff2..ccb7c4b 100644 --- a/sinks/httpSink.md +++ b/sinks/httpSink.md @@ -13,10 +13,12 @@ The `http` sink uses POST requests to a HTTP server to submit the metrics in the ], "url" : "https://my-monitoring.example.com:1234/api/write", "jwt" : "blabla.blabla.blabla", + "username": "myUser", + "password": "myPW", "timeout": "5s", - "max_idle_connections" : 10, "idle_connection_timeout" : "5s", "flush_delay": "2s", + "batch_size": 1000 } } ``` @@ -24,8 +26,11 @@ The `http` sink uses POST requests to a HTTP server to submit the metrics in the - `type`: makes the sink an `http` sink - `meta_as_tags`: Move specific meta information to the tags in the output (optional) - `url`: The full URL of the endpoint -- `jwt`: JSON web tokens for authentification (Using the *Bearer* scheme) +- `jwt`: JSON web tokens for authentication (Using the *Bearer* scheme) +- `username`: username for basic authentication +- `password`: password for basic authentication - `timeout`: General timeout for the HTTP client (default '5s') -- `max_idle_connections`: Maximally idle connections (default 10) -- `idle_connection_timeout`: Timeout for idle connections (default '5s') +- `max_retries`: Maximum number of retries to connect to the http server +- `idle_connection_timeout`: Timeout for idle connections (default '120s'). Should be larger than the measurement interval to keep the connection open - `flush_delay`: Batch all writes arriving in during this duration (default '1s', batching can be disabled by setting it to 0) +- `batch_size`: Maximal batch size. If `batch_size` is reached before the end of `flush_delay`, the metrics are sent without further delay diff --git a/sinks/influxAsyncSink.go b/sinks/influxAsyncSink.go index ccf5302..b8555c6 100644 --- a/sinks/influxAsyncSink.go +++ b/sinks/influxAsyncSink.go @@ -1,6 +1,7 @@ package sinks import ( + "bytes" "context" "crypto/tls" "encoding/json" @@ -180,22 +181,24 @@ func NewInfluxAsyncSink(name string, config json.RawMessage) (Sink, error) { // 262144 524288 if len(config) > 0 { - err := json.Unmarshal(config, &s.config) - if err != nil { + d := json.NewDecoder(bytes.NewReader(config)) + d.DisallowUnknownFields() + if err := d.Decode(&s.config); err != nil { + cclog.ComponentError(s.name, "Error reading config:", err.Error()) return nil, err } } if len(s.config.Port) == 0 { - return nil, errors.New("Missing port configuration required by InfluxSink") + return nil, errors.New("missing port configuration required by InfluxSink") } if len(s.config.Database) == 0 { - return nil, errors.New("Missing database configuration required by InfluxSink") + return nil, errors.New("missing database configuration required by InfluxSink") } if len(s.config.Organization) == 0 { - return nil, errors.New("Missing organization configuration required by InfluxSink") + return nil, errors.New("missing organization configuration required by InfluxSink") } if len(s.config.Password) == 0 { - return nil, errors.New("Missing password configuration required by InfluxSink") + return nil, errors.New("missing password configuration required by InfluxSink") } // Create lookup map to use meta infos as tags in the output metric s.meta_as_tags = make(map[string]bool) diff --git a/sinks/influxAsyncSink.md b/sinks/influxAsyncSink.md index 951d67d..ddcf4b4 100644 --- a/sinks/influxAsyncSink.md +++ b/sinks/influxAsyncSink.md @@ -9,7 +9,6 @@ The `influxasync` sink uses the official [InfluxDB golang client](https://pkg.go { "": { "type": "influxasync", - "meta_as_tags" : true, "database" : "mymetrics", "host": "dbhost.example.com", "port": "4222", @@ -21,13 +20,13 @@ The `influxasync` sink uses the official [InfluxDB golang client](https://pkg.go "retry_interval" : "1s", "retry_exponential_base" : 2, "max_retries": 20, - "max_retry_time" : "168h" + "max_retry_time" : "168h", + "meta_as_tags" : [], } } ``` - `type`: makes the sink an `influxdb` sink -- `meta_as_tags`: print all meta information as tags in the output (optional) - `database`: All metrics are written to this bucket - `host`: Hostname of the InfluxDB database server - `port`: Portnumber (as string) of the InfluxDB database server @@ -40,5 +39,6 @@ The `influxasync` sink uses the official [InfluxDB golang client](https://pkg.go - `retry_exponential_base`: The retry interval is exponentially increased with this base, default 2 - `max_retries`: Maximal number of retry attempts - `max_retry_time`: Maximal time to retry failed writes, default 168h (one week) +- `meta_as_tags`: move meta information keys to tags (optional) -For information about the calculation of the retry interval settings, see [offical influxdb-client-go documentation](https://github.com/influxdata/influxdb-client-go#handling-of-failed-async-writes) \ No newline at end of file +For information about the calculation of the retry interval settings, see [offical influxdb-client-go documentation](https://github.com/influxdata/influxdb-client-go#handling-of-failed-async-writes) diff --git a/sinks/influxSink.go b/sinks/influxSink.go index 94704cd..a9d46a5 100644 --- a/sinks/influxSink.go +++ b/sinks/influxSink.go @@ -1,6 +1,7 @@ package sinks import ( + "bytes" "context" "crypto/tls" "encoding/json" @@ -13,7 +14,8 @@ import ( lp "github.com/ClusterCockpit/cc-metric-collector/pkg/ccMetric" influxdb2 "github.com/influxdata/influxdb-client-go/v2" influxdb2Api "github.com/influxdata/influxdb-client-go/v2/api" - "github.com/influxdata/influxdb-client-go/v2/api/write" + influx "github.com/influxdata/line-protocol/v2/lineprotocol" + "golang.org/x/exp/slices" ) type InfluxSink struct { @@ -32,20 +34,49 @@ type InfluxSink struct { // Maximum number of points sent to server in single request. // Default: 1000 BatchSize int `json:"batch_size,omitempty"` + // Time interval for delayed sending of metrics. // If the buffers are already filled before the end of this interval, // the metrics are sent without further delay. // Default: 1s FlushInterval string `json:"flush_delay,omitempty"` - // Number of metrics that are dropped when buffer is full - // Default: 100 - DropRate int `json:"drop_rate,omitempty"` + flushDelay time.Duration + + // Influx client options: + + // HTTP request timeout + HTTPRequestTimeout string `json:"http_request_timeout"` + // Retry interval + InfluxRetryInterval string `json:"retry_interval,omitempty"` + // maximum delay between each retry attempt + InfluxMaxRetryInterval string `json:"max_retry_interval,omitempty"` + // base for the exponential retry delay + InfluxExponentialBase uint `json:"retry_exponential_base,omitempty"` + // maximum count of retry attempts of failed writes + InfluxMaxRetries uint `json:"max_retries,omitempty"` + // maximum total retry timeout + InfluxMaxRetryTime string `json:"max_retry_time,omitempty"` + // Specify whether to use GZip compression in write requests + InfluxUseGzip bool `json:"use_gzip"` } - batch []*write.Point - flushTimer *time.Timer - flushDelay time.Duration - batchMutex sync.Mutex // Flush() runs in another goroutine, so this lock has to protect the buffer - flushTimerMutex sync.Mutex // Ensure only one flush timer is running + + // influx line protocol encoder + encoder influx.Encoder + // number of records stored in the encoder + numRecordsInEncoder int + // List of tags and meta data tags which should be used as tags + extended_tag_list []key_value_pair + // Flush() runs in another goroutine and accesses the influx line protocol encoder, + // so this encoderLock has to protect the encoder and numRecordsInEncoder + encoderLock sync.Mutex + + // timer to run Flush() + flushTimer *time.Timer + // Lock to assure that only one timer is running at a time + timerLock sync.Mutex + + // WaitGroup to ensure only one send operation is running at a time + sendWaitGroup sync.WaitGroup } // connect connects to the InfluxDB server @@ -70,7 +101,7 @@ func (s *InfluxSink) connect() error { } else { auth = fmt.Sprintf("%s:%s", s.config.User, s.config.Password) } - cclog.ComponentDebug(s.name, + cclog.ComponentDebug(s.name, "connect():", "Using URI='"+uri+"'", "Org='"+s.config.Organization+"'", "Bucket='"+s.config.Database+"'") @@ -78,6 +109,95 @@ func (s *InfluxSink) connect() error { // Set influxDB client options clientOptions := influxdb2.DefaultOptions() + // set HTTP request timeout + if len(s.config.HTTPRequestTimeout) > 0 { + if t, err := time.ParseDuration(s.config.HTTPRequestTimeout); err == nil { + httpRequestTimeout := uint(t.Seconds()) + clientOptions.SetHTTPRequestTimeout(httpRequestTimeout) + } else { + cclog.ComponentError(s.name, "connect():", "Failed to parse duration for HTTP RequestTimeout: ", s.config.HTTPRequestTimeout) + } + } + cclog.ComponentDebug( + s.name, + "connect():", + "Influx client options HTTPRequestTimeout:", + time.Second*time.Duration(clientOptions.HTTPRequestTimeout())) + + // Set retry interval + if len(s.config.InfluxRetryInterval) > 0 { + if t, err := time.ParseDuration(s.config.InfluxRetryInterval); err == nil { + influxRetryInterval := uint(t.Milliseconds()) + clientOptions.SetRetryInterval(influxRetryInterval) + } else { + cclog.ComponentError(s.name, "connect():", "Failed to parse duration for Influx RetryInterval: ", s.config.InfluxRetryInterval) + } + } + cclog.ComponentDebug( + s.name, + "connect():", + "Influx client options RetryInterval:", + time.Millisecond*time.Duration(clientOptions.RetryInterval())) + + // Set the maximum delay between each retry attempt + if len(s.config.InfluxMaxRetryInterval) > 0 { + if t, err := time.ParseDuration(s.config.InfluxMaxRetryInterval); err == nil { + influxMaxRetryInterval := uint(t.Milliseconds()) + clientOptions.SetMaxRetryInterval(influxMaxRetryInterval) + } else { + cclog.ComponentError(s.name, "connect():", "Failed to parse duration for Influx MaxRetryInterval: ", s.config.InfluxMaxRetryInterval) + } + } + cclog.ComponentDebug( + s.name, + "connect():", + "Influx client options MaxRetryInterval:", + time.Millisecond*time.Duration(clientOptions.MaxRetryInterval())) + + // Set the base for the exponential retry delay + if s.config.InfluxExponentialBase != 0 { + clientOptions.SetExponentialBase(s.config.InfluxExponentialBase) + } + cclog.ComponentDebug( + s.name, + "connect():", + "Influx client options ExponentialBase:", + clientOptions.ExponentialBase()) + + // Set maximum count of retry attempts of failed writes + if s.config.InfluxMaxRetries != 0 { + clientOptions.SetMaxRetries(s.config.InfluxMaxRetries) + } + cclog.ComponentDebug( + s.name, + "connect():", + "Influx client options MaxRetries:", + clientOptions.MaxRetries()) + + // Set the maximum total retry timeout + if len(s.config.InfluxMaxRetryTime) > 0 { + if t, err := time.ParseDuration(s.config.InfluxMaxRetryTime); err == nil { + influxMaxRetryTime := uint(t.Milliseconds()) + cclog.ComponentDebug(s.name, "connect():", "MaxRetryTime", s.config.InfluxMaxRetryTime) + clientOptions.SetMaxRetryTime(influxMaxRetryTime) + } else { + cclog.ComponentError(s.name, "connect():", "Failed to parse duration for Influx MaxRetryInterval: ", s.config.InfluxMaxRetryInterval) + } + } + cclog.ComponentDebug( + s.name, + "connect():", + "Influx client options MaxRetryTime:", + time.Millisecond*time.Duration(clientOptions.MaxRetryTime())) + + // Specify whether to use GZip compression in write requests + clientOptions.SetUseGZip(s.config.InfluxUseGzip) + cclog.ComponentDebug( + s.name, + "connect():", + "Influx client options UseGZip:", + clientOptions.UseGZip()) + // Do not check InfluxDB certificate clientOptions.SetTLSConfig( &tls.Config{ @@ -85,7 +205,8 @@ func (s *InfluxSink) connect() error { }, ) - clientOptions.SetPrecision(time.Second) + // Set time precision + clientOptions.SetPrecision(time.Nanosecond) // Create new writeAPI s.client = influxdb2.NewClientWithOptions(uri, auth, clientOptions) @@ -102,95 +223,189 @@ func (s *InfluxSink) connect() error { return nil } +// Write sends metric m in influxDB line protocol func (s *InfluxSink) Write(m lp.CCMetric) error { - if s.flushDelay != 0 && s.flushTimerMutex.TryLock() { - // Run a batched flush for all metrics that arrived in the last flush delay interval - cclog.ComponentDebug(s.name, "Starting new flush timer") - s.flushTimer = time.AfterFunc( - s.flushDelay, - func() { - defer s.flushTimerMutex.Unlock() - cclog.ComponentDebug(s.name, "Starting flush in flush timer") - if err := s.Flush(); err != nil { - cclog.ComponentError(s.name, "Flush timer: flush failed:", err) - } - }) + // Lock for encoder usage + s.encoderLock.Lock() + + // Encode measurement name + s.encoder.StartLine(m.Name()) + + // copy tags and meta data which should be used as tags + s.extended_tag_list = s.extended_tag_list[:0] + for key, value := range m.Tags() { + s.extended_tag_list = + append( + s.extended_tag_list, + key_value_pair{ + key: key, + value: value, + }, + ) + } + for _, key := range s.config.MetaAsTags { + if value, ok := m.GetMeta(key); ok { + s.extended_tag_list = + append( + s.extended_tag_list, + key_value_pair{ + key: key, + value: value, + }, + ) + } } - // Lock access to batch slice - s.batchMutex.Lock() - - // batch slice full, dropping oldest metric(s) - // e.g. when previous flushes failed and batch slice was not cleared - if len(s.batch) == s.config.BatchSize { - newSize := s.config.BatchSize - s.config.DropRate - - for i := 0; i < newSize; i++ { - s.batch[i] = s.batch[i+s.config.DropRate] - } - for i := newSize; i < s.config.BatchSize; i++ { - s.batch[i] = nil - } - s.batch = s.batch[:newSize] - cclog.ComponentError(s.name, "Batch slice full, dropping", s.config.DropRate, "oldest metric(s)") + // Encode tags (they musts be in lexical order) + slices.SortFunc( + s.extended_tag_list, + func(a key_value_pair, b key_value_pair) int { + if a.key < b.key { + return -1 + } + if a.key > b.key { + return +1 + } + return 0 + }, + ) + for i := range s.extended_tag_list { + s.encoder.AddTag( + s.extended_tag_list[i].key, + s.extended_tag_list[i].value, + ) } - // Append metric to batch slice - p := m.ToPoint(s.meta_as_tags) - s.batch = append(s.batch, p) + // Encode fields + for key, value := range m.Fields() { + s.encoder.AddField(key, influx.MustNewValue(value)) + } - // Flush synchronously if "flush_delay" is zero - // or - // Flush if batch size is reached - if s.flushDelay == 0 || - len(s.batch) == s.config.BatchSize { - // Unlock access to batch slice - s.batchMutex.Unlock() + // Encode time stamp + s.encoder.EndLine(m.Time()) + + // Check for encoder errors + if err := s.encoder.Err(); err != nil { + // Unlock encoder usage + s.encoderLock.Unlock() + + return fmt.Errorf("Encoding failed: %v", err) + } + s.numRecordsInEncoder++ + + if s.config.flushDelay == 0 { + // Unlock encoder usage + s.encoderLock.Unlock() + + // Directly flush if no flush delay is configured return s.Flush() + } else if s.numRecordsInEncoder == s.config.BatchSize { + // Unlock encoder usage + s.encoderLock.Unlock() + + // Stop flush timer + if s.flushTimer != nil { + if ok := s.flushTimer.Stop(); ok { + cclog.ComponentDebug(s.name, "Write(): Stopped flush timer. Batch size limit reached before flush delay") + s.timerLock.Unlock() + } + } + + // Flush if batch size is reached + return s.Flush() + } else if s.timerLock.TryLock() { + + // Setup flush timer when flush delay is configured + // and no other timer is already running + if s.flushTimer != nil { + + // Restarting existing flush timer + cclog.ComponentDebug(s.name, "Write(): Restarting flush timer") + s.flushTimer.Reset(s.config.flushDelay) + } else { + + // Creating and starting flush timer + cclog.ComponentDebug(s.name, "Write(): Starting new flush timer") + s.flushTimer = time.AfterFunc( + s.config.flushDelay, + func() { + defer s.timerLock.Unlock() + cclog.ComponentDebug(s.name, "Starting flush triggered by flush timer") + if err := s.Flush(); err != nil { + cclog.ComponentError(s.name, "Flush triggered by flush timer: flush failed:", err) + } + }) + } } - // Unlock access to batch slice - s.batchMutex.Unlock() + // Unlock encoder usage + s.encoderLock.Unlock() return nil } -// Flush sends all metrics buffered in batch slice to InfluxDB server +// Flush sends all metrics stored in encoder to InfluxDB server func (s *InfluxSink) Flush() error { - cclog.ComponentDebug(s.name, "Flushing") - // Lock access to batch slice - s.batchMutex.Lock() - defer s.batchMutex.Unlock() + // Lock for encoder usage + // Own lock for as short as possible: the time it takes to clone the buffer. + s.encoderLock.Lock() - // Nothing to do, batch slice is empty - if len(s.batch) == 0 { + buf := slices.Clone(s.encoder.Bytes()) + numRecordsInBuf := s.numRecordsInEncoder + s.encoder.Reset() + s.numRecordsInEncoder = 0 + + // Unlock encoder usage + s.encoderLock.Unlock() + + if len(buf) == 0 { return nil } - // Send metrics from batch slice - err := s.writeApi.WritePoint(context.Background(), s.batch...) - if err != nil { - cclog.ComponentError(s.name, "Flush(): Flush of", len(s.batch), "metrics failed:", err) - return err - } + cclog.ComponentDebug(s.name, "Flush(): Flushing", numRecordsInBuf, "metrics") - // Clear batch slice - for i := range s.batch { - s.batch[i] = nil - } - s.batch = s.batch[:0] + // Asynchron send of encoder metrics + s.sendWaitGroup.Add(1) + go func() { + defer s.sendWaitGroup.Done() + startTime := time.Now() + err := s.writeApi.WriteRecord(context.Background(), string(buf)) + if err != nil { + cclog.ComponentError( + s.name, + "Flush():", + "Flush failed:", err, + "(number of records =", numRecordsInBuf, + ", buffer size =", len(buf), + ", send duration =", time.Since(startTime), + ")", + ) + return + } + }() return nil } func (s *InfluxSink) Close() { cclog.ComponentDebug(s.name, "Closing InfluxDB connection") - s.flushTimer.Stop() - s.Flush() - if err := s.Flush(); err != nil { - cclog.ComponentError(s.name, "Close(): Flush failed:", err) + + // Stop existing timer and immediately flush + if s.flushTimer != nil { + if ok := s.flushTimer.Stop(); ok { + s.timerLock.Unlock() + } } + + // Flush + if err := s.Flush(); err != nil { + cclog.ComponentError(s.name, "Close():", "Flush failed:", err) + } + + // Wait for send operations to finish + s.sendWaitGroup.Wait() + s.client.Close() } @@ -202,30 +417,31 @@ func NewInfluxSink(name string, config json.RawMessage) (Sink, error) { // Set config default values s.config.BatchSize = 1000 s.config.FlushInterval = "1s" - s.config.DropRate = 100 // Read config if len(config) > 0 { - err := json.Unmarshal(config, &s.config) - if err != nil { - return s, err + d := json.NewDecoder(bytes.NewReader(config)) + d.DisallowUnknownFields() + if err := d.Decode(&s.config); err != nil { + cclog.ComponentError(s.name, "Error reading config:", err.Error()) + return nil, err } } if len(s.config.Host) == 0 { - return s, errors.New("Missing host configuration required by InfluxSink") + return s, errors.New("missing host configuration required by InfluxSink") } if len(s.config.Port) == 0 { - return s, errors.New("Missing port configuration required by InfluxSink") + return s, errors.New("missing port configuration required by InfluxSink") } if len(s.config.Database) == 0 { - return s, errors.New("Missing database configuration required by InfluxSink") + return s, errors.New("missing database configuration required by InfluxSink") } if len(s.config.Organization) == 0 { - return s, errors.New("Missing organization configuration required by InfluxSink") + return s, errors.New("missing organization configuration required by InfluxSink") } if len(s.config.Password) == 0 { - return s, errors.New("Missing password configuration required by InfluxSink") + return s, errors.New("missing password configuration required by InfluxSink") } // Create lookup map to use meta infos as tags in the output metric @@ -238,28 +454,22 @@ func NewInfluxSink(name string, config json.RawMessage) (Sink, error) { if len(s.config.FlushInterval) > 0 { t, err := time.ParseDuration(s.config.FlushInterval) if err == nil { - s.flushDelay = t + s.config.flushDelay = t } } if !(s.config.BatchSize > 0) { return s, fmt.Errorf("batch_size=%d in InfluxDB config must be > 0", s.config.BatchSize) } - if !(s.config.DropRate > 0) { - return s, fmt.Errorf("drop_rate=%d in InfluxDB config must be > 0", s.config.DropRate) - } - if !(s.config.BatchSize > s.config.DropRate) { - return s, fmt.Errorf( - "batch_size=%d must be greater then drop_rate=%d in InfluxDB config", - s.config.BatchSize, s.config.DropRate) - } - - // allocate batch slice - s.batch = make([]*write.Point, 0, s.config.BatchSize) // Connect to InfluxDB server if err := s.connect(); err != nil { return s, fmt.Errorf("unable to connect: %v", err) } + + // Configure influx line protocol encoder + s.encoder.SetPrecision(influx.Nanosecond) + s.extended_tag_list = make([]key_value_pair, 0) + return s, nil } diff --git a/sinks/influxSink.md b/sinks/influxSink.md index 8f9ce83..99390f5 100644 --- a/sinks/influxSink.md +++ b/sinks/influxSink.md @@ -2,14 +2,12 @@ The `influxdb` sink uses the official [InfluxDB golang client](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2) to write the metrics to an InfluxDB database in a **blocking** fashion. It provides only support for V2 write endpoints (InfluxDB 1.8.0 or later). - ### Configuration structure ```json { "": { "type": "influxdb", - "meta_as_tags" : true, "database" : "mymetrics", "host": "dbhost.example.com", "port": "4222", @@ -18,20 +16,33 @@ The `influxdb` sink uses the official [InfluxDB golang client](https://pkg.go.de "organization": "myorg", "ssl": true, "flush_delay" : "1s", - "batch_size" : 100 + "batch_size" : 1000, + "use_gzip": true + "meta_as_tags" : [], } } ``` - `type`: makes the sink an `influxdb` sink - `meta_as_tags`: print all meta information as tags in the output (optional) -- `database`: All metrics are written to this bucket +- `database`: All metrics are written to this bucket - `host`: Hostname of the InfluxDB database server -- `port`: Portnumber (as string) of the InfluxDB database server -- `user`: Username for basic authentification -- `password`: Password for basic authentification +- `port`: Port number (as string) of the InfluxDB database server +- `user`: Username for basic authentication +- `password`: Password for basic authentication - `organization`: Organization in the InfluxDB - `ssl`: Use SSL connection - `flush_delay`: Group metrics coming in to a single batch -- `batch_size`: Maximal batch size +- `batch_size`: Maximal batch size. If `batch_size` is reached before the end of `flush_delay`, the metrics are sent without further delay +Influx client options: +======= +- `batch_size`: Maximal batch size +- `meta_as_tags`: move meta information keys to tags (optional) +- `http_request_timeout`: HTTP request timeout +- `retry_interval`: retry interval +- `max_retry_interval`: maximum delay between each retry attempt +- `retry_exponential_base`: base for the exponential retry delay +- `max_retries`: maximum count of retry attempts of failed writes +- `max_retry_time`: maximum total retry timeout +- `use_gzip`: Specify whether to use GZip compression in write requests diff --git a/sinks/libgangliaSink.go b/sinks/libgangliaSink.go index bb5488a..145b490 100644 --- a/sinks/libgangliaSink.go +++ b/sinks/libgangliaSink.go @@ -66,6 +66,7 @@ void Ganglia_pool_destroy( Ganglia_pool pool ); import "C" import ( + "bytes" "encoding/json" "errors" "fmt" @@ -233,8 +234,9 @@ func NewLibgangliaSink(name string, config json.RawMessage) (Sink, error) { s.config.GmondConfig = string(GMOND_CONFIG_FILE) s.config.GangliaLib = string(GANGLIA_LIB_NAME) if len(config) > 0 { - err = json.Unmarshal(config, &s.config) - if err != nil { + d := json.NewDecoder(bytes.NewReader(config)) + d.DisallowUnknownFields() + if err := d.Decode(&s.config); err != nil { cclog.ComponentError(s.name, "Error reading config:", err.Error()) return nil, err } diff --git a/sinks/natsSink.go b/sinks/natsSink.go index a9a980d..db446ca 100644 --- a/sinks/natsSink.go +++ b/sinks/natsSink.go @@ -108,9 +108,10 @@ func NewNatsSink(name string, config json.RawMessage) (Sink, error) { s.name = fmt.Sprintf("NatsSink(%s)", name) s.flushDelay = 10 * time.Second if len(config) > 0 { - err := json.Unmarshal(config, &s.config) - if err != nil { - cclog.ComponentError(s.name, "Error reading config for", s.name, ":", err.Error()) + d := json.NewDecoder(bytes.NewReader(config)) + d.DisallowUnknownFields() + if err := d.Decode(&s.config); err != nil { + cclog.ComponentError(s.name, "Error reading config:", err.Error()) return nil, err } } diff --git a/sinks/natsSink.md b/sinks/natsSink.md index 7a53f27..4c7d9d0 100644 --- a/sinks/natsSink.md +++ b/sinks/natsSink.md @@ -2,27 +2,26 @@ The `nats` sink publishes all metrics into a NATS network. The publishing key is the database name provided in the configuration file - ### Configuration structure ```json { "": { "type": "nats", - "meta_as_tags" : true, "database" : "mymetrics", "host": "dbhost.example.com", "port": "4222", "user": "exampleuser", - "password" : "examplepw" + "password" : "examplepw", + "meta_as_tags" : [], } } ``` - `type`: makes the sink an `nats` sink -- `meta_as_tags`: print all meta information as tags in the output (optional) - `database`: All metrics are published with this subject - `host`: Hostname of the NATS server -- `port`: Portnumber (as string) of the NATS server -- `user`: Username for basic authentification -- `password`: Password for basic authentification \ No newline at end of file +- `port`: Port number (as string) of the NATS server +- `user`: Username for basic authentication +- `password`: Password for basic authentication +- `meta_as_tags`: print all meta information as tags in the output (optional) diff --git a/sinks/prometheusSink.go b/sinks/prometheusSink.go index 7a1163d..7d792cd 100644 --- a/sinks/prometheusSink.go +++ b/sinks/prometheusSink.go @@ -1,6 +1,7 @@ package sinks import ( + "bytes" "context" "encoding/json" "errors" @@ -167,9 +168,10 @@ func NewPrometheusSink(name string, config json.RawMessage) (Sink, error) { s := new(PrometheusSink) s.name = "PrometheusSink" if len(config) > 0 { - err := json.Unmarshal(config, &s.config) - if err != nil { - cclog.ComponentError(s.name, "Error reading config for", s.name, ":", err.Error()) + d := json.NewDecoder(bytes.NewReader(config)) + d.DisallowUnknownFields() + if err := d.Decode(&s.config); err != nil { + cclog.ComponentError(s.name, "Error reading config:", err.Error()) return nil, err } } diff --git a/sinks/sampleSink.go b/sinks/sampleSink.go index 9d9e991..fe4719d 100644 --- a/sinks/sampleSink.go +++ b/sinks/sampleSink.go @@ -1,6 +1,7 @@ package sinks import ( + "bytes" "encoding/json" "fmt" "log" @@ -57,8 +58,10 @@ func NewSampleSink(name string, config json.RawMessage) (Sink, error) { // Read in the config JSON if len(config) > 0 { - err := json.Unmarshal(config, &s.config) - if err != nil { + d := json.NewDecoder(bytes.NewReader(config)) + d.DisallowUnknownFields() + if err := d.Decode(&s.config); err != nil { + cclog.ComponentError(s.name, "Error reading config:", err.Error()) return nil, err } } diff --git a/sinks/sinkManager.go b/sinks/sinkManager.go index 392346d..cd2680f 100644 --- a/sinks/sinkManager.go +++ b/sinks/sinkManager.go @@ -84,7 +84,7 @@ func (sm *sinkManager) Init(wg *sync.WaitGroup, sinkConfigFile string) error { // Check that at least one sink is running if !(len(sm.sinks) > 0) { cclog.ComponentError("SinkManager", "Found no usable sinks") - return fmt.Errorf("Found no usable sinks") + return fmt.Errorf("found no usable sinks") } return nil @@ -157,7 +157,7 @@ func (sm *sinkManager) AddOutput(name string, rawConfig json.RawMessage) error { } s, err := AvailableSinks[sinkConfig.Type](name, rawConfig) if err != nil { - cclog.ComponentError("SinkManager", "SKIP", s.Name(), "initialization failed:", err.Error()) + cclog.ComponentError("SinkManager", "SKIP", name, "initialization failed:", err.Error()) return err } sm.sinks[name] = s diff --git a/sinks/stdoutSink.go b/sinks/stdoutSink.go index eadef4e..c235a9b 100644 --- a/sinks/stdoutSink.go +++ b/sinks/stdoutSink.go @@ -1,12 +1,14 @@ package sinks import ( + "bytes" "encoding/json" "fmt" "os" "strings" // "time" + cclog "github.com/ClusterCockpit/cc-metric-collector/pkg/ccLogger" lp "github.com/ClusterCockpit/cc-metric-collector/pkg/ccMetric" ) @@ -42,8 +44,10 @@ func NewStdoutSink(name string, config json.RawMessage) (Sink, error) { s := new(StdoutSink) s.name = fmt.Sprintf("StdoutSink(%s)", name) if len(config) > 0 { - err := json.Unmarshal(config, &s.config) - if err != nil { + d := json.NewDecoder(bytes.NewReader(config)) + d.DisallowUnknownFields() + if err := d.Decode(&s.config); err != nil { + cclog.ComponentError(s.name, "Error reading config:", err.Error()) return nil, err } } diff --git a/sinks/stdoutSink.md b/sinks/stdoutSink.md index 317ca3f..3fe3308 100644 --- a/sinks/stdoutSink.md +++ b/sinks/stdoutSink.md @@ -9,14 +9,14 @@ The `stdout` sink is the most simple sink provided by cc-metric-collector. It wr { "": { "type": "stdout", - "meta_as_tags" : true, + "meta_as_tags" : [], "output_file" : "mylogfile.log" } } ``` - `type`: makes the sink an `stdout` sink -- `meta_as_tags`: print all meta information as tags in the output (optional) +- `meta_as_tags`: print meta information as tags in the output (optional) - `output_file`: Write all data to the selected file (optional). There are two 'special' files: `stdout` and `stderr`. If this option is not provided, the default value is `stdout`