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

Purestorage FlashArray Receiver First Scraper #16529

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
3 changes: 3 additions & 0 deletions cmd/configschema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.66.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/promtailreceiver v0.0.0-00010101000000-000000000000 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/pulsarreceiver v0.66.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/purefareceiver v0.66.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/rabbitmqreceiver v0.66.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator v0.66.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/riakreceiver v0.66.0 // indirect
Expand Down Expand Up @@ -1005,6 +1006,8 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/promt

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/pulsarreceiver => ../../receiver/pulsarreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/purefareceiver => ../../receiver/purefareceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/rabbitmqreceiver => ../../receiver/rabbitmqreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator => ../../receiver/receivercreator
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.66.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/promtailreceiver v0.0.0-00010101000000-000000000000
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/pulsarreceiver v0.66.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/purefareceiver v0.66.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/rabbitmqreceiver v0.66.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator v0.66.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/redisreceiver v0.66.0
Expand Down Expand Up @@ -1009,6 +1010,8 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/promt

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/pulsarreceiver => ./receiver/pulsarreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/purefareceiver => ./receiver/purefareceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/rabbitmqreceiver => ./receiver/rabbitmqreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator => ./receiver/receivercreator
Expand Down
2 changes: 2 additions & 0 deletions internal/components/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/promtailreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/pulsarreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/purefareceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/rabbitmqreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/redisreceiver"
Expand Down Expand Up @@ -263,6 +264,7 @@ func Components() (component.Factories, error) {
prometheusreceiver.NewFactory(),
promtailreceiver.NewFactory(),
pulsarreceiver.NewFactory(),
purefareceiver.NewFactory(),
rabbitmqreceiver.NewFactory(),
receivercreator.NewFactory(),
redisreceiver.NewFactory(),
Expand Down
3 changes: 3 additions & 0 deletions internal/components/receivers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ func TestDefaultReceivers(t *testing.T) {
{
receiver: "rabbitmq",
},
{
receiver: "purefa",
},
{
receiver: "receiver_creator",
},
Expand Down
18 changes: 4 additions & 14 deletions receiver/purefareceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,18 @@ Example:
```yaml
extensions:
bearertokenauth/array01:
token: "some-token"
bearertokenauth/array02:
token: "some-other-token"
token: "..."

receivers:
purefa:
endpoint: http://172.0.0.0:9490/metrics/
endpoint: http://172.0.0.1:9490/metrics
arrays:
- address: gse-array01
auth: bearertokenauth/array01
- address: gse-array02
auth: bearertokenauth/array02
hosts:
- address: gse-array01
auth: bearertokenauth/array01
auth:
authenticator: bearertokenauth/array01
settings:
reload_intervals:
array: 10s
host: 1m
volume: 2m
pods: 15s
directories: 15s
```

The full list of settings exposed for this receiver are documented [here](./config.go)
Expand Down
10 changes: 3 additions & 7 deletions receiver/purefareceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ import (

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/config/configauth"
"go.opentelemetry.io/collector/config/confighttp"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/purefareceiver/internal/array"
)

var _ component.Config = (*Config)(nil)
Expand All @@ -34,12 +35,7 @@ type Config struct {
Settings *Settings `mapstructure:"settings"`

// Arrays represents the list of arrays to query
Arrays []Array `mapstructure:"arrays"`
}

type Array struct {
Address string `mapstructure:"address"`
Auth configauth.Authentication `mapstructure:"auth"`
Arrays []array.Config `mapstructure:"arrays"`
}

type Settings struct {
Expand Down
7 changes: 6 additions & 1 deletion receiver/purefareceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package purefareceiver // import "github.com/open-telemetry/opentelemetry-collec
import (
"path/filepath"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -39,9 +40,13 @@ func TestLoadConfig(t *testing.T) {
id: component.NewID(typeStr),
expected: &Config{
ReceiverSettings: config.NewReceiverSettings(component.NewID(typeStr)),
Settings: &Settings{
ReloadIntervals: &ReloadIntervals{
Array: 15 * time.Second,
},
},
},
},
// TODO(dgoscn): testar with_custom_intervals
}

for _, tt := range tests {
Expand Down
23 changes: 23 additions & 0 deletions receiver/purefareceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ package purefareceiver // import "github.com/open-telemetry/opentelemetry-collec

// This file implements Factory for Array scraper.
import (
"context"
"fmt"
"time"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/consumer"
)

// NewFactory creates a factory for Pure Storage FlashArray receiver.
Expand All @@ -38,5 +43,23 @@ func createDefaultConfig() component.Config {
return &Config{
ReceiverSettings: config.NewReceiverSettings(component.NewID(typeStr)),
HTTPClientSettings: confighttp.HTTPClientSettings{},
Settings: &Settings{
ReloadIntervals: &ReloadIntervals{
Array: 15 * time.Second,
},
},
}
}

func createMetricsReceiver(
_ context.Context,
set component.ReceiverCreateSettings,
rCfg component.Config,
next consumer.Metrics,
) (component.MetricsReceiver, error) {
cfg, ok := rCfg.(*Config)
if !ok {
return nil, fmt.Errorf("a purefa receiver config was expected by the receiver factory, but got %T", rCfg)
}
return newReceiver(cfg, set, next), nil
}
2 changes: 1 addition & 1 deletion receiver/purefareceiver/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestCreateReceiver(t *testing.T) {
set := componenttest.NewNopReceiverCreateSettings()
mReceiver, err := factory.CreateMetricsReceiver(context.Background(), set, cfg, nil)
assert.NoError(t, err, "receiver creation failed")
assert.Nil(t, mReceiver, "receiver creation failed")
assert.NotNil(t, mReceiver, "receiver creation failed")

tReceiver, err := factory.CreateTracesReceiver(context.Background(), set, cfg, nil)
assert.Equal(t, err, component.ErrDataTypeIsNotSupported)
Expand Down
127 changes: 122 additions & 5 deletions receiver/purefareceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,164 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/purefa
go 1.18

require (
github.com/open-telemetry/opentelemetry-collector-contrib/extension/bearertokenauthextension v0.66.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.66.0
github.com/prometheus/common v0.37.0
github.com/prometheus/prometheus v0.39.1
github.com/stretchr/testify v1.8.1
go.opentelemetry.io/collector v0.66.1-0.20221128222955-4ff1ff379b90
go.opentelemetry.io/collector/component v0.66.1-0.20221128222955-4ff1ff379b90
go.opentelemetry.io/collector/consumer v0.66.1-0.20221128222955-4ff1ff379b90
go.uber.org/multierr v1.8.0
)

require (
cloud.google.com/go/compute v1.12.1 // indirect
cloud.google.com/go/compute/metadata v0.2.1 // indirect
github.com/Azure/azure-sdk-for-go v65.0.0+incompatible // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.28 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.21 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
github.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/Microsoft/go-winio v0.5.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/armon/go-metrics v0.3.10 // indirect
github.com/aws/aws-sdk-go v1.44.145 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dennwc/varint v1.0.0 // indirect
github.com/digitalocean/godo v1.84.1 // indirect
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/docker v20.10.21+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
github.com/envoyproxy/go-control-plane v0.10.3 // indirect
github.com/envoyproxy/protoc-gen-validate v0.6.8 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/swag v0.21.1 // indirect
github.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48 // indirect
github.com/go-zookeeper/zk v1.0.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/gophercloud/gophercloud v1.0.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grafana/regexp v0.0.0-20220304095617-2e8d9baf4ac2 // indirect
github.com/hashicorp/consul/api v1.15.3 // indirect
github.com/hashicorp/cronexpr v1.1.1 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-hclog v1.3.1 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/nomad/api v0.0.0-20220921012004-ddeeb1040edf // indirect
github.com/hashicorp/serf v0.9.7 // indirect
github.com/hetznercloud/hcloud-go v1.35.3 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/ionos-cloud/sdk-go/v6 v6.1.3 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.15.12 // indirect
github.com/knadh/koanf v1.4.4 // indirect
github.com/kolo/xmlrpc v0.0.0-20220919000247-3377102c83bd // indirect
github.com/linode/linodego v1.9.1 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/miekg/dns v1.1.50 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.66.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common/sigv4 v0.1.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/rs/cors v1.8.2 // indirect
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/vultr/govultr/v2 v2.17.2 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/collector/featuregate v0.66.1-0.20221128222955-4ff1ff379b90 // indirect
go.opentelemetry.io/collector/pdata v0.66.1-0.20221128222955-4ff1ff379b90 // indirect
go.opentelemetry.io/collector/semconv v0.66.1-0.20221128222955-4ff1ff379b90 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.4 // indirect
go.opentelemetry.io/otel v1.11.1 // indirect
go.opentelemetry.io/otel/metric v0.33.0 // indirect
go.opentelemetry.io/otel/trace v1.11.1 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/goleak v1.1.12 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/goleak v1.2.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/mod v0.6.0 // indirect
golang.org/x/net v0.1.0 // indirect
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/term v0.1.0 // indirect
golang.org/x/text v0.4.0 // indirect
google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc // indirect
golang.org/x/time v0.0.0-20220920022843-2ce7c2934d45 // indirect
golang.org/x/tools v0.2.0 // indirect
google.golang.org/api v0.103.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c // indirect
google.golang.org/grpc v1.51.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.66.6 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.25.4 // indirect
k8s.io/apimachinery v0.25.4 // indirect
k8s.io/client-go v0.25.4 // indirect
k8s.io/klog/v2 v2.80.0 // indirect
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver => ../prometheusreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/extension/bearertokenauthextension => ../../extension/bearertokenauthextension
Loading