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

Allow to change OcCollector Service name via LINKERD2_PROXY_TRACING_S… #2856

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions linkerd/app/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ const ENV_OUTBOUND_DISABLE_INFORMATIONAL_HEADERS: &str =

pub const ENV_TRACE_ATTRIBUTES_PATH: &str = "LINKERD2_PROXY_TRACE_ATTRIBUTES_PATH";

pub const ENV_TRACE_SERVICE_NAME: &str = "LINKERD2_PROXY_TRACE_SERVICE_NAME";

/// Constrains which destination names may be used for profile/route discovery.
///
/// The value is a comma-separated list of domain name suffixes that may be
Expand Down Expand Up @@ -376,6 +378,8 @@ pub fn parse_config<S: Strings>(strings: &S) -> Result<super::Config, EnvError>

let shutdown_grace_period = parse(strings, ENV_SHUTDOWN_GRACE_PERIOD, parse_duration);

let proxy_tracing_service_name = strings.get(ENV_TRACE_SERVICE_NAME);

let inbound_discovery_idle_timeout =
parse(strings, ENV_INBOUND_DISCOVERY_IDLE_TIMEOUT, parse_duration);
let outbound_discovery_idle_timeout =
Expand Down Expand Up @@ -811,6 +815,7 @@ pub fn parse_config<S: Strings>(strings: &S) -> Result<super::Config, EnvError>
oc_collector::Config::Enabled(Box::new(oc_collector::EnabledConfig {
attributes,
hostname: hostname?,
service_name: proxy_tracing_service_name?,
control: ControlConfig {
addr,
connect,
Expand Down
3 changes: 2 additions & 1 deletion linkerd/app/src/oc_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub struct EnabledConfig {
pub control: control::Config,
pub attributes: HashMap<String, String>,
pub hostname: Option<String>,
pub service_name: Option<String>,
}

pub type Task = Pin<Box<dyn Future<Output = ()> + Send + 'static>>;
Expand Down Expand Up @@ -69,7 +70,7 @@ impl Config {
start_timestamp: Some(SystemTime::now().into()),
}),
service_info: Some(oc::ServiceInfo {
name: Self::SERVICE_NAME.to_string(),
name: inner.service_name.unwrap_or(Self::SERVICE_NAME.to_string()),
}),
attributes: inner.attributes,
..oc::Node::default()
Expand Down