Struct Chart

Source
pub struct Chart<'a> {
    pub type_id: &'a str,
    pub name: &'a str,
    pub title: &'a str,
    pub units: &'a str,
    pub familiy: &'a str,
    pub context: &'a str,
    pub charttype: Option<ChartType>,
    pub priority: Option<u64>,
    pub update_every: Option<u64>,
    pub options: Vec<ChartOption>,
    pub plugin: &'a str,
    pub module: &'a str,
}
Expand description

This structure defines a new chart.

The template of this instruction looks like:

CHART type.id name title units [family [context [charttype [priority [update_every [options [plugin [module]]]]]]]]

See also: https://learn.netdata.cloud/docs/agent/collectors/plugins.d#chart

Use the formating features provided by the Display trait or to_string() to generate the final command string output.

Example:

let c = Chart {
   type_id: "test_type.id",
   name: "test_name",
   title: "caption_text",
   units: "test_units",
   ..Chart::default()
};
assert_eq!(
   c.to_string(),
   r#"CHART "test_type.id" "test_name" "caption_text" "test_units""#
);

See also: https://learn.netdata.cloud/docs/agent/collectors/plugins.d#chart

Fields§

§type_id: &'a str

A dot-separated compound of type.id identifier strings.

The type part controls the menu the charts will appear in.
Id Uniquely identifies the chart, this is what will be needed to add values to the chart.

Use validate() to test the formal correctness.

§name: &'a str

The name that will be presented to the user instead of id in type.id. This means that only the id part of type.id is changed. When a name has been given, the chart is index (and can be referred) as both type.id and type.name. You can set name to "" to disable it.

§title: &'a str

The text above the chart.

§units: &'a str

The label of the vertical axis of the chart, all dimensions added to a chart should have the same units of measurement.

§familiy: &'a str

This entry is used to group charts together (for example all eth0 charts should say: eth0), if empty or missing, the id part of type.id will be used. This controls the sub-menu on the dashboard.

§context: &'a str

The context is giving the template of the chart. For example, if multiple charts present the same information for a different family, they should have the same context.

This is used for looking up rendering information for the chart (colors, sizes, informational texts) and also apply alarms to it.

§charttype: Option<ChartType>

One of ChartType (line, area or stacked), if empty or missing, line will be used.

§priority: Option<u64>

The relative priority of the charts as rendered on the web page, lower numbers make the charts appear before the ones with higher numbers, if empty or missing, 1000 will be used.

§update_every: Option<u64>

Overwrite the update frequency set by the server.

Note: To force fields with strong typing, a numeric value of 1 is inserted as the default when subsequent given fields require such an output.

§options: Vec<ChartOption>

List of options. 4 options are currently supported:

obsolete to mark a chart as obsolete (Netdata will hide it and delete it after some time), detail to mark a chart as insignificant (this may be used by dashboards to make the charts smaller, or somehow visualize properly a less important chart), store_first to make Netdata store the first collected value, assuming there was an invisible previous value set to zero (this is used by statsd charts - if the first data collected value of incremental dimensions is not zero based, unrealistic spikes will appear with this option set) and hidden to perform all operations on a chart, but do not offer it on dashboards (the chart will be send to external databases).

§plugin: &'a str

Let the user identify the plugin that generated the chart. If plugin is unset or empty, Netdata will automatically set the filename of the plugin that generated the chart.

§module: &'a str

Let the user identify the module that generated the chart. Module has not default.

Trait Implementations§

Source§

impl<'a> Clone for Chart<'a>

Source§

fn clone(&self) -> Chart<'a>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Chart<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Default for Chart<'a>

Source§

fn default() -> Chart<'a>

Returns the “default value” for a type. Read more
Source§

impl<'a> Display for Chart<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Validate for Chart<'a>

Source§

impl<'v_a, 'a> ValidateArgs<'v_a> for Chart<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Chart<'a>

§

impl<'a> RefUnwindSafe for Chart<'a>

§

impl<'a> Send for Chart<'a>

§

impl<'a> Sync for Chart<'a>

§

impl<'a> Unpin for Chart<'a>

§

impl<'a> UnwindSafe for Chart<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T