Lộ trình đang học Current learning path

Developer Platform Developer Platform

Build và deploy apps trên Cloudflare. Build and deploy apps on Cloudflare.

Về trang lộ trình Track home

Phần 4: Vận hành và bước tiếp Part 4: Operate and level up · Bài 1/2 Lesson 1/2

Web Analytics và log Workers Web Analytics and Worker logs

Bật Cloudflare Web Analytics cho traffic. Dùng `wrangler tail` hoặc observability khi debug API. Enable Cloudflare Web Analytics for traffic. Use `wrangler tail` or observability when debugging APIs.

Các bước thực hiện Step-by-step

  1. Analytics → Web Analytics → Add site (snippet hoặc automatic qua zone). Analytics → Web Analytics → Add site (snippet or automatic via zone).
  2. Workers/Pages: bật Observability hoặc `wrangler tail`. Workers/Pages: enable Observability or `wrangler tail`.
  3. Log structured JSON từ API routes. Log structured JSON from API routes.
  4. Alert khi error rate tăng (Logpush nếu cần). Alert on error rate spikes (Logpush if needed).

Giải thích chi tiết Detailed explanation

Edge app cần observability khác server truyền thống — tail logs và analytics là bước vận hành cơ bản. Edge apps need different observability than traditional servers — tail logs and analytics are baseline ops.

Lưu ý (best practices) Note (best practices)

Bật Workers Logs và Traces trước khi lên production — dùng structured JSON trong `console.log` để tìm kiếm/lọc trên dashboard Observability. Enable Workers Logs and Traces before production — use structured JSON in `console.log` for searchable, filterable logs in the Observability dashboard.

Nguồn: Source: Workers Best Practices Workers Best Practices

Ví dụ triển khai (Cloudflare Resources) Deployment examples (Cloudflare Resources)

Ví dụ chính thức từ Cloudflare Resources — gợi ý theo chủ đề bài học trong lộ trình này. Official examples from Cloudflare Resources — matched to this lesson within this path.

Xem thêm ví dụ trong lộ trình → More examples in this path →

Tài liệu Cloudflare Developers Cloudflare Developer docs

Sản phẩm liên quan Related products

Học xong hoặc muốn đổi hướng? Finished or want a different path?

Ba lộ trình độc lập — mỗi lộ trình chỉ gồm bài học và tài liệu trong phạm vi đó. Chọn lộ trình khác khi sẵn sàng, không cần học song song. Three independent paths — each includes only lessons and materials for that scope. Switch when you are ready; no need to study paths in parallel.

Chưa chắc — làm bài chọn lộ trình Not sure — use the path selector · So sánh cả ba lộ trình Compare all three paths