Documentation
¶
Overview ¶
Copyright 2022 Nethermind
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Nethermind ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Nethermind ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- type AlertingConfig
- type AlertmanagerConfig
- type Config
- type GlobalConfig
- type PrometheusService
- func (p *PrometheusService) AddTarget(target types.MonitoringTarget, labels map[string]string, jobName string) error
- func (p *PrometheusService) ContainerName() string
- func (p *PrometheusService) DotEnv() map[string]string
- func (p *PrometheusService) Endpoint() string
- func (p *PrometheusService) Init(opts types.ServiceOptions) error
- func (p *PrometheusService) Name() string
- func (p *PrometheusService) RemoveTarget(instanceID string) (string, error)
- func (p *PrometheusService) SetContainerIP(ip net.IP)
- func (p *PrometheusService) Setup(options map[string]string) error
- type ScrapeConfig
- type StaticConfig
Constants ¶
This section is empty.
Variables ¶
var ( ErrReloadFailed = errors.New("failed to reload Prometheus config") ErrInvalidOptions = errors.New("invalid options for Prometheus setup") )
Functions ¶
This section is empty.
Types ¶
type AlertingConfig ¶
type AlertingConfig struct {
Alertmanagers []AlertmanagerConfig `yaml:"alertmanagers"`
}
AlertingConfig represents the alerting configuration for Prometheus.
type AlertmanagerConfig ¶
type AlertmanagerConfig struct {
StaticConfigs []StaticConfig `yaml:"static_configs"`
}
AlertmanagerConfig represents the configuration for an Alertmanager.
type Config ¶
type Config struct { Global GlobalConfig `yaml:"global"` RuleFiles []string `yaml:"rule_files"` Alerting AlertingConfig `yaml:"alerting"` ScrapeConfigs []ScrapeConfig `yaml:"scrape_configs"` }
Config represents the Prometheus configuration.
type GlobalConfig ¶
type GlobalConfig struct { ScrapeInterval string `yaml:"scrape_interval"` EvaluationInterval string `yaml:"evaluation_interval"` }
GlobalConfig represents the global configuration for Prometheus.
type PrometheusService ¶
type PrometheusService struct {
// contains filtered or unexported fields
}
PrometheusService implements the ServiceAPI interface for a Prometheus service.
func NewPrometheus ¶
func NewPrometheus() *PrometheusService
NewPrometheus creates a new PrometheusService.
func (*PrometheusService) AddTarget ¶
func (p *PrometheusService) AddTarget(target types.MonitoringTarget, labels map[string]string, jobName string) error
AddTarget adds a new target to the Prometheus config and reloads the Prometheus configuration. Assumes endpoint is in the form http://<ip/domain>:<port>
func (*PrometheusService) ContainerName ¶
func (p *PrometheusService) ContainerName() string
func (*PrometheusService) DotEnv ¶
func (p *PrometheusService) DotEnv() map[string]string
DotEnv returns the dotenv variables and default values for the Prometheus service.
func (*PrometheusService) Endpoint ¶
func (p *PrometheusService) Endpoint() string
func (*PrometheusService) Init ¶
func (p *PrometheusService) Init(opts types.ServiceOptions) error
Init initializes the Prometheus service with the given options.
func (*PrometheusService) Name ¶
func (p *PrometheusService) Name() string
func (*PrometheusService) RemoveTarget ¶
func (p *PrometheusService) RemoveTarget(instanceID string) (string, error)
RemoveTarget removes a target from the Prometheus config and reloads the Prometheus configuration.
func (*PrometheusService) SetContainerIP ¶
func (p *PrometheusService) SetContainerIP(ip net.IP)
SetContainerIP sets the container IP for the Prometheus service.
type ScrapeConfig ¶
type ScrapeConfig struct { JobName string `yaml:"job_name"` StaticConfigs []StaticConfig `yaml:"static_configs"` MetricsPath string `yaml:"metrics_path,omitempty"` }
ScrapeConfig represents the configuration for a Prometheus scrape job.
type StaticConfig ¶
type StaticConfig struct { Targets []string `yaml:"targets"` Labels map[string]string `yaml:"labels,omitempty"` }
StaticConfig represents the static configuration for a Prometheus scrape job.