feat(relay): make telemetry opt-in (#7697)

Currently, telemetry via Sentry in our relay code is opt-out but won't
actually activate for a portal instance that isn't our staging or
production environment. However, this isn't enough to prevent alerts
from relay instances that aren't ours. It turns out that some
self-hosted customers don't realise that they have to change the portal
URL to their self-hosted portal. Without changing that, the relay will
attempt to authenticate to our production portal with an unknown token
and error out with a 401, logging a false-positive to Sentry.
This commit is contained in:
Thomas Eizinger
2025-01-08 16:12:52 +01:00
committed by GitHub
parent da285c1969
commit e499d3e856
3 changed files with 16 additions and 10 deletions

View File

@@ -91,15 +91,9 @@ struct Args {
#[command(flatten)]
health_check: http_health_check::HealthCheckArgs,
/// Disable sentry.io crash-reporting agent.
#[arg(long, env = "FIREZONE_NO_TELEMETRY", default_value_t = false)]
no_telemetry: bool,
}
impl Args {
fn is_telemetry_allowed(&self) -> bool {
!self.no_telemetry
}
/// Enable sentry.io crash-reporting agent.
#[arg(long, env = "FIREZONE_TELEMETRY", default_value_t = false)]
telemetry: bool,
}
#[derive(clap::ValueEnum, Debug, Clone, Copy)]
@@ -117,7 +111,7 @@ fn main() {
let args = Args::parse();
let mut telemetry = Telemetry::default();
if args.is_telemetry_allowed() {
if args.telemetry {
telemetry.start(
args.api_url.as_str(),
option_env!("GITHUB_SHA").unwrap_or("unknown"),

View File

@@ -110,6 +110,12 @@ module "relays" {
application_name = "relay"
application_version = replace(local.relay_image_tag, ".", "-")
application_environment_variables = [
{
name = "FIREZONE_TELEMETRY"
value = "true"
}
]
health_check = {
name = "health"

View File

@@ -100,6 +100,12 @@ module "relays" {
application_name = "relay"
application_version = replace(var.image_tag, ".", "-")
application_environment_variables = [
{
name = "FIREZONE_TELEMETRY"
value = "true"
}
]
health_check = {
name = "health"