docs icon indicating copy to clipboard operation
docs copied to clipboard

Update setting up Prometheus docs

Open DevSusu opened this issue 2 years ago • 12 comments

psschwei: originally opened in serving and moved here. updates needed for docs can be found in this comment: https://github.com/knative/docs/issues/5217#issuecomment-1247306521

/area monitoring

What version of Knative?

1.7.1 (installed with https://github.com/knative/serving/releases/download/knative-v1.7.1/serving-core.yaml)

Expected Behavior

  • install knative-serving
  • port-fowarded one of them to debug on prometheus metrics
  • pods report metrics described in https://knative.dev/docs/serving/observability/metrics/serving-metrics/

Actual Behavior

kubectl port-forward service/activator-service -n knative-serving 9090:9090
Forwarding from 127.0.0.1:9090 -> 9090
Forwarding from [::1]:9090 -> 9090
Handling connection for 9090
E0914 16:42:51.809345 3007207 portforward.go:400] an error occurred forwarding 9090 -> 9090: error forwarding port 9090 to pod 4f48d8d6708f2f6cc464957b6718d2ec89088951c6430acfb0fb04857e595a94, uid : exit status 1: 2022/09/14 07:42:51 socat[13441] E connect(5, AF=2 127.0.0.1:9090, 16): Connection refused

I had to specify the metrics.backend-destination and metrics.request-metrics-backend-destination to get this working.

Steps to Reproduce the Problem

  • follow instructions on https://knative.dev/docs/install/yaml-install/serving/install-serving-with-yaml/#prerequisites
  • port-forward one of the components with 9090 port exposed
  • curl localhost:9090 (same error with curl localhost:9090/metrics)
apiVersion: v1
kind: ConfigMap
metadata:
  name: config-observability
  namespace: knative-serving
  labels:
    app.kubernetes.io/name: knative-serving
    app.kubernetes.io/component: observability
    app.kubernetes.io/version: "1.7.1"
  annotations:
    knative.dev/example-checksum: "fed4756e"
data: {}

DevSusu avatar Sep 14 '22 07:09 DevSusu

related issue: https://github.com/knative/eventing/issues/6509

DevSusu avatar Sep 14 '22 08:09 DevSusu

resolved by editing configmap

apiVersion: v1
kind: ConfigMap
metadata:
  name: config-observability
  namespace: knative-serving
  labels:
    app.kubernetes.io/name: knative-serving
    app.kubernetes.io/component: observability
    app.kubernetes.io/version: "1.7.1"
  annotations:
    knative.dev/example-checksum: "fed4756e"
data:
  metrics.backend-destination: prometheus
  metrics.request-metrics-backend-destination: prometheus

DevSusu avatar Sep 14 '22 08:09 DevSusu

I think we need to add below block to setting up prometheus part.

https://knative.dev/docs/serving/observability/metrics/collecting-metrics/#setting-up-prometheus

kubectl patch --namespace knative-serving configmap/config-observability \
  --type merge \
  --patch '{"data":{"metrics.backend-destination":"promethuus","metrics.request-metrics-backend-destination":"prometheus"}}'

kubectl patch --namespace knative-serving configmap/config-observability \
  --type merge \
  --patch '{"data":{"metrics.backend-destination":"promethuus","metrics.request-metrics-backend-destination":"prometheus"}}'

DevSusu avatar Sep 14 '22 08:09 DevSusu

@DevSusu: The label(s) area/monitoring cannot be applied, because the repository doesn't have them.

In response to this:

/area monitoring

What version of Knative?

1.7.1 (installed with https://github.com/knative/serving/releases/download/knative-v1.7.1/serving-core.yaml)

Expected Behavior

  • install knative-serving
  • port-fowarded one of them to debug on prometheus metrics
  • pods report metrics described in https://knative.dev/docs/serving/observability/metrics/serving-metrics/

Actual Behavior

kubectl port-forward service/activator-service -n knative-serving 9090:9090
Forwarding from 127.0.0.1:9090 -> 9090
Forwarding from [::1]:9090 -> 9090
Handling connection for 9090
E0914 16:42:51.809345 3007207 portforward.go:400] an error occurred forwarding 9090 -> 9090: error forwarding port 9090 to pod 4f48d8d6708f2f6cc464957b6718d2ec89088951c6430acfb0fb04857e595a94, uid : exit status 1: 2022/09/14 07:42:51 socat[13441] E connect(5, AF=2 127.0.0.1:9090, 16): Connection refused

I had to specify the metrics.backend-destination and metrics.request-metrics-backend-destination to get this working.

Steps to Reproduce the Problem

  • follow instructions on https://knative.dev/docs/install/yaml-install/serving/install-serving-with-yaml/#prerequisites
  • port-forward one of the components with 9090 port exposed
  • curl localhost:9090 (same error with curl localhost:9090/metrics)
apiVersion: v1
kind: ConfigMap
metadata:
 name: config-observability
 namespace: knative-serving
 labels:
   app.kubernetes.io/name: knative-serving
   app.kubernetes.io/component: observability
   app.kubernetes.io/version: "1.7.1"
 annotations:
   knative.dev/example-checksum: "fed4756e"
data: {}

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

knative-prow[bot] avatar Sep 14 '22 21:09 knative-prow[bot]

/good-first-issue

evankanderson avatar Dec 08 '22 20:12 evankanderson

@evankanderson: This request has been marked as suitable for new contributors.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-good-first-issue command.

In response to this:

/good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

knative-prow[bot] avatar Dec 08 '22 20:12 knative-prow[bot]

/assign @afzal442

afzal442 avatar Feb 03 '23 15:02 afzal442

Can I help?

Rajdeep1311 avatar Sep 04 '23 12:09 Rajdeep1311

/assign

xiangpingjiang avatar Sep 13 '23 15:09 xiangpingjiang

I think we need to add below block to setting up prometheus part.

https://knative.dev/docs/serving/observability/metrics/collecting-metrics/#setting-up-prometheus

kubectl patch --namespace knative-serving configmap/config-observability \
  --type merge \
  --patch '{"data":{"metrics.backend-destination":"promethuus","metrics.request-metrics-backend-destination":"prometheus"}}'

kubectl patch --namespace knative-serving configmap/config-observability \
  --type merge \
  --patch '{"data":{"metrics.backend-destination":"promethuus","metrics.request-metrics-backend-destination":"prometheus"}}'

The config map is to be set before we apply the ServiceMonitors/PodMonitors to collect metrics from Knative, right?

pawarpranav83 avatar Oct 13 '23 06:10 pawarpranav83

/assign

pawarpranav83 avatar Oct 13 '23 15:10 pawarpranav83

Please assign me this issue

KamalSritha-04 avatar Oct 27 '23 04:10 KamalSritha-04