$ kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
...
$ kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
...
omsagent-75qjs 1/1 Running 1 44h
omsagent-c7c4t 1/1 Running 0 44h
omsagent-rs-74f488997c-dshpx 1/1 Running 1 44h
omsagent-smtk7 1/1 Running 1 44h
...
您可以使用 azm-config-map.yaml 来启用 Prometheus 度量端点抓取。
如果你安装 Dapr 到不同的命名空间, 你需要更改 monitor_kubernetes_pod_namespaces
数组值。 例如:
...
...
prometheus-data-collection-settings: |-
[prometheus_data_collection_settings.cluster]
interval = "1m"
monitor_kubernetes_pods = true
monitor_kubernetes_pods_namespaces = ["dapr-system", "default"]
[prometheus_data_collection_settings.node]
interval = "1m"
...
应用config map:
kubectl apply -f ./azm-config.map.yaml
helm install dapr dapr/dapr --namespace dapr-system --set global.logAsJson=true
注意: OMS Agent仅在replicaset具有Prometheus注释时才抓取指标。
添加 dapr.io/log-as-json: "true"
annotation 到你的部署yaml.
You can run Kafka locally using this Docker image. To run without Docker, see the getting started guide here.
apiVersion: apps/v1
kind: Deployment
metadata:
name: pythonapp
namespace: default
labels:
app: python
spec:
replicas: 1
selector:
matchLabels:
app: python
template:
metadata:
labels:
app: python
annotations:
dapr.io/enabled: "true"
dapr.io/app-id: "pythonapp"
dapr.io/log-as-json: "true"
prometheus.io/scrape: "true"
prometheus.io/port: "9090"
prometheus.io/path: "/"
...
前往Azure Monitor
搜索 Dapr 日志
下面是一个示例查询,用于解析JSON格式的日志和来自Dapr系统进程的查询日志。
ContainerLog
| extend parsed=parse_json(LogEntry)
| project Time=todatetime(parsed['time']), app_id=parsed['app_id'], scope=parsed['scope'],level=parsed['level'], msg=parsed['msg'], type=parsed['type'], ver=parsed['ver'], instance=parsed['instance']
| where level != ""
| sort by Time
这个语句查询process_resident_memory_bytes Prometheus度量的Dapr系统进程,并呈现时间图
InsightsMetrics
| where Namespace == "prometheus" and Name == "process_resident_memory_bytes"
| extend tags=parse_json(Tags)
| project TimeGenerated, Name, Val, app=tostring(tags['app'])
| summarize memInBytes=percentile(Val, 99) by bin(TimeGenerated, 1m), app
| where app startswith "dapr-"
| render timechart