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

Report card fixes #583

Merged
merged 8 commits into from
Dec 5, 2017
Merged

Conversation

isaachier
Copy link
Contributor

Fixes #582.

Signed-off-by: Isaac Hier <isaachier@gmail.com>
Signed-off-by: Isaac Hier <isaachier@gmail.com>
Signed-off-by: Isaac Hier <isaachier@gmail.com>
Signed-off-by: Isaac Hier <isaachier@gmail.com>
Signed-off-by: Isaac Hier <isaachier@gmail.com>
@@ -53,7 +53,7 @@ func (r *Redis) FindDriverIDs(ctx context.Context, location string) []string {
span.SetTag("param.location", location)
ext.SpanKindRPCClient.Set(span)
defer span.Finish()
ctx = opentracing.ContextWithSpan(ctx, span)
_ = opentracing.ContextWithSpan(ctx, span)
Copy link
Member

Choose a reason for hiding this comment

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

This is wrong. The context is used later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually it looks like this is correct. It is not used again in the existing method and the ctx argument is copied by value (not a pointer). Unless context is an interface or something like that, cannot see how this works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess it is an interface: https://golang.org/pkg/context/#Context.

Copy link
Member

Choose a reason for hiding this comment

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

Hard for me to verify on the phone, but isn't the context later used for logging?

@@ -19,10 +19,12 @@ import "github.com/stretchr/testify/mock"

import "time"

// Store writes and retrieves sampling data to and from storage.
Copy link
Member

Choose a reason for hiding this comment

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

This is generated code. It should not be edited.

@@ -20,10 +20,13 @@ import (
"github.com/stretchr/testify/mock"
)

// Lock mocks distributed lock for control of a resource.
Copy link
Member

Choose a reason for hiding this comment

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

Generated code

model/span.go Outdated
@@ -96,6 +96,16 @@ func (s *Span) NormalizeTimestamps() {
}
}

// FlattenTags combines span tags, process tags, and log fields into one KeyValues collection
Copy link
Member

Choose a reason for hiding this comment

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

This is used just once and the semantic value of mixing tags with log fields is highly dubious. I would avoid having this in the model.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only reason I extracted this as a public method was a TODO by the existing function suggesting this fix. Can easily remove.

@@ -236,6 +236,11 @@ func (kv *KeyValue) IsLess(two *KeyValue) bool {
}
}

// Matches checks if this KeyValue matches the query key/value pair
func (kv *KeyValue) Matches(key, value string) bool {
Copy link
Member

Choose a reason for hiding this comment

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

Of dubious value as public method.

// FindMatch checks for a matching KeyValue in the KeyValues for the given
// query key/value pair. Returns the match and true when the match is found.
// Returns empty KeyValue and false when no match is found.
func (kvs KeyValues) FindMatch(key, value string) (KeyValue, bool) {
Copy link
Member

Choose a reason for hiding this comment

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

I can't see on the phone but I thought we already had a find-like method for a list of tags. Also, the method seems suspicious given that it takes bake as string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was a note in the existing code explaining the FindKey method only handles one value rather than multiple.

Signed-off-by: Isaac Hier <isaachier@gmail.com>
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 99.763% when pulling ec5eeff on isaachier:report-card-fixes into e86551d on jaegertracing:master.

Signed-off-by: Isaac Hier <isaachier@gmail.com>
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling d9bd9f4 on isaachier:report-card-fixes into e86551d on jaegertracing:master.

}
}
if !keyValueFoundAndMatches {
// (NB): we cannot find the KeyValues.FindKey function because there can be multiple tags with the same key
Copy link
Member

Choose a reason for hiding this comment

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

we cannot use...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes added back note from master. Had to write local helper function instead.

Copy link
Member

Choose a reason for hiding this comment

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

I meant changing the comment "we cannot use", not "find"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh lol didn't read carefully

@isaachier
Copy link
Contributor Author

Anyone want to merge this?

Signed-off-by: Isaac Hier <ihier@uber.com>
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling b9febd2 on isaachier:report-card-fixes into e86551d on jaegertracing:master.

@yurishkuro yurishkuro merged commit 1e10ffc into jaegertracing:master Dec 5, 2017
@isaachier isaachier deleted the report-card-fixes branch August 28, 2018 20:47
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.

None yet

3 participants