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

[chore]: enable gofumpt linter for connector #36372

Merged
merged 1 commit into from
Nov 14, 2024
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: 2 additions & 1 deletion connector/countconnector/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ func TestLoadConfig(t *testing.T) {
},
Metrics: map[string]MetricInfo{
"my.metric.count": {
Description: "My metric count."},
Description: "My metric count.",
},
"limited.metric.count": {
Description: "Limited metric count.",
Conditions: []string{`IsMatch(resource.attributes["host.name"], "pod-m")`},
Expand Down
8 changes: 5 additions & 3 deletions connector/otlpjsonconnector/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/connector/otlpjsonconnector/internal/metadata"
)

var logRegex = regexp.MustCompile(`^\{\s*"resourceLogs"\s*:\s*\[`)
var metricRegex = regexp.MustCompile(`^\{\s*"resourceMetrics"\s*:\s*\[`)
var traceRegex = regexp.MustCompile(`^\{\s*"resourceSpans"\s*:\s*\[`)
var (
logRegex = regexp.MustCompile(`^\{\s*"resourceLogs"\s*:\s*\[`)
metricRegex = regexp.MustCompile(`^\{\s*"resourceMetrics"\s*:\s*\[`)
traceRegex = regexp.MustCompile(`^\{\s*"resourceSpans"\s*:\s*\[`)
)

// NewFactory returns a ConnectorFactory.
func NewFactory() connector.Factory {
Expand Down
1 change: 0 additions & 1 deletion connector/routingconnector/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func newLogsConnector(
cfg.DefaultPipelines,
lr.Consumer,
set.TelemetrySettings)

if err != nil {
return nil, err
}
Expand Down
1 change: 0 additions & 1 deletion connector/routingconnector/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func newMetricsConnector(
cfg.DefaultPipelines,
mr.Consumer,
set.TelemetrySettings)

if err != nil {
return nil, err
}
Expand Down
8 changes: 5 additions & 3 deletions connector/routingconnector/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ import (
// future if needed. For now, it expects the condition to be in exactly the format:
// 'request["<name>"] <comparator> <value>' where <comparator> is either '==' or '!='.

var requestFieldRegex = regexp.MustCompile(`request\[".*"\]`)
var valueFieldRegex = regexp.MustCompile(`".*"`)
var comparatorRegex = regexp.MustCompile(`==|!=`)
var (
requestFieldRegex = regexp.MustCompile(`request\[".*"\]`)
valueFieldRegex = regexp.MustCompile(`".*"`)
comparatorRegex = regexp.MustCompile(`==|!=`)
)

type requestCondition struct {
attributeName string
Expand Down
1 change: 0 additions & 1 deletion connector/routingconnector/traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func newTracesConnector(
cfg.DefaultPipelines,
tr.Consumer,
set.TelemetrySettings)

if err != nil {
return nil, err
}
Expand Down
1 change: 0 additions & 1 deletion connector/servicegraphconnector/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

// Config defines the configuration options for servicegraphprocessor.
type Config struct {

// MetricsExporter is the name of the metrics exporter to use to ship metrics.
//
// Deprecated: The exporter is defined as part of the pipeline and this option is currently noop.
Expand Down
1 change: 0 additions & 1 deletion connector/servicegraphconnector/connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ func TestUpdateDurationMetrics(t *testing.T) {
caseStr string
duration float64
}{

{
caseStr: "index 0 latency",
duration: 0,
Expand Down
4 changes: 1 addition & 3 deletions connector/servicegraphconnector/internal/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ import (
"go.opentelemetry.io/collector/pdata/pcommon"
)

var (
ErrTooManyItems = errors.New("too many items")
)
var ErrTooManyItems = errors.New("too many items")

type Callback func(e *Edge)

Expand Down
3 changes: 2 additions & 1 deletion connector/spanmetricsconnector/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ func TestLoadConfig(t *testing.T) {
},
},
},
}},
},
},
{
id: component.NewIDWithName(metadata.Type, "exponential_histogram"),
expected: &Config{
Expand Down
1 change: 1 addition & 0 deletions connector/spanmetricsconnector/connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,7 @@ func TestSpanMetrics_Events(t *testing.T) {
})
}
}

func TestExemplarsAreDiscardedAfterFlushing(t *testing.T) {
tests := []struct {
name string
Expand Down
6 changes: 4 additions & 2 deletions connector/spanmetricsconnector/internal/metrics/unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ const (

type Unit int8

var _ encoding.TextMarshaler = (*Unit)(nil)
var _ encoding.TextUnmarshaler = (*Unit)(nil)
var (
_ encoding.TextMarshaler = (*Unit)(nil)
_ encoding.TextUnmarshaler = (*Unit)(nil)
)

func (u Unit) String() string {
switch u {
Expand Down