Skip to content

Commit

Permalink
Merge branch 'master' into upgrad-telegraf-version-Q1-2022
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhenyuTan-amz authored Mar 18, 2022
2 parents f9ca05c + 4470de2 commit cb4c275
Show file tree
Hide file tree
Showing 193 changed files with 24,864 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
[email protected] with any additional questions or comments.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*This is a fork of [telegraf](https://github.com/influxdata/telegraf/) project*

# Telegraf
# Telegraf [![Circle CI](https://circleci.com/gh/influxdata/telegraf.svg?style=svg)](https://circleci.com/gh/influxdata/telegraf) [![Docker pulls](https://img.shields.io/docker/pulls/library/telegraf.svg)](https://hub.docker.com/_/telegraf/)

![tiger](TelegrafTiger.png "tiger")

Expand Down
1 change: 1 addition & 0 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,7 @@ func (a *Agent) test(ctx context.Context, wait time.Duration, outputC chan<- tel
return err
}


startTime := time.Now()

next := outputC
Expand Down
1 change: 1 addition & 0 deletions logger/event_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@ func RegisterEventLogger(name string) error {

RegisterLogger(LogTargetEventlog, &eventLoggerCreator{logger: eventLog})
return nil

}
1 change: 1 addition & 0 deletions logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func RegisterLogger(name string, loggerCreator LoggerCreator) {
loggerRegistry[name] = loggerCreator
}


type telegrafLog struct {
writer io.Writer
internalWriter io.Writer
Expand Down
4 changes: 3 additions & 1 deletion metric/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,9 @@ func convertField(v interface{}) interface{} {
return float64(*v)
}
default:
return nil
//TODO: change here once we figure out how to handle our own map-based metric definition
//return v here because we don't want to return nil for unknown types
return v
}
return nil
}
10 changes: 10 additions & 0 deletions models/running_aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ func (r *RunningAggregator) Init() error {
return nil
}

func (r *RunningAggregator) Stop() error {
if p, ok := r.Aggregator.(telegraf.Stopper); ok {
err := p.Stop()
if err != nil {
return err
}
}
return nil
}

func (r *RunningAggregator) Period() time.Duration {
return r.Config.Period
}
Expand Down
1 change: 1 addition & 0 deletions models/running_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func (rp *RunningProcessor) LogName() string {
return logName("processors", rp.Config.Name, rp.Config.Alias)
}


func (rp *RunningProcessor) MakeMetric(metric telegraf.Metric) telegraf.Metric {
return metric
}
Expand Down
6 changes: 6 additions & 0 deletions patches/gopsutil/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*~
#*
_obj
*.tmp
.idea
vendor
76 changes: 76 additions & 0 deletions patches/gopsutil/Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions patches/gopsutil/Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
name = "github.com/StackExchange/wmi"
version = "1.0.0"

[[constraint]]
name = "github.com/stretchr/testify"
version = "1.2.2"

[[constraint]]
branch = "master"
name = "golang.org/x/sys"

[prune]
go-tests = true
unused-packages = true
61 changes: 61 additions & 0 deletions patches/gopsutil/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
gopsutil is distributed under BSD license reproduced below.

Copyright (c) 2014, WAKAYAMA Shirou
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the gopsutil authors nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


-------
internal/common/binary.go in the gopsutil is copied and modifid from golang/encoding/binary.go.



Copyright (c) 2009 The Go Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 changes: 41 additions & 0 deletions patches/gopsutil/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.PHONY: help check
.DEFAULT_GOAL := help

SUBPKGS=cpu disk docker host internal load mem net process

help: ## Show help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

check: ## Check
errcheck -ignore="Close|Run|Write" ./...
golint ./... | egrep -v 'underscores|HttpOnly|should have comment|comment on exported|CamelCase|VM|UID' && exit 1 || exit 0

BUILD_FAIL_PATTERN=grep -v "exec format error" | grep "build failed" && exit 1 || exit 0
build_test: ## test only buildable
# Supported operating systems
GOOS=linux GOARCH=amd64 go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=linux GOARCH=386 go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=linux GOARCH=arm go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=linux GOARCH=arm64 go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=freebsd go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=freebsd GOARCH=arm go test ./... | $(BUILD_FAIL_PATTERN)
CGO_ENABLED=0 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=windows go test ./... | $(BUILD_FAIL_PATTERN)
# Operating systems supported for building only (not implemented error if used)
GOOS=solaris go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=dragonfly go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=netbsd go test ./... | $(BUILD_FAIL_PATTERN)
# cross build to OpenBSD not worked since process has "C"
# GOOS=openbsd go test ./... | $(BUILD_FAIL_PATTERN)

ifeq ($(shell uname -s), Darwin)
CGO_ENABLED=1 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)
endif
@echo 'Successfully built on all known operating systems'

macos_test:
CGO_ENABLED=0 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)
CGO_ENABLED=1 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)

init_tools:
go get github.com/golang/dep/cmd/dep
Loading

0 comments on commit cb4c275

Please sign in to comment.