feat: add dedicated message-exchange for task lifecycle notifications
- add constants/message.go with MessageTask* categories and message-exchange /
message-queue / dead-letter routing constants
- add mq/publish_message.go with PushMessageToRabbitMQ (confirm mode,
dead-letter queue) separate from the existing event-exchange publisher
- add mq/emit.go with TryEmitMessage for non-blocking, OTel-traced dispatch
- add mq/event/task_event_gen.go with NewTaskSubmitted/Running/Completed/
Failed/CancelledMessage constructors
- wire TryEmitMessage into task worker and create/cancel handlers so all 5
lifecycle transitions are published (previously task.* routed to
event-exchange with no matching binding, causing silent drops)
- harden Dockerfile: scratch final image, pinned alpine:3.21 certs stage,
apk upgrade in builder, add -trimpath -mod=readonly go build flags
- add full K8s manifests under deploy/k8s/ for Redis, RabbitMQ (mTLS),
ModelRT (Downward API, scratch image, readOnlyRootFilesystem), Jaeger,
Loki, Promtail, Grafana
- expand deploy.md with async_task SQL schema, TLS cert generation steps,
K8s deployment procedures, and SSH tunnel configuration
2026-05-13 16:58:36 +08:00
|
|
|
apiVersion: v1
|
|
|
|
|
kind: ConfigMap
|
|
|
|
|
metadata:
|
|
|
|
|
name: promtail-config
|
|
|
|
|
namespace: default
|
|
|
|
|
data:
|
|
|
|
|
promtail.yaml: |
|
|
|
|
|
server:
|
|
|
|
|
http_listen_port: 9080
|
|
|
|
|
grpc_listen_port: 0
|
|
|
|
|
|
|
|
|
|
positions:
|
|
|
|
|
filename: /tmp/positions.yaml
|
|
|
|
|
|
|
|
|
|
clients:
|
2026-06-03 17:11:54 +08:00
|
|
|
- url: http://loki-service:3100/loki/api/v1/push
|
feat: add dedicated message-exchange for task lifecycle notifications
- add constants/message.go with MessageTask* categories and message-exchange /
message-queue / dead-letter routing constants
- add mq/publish_message.go with PushMessageToRabbitMQ (confirm mode,
dead-letter queue) separate from the existing event-exchange publisher
- add mq/emit.go with TryEmitMessage for non-blocking, OTel-traced dispatch
- add mq/event/task_event_gen.go with NewTaskSubmitted/Running/Completed/
Failed/CancelledMessage constructors
- wire TryEmitMessage into task worker and create/cancel handlers so all 5
lifecycle transitions are published (previously task.* routed to
event-exchange with no matching binding, causing silent drops)
- harden Dockerfile: scratch final image, pinned alpine:3.21 certs stage,
apk upgrade in builder, add -trimpath -mod=readonly go build flags
- add full K8s manifests under deploy/k8s/ for Redis, RabbitMQ (mTLS),
ModelRT (Downward API, scratch image, readOnlyRootFilesystem), Jaeger,
Loki, Promtail, Grafana
- expand deploy.md with async_task SQL schema, TLS cert generation steps,
K8s deployment procedures, and SSH tunnel configuration
2026-05-13 16:58:36 +08:00
|
|
|
|
|
|
|
|
scrape_configs:
|
|
|
|
|
- job_name: kubernetes-pods
|
|
|
|
|
kubernetes_sd_configs:
|
|
|
|
|
- role: pod
|
|
|
|
|
pipeline_stages:
|
|
|
|
|
# 解析 zap 输出的 JSON 日志,提取结构化字段
|
|
|
|
|
- json:
|
|
|
|
|
expressions:
|
|
|
|
|
level: level
|
|
|
|
|
traceID: traceID
|
|
|
|
|
spanID: spanID
|
|
|
|
|
caller: caller
|
|
|
|
|
pod: pod
|
|
|
|
|
namespace: namespace
|
|
|
|
|
node: node
|
|
|
|
|
# 将关键字段提升为 Loki Label,支持在 Grafana 中按实例/Trace 过滤
|
|
|
|
|
- labels:
|
|
|
|
|
level:
|
|
|
|
|
traceID:
|
|
|
|
|
pod:
|
|
|
|
|
namespace:
|
|
|
|
|
node:
|
|
|
|
|
relabel_configs:
|
|
|
|
|
- source_labels: [__meta_kubernetes_namespace]
|
|
|
|
|
target_label: namespace
|
|
|
|
|
- source_labels: [__meta_kubernetes_pod_name]
|
|
|
|
|
target_label: pod
|
|
|
|
|
- source_labels: [__meta_kubernetes_pod_container_name]
|
|
|
|
|
target_label: container
|
|
|
|
|
- source_labels: [__meta_kubernetes_pod_label_app]
|
|
|
|
|
target_label: app
|
|
|
|
|
# 只采集有 app label 的 Pod
|
|
|
|
|
- source_labels: [__meta_kubernetes_pod_label_app]
|
|
|
|
|
action: keep
|
|
|
|
|
regex: .+
|