bls
February 1, 2024, 5:38pm
1
Hi, I tried to enable detailed recording so I could have the raw_request and raw_response labels in prometheus logs.
I created this custom metric:
- name: TYK_PMP_PUMPS_PROMETHEUS_META_CUSTOMMETRICS
value: '[{"name":"tyk_http_requests_total","description":"Total of API requests","metric_type":"counter","labels":["host","method", "path", "response_code", "api_key", "time_stamp", "api_version", "api_name", "api_id", "org_id", "oauth_id", "request_time", "ip_address", "alias", "raw_response"]}]'
But in the tyk pump logs I get this, as if it doesn’t detect the “raw_response” label:
panic: inconsistent label cardinality: expected 15 label values but got 14
Is detailed logging available for prometheus?
Olu
February 6, 2024, 1:05pm
2
It doesn’t look like it is available. Labels from the source don’t show raw_response
present
func (pm *PrometheusMetric) GetLabelsValues(decoded analytics.AnalyticsRecord) []string {
values := []string{}
mapping := map[string]interface{}{
"host": decoded.Host,
"method": decoded.Method,
"path": decoded.Path,
"code": decoded.ResponseCode,
"response_code": decoded.ResponseCode,
"api_key": decoded.APIKey,
"key": decoded.APIKey,
"time_stamp": decoded.TimeStamp,
"api_version": decoded.APIVersion,
"api_name": decoded.APIName,
"api": decoded.APIID,
"api_id": decoded.APIID,
"org_id": decoded.OrgID,
"client_id": decoded.OauthID,
"oauth_id": decoded.OauthID,
"request_time": decoded.RequestTime,
"ip_address": decoded.IPAddress,
This file has been truncated. show original
Maybe you could share your intention or goal with why you want detailed records available.
Since Tyk pump is open source, you could modify the source code and build a custom pump for your requirements.
bls
February 6, 2024, 7:25pm
3
Ok I see. We wanted to capture metrics about request and response payload size, and also have access to request and response headers/payload to view in log browser. I’ll look into building custom pump. Thanks