-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Background
Right now our ServiceMonitor don't support setting for PodTargetLabels field.
PodTargetLabels transfers labels on the Kubernetes Pod onto the target. It is very important for some usage like relabel.
Method to add this feature
Our Kmodules.xyz has AgentSpec definition
type PrometheusSpec struct {
// Port number for the exporter side car.
Port int32 `json:"port,omitempty"`
// Namespace of Prometheus. Service monitors will be created in this namespace.
Namespace string `json:"namespace,omitempty"`
// Labels are key value pairs that is used to select Prometheus instance via ServiceMonitor labels.
// +optional
Labels map[string]string `json:"labels,omitempty"`
// Interval at which metrics should be scraped
Interval string `json:"interval,omitempty"`
// Parameters are key value pairs that are passed as flags to exporters.
// Parameters map[string]string `json:"parameters,omitempty"`
}
Prometheus' definition
type ServiceMonitorSpec struct {
// The label to use to retrieve the job name from.
JobLabel string `json:"jobLabel,omitempty"`
// TargetLabels transfers labels on the Kubernetes Service onto the target.
TargetLabels []string `json:"targetLabels,omitempty"`
// PodTargetLabels transfers labels on the Kubernetes Pod onto the target.
PodTargetLabels []string `json:"podTargetLabels,omitempty"`
// A list of endpoints allowed as part of this ServiceMonitor.
Endpoints []Endpoint `json:"endpoints"`
// Selector to select Endpoints objects.
Selector metav1.LabelSelector `json:"selector"`
// Selector to select which namespaces the Endpoints objects are discovered from.
NamespaceSelector NamespaceSelector `json:"namespaceSelector,omitempty"`
// SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.
SampleLimit uint64 `json:"sampleLimit,omitempty"`
}
We should support JobLabel , TargetLabels , PodTargetLabels , for usage.
Metadata
Metadata
Assignees
Labels
No labels