Documentation
¶
Overview ¶
Package publisher provides functionality to publish Grafana dashboards to multiple Grafana Cloud stacks. It supports publishing common dashboards to all stacks and custom dashboards to specific stacks. The publisher can operate in test mode (single stack) or production mode (all non-excluded stacks).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsConfigured ¶
func IsConfigured() bool
IsConfigured checks if the publisher configuration file exists.
Types ¶
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
Publisher manages the publishing of Grafana dashboards to multiple stacks. It uses a configuration file to determine which dashboards to publish and to which stacks.
func NewPublisher ¶
NewPublisher creates a new Publisher instance. It loads the configuration from the publisher-config.yaml file. Returns an error if the configuration file cannot be loaded or parsed.
func NewPublisherWithCloudClient ¶
func NewPublisherWithCloudClient(gcc grafana.GrafanaCloudClient) (*Publisher, error)
func (Publisher) Publish ¶
Publish synchronizes dashboards with Grafana Cloud stacks according to the configuration. If syncAllStacks is true, it publishes to all non-excluded stacks. If syncAllStacks is false, it publishes only to the test stack. Requires GRAFANA_CLOUD_TOKEN environment variable to be set. Returns an error if the synchronization fails.
type PublisherConfig ¶
type PublisherConfig struct { Exclusions []string `yaml:"exclusions,omitempty"` CommonDashboard struct { LocalFolder string `yaml:"localFolder"` GrafanaFolder string `yaml:"grafanaFolder"` } `yaml:"commonDashboards"` CustomDashboard struct { LocalFolder string `yaml:"localFolder"` GrafanaFolder string `yaml:"grafanaFolder"` } `yaml:"customDashboards"` CustomStack string `yaml:"customStack"` TestStack string `yaml:"testStack"` // contains filtered or unexported fields }
func (*PublisherConfig) ExclusionsMap ¶
func (c *PublisherConfig) ExclusionsMap() map[string]struct{}