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

reformat code before release #472

Merged
merged 1 commit into from Apr 19, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 6 additions & 7 deletions go.mod
Expand Up @@ -98,10 +98,8 @@ require (
github.com/jackc/pgproto3/v2 v2.3.1 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.12.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.54.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.54.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.54.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.54.0 // indirect
github.com/rogpeppe/go-internal v1.8.1 // indirect
github.com/tidwall/gjson v1.10.2 // indirect
github.com/tidwall/match v1.1.1 // indirect
Expand All @@ -122,6 +120,8 @@ require (
github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.5.0
github.com/aws/aws-sdk-go-v2/service/sts v1.18.3
github.com/coreos/go-systemd/v22 v22.3.2
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.54.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.54.0
github.com/prometheus-community/pro-bing v0.1.0
github.com/vmware/govmomi v0.29.0
)
Expand All @@ -132,7 +132,6 @@ require (
cloud.google.com/go/compute v1.7.0 // indirect
contrib.go.opencensus.io/exporter/prometheus v0.4.1 // indirect
github.com/Azure/azure-sdk-for-go v65.0.0+incompatible // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
Expand Down Expand Up @@ -318,14 +317,14 @@ require (
github.com/xdg/stringprep v1.0.3 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.opencensus.io v0.23.0 // indirect
go.opentelemetry.io/collector/pdata v0.54.0 // indirect
go.opencensus.io v0.23.0
go.opentelemetry.io/collector/pdata v0.54.0
go.opentelemetry.io/collector/semconv v0.54.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.32.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.32.0 // indirect
go.opentelemetry.io/otel v1.7.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.30.0 // indirect
go.opentelemetry.io/otel/sdk v1.7.0 // indirect
go.opentelemetry.io/otel/sdk v1.7.0
go.opentelemetry.io/otel/sdk/metric v0.30.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/automaxprocs v1.5.1 // indirect
Expand All @@ -340,7 +339,7 @@ require (
google.golang.org/api v0.86.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03 // indirect
google.golang.org/grpc v1.47.0 // indirect
google.golang.org/grpc v1.47.0
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
Expand Down
9 changes: 2 additions & 7 deletions go.sum
Expand Up @@ -69,7 +69,6 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbL
github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0=
github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8=
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8=
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
github.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA=
Expand Down Expand Up @@ -363,8 +362,6 @@ github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBd
github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/flashcatcloud/client_golang v1.12.2-0.20220704074148-3b31f0c90903 h1:CfWf8xXOpjs1G8xsE2ZAueqtPynok/pS5VHWhlwgRrg=
github.com/flashcatcloud/client_golang v1.12.2-0.20220704074148-3b31f0c90903/go.mod h1:nDOYPpTKRWyFSHGWY5QbDUvjSMBusROfFzxhmDKUNWo=
github.com/flashcatcloud/opentelemetry-collector v0.54.1-0.20220628041301-3b8dabd1bcd0 h1:RUknqWUJ7dTtK5rZ602dqYZyDVJiYlY3a8Dep2zuLjU=
github.com/flashcatcloud/opentelemetry-collector v0.54.1-0.20220628041301-3b8dabd1bcd0/go.mod h1:FgNzyfb4sAGb5cqusB5znETJ8Pz4OQUBGbOeGIZ2rlQ=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
Expand Down Expand Up @@ -674,7 +671,6 @@ github.com/hashicorp/consul/sdk v0.8.0 h1:OJtKBtEjboEZvG6AOUdh4Z1Zbyu0WcxQ0qatRr
github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms=
github.com/hashicorp/cronexpr v1.1.1 h1:NJZDd87hGXjoZBdvyCF9mX4DCq5Wy7+A/w+A7q0wn6c=
github.com/hashicorp/cronexpr v1.1.1/go.mod h1:P4wA0KBl9C5q2hABiMO7cp6jcIg96CDh1Efb3g1PWA4=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
Expand All @@ -686,8 +682,6 @@ github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9
github.com/hashicorp/go-hclog v0.8.0/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXcJdM=
github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
github.com/hashicorp/go-hclog v1.2.1 h1:YQsLlGDJgwhXFpucSPyVbCBviQtjlHv3jLTlp8YmtEw=
github.com/hashicorp/go-hclog v1.2.1/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
Expand Down Expand Up @@ -1045,6 +1039,8 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y
github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
github.com/open-telemetry/opentelemetry-collector v0.54.0 h1:Ib3aRVdlDhqy6FUcSP/ID1YoPnTnXKCP84g8HPM3Z9o=
github.com/open-telemetry/opentelemetry-collector v0.54.0/go.mod h1:FgNzyfb4sAGb5cqusB5znETJ8Pz4OQUBGbOeGIZ2rlQ=
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/alibabacloudlogserviceexporter v0.54.0 h1:bLOTsnh+ctD1n9jqQ1TgWba5NgHVA0H4ygCpK2dyqJk=
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/alibabacloudlogserviceexporter v0.54.0/go.mod h1:9k9/UPofhLdDvhNQwyPlpfe5TALtWD2NY5BzA2EDS2c=
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/jaegerexporter v0.54.0 h1:+Q4Mc0BzLKi79sDn3YL7hdzfr8Kk4HOCzJxpT9cx/Kw=
Expand Down Expand Up @@ -1293,7 +1289,6 @@ github.com/tidwall/gjson v1.10.2 h1:APbLGOM0rrEkd8WBw9C24nllro4ajFuJu0Sc9hRz8Bo=
github.com/tidwall/gjson v1.10.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
Expand Down
29 changes: 14 additions & 15 deletions inputs/xskyapi/xskyapi.go
Expand Up @@ -3,10 +3,6 @@ package xskyapi
import (
"bytes"
"encoding/json"
"flashcat.cloud/categraf/config"
"flashcat.cloud/categraf/inputs"
"flashcat.cloud/categraf/pkg/tls"
"flashcat.cloud/categraf/types"
"fmt"
"io"
"log"
Expand All @@ -17,6 +13,11 @@ import (
"strings"
"sync"
"time"

"flashcat.cloud/categraf/config"
"flashcat.cloud/categraf/inputs"
"flashcat.cloud/categraf/pkg/tls"
"flashcat.cloud/categraf/types"
)

const inputName = "xskyapi"
Expand Down Expand Up @@ -149,7 +150,7 @@ func (ins *Instance) gather(slist *types.SampleList, server string, token string

// acquire quota data of 3 mainstream distributed storage service provided by Xsky
switch ins.DssType {
case "oss": //object storage
case "oss": // object storage

// oss users

Expand All @@ -164,7 +165,7 @@ func (ins *Instance) gather(slist *types.SampleList, server string, token string

er := json.Unmarshal(resp, &osUsers)
if er != nil {
fmt.Printf("Parsing JSON string exception:%s\n", err)
log.Printf("Parsing JSON string exception:%s\n", err)
}

labels := map[string]string{"server": server}
Expand All @@ -190,7 +191,7 @@ func (ins *Instance) gather(slist *types.SampleList, server string, token string

err = json.Unmarshal(resp, &osBuckets)
if err != nil {
fmt.Printf("Parsing JSON string exception:%s\n", err)
log.Printf("Parsing JSON string exception:%s\n", err)
}

labels = map[string]string{"server": server}
Expand Down Expand Up @@ -221,7 +222,7 @@ func (ins *Instance) gather(slist *types.SampleList, server string, token string

er := json.Unmarshal(resp, &dfsQuotas)
if er != nil {
fmt.Printf("Parsing JSON string exception:%s\n", err)
log.Printf("Parsing JSON string exception:%s\n", err)
}

labels := map[string]string{"server": server}
Expand All @@ -247,7 +248,7 @@ func (ins *Instance) gather(slist *types.SampleList, server string, token string

err = json.Unmarshal(resp, &blockVolumes)
if err != nil {
fmt.Printf("Parsing JSON string exception:%s\n", err)
log.Printf("Parsing JSON string exception:%s\n", err)
}

labels = map[string]string{"server": server}
Expand Down Expand Up @@ -276,7 +277,7 @@ func (ins *Instance) gather(slist *types.SampleList, server string, token string

er := json.Unmarshal(resp, &fsFolders)
if er != nil {
fmt.Printf("Parsing JSON string exception:%s\n", err)
log.Printf("Parsing JSON string exception:%s\n", err)
}

labels := map[string]string{"server": server}
Expand All @@ -302,12 +303,12 @@ func (ins *Instance) gather(slist *types.SampleList, server string, token string

err = json.Unmarshal(resp, &blockVolumes)
if err != nil {
fmt.Printf("Parsing JSON string exception:%s\n", err)
log.Printf("Parsing JSON string exception:%s\n", err)
}

labels = map[string]string{"server": server}
fields = make(map[string]interface{})
//log.Println("D! len(OsUsers):", len(osUsers.OsUser))
// log.Println("D! len(OsUsers):", len(osUsers.OsUser))

for _, blockVolume := range blockVolumes.BlockVolume {
labels["name"] = blockVolume.Name
Expand Down Expand Up @@ -375,7 +376,6 @@ func (ins *Instance) sendRequest(serverURL string, token string) ([]byte, float6
}

type osUser struct {
//Email string `json:"email"`
ID int `json:"id"`
Name string `json:"name"`
Samples []struct {
Expand All @@ -389,8 +389,7 @@ type OsUsers struct {
}

type osBucket struct {
ID int `json:"id"`
//MaxBuckets int `json:"max_buckets"`
ID int `json:"id"`
Name string `json:"name"`
Owner struct {
ID int `json:"id"`
Expand Down
3 changes: 2 additions & 1 deletion traces/collector.go
Expand Up @@ -7,9 +7,10 @@ import (
"fmt"
"log"

"go.opentelemetry.io/collector/component"

"flashcat.cloud/categraf/config"
"flashcat.cloud/categraf/config/traces"
"go.opentelemetry.io/collector/component"
)

// Collector simply wrapped the OpenTelemetry Collector, which means you can get a full support
Expand Down
5 changes: 3 additions & 2 deletions traces/host.go
Expand Up @@ -3,10 +3,11 @@
package traces

import (
"flashcat.cloud/categraf/pkg/otel/extensions"
"flashcat.cloud/categraf/pkg/otel/pipelines"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config"

"flashcat.cloud/categraf/pkg/otel/extensions"
"flashcat.cloud/categraf/pkg/otel/pipelines"
)

var _ component.Host = (*serviceHost)(nil)
Expand Down
7 changes: 4 additions & 3 deletions traces/service.go
Expand Up @@ -6,14 +6,15 @@ import (
"context"
"fmt"

"flashcat.cloud/categraf/pkg/otel/extensions"
"flashcat.cloud/categraf/pkg/otel/pipelines"
"flashcat.cloud/categraf/pkg/otel/telemetrylogs"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/otel/metric/nonrecording"
"go.opentelemetry.io/otel/trace"
"go.uber.org/multierr"

"flashcat.cloud/categraf/pkg/otel/extensions"
"flashcat.cloud/categraf/pkg/otel/pipelines"
"flashcat.cloud/categraf/pkg/otel/telemetrylogs"
)

type service struct {
Expand Down