contour icon indicating copy to clipboard operation
contour copied to clipboard

Support scrape Contour/Envoy metrics by Prometheus Operator

Open izturn opened this issue 3 years ago • 0 comments

Please describe the problem you have

// TODO [danehans]: Remove the prometheus annotations when Contour is updated to
// show how the Prometheus Operator is used to scrape Contour/Envoy metrics.
PodAnnotations: map[string]string{
	"prometheus.io/scrape": "true",
	"prometheus.io/port":   "8002",
	"prometheus.io/path":   "/stats/prometheus",
},
// TODO [danehans]: Remove the prometheus annotations when Contour is updated to
// show how the Prometheus Operator is used to scrape Contour/Envoy metrics.
Annotations: map[string]string{
	"prometheus.io/scrape": "true",
	"prometheus.io/port":   fmt.Sprintf("%d", metricsPort),
},

I'd like to implement this as follows:

  1. add a flag to ContourDeployment:

type ContourDeploymentSpec struct { // +optional EnableMetrics bool json:"enableMetrics,omitempty" }

  1. if EnableMetrics equals to false, do nothing
  2. otherwise, expose ports for services: contour/8000 & envoy/8002
  3. kubectl apply CR\ServiceMontior by themself (optional)
  4. that's all

@skriss @sunjayBhatia any advise?

izturn avatar Sep 23 '22 02:09 izturn