func (d *tracedDeployer) Deploy(ctx context.Context, p events.Deployment, w io.Writer) (err error) { ctx, done := trace.Trace(ctx) err = d.deployer.Deploy(ctx, p, w) done(err, "Deploy", "repository", p.Repository.FullName, "creator", p.Deployment.Creator.Login, "ref", p.Deployment.Ref, "sha", p.Deployment.Sha, ) return err }
func (c *ecsClient) RegisterTaskDefinition(ctx context.Context, input *ecs.RegisterTaskDefinitionInput) (*ecs.RegisterTaskDefinitionOutput, error) { if c.tdThrottle == nil { // Only allow 1 task definition per second. c.tdThrottle = time.NewTicker(time.Second) } <-c.tdThrottle.C ctx, done := trace.Trace(ctx) resp, err := c.ECS.RegisterTaskDefinition(input) done(err, "RegisterTaskDefinition", "family", stringField(input.Family)) return resp, err }
// TraceDeploy wraps a Deployer to perform tracing with package trace. func TraceDeploy(d Deployer) Deployer { return DeployerFunc(func(ctx context.Context, event events.Deployment, w io.Writer) (err error) { ctx, done := trace.Trace(ctx) err = d.Deploy(ctx, event, w) done(err, "Deploy", "repository", event.Repository.FullName, "creator", event.Deployment.Creator.Login, "ref", event.Deployment.Ref, "sha", event.Deployment.Sha, ) return err }) }
// PullImage wraps the docker clients PullImage to handle authentication. func (c *Client) PullImage(ctx context.Context, opts docker.PullImageOptions) error { var a docker.AuthConfiguration reg := opts.Registry if reg == "" { reg = "https://index.docker.io/v1/" } if c, ok := c.Auth.Configs[reg]; ok { a = c } ctx, done := trace.Trace(ctx) err := c.Client.PullImage(opts, a) done(err, "PullImage", "registry", opts.Registry, "repository", opts.Repository, "tag", opts.Tag) return err }
// PullImage wraps the docker clients PullImage to handle authentication. func (c *Client) PullImage(ctx context.Context, opts docker.PullImageOptions) error { // This is to workaround an issue in the Docker API, where it doesn't // respect the registry param. We have to put the registry in the // repository field. if opts.Registry != "" { opts.Repository = fmt.Sprintf("%s/%s", opts.Registry, opts.Repository) } authConf, err := authConfiguration(c.AuthProvider, opts.Registry) if err != nil { return err } ctx, done := trace.Trace(ctx) err = c.Client.PullImage(opts, authConf) done(err, "PullImage", "registry", opts.Registry, "repository", opts.Repository, "tag", opts.Tag) return err }
func (c *ecsClient) ListServicesPages(ctx context.Context, input *ecs.ListServicesInput, fn func(*ecs.ListServicesOutput, bool) bool) error { ctx, done := trace.Trace(ctx) err := c.ECS.ListServicesPages(input, fn) done(err, "ListServicesPages") return err }
func (c *ecsClient) DescribeTaskDefinition(ctx context.Context, input *ecs.DescribeTaskDefinitionInput) (*ecs.DescribeTaskDefinitionOutput, error) { ctx, done := trace.Trace(ctx) resp, err := c.ECS.DescribeTaskDefinition(input) done(err, "DescribeTaskDefinition", "task-definition", stringField(input.TaskDefinition)) return resp, err }
func (c *ecsClient) UpdateService(ctx context.Context, input *ecs.UpdateServiceInput) (*ecs.UpdateServiceOutput, error) { ctx, done := trace.Trace(ctx) resp, err := c.ECS.UpdateService(input) done(err, "UpdateService", "service-name", stringField(input.Service), "desired-count", intField(input.DesiredCount), "task-definition", stringField(input.TaskDefinition)) return resp, err }
func (c *ecsClient) ListServices(ctx context.Context, input *ecs.ListServicesInput) (*ecs.ListServicesOutput, error) { ctx, done := trace.Trace(ctx) resp, err := c.ECS.ListServices(input) done(err, "ListServices", "services", len(resp.ServiceARNs)) return resp, err }
func (c *Client) StartContainer(ctx context.Context, id string, config *docker.HostConfig) error { ctx, done := trace.Trace(ctx) err := c.Client.StartContainer(id, config) done(err, "StartContainer", "id", id) return err }
func (c *ecsClient) describeTasks(ctx context.Context, input *ecs.DescribeTasksInput) (*ecs.DescribeTasksOutput, error) { ctx, done := trace.Trace(ctx) resp, err := c.ECS.DescribeTasks(input) done(err, "DescribeTasks", "tasks", len(input.Tasks)) return resp, err }
func (c *ecsClient) DescribeServices(ctx context.Context, input *ecs.DescribeServicesInput) (*ecs.DescribeServicesOutput, error) { ctx, done := trace.Trace(ctx) resp, err := c.ECS.DescribeServices(input) done(err, "DescribeServices", "services", len(input.Services)) return resp, err }
func (c *Client) RemoveContainer(ctx context.Context, opts docker.RemoveContainerOptions) error { ctx, done := trace.Trace(ctx) err := c.Client.RemoveContainer(opts) done(err, "RemoveContainer", "id", opts.ID) return err }
func ping(ctx context.Context) (err error) { ctx, done := trace.Trace(ctx) defer done(nil, "pong") return }
func (c *ecsClient) StopTask(ctx context.Context, input *ecs.StopTaskInput) (*ecs.StopTaskOutput, error) { ctx, done := trace.Trace(ctx) resp, err := c.ECS.StopTask(input) done(err, "StopTask", "task", stringField(input.Task)) return resp, err }
func (c *Client) StopContainer(ctx context.Context, id string, timeout uint) error { ctx, done := trace.Trace(ctx) err := c.Client.StopContainer(id, timeout) done(err, "StopContainer", "id", id, "timeout", timeout) return err }
func (c *ecsClient) RunTask(ctx context.Context, input *ecs.RunTaskInput) (*ecs.RunTaskOutput, error) { ctx, done := trace.Trace(ctx) resp, err := c.ECS.RunTask(input) done(err, "RunTask", "taskDefinition", stringField(input.TaskDefinition)) return resp, err }
func (c *Client) CreateContainer(ctx context.Context, opts docker.CreateContainerOptions) (*docker.Container, error) { ctx, done := trace.Trace(ctx) container, err := c.Client.CreateContainer(opts) done(err, "CreateContainer", "image", opts.Config.Image) return container, err }
func (c *ecsClient) DeleteService(ctx context.Context, input *ecs.DeleteServiceInput) (*ecs.DeleteServiceOutput, error) { ctx, done := trace.Trace(ctx) resp, err := c.ECS.DeleteService(input) done(err, "DeleteService", "service-name", stringField(input.Service)) return resp, err }
func (c *Client) AttachToContainer(ctx context.Context, opts docker.AttachToContainerOptions) error { ctx, done := trace.Trace(ctx) err := c.Client.AttachToContainer(opts) done(err, "AttachToContainer", "container", opts.Container) return err }
func (c *ecsClient) ListTasks(ctx context.Context, input *ecs.ListTasksInput) (*ecs.ListTasksOutput, error) { ctx, done := trace.Trace(ctx) resp, err := c.ECS.ListTasks(input) done(err, "ListTasks") return resp, err }