cloud

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoOrg = errors.New("no org associated with this Engine")

Functions

func SpansToPB added in v0.20.0

func SpansToPB(spans []SpanData) []*tracepb.ResourceSpans

SpansToPB converts Cloud API SpanData into OTLP ResourceSpans proto, suitable for feeding through telemetry.SpansFromPB and into a SpanExporter.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(
	ctx context.Context,
	cloudAuth *auth.Cloud,
) (*Client, error)

func (*Client) Engine added in v0.18.9

func (c *Client) Engine(ctx context.Context, req EngineRequest) (*EngineSpec, error)

func (*Client) OrgByName added in v0.20.0

func (c *Client) OrgByName(ctx context.Context, name string) (*OrgResponse, error)

func (*Client) StreamLogs added in v0.20.0

func (c *Client) StreamLogs(
	ctx context.Context,
	orgID string,
	traceID string,
	spanID string,
	handler func([]LogMessage),
) error

StreamLogs streams log messages for a trace from Dagger Cloud's GraphQL API.

func (*Client) StreamSpans added in v0.20.0

func (c *Client) StreamSpans(
	ctx context.Context,
	orgID string,
	traceID string,
	handler func([]SpanData),
) error

StreamSpans streams span data for a trace from Dagger Cloud's GraphQL API. It calls the handler for each batch of spans received.

func (*Client) User

func (c *Client) User(ctx context.Context) (*UserResponse, error)

type EngineRequest added in v0.19.1

type EngineRequest struct {
	Module               string   `json:"module,omitempty"`
	Function             string   ` json:"function,omitempty"`
	ExecCmd              []string `json:"exec_cmd,omitempty"`
	ClientID             string   `json:"client_id,omitempty"`
	MinimumEngineVersion string   `json:"minimum_engine_version,omitempty"`
	TraceID              string   `json:"trace_id,omitempty"`
}

type EngineSpec added in v0.18.9

type EngineSpec struct {
	EngineRequest

	Image          string                   `json:"image,omitempty"`
	Location       string                   `json:"location,omitempty"`
	OrgID          string                   `json:"org_id,omitempty"`
	UserID         string                   `json:"user_id,omitempty"`
	URL            string                   `json:"url,omitempty"`
	CertSerialized *SerializableCertificate `json:"cert,omitempty"`
	InstanceID     string                   `json:"instance_id,omitempty"`
}

func (*EngineSpec) TLSCertificate added in v0.18.9

func (es *EngineSpec) TLSCertificate() (*tls.Certificate, error)

type ErrResponse added in v0.18.9

type ErrResponse struct {
	Message string `json:"message"`
}

type LogMessage added in v0.20.0

type LogMessage struct {
	SpanID     *string        `json:"spanId"`
	Timestamp  time.Time      `json:"timestamp"`
	Body       string         `json:"body"`
	Attributes map[string]any `json:"attributes"`
}

type OrgResponse added in v0.20.0

type OrgResponse struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type SerializableCertificate added in v0.18.9

type SerializableCertificate struct {
	CertificateChain [][]byte `json:"certificate_chain"` // DER-encoded certs
	PrivateKey       []byte   `json:"private_key"`       // PKCS#8 encoded private key
	OCSPStaple       []byte   `json:"ocsp_staple,omitempty"`
	SCTs             [][]byte `json:"scts,omitempty"`
}

type SpanData added in v0.20.0

type SpanData struct {
	ID         string         `json:"id"`
	TraceID    string         `json:"traceId"`
	TraceState string         `json:"traceState"`
	Name       string         `json:"name"`
	ParentID   *string        `json:"parentId"`
	Kind       string         `json:"kind"`
	Timestamp  time.Time      `json:"timestamp"`
	EndTime    *time.Time     `json:"endTime"`
	UpdateTime time.Time      `json:"updateTime"`
	Attributes map[string]any `json:"attributes"`
	Status     SpanStatus     `json:"status"`
	Events     []SpanEvent    `json:"events"`
	Links      []SpanLink     `json:"links"`
	Scope      SpanScope      `json:"scope"`
	HasLogs    bool           `json:"hasLogs"`
	ChildCount int            `json:"childCount"`
	Partial    bool           `json:"partial"`
}

type SpanEvent added in v0.20.0

type SpanEvent struct {
	Timestamp  time.Time      `json:"timestamp"`
	Name       string         `json:"name"`
	Attributes map[string]any `json:"attributes"`
}
type SpanLink struct {
	TraceID    string         `json:"traceId"`
	SpanID     string         `json:"spanId"`
	TraceState string         `json:"traceState"`
	Attributes map[string]any `json:"attributes"`
}

type SpanScope added in v0.20.0

type SpanScope struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type SpanStatus added in v0.20.0

type SpanStatus struct {
	Message string `json:"message"`
	Code    string `json:"code"`
}

type UserResponse

type UserResponse struct {
	ID   string     `json:"id"`
	Orgs []auth.Org `json:"orgs"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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