Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'signalfx:master' into master
Browse files Browse the repository at this point in the history
jherbage authored Nov 24, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 2f5bda4 + f201bf2 commit 3893600
Showing 65 changed files with 8,524 additions and 971 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/test-signalflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: build-and-test-signalflow
on:
push:
branches:
- main
pull_request:
paths:
- 'signalflow/**'

jobs:
test-signalflow-package:
runs-on: ubuntu-22.04
strategy:
matrix:
GO_VERSION: [ "1.19", "1.20" ]
steps:
- name: Check out the codebase.
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.GO_VERSION }}

- name: Caching dependency
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
~/go/bin
key: ${{ runner.os }}-go-${{ hashFiles('signalflow/go.sum') }}

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2
working-directory: signalflow

- name: Run signalfx-go tests
run: |
cd signalflow
go mod download
go test -cover -race ./... -parallel 4 -timeout 5m
13 changes: 7 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
name: build-and-test

on:
push:
branches:
- main
pull_request:
paths_ignore:
- 'signalflow/**'

jobs:
test:
test-main-package:
runs-on: ubuntu-20.04
strategy:
matrix:
GO_VERSION: [ "1.17" ]
GO_VERSION: [ "1.17", "1.20" ]
steps:
- name: Check out the codebase.
uses: actions/checkout@v3
@@ -28,13 +29,13 @@ jobs:
~/.cache/go-build
~/go/pkg/mod
~/go/bin
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}

- name: Run tests
- name: Run signalfx-go tests
run: |
go mod download
# Used for code generation
go install github.com/mauricelam/genny
go install golang.org/x/tools/cmd/goimports
go generate ./...
go test ./... -parallel 4 -timeout 2m
go test ./... -parallel 4 -timeout 4m
16 changes: 13 additions & 3 deletions aws_cloudwatch_integration_test.go
Original file line number Diff line number Diff line change
@@ -40,11 +40,21 @@ func TestUpdateAWSCloudWatchIntegration(t *testing.T) {

mux.HandleFunc("/v2/integration/id", verifyRequest(t, "PUT", true, http.StatusOK, nil, "integration/create_aws_success.json"))

result, err := client.UpdateAWSCloudWatchIntegration(context.Background(), "id", &integration.AwsCloudWatchIntegration{
Type: "AWSCloudWatch",
})
cwIntegration := integration.AwsCloudWatchIntegration{
NamespaceSyncRules: []*integration.AwsNameSpaceSyncRule{
{
Namespace: "AWS/SomeNewNamespace",
},
},
Services: []integration.AwsService{"AWS/AnotherNewNamespace"},
Type: "AWSCloudWatch",
}
result, err := client.UpdateAWSCloudWatchIntegration(context.Background(), "id", &cwIntegration)
assert.NoError(t, err, "Unexpected error creating integration")
assert.Equal(t, "string", result.Name, "Name does not match")
assert.Equal(t, integration.AwsService("AWS/SomeNewNamespace"), result.NamespaceSyncRules[0].Namespace,
"NamespaceSyncRules[0].Namespace does not match")
assert.Equal(t, integration.AwsService("AWS/AnotherNewNamespace"), result.Services[0], "Services[0] does not match")
}

func TestUpdateAWSCloudWatchIntegrationMetricStatsToSync(t *testing.T) {
9 changes: 0 additions & 9 deletions client.go
Original file line number Diff line number Diff line change
@@ -7,8 +7,6 @@ import (
"net/url"
stdpath "path"
"time"

"github.com/signalfx/signalfx-go/signalflow"
)

// DefaultAPIURL is the default URL for making API requests
@@ -104,10 +102,3 @@ func (c *Client) doRequestWithToken(ctx context.Context, method string, path str

return c.httpClient.Do(req)
}

// SignalFlow creates and returns a SignalFlow client that can be used to
// execute streaming jobs.
func (c *Client) SignalFlow(options ...signalflow.ClientParam) (*signalflow.Client, error) {
options = append(options, signalflow.AccessToken(c.authToken))
return signalflow.NewClient(options...)
}
37 changes: 32 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,39 @@
module github.com/signalfx/signalfx-go

go 1.12
go 1.17

require (
github.com/davecgh/go-spew v1.1.1
github.com/gorilla/websocket v1.4.2
github.com/mauricelam/genny v0.0.0-20190320071652-0800202903e5
github.com/signalfx/golib/v3 v3.3.37
github.com/stretchr/testify v1.6.1
golang.org/x/tools v0.0.0-20190906203814-12febf440ab1
github.com/signalfx/golib/v3 v3.3.47
github.com/stretchr/testify v1.8.2
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5
golang.org/x/tools v0.1.5
)

require (
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/jaegertracing/jaeger v1.38.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/signalfx/com_signalfx_metrics_protobuf v0.0.3 // indirect
github.com/signalfx/gohistogram v0.0.0-20160107210732-1ccfd2ff5083 // indirect
github.com/signalfx/sapm-proto v0.7.2 // indirect
github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.22.0 // indirect
golang.org/x/mod v0.4.2 // indirect
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 3893600

Please sign in to comment.