Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Commit fd893a1

Browse files
committed
Print the URL into description
It helps to see what is the configured remote url and catch eventual error in the set config.
1 parent 4a18a4d commit fd893a1

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

pkg/remotewrite/remotewrite.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ func New(params output.Params) (*Output, error) {
5858
}, nil
5959
}
6060

61-
func (*Output) Description() string {
62-
return "Prometheus remote write"
61+
func (o *Output) Description() string {
62+
return fmt.Sprintf("Prometheus remote write (%s)", o.config.URL.String)
6363
}
6464

6565
func (o *Output) Start() error {

pkg/remotewrite/remotewrite_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,20 @@ import (
99
"github.com/stretchr/testify/assert"
1010
"github.com/stretchr/testify/require"
1111
"go.k6.io/k6/metrics"
12+
"gopkg.in/guregu/null.v3"
1213
)
1314

15+
func TestOutputDescription(t *testing.T) {
16+
t.Parallel()
17+
o := Output{
18+
config: Config{
19+
URL: null.StringFrom("http://remote-url.fake"),
20+
},
21+
}
22+
exp := "Prometheus remote write (http://remote-url.fake)"
23+
assert.Equal(t, exp, o.Description())
24+
}
25+
1426
func TestOutputConvertToPbSeries(t *testing.T) {
1527
t.Parallel()
1628

0 commit comments

Comments
 (0)