blob: 6ff4022e9d42124c77b6f7113e5c2695a9257fec [file] [log] [blame] [edit]
subject: namespace:ns
revision: "2022"
rules:
- selector: # must be empty for preprocessing adapters
aspects:
# when running local without a kubeconfig file specified in globalconfig,
# this aspect should be commented out. It is only needed when the attributes
# it produces are needed elsewhere in the config.
- kind: attributes
params:
input_expressions:
sourceUID: source.uid | ""
targetUID: target.uid | ""
originUID: origin.uid | ""
targetService: request.headers["authority"] | request.host | ""
attribute_bindings:
source.ip: sourcePodIp
source.service: sourceService
source.name: sourcePodName
source.namespace: sourceNamespace
source.labels: sourceLabels
source.serviceAccount: sourceServiceAccountName
target.service: targetService
- kind: quotas
params:
quotas:
- descriptor_name: RequestCount
max_amount: 5
expiration: 1s
- kind: metrics
adapter: prometheus
params:
metrics:
- descriptor_name: request_count
# we want to increment this counter by 1 for each unique (source, target, service, method, response_code) tuple
value: "1"
labels:
source: source.name | "unknown"
target: target.name | "unknown"
service: api.name | "unknown"
method: api.method | "unknown"
response_code: response.code | 200
- descriptor_name: request_latency
value: response.duration | "0ms"
labels:
source: source.name | "unknown"
target: target.name | "unknown"
service: api.name | "unknown"
method: api.method | "unknown"
response_code: response.code | 200
- kind: access-logs
params:
logName: access_log
log:
descriptor_name: accesslog.common
template_expressions:
originIp: origin.ip
sourceUser: origin.user
timestamp: request.time
method: request.method
url: request.path
protocol: request.scheme
responseCode: response.code
responseSize: response.size
labels:
originIp: origin.ip
sourceUser: origin.user
timestamp: request.time
method: request.method
url: request.path
protocol: request.scheme
responseCode: response.code
responseSize: response.size