Skip to content

Set zipkin_service_name to LocalInfo::clusterName().#7354

Merged
mattklein123 merged 4 commits intoenvoyproxy:masterfrom
g-easy:service
Jul 17, 2019
Merged

Set zipkin_service_name to LocalInfo::clusterName().#7354
mattklein123 merged 4 commits intoenvoyproxy:masterfrom
g-easy:service

Conversation

@g-easy
Copy link
Copy Markdown
Contributor

@g-easy g-easy commented Jun 21, 2019

No description provided.

Signed-off-by: Emil Mikulic <g-easy@users.noreply.github.com>
objectiser
objectiser previously approved these changes Jun 21, 2019
Copy link
Copy Markdown
Contributor

@objectiser objectiser left a comment

Choose a reason for hiding this comment

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

LGTM - might be worth adding a test for a supplied clusterName appearing in the span?

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Nice, generally LGTM but +1 for adding a test.

/wait

Signed-off-by: Emil Mikulic <g-easy@users.noreply.github.com>
@g-easy
Copy link
Copy Markdown
Contributor Author

g-easy commented Jun 24, 2019

LGTM - might be worth adding a test for a supplied clusterName appearing in the span?

Nothing like this is exposed for testing by OpenCensus, which has a very narrow API by design.

The cluster name is fed to the Zipkin exporter, which puts it into the JSON it generates. The cluster name doesn't appear in the generated SpanData which we actually do have access to in tests.

I'm not really sure how to meaningfully test this. I could add a getClusterName to OpenCensus::Driver. What do you suggest?

Signed-off-by: Emil Mikulic <g-easy@users.noreply.github.com>
@objectiser
Copy link
Copy Markdown
Contributor

@g-easy One possibility would be to have a test create the tracer with a mock exporter, and then create a test span to check the exported data?

@stale
Copy link
Copy Markdown

stale bot commented Jul 1, 2019

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Jul 1, 2019
@stale
Copy link
Copy Markdown

stale bot commented Jul 8, 2019

This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot closed this Jul 8, 2019
@g-easy
Copy link
Copy Markdown
Contributor Author

g-easy commented Jul 9, 2019

I'm sorry @objectiser I don't follow - could you show me what this would look like in the code?

Alternatively, we could submit this as-is, it's just swapping out a string.

@objectiser
Copy link
Copy Markdown
Contributor

@g-easy didn't have a concrete idea - although thought if possible to mock the exporter could then capture the span data reported from the tracer - but on examining the code it doesn't look like this would work.

So I'd be ok with merging the change for now.

@mattklein123 ok with you?

@g-easy
Copy link
Copy Markdown
Contributor Author

g-easy commented Jul 9, 2019

Yeah, sorry, the OpenCensus C++ API is very limited by design. :/

@objectiser
Copy link
Copy Markdown
Contributor

Looks like some form of "in memory" exporter has been requested in other languages census-instrumentation/opencensus-java#1640 census-instrumentation/opencensus-go#293 - if this was available it would have solved the problem :)

@g-easy
Copy link
Copy Markdown
Contributor Author

g-easy commented Jul 9, 2019

We sort of do that here to catch the generated SpanData:

// use it to catch the spans we produce.

The problem is the cluster name doesn't end up in the SpanData, it only ends up in the Zipkin-specific JSON generated by the Zipkin-specific exporter. I tried to say this in #7354 (comment)

@mattklein123
Copy link
Copy Markdown
Member

@mattklein123 ok with you?

Sure that's fine.

@mattklein123 mattklein123 reopened this Jul 9, 2019
@stale stale bot removed the stale stalebot believes this issue/PR has not been touched recently label Jul 9, 2019
@mattklein123
Copy link
Copy Markdown
Member

@g-easy please merge master.

/wait

…vice

Signed-off-by: Emil Mikulic <g-easy@users.noreply.github.com>
if (oc_config.zipkin_exporter_enabled()) {
::opencensus::exporters::trace::ZipkinExporterOptions opts(oc_config.zipkin_url());
opts.service_name = oc_config.zipkin_service_name();
opts.service_name = local_info_.clusterName();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Before we merge this: what actually populates clusterName?

I have a test config with:

static_resources:
  clusters:
  - name: cluster1

And I get empty string instead of "cluster1" on L206.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's populated with the local cluster name. This can be set via CLI or in the bootstrap config. https://www.envoyproxy.io/docs/envoy/latest/operations/cli#cmdoption-service-cluster

LMK if this change still looks good to you.

/wait-any

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the tip, setting the name with --service-cluster totally works!

I'm happy with this change now.

@g-easy
Copy link
Copy Markdown
Contributor Author

g-easy commented Jul 17, 2019

Please go ahead and merge. :)

@mattklein123 mattklein123 merged commit ea3ebca into envoyproxy:master Jul 17, 2019
@g-easy g-easy deleted the service branch July 17, 2019 05:12
@RashmiRam
Copy link
Copy Markdown

Since this configurable option of service name is removed, Is there any other option to configure the zipkin service name ?
@g-easy Can you please help here?

@g-easy
Copy link
Copy Markdown
Contributor Author

g-easy commented Sep 22, 2020

Are you able to set the service name you need with --service-cluster?

@RashmiRam
Copy link
Copy Markdown

I haven't tried it. But, I don't want to change the cluster name since that is referenced in some other systems. I want to change the service name in tracing alone. Would that be possible with this param?

@g-easy
Copy link
Copy Markdown
Contributor Author

g-easy commented Sep 22, 2020

Unfortunately, there's currently no override for the service name.

@RashmiRam
Copy link
Copy Markdown

Do you think it is a valid ask to bring back this service name overriding in tracing feature?

@g-easy
Copy link
Copy Markdown
Contributor Author

g-easy commented Sep 22, 2020

It's worth asking the Envoy folks. Maybe open an issue?

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.

4 participants