-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Prometheus config and metric sync #82
Conversation
internal/config.go
Outdated
) | ||
|
||
// PrometheusConfig defines Prometheus configuration. | ||
type PrometheusConfig struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is metrics#PrometheusConfig
and here internal#PrometheusConfig
. The latter can be removed.
} | ||
|
||
// Validate checks constraints in the supplied Prometheus configuration and returns an error if they are violated. | ||
func (c *PrometheusConfig) Validate() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would let Validate()
always return nil
and simply disable metric collection if host is not configured, i.e. empty.
cmd/icinga-kubernetes/main.go
Outdated
klog.Fatal(errors.Wrap(err, "can't create configuration")) | ||
} | ||
|
||
promClient, err := promapi.NewClient(promapi.Config{Address: cfg.Prometheus.Host + ":" + strconv.Itoa(cfg.Prometheus.Port)}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is utils.JoinHostPort
from Icinga Go Library. Also, there should be a reasonable default for the Prometheus port.
go.mod
Outdated
go 1.21 | ||
go 1.22 | ||
|
||
toolchain go1.22.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That can be removed.
schema/mysql/schema.sql
Outdated
@@ -464,7 +464,7 @@ CREATE TABLE config_map ( | |||
|
|||
CREATE TABLE data ( | |||
id binary(20) NOT NULL, | |||
name varchar(63) COLLATE utf8mb4_unicode_ci NOT NULL, | |||
name varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert that change. Will be fixed in main.
pkg/metrics/metrics.go
Outdated
fmt.Printf("Warnings: %v\n", warnings) | ||
} | ||
if result == nil { | ||
fmt.Println("No results found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove all such No results found
lines.
4c74ace
to
3420ebe
Compare
Add following to the main branch: