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

Configuration: Update tracing section to clarify GF_TRACING prefix applies to all Jaeger variables #32666

Closed
wants to merge 1 commit into from
Closed

Conversation

conorevans
Copy link
Contributor

Signed-off-by: Conor Evans coevans@tcd.ie

What this PR does / why we need it: Since these variables do not feature in the [tracing.jaeger] section and they are explicitly called out as JAEGER_..., it was definitely not clear to me that the GF_<section> prefix applied here. I spent some time trying to debug, seeing if there was a problem with the agent, before I realized that I wasn't seeing anything tracing related in the logs on startup. I took a hunch on this and my hunch was confirmed:

t=2021-04-03T18:00:00+0000 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_TRACING_JAEGER_SAMPLER_TYPE=const"

…eger variables

Signed-off-by: Conor Evans <coevans@tcd.ie>
@conorevans conorevans requested a review from a team as a code owner April 3, 2021 18:15
@conorevans conorevans requested review from oddlittlebird, achatterjee-grafana and osg-grafana and removed request for a team April 3, 2021 18:15
@grafanabot grafanabot added type/docs pr/external This PR is from external contributor labels Apr 3, 2021
@@ -1222,7 +1226,7 @@ Specifies the type of sampler: `const`, `probabilistic`, `ratelimiting`, or `rem

Refer to https://www.jaegertracing.io/docs/1.16/sampling/#client-sampling-configuration for details on the different tracing types.

Can be set with the environment variable `JAEGER_SAMPLER_TYPE`.
Can be set with the environment variable `GF_TRACING_JAEGER_SAMPLER_TYPE`.
Copy link
Contributor Author

@conorevans conorevans Apr 3, 2021

Choose a reason for hiding this comment

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

I suppose this and sampler_param do follow the convention already given that it is under [tracing.jaeger.sampler_type] but it's called out as JAEGER_SAMPLER_TYPE here (when it doesn't need to be, given that it follows the GF_<section>_<parameter> convention). So I think the comment could either be updated as here, or removed entirely, but as JAEGER_SAMPLER_TYPE I do think it's somewhat confusing.


### address

The host:port destination for reporting spans. (ex: `localhost:6831`)

Can be set with the environment variables `JAEGER_AGENT_HOST` and `JAEGER_AGENT_PORT`.
Can be set with the environment variables `GF_TRACING_JAEGER_AGENT_HOST`
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 have actually submitted an issue relating to these env vars as they do not enable tracing - address must be set, unlike it states here. #32667

Copy link
Member

Choose a reason for hiding this comment

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

This doesn't look right. You can actually set it either using GF_TRACING_JAEGER_ADDRESS or either using JAEGER_AGENT_HOST and JAEGER_AGENT_PORT, see https://www.jaegertracing.io/docs/1.16/client-features/.

Copy link
Contributor Author

@conorevans conorevans Apr 7, 2021

Choose a reason for hiding this comment

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

I used JAEGER_AGENT_HOST and JAEGER_AGENT_PORT initially and it did not initialize tracing for me. Let's look at tracing.go:

func (ts *TracingService) Init() error {
	ts.log = log.New("tracing")
	ts.parseSettings()

	if ts.enabled {
		return ts.initGlobalTracer()
	}

	return nil
}

ts.initGlobalTracer() is where the Jaeger Cfg is parsed:

func (ts *TracingService) initGlobalTracer() error {
	cfg, err := ts.initJaegerCfg()
	if err != nil {
		return err
	}
....

And it'll only go to ts.initGlobalTracer() if ts.enabled. So let's return to ts.ParseSettings() just before it:

func (ts *TracingService) parseSettings() {
	var section, err = ts.Cfg.Raw.GetSection("tracing.jaeger")
	if err != nil {
		return
	}

	ts.address = section.Key("address").MustString("")
	if ts.address != "" {
		ts.enabled = true
	}
...

We can see ts.enabled is explictly dependent on GF_TRACING_JAEGER_ADDRESS.

Maybe the Jaeger config would start up successfully using JAEGER_AGENT_HOST and JAEGER_AGENT_PORT (rather than GF_TRACING_JAEGER_AGENT_PORT, so the update to the text here isn't relevant, but the issue #32667 is relevant.

Copy link
Member

Choose a reason for hiding this comment

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

#32667 is definitely relevant for enable tracing and should be fixed. I thought that actually was fixed, but I was wrong. I'm pretty sure there was some other PR that changed things. Had #23887 in mind, but no it didn't touch upon this problem. #25768 is related, but didn't really do anything in regards to enable tracing. Maybe I started some work on this back in the day, but never ended up in a PR?

However, if you would provide a value for GF_TRACING_JAEGER_ADDRESS and values for JAEGER_AGENT_HOST and JAEGER_AGENT_PORT I think the latter ones would be used.

Copy link
Contributor Author

@conorevans conorevans Apr 7, 2021

Choose a reason for hiding this comment

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

However, if you would provide a value for GF_TRACING_JAEGER_ADDRESS and values for JAEGER_AGENT_HOST and JAEGER_AGENT_PORT I think the latter ones would be used.

Yeah definitely.

I think this PR arose from my troubles at #32667. I think this PR can be closed - after the above comment where I dug a bit further, I realized that these docs would be fine and accurate if #32667 did not exist.

@achatterjee-grafana
Copy link
Contributor

Need developer review and approval.

@zoltanbedi zoltanbedi self-requested a review April 6, 2021 06:56
@aocenas aocenas requested a review from marefr April 6, 2021 09:41
@zoltanbedi zoltanbedi removed their request for review April 7, 2021 10:34
Copy link
Member

@marefr marefr left a comment

Choose a reason for hiding this comment

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

Standard jaeger environment variables are still supported and should still be documented, but agree that explaining that GF_<section> convention also could be used is a good thing.

@@ -1201,18 +1201,22 @@ Configure Grafana's Jaeger client for distributed tracing.
You can also use the standard `JAEGER_*` environment variables to configure
Jaeger. See the table at the end of https://www.jaegertracing.io/docs/1.16/client-features/
for the full list. Environment variables will override any settings provided here.
These environment variables follow the `GF_<section>` convention above,
Copy link
Member

Choose a reason for hiding this comment

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

Based on information about standard jaeger environment variables above (documented at https://www.jaegertracing.io/docs/1.16/client-features/) this needs to explain that you can use GF_<section> convention if you prefer as well.

The reason for using standard jaeger environment variables is because some uses that for all their services, including Grafana, as convenience.


### always_included_tag

Comma-separated list of tags to include in all new spans, such as `tag1:value1,tag2:value2`.

Can be set with the environment variable `JAEGER_TAGS` (use `=` instead of `:` with the environment variable).
Can be set with the environment variable `GF_TRACING_JAEGER_TAGS`
Copy link
Member

Choose a reason for hiding this comment

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

Information about JAEGER_TAGS is still needed, but you can explain that GF_TRACING_JAEGER_TAGS can be used as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/external This PR is from external contributor type/docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants