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

Added Tag Configuration Support Lightstep Tracing #4175

Conversation

midnightconman
Copy link
Contributor

@midnightconman midnightconman commented May 4, 2021

Signed-off-by: midnightconman midnightconman@gmail.com

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Fixes: #4148

Adds support to the configuration of the lightstep tracing client to send arbitrary tags to lightstep. The interface matches the interface for the Jaeger tracing config (comma-delimited string with key value pairs delimited by =, which also supports environment variables). An example would be:

tags: "env=prod,region=west,pod=${POD_NAME:unknown}"

Verification

This was tested via make test.

@midnightconman midnightconman force-pushed the midnightconman/ls-tracing-tags-20210504 branch from 8af7d99 to c2cb109 Compare May 4, 2021 20:42
@midnightconman
Copy link
Contributor Author

I'm not sure if this test is flakey or if this is a real issue... it seems the tests failed at reloading?

reloader_test.go:364: reloader_test.go:364:
        
        	exp: 6
        
        	got: 5

@midnightconman
Copy link
Contributor Author

Yep, this manifest is missing from quay:
image

I think this PR broke it: #4171

bwplotka
bwplotka previously approved these changes May 7, 2021
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Nice, thanks! Can we add test before merging?

The e2e issue is not related, fixing this in another place: #4202

.bingo/prometheus.mod Outdated Show resolved Hide resolved
// - comma separated list of key=value
// - value can be specified using the notation ${envVar:defaultValue}, where `envVar`
// is an environment variable and `defaultValue` is the value to use in case the env var is not set.
func parseTags(sTags string) opentracing.Tags {
Copy link
Member

Choose a reason for hiding this comment

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

Can we have a quick unit-test for it? (:

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 was thinking about that 😜 But there aren't any other unit tests in the tracing package (except stackdriver), so I figured it didn't make sense to break that ground for this simple change.

Should we add in a testing file and scaffolding for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Scratch all that... I went ahead and added testing. PTAL

Copy link
Member

Choose a reason for hiding this comment

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

Haaa, yea, something pragmatic would work, e.g just testing parsting tags (: Like what you did! Thanks!

@bwplotka
Copy link
Member

bwplotka commented May 7, 2021

Can you rebase? #4202 was merged 🤗

Signed-off-by: midnightconman <midnightconman@gmail.com>
Signed-off-by: midnightconman <midnightconman@gmail.com>
Signed-off-by: midnightconman <midnightconman@gmail.com>
@midnightconman midnightconman force-pushed the midnightconman/ls-tracing-tags-20210504 branch from 7d23dda to 4af605c Compare May 7, 2021 17:11
Signed-off-by: midnightconman <midnightconman@gmail.com>
Signed-off-by: midnightconman <midnightconman@gmail.com>
@midnightconman midnightconman force-pushed the midnightconman/ls-tracing-tags-20210504 branch from 434e1b8 to 57e3e01 Compare May 7, 2021 18:13
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

LGTM, amazing!

// - comma separated list of key=value
// - value can be specified using the notation ${envVar:defaultValue}, where `envVar`
// is an environment variable and `defaultValue` is the value to use in case the env var is not set.
func parseTags(sTags string) opentracing.Tags {
Copy link
Member

Choose a reason for hiding this comment

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

Haaa, yea, something pragmatic would work, e.g just testing parsting tags (: Like what you did! Thanks!


testingData := []testData{
{
description: `A very simple case, key "foo" and value "bar"`,
Copy link
Member

Choose a reason for hiding this comment

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

amazing 🤗


os.Setenv("_TEST_PARSE_TAGS", "env-bar")
for _, test := range testingData {
t.Logf("testing %s\n", test.description)
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 not a biggy, but we can use t.Run for consistency instead this (: But that's fine for now, for this PR, just let's remember for next one

@bwplotka bwplotka enabled auto-merge (squash) May 8, 2021 10:27
@bwplotka bwplotka merged commit 060a618 into thanos-io:main May 8, 2021
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.

Allow Arbitrary Tags Lightstep Tracing
2 participants