argossftp

package module
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 11 Imported by: 1

Documentation

Overview

Package argossftp instruments github.com/pkg/sftp clients. *sftp.Client is a concrete struct whose methods (besides ReadDirContext) take no context.Context - the library predates that convention, same constraint hit with Azure Service Bus's *Sender in the messaging phase. Because it's a concrete struct rather than an interface, Wrap can embed it: every method not explicitly overridden below (Close, Chmod, Getwd, ...) keeps working unmodified through Go's normal method promotion. The overridden operations gain *Context-suffixed siblings - mirroring the library's own ReadDir/ReadDirContext naming - rather than silently changing an existing method's signature.

Neither SFTP nor SMTP (the other niche-phase module) have an OpenTelemetry semantic-convention namespace, unlike HTTP/DB/messaging/ RPC; the attributes here (sftp.operation, sftp.path) are Argos-specific.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*sftp.Client
	// contains filtered or unexported fields
}

Client wraps *sftp.Client. Every method of the embedded client not overridden below is used unmodified via Go's normal method promotion.

func Wrap

func Wrap(c *sftp.Client, opts ...Option) *Client

Wrap builds an instrumented Client around c.

func (*Client) CreateContext

func (c *Client) CreateContext(ctx context.Context, path string) (*sftp.File, error)

CreateContext is Client.Create with a span.

func (*Client) MkdirAllContext

func (c *Client) MkdirAllContext(ctx context.Context, path string) error

MkdirAllContext is Client.MkdirAll with a span.

func (*Client) MkdirContext

func (c *Client) MkdirContext(ctx context.Context, path string) error

MkdirContext is Client.Mkdir with a span.

func (*Client) OpenContext

func (c *Client) OpenContext(ctx context.Context, path string) (*sftp.File, error)

OpenContext is Client.Open with a span.

func (*Client) RemoveContext

func (c *Client) RemoveContext(ctx context.Context, path string) error

RemoveContext is Client.Remove with a span.

func (*Client) RenameContext

func (c *Client) RenameContext(ctx context.Context, oldname, newname string) error

RenameContext is Client.Rename with a span. When WithPathAttribute is set, the destination is recorded as sftp.destination_path alongside the source path recorded on every span.

func (*Client) StatContext

func (c *Client) StatContext(ctx context.Context, path string) (os.FileInfo, error)

StatContext is Client.Stat with a span.

type Option

type Option func(*config)

Option configures the Client returned by Wrap.

func WithLogger

func WithLogger(l logging.Logger) Option

WithLogger attaches a Logger for error-level logging of failed operations, in addition to the span/metric recording that always happens.

func WithPathAttribute

func WithPathAttribute(enabled bool) Option

WithPathAttribute enables recording the file path as the sftp.path attribute. Off by default: paths can embed usernames or other identifying information callers may not want copied into telemetry.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址