-
Notifications
You must be signed in to change notification settings - Fork 433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(service): enable tracing on all services #3135
Conversation
"github.com/ovh/cds/sdk" | ||
"github.com/ovh/cds/sdk/hatchery" | ||
"github.com/ovh/cds/sdk/log" | ||
) | ||
|
||
//create the docker bridge | ||
func (h *HatcherySwarm) createNetwork(dockerClient *dockerClient, name string) error { | ||
func (h *HatcherySwarm) createNetwork(ctx context.Context, dockerClient *dockerClient, name string) error { | ||
ctx, end := tracing.Span(ctx, "swarm.createNetwork", tracing.Tag("network", name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ineffectual assignment to ctx
@@ -46,7 +49,10 @@ type containerArgs struct { | |||
} | |||
|
|||
//shortcut to create+start(=run) a container | |||
func (h *HatcherySwarm) createAndStartContainer(dockerClient *dockerClient, cArgs containerArgs, spawnArgs hatchery.SpawnArguments) error { | |||
func (h *HatcherySwarm) createAndStartContainer(ctx context.Context, dockerClient *dockerClient, cArgs containerArgs, spawnArgs hatchery.SpawnArguments) error { | |||
ctx, end := tracing.Span(ctx, "swarm.createAndStartContainer", tracing.Tag(tracing.TagWorker, cArgs.name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ineffectual assignment to ctx
sdk/hatchery/hatchery.go
Outdated
tracing.Tag("reason", reason), | ||
) | ||
} | ||
tracing.End(currentCtx, nil, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of tracing.End
is not checked
sdk/hatchery/hatchery.go
Outdated
tracing.Tag("reason", reason), | ||
) | ||
} | ||
_ = tracing.End(currentCtx, nil, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot assign 2 values to 1 variables
@@ -89,11 +95,13 @@ func (h *HatcherySwarm) createAndStartContainer(dockerClient *dockerClient, cArg | |||
} | |||
} | |||
|
|||
_ := next tracing.Span(ctx, "swarm.dockerClient.ImageList") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected ';', found 'IDENT' tracing (and 3 more errors)
if errl != nil { | ||
log.Warning("createAndStartContainer> Unable to list images: %s", errl) | ||
} | ||
next() |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@@ -111,19 +119,28 @@ checkImage: | |||
} | |||
|
|||
if !imageFound { | |||
_ := next tracing.Span(ctx, "swarm.dockerClient.pullImage", tracing.Tag("image", cArgs.image)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undeclared name: next
} | ||
|
||
c, err := dockerClient.ContainerCreate(context.Background(), config, hostConfig, networkingConfig, name) | ||
_, next:= tracing.Span(ctx, "swarm.dockerClient.ContainerCreate", tracing.Tag(tracing.TagWorker, cArgs.name), tracing.Tag("network", fmt.Sprintf("%v", networkingConfig)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing ',' before newline in argument list (and 10 more errors)
@@ -213,12 +221,12 @@ func (h *HatcherySwarm) SpawnWorker(spawnArgs hatchery.SpawnArguments) (string, | |||
if network == "" { | |||
network = name + "-net" | |||
networkAlias = "worker" | |||
if err := h.createNetwork(dockerClient, network); err != nil { | |||
if err := h.createNetwork(ctx, dockerClient, network); err != nil { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@@ -268,7 +276,7 @@ func (h *HatcherySwarm) SpawnWorker(spawnArgs hatchery.SpawnArguments) (string, | |||
entryPoint: nil, | |||
} | |||
|
|||
if err := h.createAndStartContainer(dockerClient, args, spawnArgs); err != nil { | |||
if err := h.createAndStartContainer(ctx, dockerClient, args, spawnArgs); err != nil { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@@ -386,7 +394,7 @@ func (h *HatcherySwarm) SpawnWorker(spawnArgs hatchery.SpawnArguments) (string, | |||
} | |||
|
|||
//start the worker | |||
if err := h.createAndStartContainer(dockerClient, args, spawnArgs); err != nil { | |||
if err := h.createAndStartContainer(ctx, dockerClient, args, spawnArgs); err != nil { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
CDS Report ut-engine#5354.0 ✘
|
No description provided.