Set zipkin_service_name to LocalInfo::clusterName().#7354
Set zipkin_service_name to LocalInfo::clusterName().#7354mattklein123 merged 4 commits intoenvoyproxy:masterfrom
Conversation
Signed-off-by: Emil Mikulic <g-easy@users.noreply.github.com>
objectiser
left a comment
There was a problem hiding this comment.
LGTM - might be worth adding a test for a supplied clusterName appearing in the span?
mattklein123
left a comment
There was a problem hiding this comment.
Nice, generally LGTM but +1 for adding a test.
/wait
Signed-off-by: Emil Mikulic <g-easy@users.noreply.github.com>
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 |
|
@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? |
|
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! |
|
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! |
|
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. |
|
@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? |
|
Yeah, sorry, the OpenCensus C++ API is very limited by design. :/ |
|
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 :) |
|
We sort of do that here to catch the generated SpanData: 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) |
Sure that's fine. |
|
@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(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Thanks for the tip, setting the name with --service-cluster totally works!
I'm happy with this change now.
|
Please go ahead and merge. :) |
|
Since this configurable option of service name is removed, Is there any other option to configure the zipkin service name ? |
|
Are you able to set the service name you need with |
|
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? |
|
Unfortunately, there's currently no override for the service name. |
|
Do you think it is a valid ask to bring back this service name overriding in tracing feature? |
|
It's worth asking the Envoy folks. Maybe open an issue? |
No description provided.