pub struct GrafanaTemplateRenderingService { /* private fields */ }Expand description
Service for rendering Grafana provisioning templates
This service encapsulates the logic for rendering Grafana datasource and dashboard configuration files. It’s designed to be shared across command handlers and steps that need to prepare Grafana provisioning.
Implementations§
Source§impl GrafanaTemplateRenderingService
impl GrafanaTemplateRenderingService
Sourcepub fn from_paths(
templates_dir: PathBuf,
build_dir: PathBuf,
clock: Arc<dyn Clock>,
) -> Self
pub fn from_paths( templates_dir: PathBuf, build_dir: PathBuf, clock: Arc<dyn Clock>, ) -> Self
Build a GrafanaTemplateRenderingService from environment paths
§Arguments
templates_dir- Directory containing the source templatesbuild_dir- Directory where rendered templates will be writtenclock- The clock for generating timestamps
§Returns
Returns a configured GrafanaTemplateRenderingService ready for template rendering
Sourcepub fn render(
&self,
grafana_configured: bool,
prometheus_config: Option<&PrometheusConfig>,
) -> Result<Option<PathBuf>, GrafanaTemplateRenderingServiceError>
pub fn render( &self, grafana_configured: bool, prometheus_config: Option<&PrometheusConfig>, ) -> Result<Option<PathBuf>, GrafanaTemplateRenderingServiceError>
Render Grafana provisioning templates
This renders Grafana datasource and dashboard provisioning files to the build directory.
Returns None if Grafana or Prometheus is not configured (Prometheus is required as datasource).
§Arguments
grafana_configured- Whether Grafana is configured in user inputsprometheus_config- Prometheus configuration (required for datasource, optional)
§Returns
Returns the path to the rendered Grafana provisioning directory, or None if not configured
§Errors
Returns GrafanaTemplateRenderingServiceError::RenderingFailed if template rendering fails.
Auto Trait Implementations§
impl !RefUnwindSafe for GrafanaTemplateRenderingService
impl !UnwindSafe for GrafanaTemplateRenderingService
impl Freeze for GrafanaTemplateRenderingService
impl Send for GrafanaTemplateRenderingService
impl Sync for GrafanaTemplateRenderingService
impl Unpin for GrafanaTemplateRenderingService
impl UnsafeUnpin for GrafanaTemplateRenderingService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request