SiamCafe.net Blog
Technology

SigNoz Observability Service Mesh Setup

signoz observability service mesh setup
SigNoz Observability Service Mesh Setup | SiamCafe Blog
2025-09-01· อ. บอม — SiamCafe.net· 9,899 คำ

SigNoz Service Mesh

SigNoz Observability Service Mesh Istio OpenTelemetry ClickHouse Metrics Traces Logs Dashboard Alert Kubernetes

ComponentRoleDataStorage
SigNoz OTel Collectorรับ Telemetry DataTraces Metrics LogsClickHouse
SigNoz Query ServiceQuery ข้อมูลAPI สำหรับ DashboardClickHouse
SigNoz FrontendDashboard UIVisualization-
Istio Control PlaneManage MeshConfig Policyetcd
Envoy SidecarProxy TrafficMetrics Traces Logs→ OTel Collector
ClickHouseStorage BackendAll TelemetryColumnar DB

Installation & Setup

# === SigNoz + Istio Setup on Kubernetes ===

# Step 1: Install SigNoz via Helm
# helm repo add signoz https://charts.signoz.io
# helm repo update
# helm install signoz signoz/signoz \
#   --namespace signoz \
#   --create-namespace \
#   --set otelCollector.config.receivers.zipkin.endpoint=0.0.0.0:9411

# Step 2: Install Istio
# istioctl install --set profile=demo -y
# kubectl label namespace default istio-injection=enabled

# Step 3: Configure Istio to send traces to SigNoz
# kubectl apply -f - <

Dashboard & Monitoring

# === SigNoz Dashboard Configuration ===

@dataclass
class DashboardPanel:
    panel: str
    query_type: str
    metric: str
    group_by: str
    alert_threshold: str

panels = [
    DashboardPanel("Request Rate (RPS)",
        "ClickHouse Query",
        "rate(istio_requests_total) by service",
        "service_name, response_code",
        "RPS drop > 50% → Alert"),
    DashboardPanel("Error Rate (%)",
        "ClickHouse Query",
        "rate(istio_requests_total{response_code=~'5.*'}) / rate(istio_requests_total) * 100",
        "service_name",
        "Error Rate > 1% → Alert"),
    DashboardPanel("Latency P99 (ms)",
        "ClickHouse Query",
        "histogram_quantile(0.99, istio_request_duration_milliseconds_bucket)",
        "service_name",
        "P99 > 500ms → Alert"),
    DashboardPanel("Service Map",
        "Trace-based",
        "Auto-generated จาก Trace Data",
        "service_name, operation",
        "New Edge = New Dependency → Review"),
    DashboardPanel("Top Slow Traces",
        "Trace Explorer",
        "duration > 1000ms ORDER BY duration DESC",
        "service_name, operation, status",
        "Slow Trace > 2s → Investigate"),
    DashboardPanel("Log Errors",
        "Log Explorer",
        "level = 'error' OR level = 'fatal'",
        "service_name, message",
        "Error Log Spike > 10x → Alert"),
]

print("=== Dashboard Panels ===")
for p in panels:
    print(f"\n  [{p.panel}]")
    print(f"    Query: {p.query_type}")
    print(f"    Metric: {p.metric}")
    print(f"    Group: {p.group_by}")
    print(f"    Alert: {p.alert_threshold}")

Alerting

# === Alert Rules ===

@dataclass
class AlertRule:
    name: str
    condition: str
    severity: str
    channel: str
    action: str

alerts = [
    AlertRule("High Error Rate",
        "Error Rate > 1% สำหรับ 5 นาทีต่อเนื่อง",
        "Critical",
        "Slack #alerts + PagerDuty",
        "Investigate → Rollback ถ้าจำเป็น"),
    AlertRule("High Latency",
        "P99 Latency > 500ms สำหรับ 5 นาที",
        "Warning",
        "Slack #alerts",
        "Check Resource Usage → Scale Up"),
    AlertRule("Service Down",
        "RPS = 0 สำหรับ 2 นาที",
        "Critical",
        "Slack + PagerDuty + Email",
        "Check Pod Status → Restart → Escalate"),
    AlertRule("mTLS Failure",
        "istio_requests_total{security_policy='unknown'}",
        "High",
        "Slack #security",
        "Check Istio mTLS Config → Fix Certificate"),
    AlertRule("Circuit Breaker Open",
        "envoy_cluster_circuit_breakers_open > 0",
        "Warning",
        "Slack #alerts",
        "Check Upstream Service → Increase Limits"),
]

