Skip to content
Merged
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
154 changes: 32 additions & 122 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ path = "src/lib.rs"
[features]
default = []
agent-initiated = ["default"]
telemetry = ["tonic", "opentelemetry-otlp"]
telemetry = []

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -50,11 +50,10 @@ prometheus = "0.14.0"
chrono = { version = "0.4.40", features = ["serde"] }
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.19", features = ["json", "env-filter"] }
tracing-opentelemetry = "0.28.0"
opentelemetry = { version = "0.27.1", features = ["trace"] }
opentelemetry-otlp = { version = "0.29.0", optional = true }
opentelemetry_sdk = { version = "0.29.0", features = ["rt-tokio"] }
tonic = { version = "0.13.0", optional = true }
tracing-opentelemetry = "0.30.0"
opentelemetry = { version = "0.29.0" }
opentelemetry-otlp = { version = "0.29.0", features = ["grpc-tonic", "logs"]}
opentelemetry_sdk = { version = "0.29.0" }
thiserror = "2.0.11"
anyhow = "1.0.96"
base64 = "0.22.1"
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ generate-addon-crds features="":

# run with opentelemetry
run-telemetry:
OPENTELEMETRY_ENDPOINT_URL=http://127.0.0.1:55680 RUST_LOG=info,kube=trace,controller=debug cargo run --features=telemetry
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=http://127.0.0.1:55680 RUST_LOG=info,kube=trace,controller=debug cargo run --features=telemetry

# run without opentelemetry
run:
Expand Down
13 changes: 8 additions & 5 deletions src/controllers/addon_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use serde::{de::DeserializeOwned, ser, Deserialize, Serialize};
use serde_json::Value;
use serde_with::{serde_as, DisplayFromStr};
use thiserror::Error;
use tracing::{info, instrument};
use tracing::{field::display, info, instrument, Span};

use crate::{
api::fleet_addon_config::{FleetAddonConfig, Install, InstallOptions, Server},
Expand Down Expand Up @@ -93,8 +93,9 @@ struct CertData {
}

impl FleetAddonConfig {
#[instrument(skip_all, fields(trace_id = display(telemetry::get_trace_id()), name = self.name_any(), namespace = self.namespace()))]
#[instrument(skip_all, fields(reconcile_id, name = self.name_any(), namespace = self.namespace()))]
pub async fn reconcile_helm(&mut self, ctx: Arc<Context>) -> crate::Result<Action> {
let _current = Span::current().record("reconcile_id", display(telemetry::get_trace_id()));
let chart = FleetChart {
repo: "https://rancher.github.io/fleet-helm-charts/".into(),
namespace: "cattle-fleet-system".into(),
Expand Down Expand Up @@ -148,11 +149,12 @@ impl FleetAddonConfig {
return Ok(Action::await_change());
}

#[instrument(skip_all, fields(trace_id = display(telemetry::get_trace_id()), name = self.name_any(), namespace = self.namespace()))]
#[instrument(skip_all, fields(reconcile_id, name = self.name_any(), namespace = self.namespace()))]
pub async fn reconcile_config_sync(
self: Arc<Self>,
ctx: Arc<Context>,
) -> crate::Result<Action> {
let _current = Span::current().record("reconcile_id", display(telemetry::get_trace_id()));
let ns = Namespace::from("cattle-fleet-system");
let mut fleet_config: FleetConfig = ctx.client.get("fleet-controller", &ns).await?;

Expand All @@ -179,7 +181,7 @@ impl FleetAddonConfig {
Ok(Action::await_change())
}

#[instrument(skip_all, fields(trace_id = display(telemetry::get_trace_id()), name = self.name_any(), namespace = self.namespace()))]
#[instrument(skip_all, fields(reconcile_id, name = self.name_any(), namespace = self.namespace()))]
pub async fn update_watches(
self: Arc<Self>,
ctx: Arc<Context>,
Expand Down Expand Up @@ -230,11 +232,12 @@ impl FleetAddonConfig {
Ok(Action::await_change())
}

#[instrument(skip_all, fields(trace_id = display(telemetry::get_trace_id()), name = self.name_any(), namespace = self.namespace()))]
#[instrument(skip_all, fields(reconcile_id, name = self.name_any(), namespace = self.namespace()))]
pub async fn reconcile_dynamic_watches(
self: Arc<Self>,
ctx: Arc<Context>,
) -> crate::Result<Action> {
let _current = Span::current().record("reconcile_id", display(telemetry::get_trace_id()));
self.update_watches(ctx).await?;

Ok(Action::await_change())
Expand Down
Loading
Loading