Skip to content

Commit

Permalink
feat(otel): add more frr attributes
Browse files Browse the repository at this point in the history
Signed-off-by: Boris Glimcher <[email protected]>
  • Loading branch information
glimchb committed Oct 14, 2023
1 parent a8a8a0f commit a58884e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/utils/telnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,17 @@ func FrrBgpCmd(ctx context.Context, command string) (string, error) {
// TelnetDialAndCommunicate connects to telnet with password and runs command
func TelnetDialAndCommunicate(ctx context.Context, command string, port int) (string, error) {
_, childSpan := tracer.Start(ctx, "frr.Command")
childSpan.SetAttributes(attribute.String("command.name", command))
defer childSpan.End()

if childSpan.IsRecording() {
childSpan.SetAttributes(
attribute.Int("frr.port", port),
attribute.String("frr.name", command),
attribute.String("frr.address", address),
attribute.String("frr.network", network),
)
}

// new connection every time
conn, err := telnet.DialTimeout(network, fmt.Sprintf("%s:%d", address, port), timeout)
if err != nil {
Expand Down

0 comments on commit a58884e

Please sign in to comment.