0Pricing
Serverless Backend with AWS Lambda & API Gateway · Lektion

Observability mit strukturiertem Logging und Tracing

Erkennen Sie, was Ihre Functions tatsächlich tun. Lernen Sie strukturiertes JSON-Logging, verteiltes Tracing mit AWS X-Ray und benutzerdefinierte Metriken für Observability auf Produktionsniveau.

Observability mit strukturiertem Logging und Tracing ist eine kostenlose Serverless Backend with AWS Lambda & API Gateway-Lektion auf CoddyKit. Dies ist Lektion 4 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Serverless Backend with AWS Lambda & API Gateway-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Serverless Backend with AWS Lambda & API Gateway-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

The Three Pillars of Observability

Observability rests on logs, metrics, and traces. Together they answer what happened, how much, and where the time went across your serverless system.

Why Structured Logging?

Plain text logs are hard to search. Structured (JSON) logs let CloudWatch Logs Insights filter and aggregate by field, turning logs into queryable data.

Writing a Structured Log

Emit JSON with consistent fields so you can query by request, level, and custom attributes.

console.log(JSON.stringify({
  level: "INFO",
  requestId: context.awsRequestId,
  action: "createOrder",
  orderId: 42
}));

Correlation IDs

Pass a correlation ID through every service and log it everywhere. This lets you trace a single user request across multiple functions and queues.

Querying with Logs Insights

CloudWatch Logs Insights runs SQL-like queries over structured logs.

fields @timestamp, action, orderId
| filter level = "ERROR"
| sort @timestamp desc
| limit 20

Distributed Tracing with X-Ray

AWS X-Ray records a trace as a request flows through Lambda, API Gateway, DynamoDB, and more, showing a timeline of every segment.

Enabling X-Ray

Turn on active tracing for the function, then instrument the SDK so downstream calls become subsegments.

const AWSXRay = require("aws-xray-sdk-core");
const AWS = AWSXRay.captureAWS(require("aws-sdk"));

Custom Subsegments

Wrap your own logic in a subsegment to measure how long a specific block takes inside the trace.

const seg = AWSXRay.getSegment().addNewSubsegment("validate");
validate(input);
seg.close();

Custom Metrics with EMF

The Embedded Metric Format lets you emit metrics inside a structured log line. CloudWatch extracts them automatically — no extra API call.

Setting Alarms

Create CloudWatch alarms on error rate, p99 latency, and DLQ depth. Alarms turn passive metrics into proactive alerts before users notice.

Avoiding Log Noise

Log with intent:

  • Use levels (DEBUG/INFO/ERROR) and a log-level env var
  • Never log secrets or full PII
  • Sample high-volume traces to control cost

Quick Check

Test your observability knowledge.

Recap

You learned production observability:

  • Logs, metrics, and traces are the three pillars
  • Use structured JSON logs and correlation IDs
  • X-Ray gives distributed traces across services
  • Emit custom metrics with EMF and alarm on them

Häufig gestellte Fragen

Ist die Lektion „Observability mit strukturiertem Logging und Tracing“ kostenlos?

Ja — der vollständige Text von „Observability mit strukturiertem Logging und Tracing“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Serverless Backend with AWS Lambda & API Gateway-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Serverless Backend with AWS Lambda & API Gateway-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Observability mit strukturiertem Logging und Tracing“?

Erkennen Sie, was Ihre Functions tatsächlich tun. Lernen Sie strukturiertes JSON-Logging, verteiltes Tracing mit AWS X-Ray und benutzerdefinierte Metriken für Observability auf Produktionsniveau. Du übst Serverless Backend with AWS Lambda & API Gateway mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um Serverless Backend with AWS Lambda & API Gateway zu starten?

Keine Vorkenntnisse erforderlich. Serverless Backend with AWS Lambda & API Gateway auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 4 von 4.

Wie lange dauert die Lektion „Observability mit strukturiertem Logging und Tracing“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser Serverless Backend with AWS Lambda & API Gateway-Lektion Code schreiben und ausführen?

Ja. Jede Serverless Backend with AWS Lambda & API Gateway-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Cold Starts und Warm-up-Strategien
  2. Techniken zur Kostenoptimierung
  3. Fehlerbehandlung und Retries
  4. Observability mit strukturiertem Logging und Tracing
← Zurück zu Serverless Backend with AWS Lambda & API Gateway