Code Explainers
Code explainers tagged #observability
php
namespace App\Providers; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\Log;
Catching N+1 queries with Eloquent strict mode in Laravel
n+1 queries
strict mode
eager loading
Intermediate
7 steps
ruby
module SlowQueryLogger SLOW_QUERY_THRESHOLD_MS = 200.0 IGNORED_PAYLOAD_NAMES = %w[SCHEMA TRANSACTION].freeze
Logging slow SQL queries in Rails
instrumentation
logging
pub-sub
Intermediate
7 steps
javascript
const express = require('express'); const router = express.Router(); const { pool } = require('../db'); const redis = require('../redis');
Building a health check endpoint in Express
health-check
timeouts
promise-race
Intermediate
9 steps
javascript
'use client'; import { useEffect } from 'react'; import * as Sentry from '@sentry/nextjs';
How a Next.js error boundary recovers
error-boundary
error-handling
observability
Intermediate
8 steps
rust
use std::time::Instant; use axum::{ body::Body,
Prometheus request metrics in Axum
middleware
observability
prometheus
Intermediate
7 steps
rust
use std::time::Duration; use axum::{ body::Body,
Structured request tracing in Axum
middleware
observability
tracing
Intermediate
7 steps
go
package middleware import ( "strconv"
Instrumenting a Gin API with Prometheus
middleware
observability
metrics
Intermediate
6 steps
typescript
import { Controller, Get } from '@nestjs/common'; import { HealthCheck, HealthCheckService,
Liveness vs readiness probes in NestJS
health-checks
dependency-injection
observability
Intermediate
6 steps
java
@Service public class OrderMetricsService { private final MeterRegistry registry;
Instrumenting orders with Micrometer in Spring
metrics
micrometer
observability
Intermediate
8 steps
go
package middleware import ( "time"
Building a request logger middleware in Gin
middleware
structured-logging
closures
Intermediate
6 steps
java
@Component public class RequestTimingInterceptor implements HandlerInterceptor { private static final Logger log = LoggerFactory.getLogger(RequestTimingInterceptor.class);
How a Spring HandlerInterceptor times requests
interceptor
request-lifecycle
logging
Intermediate
6 steps