Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Go (1.20), Alpine (3.17), and all modules #131

Merged
merged 1 commit into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ steps:
- name: ":hammer_and_wrench:"
plugins:
- docker#v2.0.0:
image: "golang:1.16"
image: "golang:1.20"
command: ["go", "test", "-v", "-race", "."]
environment:
- GO111MODULE=on
Expand All @@ -14,23 +14,23 @@ steps:
build: main.go
import: github.com/buildkite/buildkite-agent-metrics
targets:
- version: "1.16"
- version: "1.20.2"
goos: linux
goarch: amd64
gomodule: "on"
- version: "1.16"
- version: "1.20.2"
goos: linux
goarch: arm64
gomodule: "on"
- version: "1.16"
- version: "1.20.2"
goos: windows
goarch: amd64
gomodule: "on"
- version: "1.16"
- version: "1.20.2"
goos: darwin
goarch: amd64
gomodule: "on"
- version: "1.16"
- version: "1.20.2"
goos: darwin
goarch: arm64
gomodule: "on"
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/steps/build-lambda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -eu
docker run --rm --volume "$PWD:/code" \
--workdir "/code" \
--rm \
golang:1.16 \
golang:1.20 \
sh -c "go get ./lambda && go build -o ./lambda/handler ./lambda"

chmod +x ./lambda/handler
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM golang:1.16 as builder
FROM golang:1.20 as builder
WORKDIR /go/src/github.com/buildkite/buildkite-agent-metrics/
COPY . .
RUN GO111MODULE=on GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o buildkite-agent-metrics .

FROM alpine:3.9
FROM alpine:3.17
RUN apk update && apk add curl ca-certificates
COPY --from=builder /go/src/github.com/buildkite/buildkite-agent-metrics/buildkite-agent-metrics .
EXPOSE 8080 8125
Expand Down
3 changes: 2 additions & 1 deletion backend/newrelic.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ type NewRelicBackend struct {

// NewNewRelicBackend returns a backend for New Relic
// Where appName is your desired application name in New Relic
// and licenseKey is your New Relic license key
//
// and licenseKey is your New Relic license key
func NewNewRelicBackend(appName string, licenseKey string) (*NewRelicBackend, error) {
config := newrelic.NewConfig(appName, licenseKey)
app, err := newrelic.NewApplication(config)
Expand Down
6 changes: 3 additions & 3 deletions backend/stackdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"time"

"github.com/buildkite/buildkite-agent-metrics/collector"
"github.com/golang/protobuf/ptypes/timestamp"
"google.golang.org/genproto/googleapis/api/label"
"google.golang.org/protobuf/types/known/timestamppb"

monitoring "cloud.google.com/go/monitoring/apiv3"
"google.golang.org/genproto/googleapis/api/metric"
Expand Down Expand Up @@ -51,7 +51,7 @@ func NewStackDriverBackend(gcpProjectID string) (*StackDriverBackend, error) {
// Collect metrics
func (sd *StackDriverBackend) Collect(r *collector.Result) error {
ctx := context.Background()
now := &timestamp.Timestamp{
now := &timestamppb.Timestamp{
Seconds: time.Now().Unix(),
}
orgName := dashReplacer.Replace(r.Org)
Expand Down Expand Up @@ -120,7 +120,7 @@ func createCustomMetricRequest(projectID *string, metricType *string) *monitorin
}

// createTimeSeriesValueRequest creates a StackDriver value request for the specified metric
func createTimeSeriesValueRequest(projectID *string, metricType *string, queue string, value int, time *timestamp.Timestamp) *monitoringpb.CreateTimeSeriesRequest {
func createTimeSeriesValueRequest(projectID *string, metricType *string, queue string, value int, time *timestamppb.Timestamp) *monitoringpb.CreateTimeSeriesRequest {
req := &monitoringpb.CreateTimeSeriesRequest{
Name: "projects/" + *projectID,
TimeSeries: []*monitoringpb.TimeSeries{{
Expand Down
6 changes: 3 additions & 3 deletions backend/stackdriver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"testing"
"time"

"github.com/golang/protobuf/ptypes/timestamp"
"google.golang.org/genproto/googleapis/api/label"
"google.golang.org/genproto/googleapis/api/metric"
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
"google.golang.org/protobuf/types/known/timestamppb"
)

func Test_createCustomMetricRequest(t *testing.T) {
Expand Down Expand Up @@ -49,7 +49,7 @@ func Test_createCustomMetricRequest(t *testing.T) {
}

func Test_createTimeSeriesValueRequest(t *testing.T) {
now := timestamp.Timestamp{
now := timestamppb.Timestamp{
Seconds: time.Now().Unix(),
}

Expand All @@ -58,7 +58,7 @@ func Test_createTimeSeriesValueRequest(t *testing.T) {
metricType string
queue string
value int
time timestamp.Timestamp
time timestamppb.Timestamp
}
tests := []struct {
name string
Expand Down
2 changes: 1 addition & 1 deletion collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (c *Collector) Collect() (*Result, error) {
httpClient := &http.Client{
Timeout: 15 * time.Second,
}

if len(c.Queues) == 0 {
log.Println("Collecting agent metrics for all queues")

Expand Down
50 changes: 38 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,17 +1,43 @@
module github.com/buildkite/buildkite-agent-metrics

go 1.16
go 1.20

require (
cloud.google.com/go v0.37.2
github.com/DataDog/datadog-go v0.0.0-20180822151419-281ae9f2d895
github.com/aws/aws-lambda-go v1.28.0
github.com/aws/aws-sdk-go v1.15.66
github.com/golang/mock v1.2.0
github.com/golang/protobuf v1.2.0
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect
github.com/newrelic/go-agent v3.0.0+incompatible
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f
google.golang.org/genproto v0.0.0-20190401181712-f467c93bbac2
cloud.google.com/go/monitoring v1.13.0
github.com/DataDog/datadog-go v4.8.3+incompatible
github.com/aws/aws-lambda-go v1.38.0
github.com/aws/aws-sdk-go v1.44.222
github.com/golang/mock v1.6.0
github.com/newrelic/go-agent v3.20.4+incompatible
github.com/prometheus/client_golang v1.14.0
github.com/prometheus/client_model v0.3.0
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4
google.golang.org/protobuf v1.29.1
)

require (
cloud.google.com/go/compute v1.18.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/googleapis/gax-go/v2 v2.8.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/mod v0.9.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/oauth2 v0.6.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/tools v0.7.0 // indirect
google.golang.org/api v0.113.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/grpc v1.53.0 // indirect
)
Loading