Skip to content

Commit

Permalink
url encode monitor IDs in SA receiver (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmfitzpatrick authored Apr 13, 2021
1 parent d6b531d commit 528ceb8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/receiver/smartagentreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ package smartagentreceiver
import (
"context"
"fmt"
"net/url"
"os"
"path/filepath"
"reflect"
"runtime"
"strings"
"sync"

"github.com/signalfx/signalfx-agent/pkg/core/common/constants"
Expand Down Expand Up @@ -97,7 +97,7 @@ func (r *Receiver) Start(_ context.Context, host component.Host) error {

configCore := r.config.monitorConfig.MonitorConfigCore()
monitorType := configCore.Type
monitorName := strings.ReplaceAll(r.config.Name(), "/", "")
monitorName := url.PathEscape(r.config.Name())
configCore.MonitorID = types.MonitorID(monitorName)

configureRusToZapOnce.Do(func() {
Expand Down
2 changes: 1 addition & 1 deletion internal/receiver/smartagentreceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func TestSmartAgentReceiver(t *testing.T) {
err := receiver.Start(context.Background(), componenttest.NewNopHost())
require.NoError(t, err)

assert.EqualValues(t, "smartagentvalid", cfg.monitorConfig.MonitorConfigCore().MonitorID)
assert.EqualValues(t, "smartagent%2Fvalid", cfg.monitorConfig.MonitorConfigCore().MonitorID)
monitor, isMonitor := receiver.monitor.(*cpu.Monitor)
require.True(t, isMonitor)

Expand Down

0 comments on commit 528ceb8

Please sign in to comment.