print("=== Alert Rules ===")
for a in alerts:
    print(f"  [{a.name}] {a.condition}")
    print(f"    Severity: {a.severity}")
    print(f"    Channel: {a.channel}")
    print(f"    Action: {a.action}")

เคล็ดลับ

  • Sampling: Production ตั้ง Sampling 1-10% ไม่ใช่ 100% ลด Cost
  • ClickHouse: ตั้ง TTL Retention 7-30 วัน ป้องกัน Disk เต็ม
  • Service Map: ใช้ Service Map หา Dependency ที่ไม่คาดคิด
  • Alert: ตั้ง Alert ทุก Service Error Rate Latency RPS
  • Namespace: แยก Namespace ตาม Environment dev staging prod

การนำความรู้ไปประยุกต์ใช้งานจริง

แหล่งเรียนรู้ที่แนะนำ ได้แก่ Official Documentation ที่อัพเดทล่าสุดเสมอ Online Course จาก Coursera Udemy edX ช่อง YouTube คุณภาพทั้งไทยและอังกฤษ และ Community อย่าง Discord Reddit Stack Overflow ที่ช่วยแลกเปลี่ยนประสบการณ์กับนักพัฒนาทั่วโลก

เปรียบเทียบข้อดีและข้อเสีย

ข้อดีข้อเสีย
ประสิทธิภาพสูง ทำงานได้เร็วและแม่นยำ ลดเวลาทำงานซ้ำซ้อนต้องใช้เวลาเรียนรู้เบื้องต้นพอสมควร มี Learning Curve สูง
มี Community ขนาดใหญ่ มีคนช่วยเหลือและแหล่งเรียนรู้มากมายบางฟีเจอร์อาจยังไม่เสถียร หรือมีการเปลี่ยนแปลงบ่อยในเวอร์ชันใหม่
รองรับ Integration กับเครื่องมือและบริการอื่นได้หลากหลายต้นทุนอาจสูงสำหรับ Enterprise License หรือ Cloud Service
เป็น Open Source หรือมีเวอร์ชันฟรีให้เริ่มต้นใช้งานต้องการ Hardware หรือ Infrastructure ที่เพียงพอ

จากตารางเปรียบเทียบจะเห็นว่าข้อดีมีมากกว่าข้อเสียอย่างชัดเจน โดยเฉพาะในแง่ของประสิทธิภาพและความสามารถในการ Scale สำหรับข้อเสียส่วนใหญ่สามารถแก้ไขได้ด้วยการเรียนรู้อย่างเป็นระบบและวางแผนทรัพยากรให้เหมาะสม

SigNoz คืออะไร

Open Source Observability Metrics Traces Logs OpenTelemetry ClickHouse Dashboard Alert Kubernetes Helm ทดแทน Datadog New Relic GitHub 15K+ Stars

Service Mesh คืออะไร

Infrastructure Layer Istio Linkerd Envoy Sidecar Traffic Management mTLS Security Observability Metrics Traces Logs Microservices

ตั้งค่าอย่างไร

Helm install SigNoz istioctl install Istio Injection zipkin address OTel Collector accessLog JSON Prometheus Scrape Service Map Trace

ดู Dashboard อะไรได้บ้าง

Service Map RPS Error Rate Latency P99 Trace Waterfall Flame Graph Log Explorer Custom Dashboard ClickHouse Query Alert Rule

สรุป

SigNoz Observability Service Mesh Istio OpenTelemetry ClickHouse Metrics Traces Logs Dashboard Alert Service Map Kubernetes Helm

📖 บทความที่เกี่ยวข้อง

SigNoz Observability Troubleshooting แก้ปัญหาอ่านบทความ → Htmx Alpine.js Service Mesh Setupอ่านบทความ → Linkerd Service Mesh Production Setup Guideอ่านบทความ → SigNoz Observability 12 Factor Appอ่านบทความ → OPA Gatekeeper Service Mesh Setupอ่านบทความ →

📚 ดูบทความทั้งหมด →