Skip to content

Commit

Permalink
chore(deps): Bump github.com/showwin/speedtest-go from 1.6.6 to 1.6.7 (
Browse files Browse the repository at this point in the history
…#14250)

Co-authored-by: Josh Powers <[email protected]>
Co-authored-by: r3inbowari <[email protected]>
  • Loading branch information
3 people authored Nov 10, 2023
1 parent 87ca7b2 commit d644ffd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ require (
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
github.com/sensu/sensu-go/api/core/v2 v2.16.0
github.com/shirou/gopsutil/v3 v3.23.9
github.com/showwin/speedtest-go v1.6.6
github.com/showwin/speedtest-go v1.6.7
github.com/signalfx/golib/v3 v3.3.53
github.com/sirupsen/logrus v1.9.3
github.com/sleepinggenius2/gosmi v0.4.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2084,8 +2084,8 @@ github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9Nz
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/showwin/speedtest-go v1.6.6 h1:WPq8vhD1aHzt23hJA+wHe3MLOXsVrMMOjU2UO98pOSc=
github.com/showwin/speedtest-go v1.6.6/go.mod h1:uLgdWCNarXxlYsL2E5TOZpCIwpgSWnEANZp7gfHXHu0=
github.com/showwin/speedtest-go v1.6.7 h1:U0uMD9v4QS2JEqBoCHPWYQ1S9f87AnSSl5WsT+sBX6c=
github.com/showwin/speedtest-go v1.6.7/go.mod h1:uLgdWCNarXxlYsL2E5TOZpCIwpgSWnEANZp7gfHXHu0=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/signalfx/com_signalfx_metrics_protobuf v0.0.3 h1:32k2QLgsKhcEs55q4REPKyIadvid5FPy2+VMgvbmKJ0=
github.com/signalfx/com_signalfx_metrics_protobuf v0.0.3/go.mod h1:gJrXWi7wSGXfiC7+VheQaz+ypdCt5SmZNL+BRxUe7y4=
Expand Down
7 changes: 6 additions & 1 deletion plugins/inputs/internet_speed/internet_speed.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,14 @@ func (is *InternetSpeed) Gather(acc telegraf.Accumulator) error {
}

func (is *InternetSpeed) findClosestServer() error {
proto := speedtest.HTTP
if os.Getegid() <= 0 {
proto = speedtest.ICMP
}

client := speedtest.New(speedtest.WithUserConfig(&speedtest.UserConfig{
UserAgent: internal.ProductToken(),
ICMP: os.Geteuid() == 0 || os.Geteuid() == -1,
PingMode: proto,
SavingMode: is.MemorySavingMode,
}))
if is.Connections > 0 {
Expand Down
10 changes: 3 additions & 7 deletions plugins/inputs/internet_speed/internet_speed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ func TestGathering(t *testing.T) {
MemorySavingMode: true,
Log: testutil.Logger{},
}
require.NoError(t, internetSpeed.Init())

acc := &testutil.Accumulator{}

require.NoError(t, internetSpeed.Gather(acc))
}

Expand All @@ -29,16 +29,12 @@ func TestDataGen(t *testing.T) {
MemorySavingMode: true,
Log: testutil.Logger{},
}
require.NoError(t, internetSpeed.Init())

acc := &testutil.Accumulator{}
require.NoError(t, internetSpeed.Gather(acc))

metric, ok := acc.Get("internet_speed")
require.True(t, ok)

tags := metric.Tags

fields := metric.Fields

acc.AssertContainsTaggedFields(t, "internet_speed", fields, tags)
acc.AssertContainsTaggedFields(t, "internet_speed", metric.Fields, metric.Tags)
}

0 comments on commit d644ffd

Please sign in to comment.