惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Schneier on Security
F
Fortinet All Blogs
B
Blog
GbyAI
GbyAI
P
Proofpoint News Feed
量子位
The Register - Security
The Register - Security
宝玉的分享
宝玉的分享
大猫的无限游戏
大猫的无限游戏
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
B
Blog RSS Feed
WordPress大学
WordPress大学
Recorded Future
Recorded Future
Recent Announcements
Recent Announcements
V
Vulnerabilities – Threatpost
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Secure Thoughts
雷峰网
雷峰网
Stack Overflow Blog
Stack Overflow Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Webroot Blog
Webroot Blog
AWS News Blog
AWS News Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
The GitHub Blog
The GitHub Blog
爱范儿
爱范儿
O
OpenAI News
月光博客
月光博客
H
Hacker News: Front Page
S
Security Affairs
W
WeLiveSecurity
The Hacker News
The Hacker News
aimingoo的专栏
aimingoo的专栏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Help Net Security
Help Net Security
MongoDB | Blog
MongoDB | Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
Docker
T
The Blog of Author Tim Ferriss
Spread Privacy
Spread Privacy
Blog — PlanetScale
Blog — PlanetScale
J
Java Code Geeks
S
Securelist
Microsoft Azure Blog
Microsoft Azure Blog
TaoSecurity Blog
TaoSecurity Blog
T
Threat Research - Cisco Blogs
M
MIT News - Artificial intelligence
A
About on SuperTechFans

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Observability: Metrics or Logs, Which is Truly Enough?
Mustafa ERBAY · 2026-06-03 · via DEV Community

We have two fundamental tools we use to understand the health of our systems and solve problems: metrics and logs. Questioning which one is more important or which one is sufficient on its own has been a long-standing debate. Based on my field experience, I've seen that these two actually complement each other and can make a critical difference when not used correctly. In this post, we will delve into the power, limitations, and optimal use cases of metrics and logs.

As I start thinking about this topic, the first thing that comes to mind is a "sneaky" performance problem we experienced last year. Feedback from our users indicated that some operations were taking longer than expected. However, the metrics on our main dashboard—CPU usage, memory usage, network traffic—all appeared normal. It was at this point that I realized relying solely on metrics was insufficient. We had to dive deep into the logs to get to the root of the problem.

Metrics: A Broad Perspective and Quick Diagnosis

Metrics are a great way to monitor the overall health and performance of our systems. Being numerical data, they are very valuable for tracking trends, detecting anomalies, and identifying performance bottlenecks. Values like CPU usage, memory usage, disk I/O, and network packet loss are like the "vital signs" of our system. Collecting and visualizing this data provides a broad perspective.

For example, while working on a production ERP system, we would monitor the number of requests per server and response times. If the number of requests suddenly spiked and response times increased, it indicated a serious problem. Such metrics allowed us to quickly detect the existence of a problem. We would collect these metrics with tools like Prometheus and visualize them with Grafana. By setting up an alerting system, we would be instantly notified when certain thresholds were crossed. This was critical for proactive intervention.

ℹ️ The Power of Metrics

Metrics are indispensable for seeing the general trends and the big picture in a system. They allow us to quickly say "something is going wrong." They are particularly effective in identifying performance bottlenecks and resource exhaustion.

However, metrics don't tell us why the problem is occurring. They only indicate that something is not right. Seeing CPU usage at 90% on a web server indicates a problem, but it doesn't tell us if the source of this problem is a heavy query, a memory leak, or simply increased traffic. This is where logs come into play.

Logs: A Detailed Excavation to the Root Cause of Problems

Logs are textual records that describe what our systems did, when they did it, and why they did it. They contain the details behind an event, error messages, transaction steps, and their outputs. While metrics answer the question "what happened," logs seek to answer the question "why did it happen." Logs are invaluable, especially in debugging and incident analysis processes.

