### Building a dashboard with Java Foundation SDK Source: https://grafana.github.io/grafana-foundation-sdk/java/How-To/building-a-dashboard This example shows the complete setup for creating a dashboard, including setting metadata, time ranges, and adding a panel with a Prometheus data query. ```java package example; import com.fasterxml.jackson.core.JsonProcessingException; import com.grafana.foundation.dashboard.Dashboard; import com.grafana.foundation.common.Constants; import com.grafana.foundation.dashboard.DashboardBuilder; import com.grafana.foundation.dashboard.DashboardDashboardTimeBuilder; import com.grafana.foundation.dashboard.RowBuilder; import com.grafana.foundation.prometheus.DataqueryBuilder; import com.grafana.foundation.timeseries.PanelBuilder; import java.util.List; public class Main { public static void main(String[] args) throws JsonProcessingException { Dashboard dashboard = new DashboardBuilder("Sample Dashboard"). uid("generated-from-java"). tags(List.of("generated", "from", "java")). refresh("1m"). time(new DashboardDashboardTimeBuilder(). from("now-30m"). to("now") ). timezone(Constants.TimeZoneBrowser). withRow(new RowBuilder("Overview")). withPanel(new PanelBuilder(). title("Network Received"). unit("bps"). min(0.0). withTarget(new DataqueryBuilder(). expr("rate(node_network_receive_bytes_total{job=\"integrations/raspberrypi-node\", device!=\"lo\"}[$__rate_interval]) * 8"). legendFormat("{{ device }}") ) ).build(); System.out.println(dashboard.toJSON()); } } ``` -------------------------------- ### Install Grafana Foundation SDK via go get Source: https://grafana.github.io/grafana-foundation-sdk/go/Installing Use this command to add the specific version of the Grafana Foundation SDK to your Go project. ```bash go get github.com/grafana/grafana-foundation-sdk/go@v0.0.21 ``` -------------------------------- ### Building a dashboard (Example) Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/dashboard/builder-DashboardBuilder Complete example demonstrating how to use DashboardBuilder to construct a dashboard with a row, a panel, and a Prometheus data query, then output as JSON. ```APIDOC ## Building a dashboard ### Description Example code showing how to build a dashboard using DashboardBuilder and related builders. ### Code ```java package example; import com.fasterxml.jackson.core.JsonProcessingException; import com.grafana.foundation.dashboard.Dashboard; import com.grafana.foundation.common.Constants; import com.grafana.foundation.dashboard.DashboardBuilder; import com.grafana.foundation.dashboard.DashboardDashboardTimeBuilder; import com.grafana.foundation.dashboard.RowBuilder; import com.grafana.foundation.prometheus.DataqueryBuilder; import com.grafana.foundation.timeseries.PanelBuilder; import java.util.List; public class Main { public static void main(String[] args) throws JsonProcessingException { Dashboard dashboard = new DashboardBuilder("Sample Dashboard"). uid("generated-from-java"). tags(List.of("generated", "from", "java")). refresh("1m"). time(new DashboardDashboardTimeBuilder(). from("now-30m"). to("now") ). timezone(Constants.TimeZoneBrowser). withRow(new RowBuilder("Overview")). withPanel(new PanelBuilder(). title("Network Received"). unit("bps"). min(0.0). withTarget(new DataqueryBuilder(). expr("rate(node_network_receive_bytes_total{job=\"integrations/raspberrypi-node\", device!=\"lo\"}[$__rate_interval]) * 8"). legendFormat("{{ device }}") ) ).build(); System.out.println(dashboard.toJSON()); } } ``` ``` -------------------------------- ### Building a dashboard example Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/dashboard/builder-Dashboard Demonstrates how to construct a dashboard with rows, panels, and Prometheus queries using the builder pattern. ```python from grafana_foundation_sdk.builders.dashboard import Dashboard, Row from grafana_foundation_sdk.builders.prometheus import Dataquery as PrometheusQuery from grafana_foundation_sdk.builders.timeseries import Panel as Timeseries from grafana_foundation_sdk.models.common import TimeZoneBrowser def build_dashboard() -> Dashboard: return ( Dashboard("[TEST] Node Exporter / Raspberry") .uid("test-dashboard-raspberry") .tags(["generated", "raspberrypi-node-integration"]) .refresh("1m") .time("now-30m", "now") .timezone(TimeZoneBrowser) .with_row(Row("Overview")) .with_panel( Timeseries() .title("Network Received") .unit("bps") .min_val(0) .with_target( PrometheusQuery() .expr('rate(node_network_receive_bytes_total{job="integrations/raspberrypi-node", device!="lo"}[$__rate_interval]) * 8') .legend_format("{{ device }}") ) ) ) ``` -------------------------------- ### Convert a dashboard using Go Source: https://grafana.github.io/grafana-foundation-sdk/go/How-To/converting-a-dashboard This example demonstrates how to read a dashboard JSON file, register default plugins, and convert the dashboard structure. ```go package main import ( "encoding/json" "fmt" "os" "github.com/grafana/grafana-foundation-sdk/go/cog/plugins" "github.com/grafana/grafana-foundation-sdk/go/dashboard" ) func main() { // Required to correctly unmarshal panels and dataqueries plugins.RegisterDefaultPlugins() dashboardJSON, err := os.ReadFile("dashboard.json") if err != nil { panic(err) } dash := dashboard.Dashboard{} if err = json.Unmarshal(dashboardJSON, &dash); err != nil { panic(err) } converted := dashboard.DashboardConverter(dash) fmt.Println(converted) } ``` -------------------------------- ### Building a dashboard Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/dashboard/builder-Dashboard Example demonstrating how to build a complete dashboard using the Dashboard builder, including rows, panels, and queries. ```APIDOC ## Building a dashboard ### Description Example demonstrating how to build a complete dashboard using the Dashboard builder, including rows, panels, and queries. ### Example ```python from grafana_foundation_sdk.builders.dashboard import Dashboard, Row from grafana_foundation_sdk.builders.prometheus import Dataquery as PrometheusQuery from grafana_foundation_sdk.builders.timeseries import Panel as Timeseries from grafana_foundation_sdk.models.common import TimeZoneBrowser def build_dashboard() -> Dashboard: return ( Dashboard("[TEST] Node Exporter / Raspberry") .uid("test-dashboard-raspberry") .tags(["generated", "raspberrypi-node-integration"]) .refresh("1m") .time("now-30m", "now") .timezone(TimeZoneBrowser) .with_row(Row("Overview")) .with_panel( Timeseries() .title("Network Received") .unit("bps") .min_val(0) .with_target( PrometheusQuery() .expr('rate(node_network_receive_bytes_total{job="integrations/raspberrypi-node", device!="lo"}[$__rate_interval]) * 8') .legend_format("{{ device }}") ) ) ) ``` ``` -------------------------------- ### Construct a dashboard with the Go SDK Source: https://grafana.github.io/grafana-foundation-sdk/go/How-To/building-a-dashboard This example shows how to initialize a dashboard builder, configure its metadata, add a row, and include a time series panel with a Prometheus data query. ```go package main import ( "encoding/json" "fmt" "github.com/grafana/grafana-foundation-sdk/go/common" "github.com/grafana/grafana-foundation-sdk/go/dashboard" "github.com/grafana/grafana-foundation-sdk/go/prometheus" "github.com/grafana/grafana-foundation-sdk/go/timeseries" ) func main() { builder := dashboard.NewDashboardBuilder("Sample dashboard"). Uid("generated-from-go"). Tags([]string{"generated", "from", "go"}). Refresh("1m"). Time("now-30m", "now"). Timezone(common.TimeZoneBrowser). WithRow(dashboard.NewRowBuilder("Overview")). WithPanel( timeseries.NewPanelBuilder(). Title("Network Received"). Unit("bps"). Min(0). WithTarget( prometheus.NewDataqueryBuilder(). Expr(`rate(node_network_receive_bytes_total{job="integrations/raspberrypi-node", device!="lo"}[$__rate_interval]) * 8`). LegendFormat("{{ device }}"), ), ) sampleDashboard, err := builder.Build() if err != nil { panic(err) } dashboardJson, err := json.MarshalIndent(sampleDashboard, "", " ") if err != nil { panic(err) } fmt.Println(string(dashboardJson)) } ``` -------------------------------- ### WeekStart configuration Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/dashboard/builder-DashboardBuilder Sets the day the week starts, expressed as a lowercase day name (e.g., "monday"). ```go func (builder *DashboardBuilder) WeekStart(weekStart string) *DashboardBuilder ``` -------------------------------- ### weekStart method Source: https://grafana.github.io/grafana-foundation-sdk/php/Reference/dashboard/builder-DashboardBuilder Sets the day when the week starts, expressed as a lowercase string (e.g., 'monday'). ```php weekStart(string $weekStart) ``` -------------------------------- ### Constructing a dashboard with DashboardBuilder Source: https://grafana.github.io/grafana-foundation-sdk/typescript/How-To/building-a-dashboard This example shows how to initialize a dashboard, set its metadata, and add a row containing a timeseries panel with a Prometheus data query. ```typescript import { DashboardBuilder, RowBuilder } from '@grafana/grafana-foundation-sdk/dashboard'; import { DataqueryBuilder } from '@grafana/grafana-foundation-sdk/prometheus'; import { PanelBuilder } from '@grafana/grafana-foundation-sdk/timeseries'; const builder = new DashboardBuilder('[TEST] Node Exporter / Raspberry') .uid('test-dashboard-raspberry') .tags(['generated', 'raspberrypi-node-integration']) .refresh('1m') .time({from: 'now-30m', to: 'now'}) .timezone('browser') .withRow(new RowBuilder('Overview')) .withPanel( new PanelBuilder() .title('Network Received') .unit('bps') .min(0) .withTarget( new DataqueryBuilder() .expr('rate(node_network_receive_bytes_total{job="integrations/raspberrypi-node", device!="lo"}[$__rate_interval]) * 8') .legendFormat("{{ device }}") ) ) ; console.log(JSON.stringify(builder.build(), null, 2)); ``` -------------------------------- ### Building a dashboard with DashboardBuilder Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/dashboard/builder-DashboardBuilder Complete example showing how to build a dashboard with a row and a time series panel, including setting time range, timezone, and a Prometheus data query. The resulting dashboard is serialized to JSON and printed. ```java package example; import com.fasterxml.jackson.core.JsonProcessingException; import com.grafana.foundation.dashboard.Dashboard; import com.grafana.foundation.common.Constants; import com.grafana.foundation.dashboard.DashboardBuilder; import com.grafana.foundation.dashboard.DashboardDashboardTimeBuilder; import com.grafana.foundation.dashboard.RowBuilder; import com.grafana.foundation.prometheus.DataqueryBuilder; import com.grafana.foundation.timeseries.PanelBuilder; import java.util.List; public class Main { public static void main(String[] args) throws JsonProcessingException { Dashboard dashboard = new DashboardBuilder("Sample Dashboard"). uid("generated-from-java"). tags(List.of("generated", "from", "java")). refresh("1m"). time(new DashboardDashboardTimeBuilder(). from("now-30m"). to("now") ). timezone(Constants.TimeZoneBrowser). withRow(new RowBuilder("Overview")). withPanel(new PanelBuilder(). title("Network Received"). unit("bps"). min(0.0). withTarget(new DataqueryBuilder(). expr("rate(node_network_receive_bytes_total{job=\"integrations/raspberrypi-node\", device!=\"lo\"}[$__rate_interval]) * 8"). legendFormat("{{ device }}") ) ).build(); System.out.println(dashboard.toJSON()); } } ``` -------------------------------- ### week_start method Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/dashboard/builder-Dashboard Sets the day when the week starts, expressed as a lowercase day name. ```python def week_start(week_start: str) -> typing.Self ``` -------------------------------- ### From Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/dashboardv2/builder-TimeSettingsBuilder Sets the start time range for the dashboard. ```APIDOC ## From ### Description Sets the start time range for the dashboard. Accepted values are relative time strings like "now-6h" or absolute time strings like "2020-07-10T08:00:00.000Z". ### Signature func (builder *TimeSettingsBuilder) From(from string) *TimeSettingsBuilder ### Parameters - from (string) - Required - The start time range string. ### Returns - *TimeSettingsBuilder - The builder for chaining. ``` -------------------------------- ### Marshalling to JSON example Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/dashboard/object-Dashboard Demonstrates how to marshal a Dashboard object into a JSON string. ```go package main import ( "encoding/json" "fmt" "os" "github.com/grafana/grafana-foundation-sdk/go/cog" "github.com/grafana/grafana-foundation-sdk/go/dashboard" ) func main() { sampleDashboard := &dashboard.Dashboard{ Uid: cog.ToPtr("sample-dashboard-uid"), Title: cog.ToPtr("Sample dashboard"), } dashboardJson, err := json.MarshalIndent(sampleDashboard, "", " ") if err != nil { panic(err) } fmt.Println(string(dashboardJson)) } ``` -------------------------------- ### begin(begin: int) Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/alerting/builder-WeekdayRange Sets the beginning weekday for the WeekdayRange. This method allows configuration of the start of the range. ```APIDOC ## begin(begin: int) ### Description Sets the beginning weekday for the WeekdayRange. This method allows configuration of the start of the range. ### Method begin ### Signature ``` def begin(begin: int) -> typing.Self ``` ### Parameters - **begin** (int) - Required - The beginning weekday value. ### Returns - **typing.Self** - The current WeekdayRange instance for chaining. ``` -------------------------------- ### week_start(week_start: typing.Literal["saturday", "monday", "sunday"]) Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/dashboardv2/builder-TimeSettings Sets the day when the week starts. ```APIDOC ## week_start(week_start: typing.Literal["saturday", "monday", "sunday"]) ### Description Sets the day when the week starts. Expressed by the name of the day in lowercase, e.g. "monday". ### Method week_start ### Signature ``` def week_start(week_start: typing.Literal["saturday", "monday", "sunday"]) -> typing.Self ``` ### Parameters - **week_start** (typing.Literal["saturday", "monday", "sunday"]) - Required - Day of the week. ### Returns - **typing.Self** - The builder instance for chaining. ``` -------------------------------- ### AlarmNamePrefix Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/cloudwatch/builder-AnnotationQueryBuilder Sets the alarm name prefix to filter alarms by name. For example, 'my-team-service-' matches alarms with names starting with that prefix. ```APIDOC ## AlarmNamePrefix ### Description Sets the alarm name prefix to filter alarms by name. For example, 'my-team-service-' matches alarms with names starting with that prefix. ### Signature func (builder *AnnotationQueryBuilder) AlarmNamePrefix(alarmNamePrefix string) *AnnotationQueryBuilder ### Parameters - alarmNamePrefix (string) - Required - The alarm name prefix. ``` -------------------------------- ### Unmarshalling from JSON example Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/dashboard/object-Dashboard Demonstrates how to unmarshal a JSON file into a Dashboard object, requiring the registration of default plugins for panels and data queries. ```go package main import ( "encoding/json" "fmt" "os" "github.com/grafana/grafana-foundation-sdk/go/cog/plugins" "github.com/grafana/grafana-foundation-sdk/go/dashboard" ) func main() { // Required to correctly unmarshal panels and dataqueries plugins.RegisterDefaultPlugins() dashboardJSON, err := os.ReadFile("dashboard.json") if err != nil { panic(err) } sampleDashboard := &dashboard.Dashboard{} if err := json.Unmarshal(dashboardJSON, sampleDashboard); err != nil { panic(fmt.Sprintf("%s", err)) } fmt.Printf("%#v\n", sampleDashboard) } ``` -------------------------------- ### ActionPrefix Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/cloudwatch/builder-AnnotationQueryBuilder Sets the action prefix to filter alarms by alarm action. For example, specifying 'arn:aws:sns:us-east-1:123456789012:my-app-' matches alarms with actions starting with that prefix. ```APIDOC ## ActionPrefix ### Description Sets the action prefix to filter alarms by alarm action. For example, specifying 'arn:aws:sns:us-east-1:123456789012:my-app-' matches alarms with actions starting with that prefix. ### Signature func (builder *AnnotationQueryBuilder) ActionPrefix(actionPrefix string) *AnnotationQueryBuilder ### Parameters - actionPrefix (string) - Required - The action prefix. ``` -------------------------------- ### Unmarshalling Dashboard from JSON Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/dashboard/object-Dashboard Example showing how to load a dashboard from a JSON file. Requires registering default plugins to correctly handle panels and data queries. ```python import json from grafana_foundation_sdk.cog.plugins import register_default_plugins from grafana_foundation_sdk.models.dashboard import Dashboard as DashboardModel if __name__ == '__main__': # Required to correctly unmarshal panels and dataqueries register_default_plugins() with open("dashboard.json", "r") as f: decoded_dashboard = DashboardModel.from_json(json.load(f)) print(decoded_dashboard) ``` -------------------------------- ### PanelBuilder.TimeShift Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/barchart/builder-PanelBuilder Overrides the time range for individual panels by shifting its start and end relative to the time picker. For example, you can shift the time range for the panel to be two hours earlier than the dashboard time picker setting `2h`. Note: Panel time overrides have no effect when the dashboard's time range is absolute. ```APIDOC ## PanelBuilder.TimeShift ### Description Overrides the time range for individual panels by shifting its start and end relative to the time picker. For example, you can shift the time range for the panel to be two hours earlier than the dashboard time picker setting `2h`. Note: Panel time overrides have no effect when the dashboard's time range is absolute. ### Method TimeShift ### Signature func (builder *PanelBuilder) TimeShift(timeShift string) *PanelBuilder ### Parameters - **timeShift** (string) - Required - The time shift offset, e.g., "2h". ### Returns - *PanelBuilder - The builder for chaining. ``` -------------------------------- ### from_val(from_val: str) Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/expr/builder-ExprTypeSqlTimeRange Sets the start time of the query. The from_val parameter is the start time of the query. ```APIDOC ## from_val(from_val: str) ### Description Sets the start time of the query. The from_val parameter is the start time of the query. ### Method from_val ### Signature def from_val(from_val: str) -> typing.Self ### Parameters - **from_val** (str) - Required - The start time of the query. ### Returns - **typing.Self** - The current instance for method chaining. ### Example ```python range = ExprTypeSqlTimeRange() range.from_val("2023-01-01T00:00:00Z") ``` ``` -------------------------------- ### from_val(from_val: str) Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/expr/builder-ExprTypeThresholdTimeRange Sets the start time of the query. The from_val parameter is a string representing the start time. ```APIDOC ## from_val(from_val: str) ### Description Sets the start time of the query. The from_val parameter is a string representing the start time. ### Method from_val ### Signature def from_val(from_val: str) -> typing.Self ### Parameters - from_val (str) - Required - The start time of the query. ### Returns - typing.Self - The current instance for chaining. ``` -------------------------------- ### build() Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/common/builder-VizLegendOptionsBuilder Builds and returns the VizLegendOptions object with the configured properties. ```APIDOC ## build() ### Description Builds the object and returns the resulting VizLegendOptions instance. ### Method build ### Signature public VizLegendOptions build() ### Parameters None ### Returns VizLegendOptions - The constructed VizLegendOptions object. ``` -------------------------------- ### From Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/expr/builder-ExprTypeResampleTimeRangeBuilder Sets the start time of the query. ```APIDOC ## From ### Description From is the start time of the query. ### Method From ### Signature func (builder *ExprTypeResampleTimeRangeBuilder) From(from string) *ExprTypeResampleTimeRangeBuilder ### Parameters - from (string) - Required - The start time of the query. ### Returns - *ExprTypeResampleTimeRangeBuilder - The builder instance for chaining. ``` -------------------------------- ### From Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/expr/builder-ExprTypeClassicConditionsTimeRangeBuilder Sets the start time of the query. ```APIDOC ## From ### Description From is the start time of the query. ### Signature func (builder *ExprTypeClassicConditionsTimeRangeBuilder) From(from string) *ExprTypeClassicConditionsTimeRangeBuilder ### Parameters - from (string) - Required - The start time of the query. ### Returns - *ExprTypeClassicConditionsTimeRangeBuilder - The builder for chaining. ``` -------------------------------- ### build() Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/heatmap/builder-ExemplarConfig Builds the object and returns the constructed heatmap.ExemplarConfig instance. ```APIDOC ## build() ### Description Builds the object and returns the constructed heatmap.ExemplarConfig instance. ### Method build ### Signature ``` def build() -> heatmap.ExemplarConfig ``` ### Parameters None ### Returns - **heatmap.ExemplarConfig** - The built ExemplarConfig object. ``` -------------------------------- ### From Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/expr/builder-ExprTypeThresholdTimeRangeBuilder Sets the From field, which is the start time of the query. ```APIDOC ## From ### Description From is the start time of the query. ### Signature func (builder *ExprTypeThresholdTimeRangeBuilder) From(from string) *ExprTypeThresholdTimeRangeBuilder ### Parameters - from (string) - Required - The start time of the query. ### Returns - *ExprTypeThresholdTimeRangeBuilder - The builder instance for chaining. ``` -------------------------------- ### From Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/expr/builder-ExprTypeSqlTimeRangeBuilder Sets the From field, which is the start time of the query. ```APIDOC ## From ### Description From is the start time of the query. ### Signature func (builder *ExprTypeSqlTimeRangeBuilder) From(from string) *ExprTypeSqlTimeRangeBuilder ### Parameters - **from** (string) - Required - The start time of the query. ### Returns - *ExprTypeSqlTimeRangeBuilder - The builder for chaining. ``` -------------------------------- ### build() Source: https://grafana.github.io/grafana-foundation-sdk/php/Reference/heatmap/builder-HeatmapTooltipBuilder Builds the tooltip configuration object. ```APIDOC ## build() ### Description Builds the tooltip configuration object. ### Method build ### Signature build() ### Parameters None ### Returns The built tooltip configuration object. ``` -------------------------------- ### From Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/expr/builder-ExprTypeReduceTimeRangeBuilder Sets the From field, which is the start time of the query. ```APIDOC ## From ### Description From is the start time of the query. ### Signature func (builder *ExprTypeReduceTimeRangeBuilder) From(from string) *ExprTypeReduceTimeRangeBuilder ### Parameters - **from** (string) - Required - The start time of the query. ### Returns - *ExprTypeReduceTimeRangeBuilder - The builder for chaining. ``` -------------------------------- ### build() Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/preferences/builder-PreferencesBuilder Builds and returns the Preferences object with the configured settings. ```APIDOC ## build() ### Description Builds the object and returns the constructed Preferences instance. ### Method build ### Signature ``` public Preferences build() ``` ### Returns - **Preferences** - The constructed preferences object. ``` -------------------------------- ### From Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/expr/builder-ExprTypeMathTimeRangeBuilder Sets the From field, which is the start time of the query. ```APIDOC ## From ### Description From is the start time of the query. ### Signature func (builder *ExprTypeMathTimeRangeBuilder) From(from string) *ExprTypeMathTimeRangeBuilder ### Parameters - **from** (string) - Required - The start time of the query. ### Returns - *ExprTypeMathTimeRangeBuilder - The builder for chaining. ``` -------------------------------- ### build() Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/bargauge/builder-VisualizationV2 Builds the object and returns a dashboardv2.VizConfigKind. ```APIDOC ## build() ### Description Builds the object and returns the resulting configuration. ### Method build ### Signature ``` def build() -> dashboardv2.VizConfigKind ``` ### Returns - **dashboardv2.VizConfigKind** - The built visualization configuration. ``` -------------------------------- ### build() Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/candlestick/builder-Visualization Builds the visualization object and returns a dashboardv2beta1.VizConfigKind. ```APIDOC ## build() ### Description Builds the object and returns the resulting visualization configuration. ### Method build ### Signature ``` def build() -> dashboardv2beta1.VizConfigKind ``` ### Returns - **dashboardv2beta1.VizConfigKind** - The built visualization configuration. ``` -------------------------------- ### Field Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/nodegraph/builder-ArcOptionBuilder Sets the field from which to get the value. ```APIDOC ## Field ### Description Field from which to get the value. Values should be less than 1, representing fraction of a circle. ### Method Field ### Signature func (builder *ArcOptionBuilder) Field(field string) *ArcOptionBuilder ### Parameters - field (string) - Required - Field from which to get the value. Values should be less than 1, representing fraction of a circle. ### Returns - *ArcOptionBuilder - The builder instance for chaining. ``` -------------------------------- ### start_value Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/testdata/builder-Query Sets the start value for the testdata query. ```APIDOC ## start_value ### Description Sets the start value for the testdata query. ### Method start_value ### Parameters - **start_value** (float) - Required - The start value. ### Returns - typing.Self - The builder instance for chaining. ``` -------------------------------- ### build() Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/dashboardv2/builder-QueryOptionsSpecBuilder Builds the QueryOptionsSpec object with the configured settings. ```APIDOC ## Method: build ### Description Builds the QueryOptionsSpec object with the configured settings. ### Signature public QueryOptionsSpec build() ### Parameters None ### Returns QueryOptionsSpec - The built QueryOptionsSpec object. ``` -------------------------------- ### Build Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/heatmap/builder-ExemplarConfigBuilder Builds the ExemplarConfig object from the builder. ```APIDOC ## Build ### Description Builds the object. ### Signature func (builder *ExemplarConfigBuilder) Build() (ExemplarConfig, error) ### Returns - ExemplarConfig - The built configuration object. - error - An error if building fails. ``` -------------------------------- ### startValue(float $startValue) Source: https://grafana.github.io/grafana-foundation-sdk/php/Reference/testdata/builder-QueryBuilder Sets the start value. ```APIDOC ## startValue(float $startValue) ### Description Sets the start value. ### Method startValue ### Parameters - **$startValue** (float) - Required - The start value. ### Signature ``` startValue(float $startValue) ``` ``` -------------------------------- ### ExemplarConfig() Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/heatmap/builder-ExemplarConfig Constructor for the ExemplarConfig class. Initializes a new instance of the exemplar configuration object. ```APIDOC ## ExemplarConfig() ### Description Constructor for the ExemplarConfig class. Initializes a new instance of the exemplar configuration object. ### Method Constructor ### Signature ``` ExemplarConfig() ``` ### Parameters None ### Returns - **ExemplarConfig** - A new instance of the ExemplarConfig class. ``` -------------------------------- ### startValue(Double startValue) Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/testdata/builder-DataqueryBuilder Sets the start value. ```APIDOC ## startValue(Double startValue) ### Description Sets the start value. ### Method startValue ### Signature `public dataqueryBuilder startValue(Double startValue)` ### Parameters - **startValue** (Double) - Required - The start value. ``` -------------------------------- ### StartValue Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/testdata/builder-DataqueryBuilder Sets the start value for the data query. ```APIDOC ## StartValue ### Description Sets the start value for the data query. ### Method StartValue ### Signature func (builder *DataqueryBuilder) StartValue(startValue float64) *DataqueryBuilder ### Parameters - **startValue** (float64) - Required - The start value to set. ### Returns - *DataqueryBuilder - The builder instance for chaining. ``` -------------------------------- ### Building a dashboard Source: https://grafana.github.io/grafana-foundation-sdk/php/Reference/dashboard/builder-DashboardBuilder Demonstrates how to instantiate a DashboardBuilder, configure its properties, and add rows and panels to generate a dashboard JSON structure. ```php use Grafana\Foundation\Common; use Grafana\Foundation\Dashboard\DashboardBuilder; use Grafana\Foundation\Dashboard\RowBuilder; use Grafana\Foundation\Prometheus; use Grafana\Foundation\Timeseries; require_once __DIR__.'/vendor/autoload.php'; $builder = (new DashboardBuilder(title: 'Sample dashboard')) ->uid('generated-from-php') ->tags(['generated', 'from', 'php']) ->refresh('1m') ->time('now-30m', 'now') ->timezone(Common\Constants::TIME_ZONE_BROWSER) ->withRow(new RowBuilder('Overview')) ->withPanel( (new Timeseries\PanelBuilder()) ->title('Network received') ->unit('bps') ->min(0) ->withTarget( (new Prometheus\DataqueryBuilder()) ->expr('rate(node_network_receive_bytes_total{job="integrations/raspberrypi-node", device!="lo"}[$__rate_interval]) * 8') ->legendFormat('{{ device }}') ) ) ; echo(json_encode($builder->build(), JSON_PRETTY_PRINT).PHP_EOL); ``` -------------------------------- ### from_val(from_val: str) Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/expr/builder-ExprTypeClassicConditionsTimeRange Sets the start time of the query. ```APIDOC ## from_val(from_val: str) ### Description Sets the start time of the query. ### Method from_val ### Signature def from_val(from_val: str) -> typing.Self ### Parameters - **from_val** (str) - Required - The start time of the query. ### Returns - **typing.Self** - The current instance for chaining. ``` -------------------------------- ### Initialize VisualizationBuilder Source: https://grafana.github.io/grafana-foundation-sdk/php/Reference/bargauge/builder-VisualizationBuilder Constructor for creating a new instance of the builder. ```php new VisualizationBuilder() ``` -------------------------------- ### QueryBuilder.startValue(Double startValue) Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/testdata/builder-QueryBuilder Sets the start value for the query. ```APIDOC ## QueryBuilder.startValue(Double startValue) ### Description Sets the start value for the query. ### Method startValue ### Signature `public QueryBuilder startValue(Double startValue)` ### Parameters - **startValue** (Double) - Required - The start value. ### Returns QueryBuilder - The builder instance for chaining. ``` -------------------------------- ### public TimeRangeBuilder from(String from) Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/prometheus/builder-TimeRangeBuilder Sets the start time of the query. ```APIDOC ## Method: from ### Description From is the start time of the query. ### Signature public TimeRangeBuilder from(String from) ### Parameters - **from** (String) - Required - The start time of the query. ### Returns TimeRangeBuilder - The builder instance for chaining. ``` -------------------------------- ### Build Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/common/builder-OptionsWithTooltipBuilder Builds the OptionsWithTooltip object from the builder. ```APIDOC ## Build ### Description Builds the object. ### Signature func (builder *OptionsWithTooltipBuilder) Build() (OptionsWithTooltip, error) ### Returns - OptionsWithTooltip - The built object. - error - An error if the build fails. ``` -------------------------------- ### weekStart(TimeSettingsSpecWeekStart weekStart) Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/dashboardv2beta1/builder-TimeSettingsBuilder Sets the day when the week starts. ```APIDOC ## Method: weekStart(TimeSettingsSpecWeekStart weekStart) ### Description Sets the day when the week starts. Expressed by the name of the day in lowercase, e.g. "monday". ### Syntax ```java public TimeSettingsBuilder weekStart(TimeSettingsSpecWeekStart weekStart) ``` ### Parameters - **weekStart** (TimeSettingsSpecWeekStart) - Required - The week start day enum. ### Returns The TimeSettingsBuilder instance for chaining. ``` -------------------------------- ### new VizLegendOptionsBuilder() Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/common/builder-VizLegendOptionsBuilder Creates a new instance of the VizLegendOptionsBuilder class. ```APIDOC ## new VizLegendOptionsBuilder() ### Description Creates a new instance of the VizLegendOptionsBuilder class. ### Method Constructor ### Signature new VizLegendOptionsBuilder() ### Parameters None ### Returns VizLegendOptionsBuilder - A new builder instance. ``` -------------------------------- ### from_val(from_val: str) Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/dashboardv2/builder-TimeSettings Sets the start time range for the dashboard. ```APIDOC ## from_val(from_val: str) ### Description Sets the start time range for the dashboard. Accepted values are relative time strings like "now-6h" or absolute time strings like "2020-07-10T08:00:00.000Z". ### Method from_val ### Signature ``` def from_val(from_val: str) -> typing.Self ``` ### Parameters - **from_val** (str) - Required - Start time range string. ### Returns - **typing.Self** - The builder instance for chaining. ``` -------------------------------- ### build() Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/dashboardv2beta1/builder-NotebookLayoutItemKindBuilder Builds and returns a NotebookLayoutItemKind object. ```APIDOC ## Method: build ### Description Builds the object and returns the resulting NotebookLayoutItemKind instance. ### Signature ```java public NotebookLayoutItemKind build() ``` ### Returns - **NotebookLayoutItemKind** - The built object. ``` -------------------------------- ### timeFrom(String timeFrom) Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/dashboardv2/builder-QueryOptionsSpecBuilder Sets the start time for the query options. ```APIDOC ## Method: timeFrom ### Description Sets the start time for the query options. ### Signature public QueryOptionsSpecBuilder timeFrom(String timeFrom) ### Parameters - **timeFrom** (String) - Required - The start time value. ### Returns QueryOptionsSpecBuilder - The builder instance for chaining. ``` -------------------------------- ### begin(Integer begin) Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/alerting/builder-WeekdayRangeBuilder Sets the begin value for the WeekdayRange being built. ```APIDOC ## Method: begin ### Description Sets the begin property of the WeekdayRange. ### Signature public WeekdayRangeBuilder begin(Integer begin) ### Parameters - **begin** (Integer) - Required - The begin value to set. ### Returns WeekdayRangeBuilder - The builder instance for chaining. ``` -------------------------------- ### Operator Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/tempo/builder-TraceqlFilterBuilder Sets the operator that connects the tag to the value, for example: =, >, !=, =~. ```APIDOC ## Operator ### Description Sets the operator that connects the tag to the value, for example: =, >, !=, =~. ### Signature func (builder *TraceqlFilterBuilder) Operator(operator string) *TraceqlFilterBuilder ### Parameters - operator (string) - Required - The operator to use. ### Returns - *TraceqlFilterBuilder - The builder instance for chaining. ``` -------------------------------- ### build() Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/resource/builder-Manifest Builds the object and returns a resource.Manifest instance. ```APIDOC ## build() ### Description Builds the object and returns the constructed resource.Manifest. ### Method build ### Signature ``` def build() -> resource.Manifest ``` ### Returns - **resource.Manifest** - The built Manifest object. ``` -------------------------------- ### weekStart method Source: https://grafana.github.io/grafana-foundation-sdk/typescript/Reference/preferences/builder-PreferencesBuilder Sets the start day of the week (e.g., sunday, monday). ```typescript weekStart(weekStart: string) ``` -------------------------------- ### func (builder *VizLegendOptionsBuilder) Build() (VizLegendOptions, error) Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/common/builder-VizLegendOptionsBuilder Builds the VizLegendOptions object. ```APIDOC ## Build ### Description Builds the VizLegendOptions object. ### Method Build ### Signature func (builder *VizLegendOptionsBuilder) Build() (VizLegendOptions, error) ### Returns - VizLegendOptions - The built object. - error - An error if the build fails. ``` -------------------------------- ### VizLegendOptions() Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/common/builder-VizLegendOptions Constructor for the VizLegendOptions class. ```APIDOC ## VizLegendOptions() ### Description Creates a new instance of the VizLegendOptions builder. ### Method Constructor ### Signature VizLegendOptions() ### Returns A new VizLegendOptions instance. ``` -------------------------------- ### Open Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/candlestick/builder-CandlestickFieldMapBuilder Sets the Open field, which corresponds to the starting value of the given period. ```APIDOC ## Open ### Description Corresponds to the starting value of the given period. ### Signature func (builder *CandlestickFieldMapBuilder) Open(open string) *CandlestickFieldMapBuilder ### Parameters - open (string) - The open value. ### Returns - *CandlestickFieldMapBuilder - The builder for chaining. ``` -------------------------------- ### begin(int $begin) Source: https://grafana.github.io/grafana-foundation-sdk/php/Reference/alerting/builder-WeekdayRangeBuilder Sets the beginning value for the WeekdayRange. ```APIDOC ## begin(int $begin) ### Description Sets the beginning value for the WeekdayRange. ### Method `begin(int $begin)` ### Parameters - **$begin** (int) - Required - The beginning value. ### Returns The current WeekdayRangeBuilder instance for method chaining. ``` -------------------------------- ### Tag Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/tempo/builder-TraceqlFilterBuilder Sets the tag for the search filter, for example: .http.status_code, .service.name, status. ```APIDOC ## Tag ### Description Sets the tag for the search filter, for example: .http.status_code, .service.name, status. ### Signature func (builder *TraceqlFilterBuilder) Tag(tag string) *TraceqlFilterBuilder ### Parameters - tag (string) - Required - The tag for the search filter. ### Returns - *TraceqlFilterBuilder - The builder instance for chaining. ``` -------------------------------- ### build() Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/common/builder-StackingConfigBuilder Builds the StackingConfig object with the configured properties. ```APIDOC ## build() ### Description Builds the StackingConfig object using the current builder state. ### Method build ### Signature public StackingConfig build() ### Parameters None ### Returns A StackingConfig object. ``` -------------------------------- ### build() Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/text/builder-CodeOptionsBuilder Builds the CodeOptions object with the configured settings. ```APIDOC ## Method: build() ### Description Builds the CodeOptions object with the configured settings. ### Syntax ```java public CodeOptions build() ``` ### Parameters None. ### Returns A CodeOptions object. ``` -------------------------------- ### public ArcOptionBuilder field(String field) Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/nodegraph/builder-ArcOptionBuilder Sets the field from which to get the value. ```APIDOC ## public ArcOptionBuilder field(String field) ### Description Field from which to get the value. Values should be less than 1, representing fraction of a circle. ### Method `public ArcOptionBuilder field(String field)` ### Parameters - **field** (String) - Required - Field from which to get the value. Values should be less than 1, representing fraction of a circle. ### Returns The ArcOptionBuilder instance for chaining. ``` -------------------------------- ### build() Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/canvas/builder-CanvasOptionsRoot Builds the CanvasOptionsRoot object. ```APIDOC ## build() ### Description Builds the object and returns the resulting CanvasOptionsRoot instance. ### Method build ### Signature ``` def build() -> canvas.CanvasOptionsRoot ``` ### Returns - **canvas.CanvasOptionsRoot** - The built CanvasOptionsRoot object. ``` -------------------------------- ### build() Source: https://grafana.github.io/grafana-foundation-sdk/php/Reference/xychart/builder-MatcherConfigBuilder Builds the MatcherConfig object. ```APIDOC ## build() ### Description Builds the MatcherConfig object. ### Method build ### Signature ``` build() ``` ### Parameters None ### Returns The built MatcherConfig object. ``` -------------------------------- ### relativeTimeRange(\Grafana\Foundation\Alerting\RelativeTimeRange $relativeTimeRange) Source: https://grafana.github.io/grafana-foundation-sdk/php/Reference/alerting/builder-QueryBuilder Sets the per query start and end time for requests. ```APIDOC ## Method: relativeTimeRange ### Description Sets the per query start and end time for requests. ### Signature ```php relativeTimeRange(\Grafana\Foundation\Alerting\RelativeTimeRange $relativeTimeRange) ``` ### Parameters - **$relativeTimeRange** (\Grafana\Foundation\Alerting\RelativeTimeRange) - Required - The relative time range object. ``` -------------------------------- ### public PreferencesBuilder weekStart(String weekStart) Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/preferencesv1alpha1/builder-PreferencesBuilder Sets the day of the week that starts the week. ```APIDOC ## Method: weekStart ### Description Day of the week (sunday, monday, etc). ### Signature ``` public PreferencesBuilder weekStart(String weekStart) ``` ### Parameters - **weekStart** (String) - Required - The day of the week. ### Returns - **PreferencesBuilder** - The builder instance for chaining. ``` -------------------------------- ### Begin Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/alerting/builder-MonthRangeBuilder Sets the begin value for the MonthRange. ```APIDOC ## Begin ### Description Sets the begin value for the MonthRange. ### Signature func (builder *MonthRangeBuilder) Begin(begin int32) *MonthRangeBuilder ### Parameters - begin (int32) - The begin value. ### Returns - *MonthRangeBuilder - The builder instance for chaining. ``` -------------------------------- ### Build Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/annotationslist/builder-VisualizationBuilder Builds the visualization object and returns the resulting VizConfigKind. ```APIDOC ## Build ### Description Builds the object and returns the resulting VizConfigKind. ### Signature func (builder *VisualizationBuilder) Build() (dashboardv2beta1.VizConfigKind, error) ### Returns - dashboardv2beta1.VizConfigKind - The built visualization configuration. - error - An error if the build fails. ``` -------------------------------- ### FiscalYearStartMonth Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/dashboard/builder-DashboardBuilder Sets the month that the fiscal year starts on. 0 = January, 11 = December. ```APIDOC ## FiscalYearStartMonth ### Description Sets the month that the fiscal year starts on. 0 = January, 11 = December. ### Signature func (builder *DashboardBuilder) FiscalYearStartMonth(fiscalYearStartMonth uint8) *DashboardBuilder ### Parameters - **fiscalYearStartMonth** (uint8) - Required - The month number (0-11). ### Returns - **builder** (*DashboardBuilder) - The builder instance for chaining. ``` -------------------------------- ### build() Source: https://grafana.github.io/grafana-foundation-sdk/php/Reference/dashboardv2beta1/builder-NotebookLayoutKindBuilder Builds the object and returns the constructed NotebookLayoutKind instance. ```APIDOC ## build() ### Description Builds the object and returns the constructed NotebookLayoutKind instance. ### Method build ### Signature ```php build() ``` ### Parameters None ### Returns The built object. ``` -------------------------------- ### Marshalling Dashboard to JSON Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/dashboard/object-Dashboard Example showing how to encode a Dashboard object into a JSON string. ```python from grafana_foundation_sdk.cog.encoder import JSONEncoder from grafana_foundation_sdk.models.dashboard import Dashboard if __name__ == '__main__': dashboard = Dashboard() encoder = JSONEncoder(sort_keys=True, indent=2) print(encoder.encode(dashboard)) ``` -------------------------------- ### build() Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/testdata/builder-Key Builds the object and returns a testdata.Key instance. ```APIDOC ## build() ### Description Builds the object and returns a testdata.Key instance. ### Method build ### Signature ``` def build() -> testdata.Key ``` ### Returns - testdata.Key - The built object. ``` -------------------------------- ### QueryV2Builder.startValue(Double startValue) Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/testdata/builder-QueryV2Builder Sets the start value for the query. Returns the builder instance for chaining. ```APIDOC ## QueryV2Builder.startValue(Double startValue) ### Description Sets the start value for the query. ### Method startValue ### Signature public QueryV2Builder startValue(Double startValue) ### Parameters - **startValue** (Double) - Required - The start value to set. ### Returns QueryV2Builder - The builder instance for chaining. ``` -------------------------------- ### ExemplarConfig.from_json Source: https://grafana.github.io/grafana-foundation-sdk/python/Reference/heatmap/object-ExemplarConfig Builds this object from a JSON-decoded dict. ```APIDOC ## from_json ### Description Builds this object from a JSON-decoded dict. ### Method `from_json(data: dict[str, typing.Any]) -> typing.Self` ### Parameters - `data` (dict[str, typing.Any]) - Required - The JSON-decoded dict to build the object from. ### Returns - `typing.Self` - The constructed ExemplarConfig object. ``` -------------------------------- ### func (builder *QueryOptionsSpecBuilder) TimeFrom(timeFrom string) *QueryOptionsSpecBuilder Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/dashboardv2/builder-QueryOptionsSpecBuilder Sets the start time for the query. ```APIDOC ## func (builder *QueryOptionsSpecBuilder) TimeFrom(timeFrom string) *QueryOptionsSpecBuilder ### Description Sets the start time for the query. ### Signature func (builder *QueryOptionsSpecBuilder) TimeFrom(timeFrom string) *QueryOptionsSpecBuilder ### Parameters - timeFrom (string) - Required - The start time value. ### Returns - *QueryOptionsSpecBuilder - The builder instance for chaining. ``` -------------------------------- ### build() Source: https://grafana.github.io/grafana-foundation-sdk/java/Reference/dashboardv2beta1/builder-NotebookLayoutSpecBuilder Builds and returns the NotebookLayoutSpec object. ```APIDOC ## Method: build() ### Description Builds the object and returns the resulting NotebookLayoutSpec. ### Syntax ``` public NotebookLayoutSpec build() ``` ### Parameters None. ### Returns NotebookLayoutSpec - The built NotebookLayoutSpec object. ``` -------------------------------- ### Search Source: https://grafana.github.io/grafana-foundation-sdk/go/Reference/tempo/builder-DataqueryBuilder Sets the logfmt query to filter traces by their tags. Deprecated. Example: http.status_code=200 error=true. ```APIDOC ## Search ### Description @deprecated Logfmt query to filter traces by their tags. Example: http.status_code=200 error=true. ### Method Search ### Signature func (builder *DataqueryBuilder) Search(search string) *DataqueryBuilder ### Parameters - search (string) - Required - The logfmt query. ```