Skip to content

Commit

Permalink
upload: add hostname to agent spans
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdecaf committed Nov 7, 2023
1 parent 9528931 commit 9eca82b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/upload/ftp.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ func (agent *FTPTransferAgent) Hostname() string {

func (agent *FTPTransferAgent) Delete(ctx context.Context, path string) error {
_, span := telemetry.StartSpan(ctx, "agent-ftp-delete", trace.WithAttributes(
attribute.String("hostname", agent.Hostname()),
attribute.String("path", path),
))
defer span.End()
Expand All @@ -135,6 +136,7 @@ func (agent *FTPTransferAgent) UploadFile(ctx context.Context, f File) error {
pathToWrite := filepath.Join(agent.OutboundPath(), f.Filepath)

_, span := telemetry.StartSpan(ctx, "agent-ftp-upload", trace.WithAttributes(
attribute.String("hostname", agent.Hostname()),
attribute.String("path", pathToWrite),
))
defer span.End()
Expand All @@ -144,6 +146,7 @@ func (agent *FTPTransferAgent) UploadFile(ctx context.Context, f File) error {

func (agent *FTPTransferAgent) ReadFile(ctx context.Context, path string) (*File, error) {
_, span := telemetry.StartSpan(ctx, "agent-ftp-read", trace.WithAttributes(
attribute.String("hostname", agent.Hostname()),
attribute.String("path", path),
))
defer span.End()
Expand Down Expand Up @@ -172,6 +175,7 @@ func (agent *FTPTransferAgent) GetReturnFiles(ctx context.Context) ([]string, er

func (agent *FTPTransferAgent) readFilepaths(ctx context.Context, dir string) ([]string, error) {
_, span := telemetry.StartSpan(ctx, "agent-ftp-list", trace.WithAttributes(
attribute.String("hostname", agent.Hostname()),
attribute.String("path", dir),
))
defer span.End()
Expand Down
4 changes: 4 additions & 0 deletions internal/upload/sftp.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func (agent *SFTPTransferAgent) Hostname() string {

func (agent *SFTPTransferAgent) Delete(ctx context.Context, path string) error {
_, span := telemetry.StartSpan(ctx, "agent-sftp-delete", trace.WithAttributes(
attribute.String("hostname", agent.Hostname()),
attribute.String("path", path),
))
defer span.End()
Expand All @@ -116,6 +117,7 @@ func (agent *SFTPTransferAgent) UploadFile(ctx context.Context, f File) error {
pathToWrite := filepath.Join(agent.OutboundPath(), filepath.Base(f.Filepath))

_, span := telemetry.StartSpan(ctx, "agent-sftp-upload", trace.WithAttributes(
attribute.String("hostname", agent.Hostname()),
attribute.String("path", pathToWrite),
))
defer span.End()
Expand All @@ -125,6 +127,7 @@ func (agent *SFTPTransferAgent) UploadFile(ctx context.Context, f File) error {

func (agent *SFTPTransferAgent) ReadFile(ctx context.Context, path string) (*File, error) {
_, span := telemetry.StartSpan(ctx, "agent-sftp-read", trace.WithAttributes(
attribute.String("hostname", agent.Hostname()),
attribute.String("path", path),
))
defer span.End()
Expand Down Expand Up @@ -153,6 +156,7 @@ func (agent *SFTPTransferAgent) GetReturnFiles(ctx context.Context) ([]string, e

func (agent *SFTPTransferAgent) readFilepaths(ctx context.Context, dir string) ([]string, error) {
_, span := telemetry.StartSpan(ctx, "agent-sftp-list", trace.WithAttributes(
attribute.String("hostname", agent.Hostname()),
attribute.String("path", dir),
))
defer span.End()
Expand Down

0 comments on commit 9eca82b

Please sign in to comment.