In an enterprise software project, we received a ticket about the application crashing when a user clicked a specific button. There were no anomalies in the metrics. However, when we examined the detailed logs from the user, we found a timeout error in the database connection. This error was triggered by a specific user profile and a particular data set. The SQL query execution timeout exceeded message in the logs clearly revealed the source of the problem.

💡 Detailed Analysis of Logs

Logs contain all the details of an event. They provide information about error messages, exceptions, transaction flows, and the interactions between system components. These details are vital for finding the root cause of complex problems.

To use logs effectively, a good logging strategy needs to be established. What information will be logged, how log levels (DEBUG, INFO, WARN, ERROR, FATAL) will be used, and how logs will be centralized (e.g., with ELK Stack or Loki) are important. In my own systems, I always make sure to keep detailed error logs, especially for critical services. For instance, in case of an error in a background worker, I create a log entry that includes the ID of the relevant job, its parameters, and the error details.

The Dance Between Metrics and Logs: The Power of Correlation

The real power emerges when we can establish a correlation between metrics and logs. When you see an unexpected increase or decrease in a metric, you can immediately understand what's happening by looking at the logs from that specific time frame. Or, when an error is logged, you can assess the impact of the problem by examining how the metrics behaved during the same time frame. This forms the basis of "Observability."

A few years ago, I started experiencing performance issues in the backend of a financial calculator application I developed. Metrics indicated that CPU usage was maxing out at certain hours. However, I couldn't clearly see how many requests were coming in or which queries were running. By combining Prometheus metrics, FastAPI logs, and data from tools like PostgreSQL's pg_stat_statements, I found the source of the problem.

The issue was in a function that performed complex calculations for a specific financial instrument. This function contained numerous nested loops and database queries. With increased traffic, this function was causing excessive CPU usage. Logs showed which queries were running slowly, and metrics showed when CPU was being strained. By combining these two data sets, I diagnosed the problem with over 90% certainty and optimized the relevant function.

⚠️ Failure to Correlate Can Be Dangerous

Failing to establish a connection between metrics and logs can significantly slow down the troubleshooting process. You might have to spend hours sifting through log files to understand the cause of an anomaly in a metric. Or conversely, when you see an error log, you may not be able to understand how this error is affecting the overall performance of the system.

One of the most effective ways to achieve this correlation is to add tags to your logs that can be associated with metrics. For example, you can add a unique request ID (trace ID), user ID, or transaction ID to each log entry. This way, you can easily group all logs related to a specific request and the metrics associated with that request.

In Which Situation is Which More Effective?

Both tools have their unique strengths. Understanding when each is more effective increases our efficiency.

When are Metrics More Effective?

  • General Performance Monitoring: Metrics are the best choice for continuously monitoring the overall health and performance of your system.
  • Trend Analysis: Used for seeing trends over time, capacity planning, and predicting future problems.
  • Anomaly Detection: Ideal for quickly detecting unexpected sudden changes (e.g., traffic spikes, increased request latency).
  • Alerting: Used for receiving notifications when specific thresholds are exceeded.

When are Logs More Effective?

  • Debugging: Logs are indispensable for understanding why an error occurred and how it happened.
  • Incident Analysis: Used for understanding exactly when an incident started, what steps it involved, and how it was resolved.
  • Auditing: Used for recording who did what and when, and for security audits.
  • Monitoring Business Workflows: Used for tracking each step of complex business workflows and identifying bottlenecks.

For example, I had developed a spam blocker on the Android side of a mobile application. Users reported that the application was occasionally slow. The metrics (CPU, memory) were within normal limits. However, when I examined the application's logs, I saw unnecessary and repetitive network requests made by a background service. These requests, though brief, were consuming system resources and negatively impacting the user experience. The logs showed exactly which service and which function the problem originated from.

Trade-offs and Costs: Things Not to Be Ignored

Both metric collection and logging add overhead to our systems. It's important to manage this overhead and optimize costs.

