Skip to content
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

Merged
merged 9 commits into from
Aug 7, 2018

Conversation

fsamin
Copy link
Member

@fsamin fsamin commented Aug 3, 2018

No description provided.

@fsamin fsamin requested review from yesnault, sguiheux and bnjjj August 3, 2018 12:24
"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))
Copy link

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))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ineffectual assignment to ctx

tracing.Tag("reason", reason),
)
}
tracing.End(currentCtx, nil, nil)
Copy link

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

tracing.Tag("reason", reason),
)
}
_ = tracing.End(currentCtx, nil, nil)
Copy link

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")
Copy link

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.

@@ -111,19 +119,28 @@ checkImage:
}

if !imageFound {
_ := next tracing.Span(ctx, "swarm.dockerClient.pullImage", tracing.Tag("image", cArgs.image))
Copy link

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))
Copy link

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.

@@ -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.

@@ -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.

@ovh-cds
Copy link
Collaborator

ovh-cds commented Aug 3, 2018

CDS Report ut-engine#5354.0 ✘

  • Stage 1
    • Engine Test with DB ✘

@fsamin fsamin merged commit 2d5c957 into master Aug 7, 2018
@fsamin fsamin deleted the fsamin/fix-2018-08-01-10-29-01 branch August 7, 2018 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants