envoy icon indicating copy to clipboard operation
envoy copied to clipboard

Missing metrics in /stats response

Open tangmengqiu opened this issue 5 years ago • 3 comments

If you are reporting any crash or any potential security issue, do not open an issue in this repo. Please report the issue via emailing [email protected] where the issue will be triaged appropriately.

Title: Missing metrics from /stats/prometheus compared with /stats

Description:

What issue is being seen? Describe what should be happening instead of

Got: different number of metrics return from /stats/prometheus and /stats API. Expected: same content should be return from /stats/prometheus and /stats , just in different format.

Repro steps:

Include sample requests, environment, etc. All data and inputs

  1. kubectl exec -n ui-app -it $POD -c istio-proxy -- curl -sS 'localhost:15000/stats/prometheus'
  2. kubectl exec -n ui-app -it $POD -c istio-proxy -- curl -sS 'localhost:15000/stats'
  3. compare what you got In my case, lost some of the istio_requests_total metrics:

kubectl exec -n ui-app -it $POD -c istio-proxy -- curl -sS 'localhost:15000/stats/prometheus' :

istio_requests_total
{response_code="test"
reporter="source"
source_workload="test"
source_workload_namespace="test"
source_principal="test"
source_app="test"
source_version="test"
source_cluster="test"
destination_workload="test"
destination_workload_namespace="test"
destination_principal="test"
destination_app="test"
destination_version="test"
destination_service="test"
destination_service_name="test"
destination_service_namespace="test"
destination_cluster="test"
request_protocol="test"
response_flags="test"
grpc_response_status="test"
connection_security_policy="test"
source_canonical_service="test"
destination_canonical_service="test"
source_canonical_revision="test"
destination_canonical_revision="test"} 3656

istio_requests_total
{response_code="test"
reporter="source"
source_workload="test"
source_workload_namespace="test"
source_principal="test"
source_app="test"
source_version="test"
source_cluster="test"
destination_workload="test"
destination_workload_namespace="test"
destination_principal="test"
destination_app="test"
destination_version="test"
destination_service="test"
destination_service_name="test"
destination_service_namespace="test"
destination_cluster="test"
request_protocol="test"
response_flags="test"
grpc_response_status="test"
connection_security_policy="test"
source_canonical_service="test"
destination_canonical_service="test"
source_canonical_revision="test"
destination_canonical_revision="test"} 3643

kubectl exec -n ui-app -it $POD -c istio-proxy -- curl -sS 'localhost:15000/stats' :

reporter=.=destination
source_workload=.=test
source_workload_namespace=.=test
source_principal=.=test
source_app=.=test
source_version=.=test
source_canonical_service=.=test
source_canonical_revision=.=test
source_cluster=.=test
destination_workload=.=test
destination_workload_namespace=.=test
destination_principal=.=test
destination_app=.=test
destination_version=.=test
destination_service=.=test
destination_service_name=.=test
destination_service_namespace=.=test
destination_canonical_service=.=test
destination_canonical_revision=.=test
destination_cluster=.=test
request_protocol=.=test
response_flags=.=test
connection_security_policy=.=test
response_code=.=test
grpc_response_status=.=test
request_path=.=test
istio_requests_total: 21976

reporter=.=source
source_workload=.=test
source_workload_namespace=.=test
source_principal=.=test
source_app=.=test
source_version=.=test
source_canonical_service=.=test
source_canonical_revision=.=test
source_cluster=.=test
destination_workload=.=test
destination_workload_namespace=.=test
destination_principal=.=test
destination_app=.=test
destination_version=.=test
destination_service=.=test
destination_service_name=.=test
destination_service_namespace=.=test
destination_canonical_service=.=test
destination_canonical_revision=.=test
destination_cluster=.=test
request_protocol=.=test
response_flags=.=test
connection_security_policy=.=test
response_code=.=test
grpc_response_status=.=test
istio_requests_total: 3666

reporter=.=source
source_workload=.=test
source_workload_namespace=.=test
source_principal=.=test
source_app=.=test
source_version=.=test
source_canonical_service=.=test
source_canonical_revision=.=test
source_cluster=.=test
destination_workload=.=test
destination_workload_namespace=.=test
destination_principal=.=test
destination_app=.=test
destination_version=.=test
destination_service=.=test
destination_service_name=.=test
destination_service_namespace=.=test
destination_canonical_service=.=test
destination_canonical_revision=.=test
destination_cluster=.=test
request_protocol=.=test
response_flags=.=test
connection_security_policy=.=test
response_code=.=test
grpc_response_status=.=test
istio_requests_total: 3653

The first query returns 2 records but the second query returns 3 records.

Note: The Envoy_collect tool gathers a tarball with debug logs, config and the following admin endpoints: /stats, /clusters and /server_info. Please note if there are privacy concerns, sanitize the data prior to sharing the tarball/pasting.

Admin and Stats Output:

Include the admin output for the following endpoints: /stats, /clusters, /routes, /server_info. For more information, refer to the admin endpoint documentation.

Note: If there are privacy concerns, sanitize the data prior to sharing.

Config:

Include the config used to configure Envoy.

Logs:

Include the access logs and the Envoy logs.

Note: If there are privacy concerns, sanitize the data prior to sharing.

Call Stack:

If the Envoy binary is crashing, a call stack is required. Please refer to the Bazel Stack trace documentation.

tangmengqiu avatar Oct 15 '21 09:10 tangmengqiu

cc @jmarantz

mattklein123 avatar Oct 19 '21 15:10 mattklein123

sorry, I guess the reason is the statsTag config of Envoy's bootstrap missing the requests_path tag so the first metric return by kubectl exec -n ns -it $POD -c istio-proxy -- curl -sS 'localhost:15000/stats' with an extra dimension: request_path cannot be converted to Prometheus format.

tangmengqiu avatar Oct 20 '21 05:10 tangmengqiu

see comment before

tangmengqiu avatar Oct 20 '21 05:10 tangmengqiu