Costs of Metric Collection:

  • Data Storage: Storing long-term metric data can require significant disk space.
  • Network Traffic: Moving metrics from where they are collected to where they are analyzed creates additional network traffic.
  • Processing Load: Collecting and processing metrics (e.g., aggregations) uses CPU and memory.

Costs of Logging:

  • Data Storage: Logs are typically larger in volume than metrics, and long-term storage costs are high.
  • Network Traffic: Sending logs to centralized logging systems can create significant network traffic.
  • Processing Load: Processing, parsing, and indexing logs requires CPU and memory.
  • Development Cost: Designing and implementing a good logging strategy requires additional development time.

On my own VPS, I set up both metric and log collection infrastructure for custom financial calculators. Initially, I logged everything in excessive detail and collected as many metrics as possible. However, after a few months, I found that the storage costs and the load on the system were higher than expected. Especially journald logging too much detail quickly consumed disk space.

🔥 The Risk of Excessive Logging and Metric Collection

While it's tempting to log everything or collect every piece of metric data, this increases costs and makes it harder to find the information you're looking for. The saying "getting lost in the log forest" perfectly describes this situation. You need to determine what you need to use your resources effectively.

After this experience, I adjusted the logging levels. I started keeping only critical ERROR and FATAL level logs for a long time, while keeping INFO and DEBUG level logs for shorter periods. Similarly, I optimized storage costs by keeping only detailed data from the last week for the metrics I collected, and storing longer-term data at a lower resolution. This allowed me to analyze detailed data from the last week in Grafana while still providing enough information for monthly trends.

Observability: Not Just Metrics and Logs, but Traces Too!

While metrics and logs are the fundamental building blocks, modern Observability approaches typically include a third component: Distributed Tracing. Tracing allows you to end-to-end track the journey of a request across different services in your system. A request starts at the API gateway, travels through microservices, and reaches the database. Tracing records each step of this journey and shows how much time each service spent.

Especially in microservice architectures, completing a request may require the interaction of multiple services. In such cases, looking only at the metrics or logs of a single service may not be enough. Tracing clearly reveals which service or services are causing the problem and where the latency is occurring.

In one project, we were working on a microservice architecture that processed user orders. The order processing time sometimes increased unexpectedly. Metrics showed that the overall system load was normal. Logs revealed no serious errors in individual services. However, by using a tracing tool like Jaeger to track the request's journey, we found a significant delay in communication between the order service and the inventory service. The problem stemmed from a slow database query in the inventory service. Tracing allowed us to find this issue.

ℹ️ The Role of Tracing

Distributed Tracing is a critical tool for troubleshooting and performance optimization, especially in complex, distributed systems. It makes it easier to identify bottlenecks and errors by visualizing the entire journey of a request through the system.

Implementing tracing usually requires some code changes. Trace context needs to be propagated during inter-service communication (e.g., in HTTP requests), and the relevant tracing library needs to be used in each service. Although this is an additional development overhead, the visibility it provides, especially in microservice environments, is invaluable.

Conclusion: Not a Single Tool, but a Whole

In conclusion, the answer to the question "metrics or logs?" is simple: both. And often, tracing should be added too. These tools should be seen not as competitors, but as complements to each other.

  • Metrics provide a quick overview of your system's overall health and allow you to detect anomalies.
  • Logs help you deeply understand the causes of these anomalies and speed up the debugging process.
  • Tracing, especially in distributed systems, reveals bottlenecks and inter-service issues by tracking the entire lifecycle of a request.

In my own experiences, I've seen that systems that can effectively combine these three components can detect and resolve problems much faster. This makes a big difference not only in operational efficiency but also in user satisfaction and system reliability. Therefore, when building your Observability strategy, consider how these tools complement each other, rather than focusing on just one.

On this journey, I always see that there are new things to learn. I constantly strive to improve how I can better use these tools and make our systems more visible.