Repository navigation
fix(log-alerts): AI 분석용 Loki 컨텍스트 쿼리 전달 - #78
Merged
Merged
Conversation
developowl
force-pushed
the
feat/log-alert-policy-context
branch
from
June 25, 2026 00:37
c47c668 to
d49febc
Compare
developowl
added a commit
that referenced
this pull request
Jun 25, 2026
* fix(log-alerts): pass Loki context query to ai analyzer * refactor(log-alerts): align Loki rules with host resource alerts * fix(ai-analyzer): pin LOKI_URL to log-server Tailscale IP 검증 중 ai-analyzer pod 의 Loki 조회가 매번 `[Errno -2] Name or service not known` 로 실패하는 것을 확인. pod 의 resolv.conf 가 cluster CoreDNS (10.43.0.10) → Tailscale DNS (100.100.100.100) 순서인데, CoreDNS 가 `tail07adfd.ts.net` 에 대해 NXDOMAIN 을 반환해서 glibc resolver 가 두 번째 nameserver 로 fallback 하지 않음. dnsConfig.nameservers 가 박혀 있어도 우선순위가 안 먹는 구조적 한계. #76 (otel-gateway export endpoint) 와 같은 패턴으로 Tailscale IP (observ-log-server = 100.68.2.91) 를 직접 박아 우회. README 환경변수 표와 values.yaml 주석에 이유 명시. PR #78 (logql_context_query annotation) 의 실측 검증 prerequisite. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #77.
cluster,source,category,threshold메타데이터를 추가했습니다.logql_context_queryannotation을 추가했습니다.logql_context_query를 우선 사용하도록 했습니다.cluster/namespace를 Loki 실제 라벨인k8s_cluster_name/k8s_namespace_name으로 정규화합니다.Why
Slack 스레드의 AI 분석 결과에서
loki_lines=0이 나오는 원인은 alert 라벨의cluster=pc1을 Loki selector{cluster="pc1"}로 그대로 조회하는 흐름일 가능성이 큽니다. 실제 Loki stream label은k8s_cluster_name="pc1"이므로 로그 기반 alert는 명시적인 LogQL 컨텍스트 쿼리를 넘기고, 일반 fallback도 라벨명을 정규화하도록 수정했습니다.Validation
git diff --checkruby -e 'require "yaml"; YAML.load_file("apps/log-server/values.yaml"); puts "yaml ok"'PYTHONPYCACHEPREFIX=/tmp/codex-pycache python3 -m py_compile apps/ai/ai-analyzer/app/context/loki.py