Skip to content

Commit

Permalink
[workers-observability] add sidebar ordering. many areas marked todo
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohin Lohe committed Sep 23, 2024
1 parent 6d87899 commit 3e0ff6b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/content/docs/workers/observability/logs/index.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
pcx_content_type: navigation
title: Log Management
title: Logs
sidebar:
order: 2
group:
hideIndex: false
---

import { DirectoryListing } from "~/components";

Use different methods of logging throughout the entire software development lifecycle of your Worker project.
TODO

<DirectoryListing />
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ title: Real-time logs
head: []
description: Debug your Worker application by accessing logs and exceptions
through the Cloudflare dashboard or `wrangler tail`.
sidebar:
order: 3
---

import { TabItem, Tabs, Steps } from "~/components";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ head: []
description: Track and log Workers on invocation by assigning a Tail Worker to
your projects.
sidebar:
order: 4
badge:
text: Beta

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ title: Workers Logpush
head: []
description: Send Workers Trace Event Logs to a supported third party, such as a
storage or logging provider.
sidebar:
order: 5

---

Expand All @@ -19,7 +21,9 @@ Workers Trace Events Logpush is not available for zones on the [Cloudflare China

## Verify your Logpush access

Workers Logpush requires a Wrangler version of `2.2.0` or higher. Check your version by running `wrangler version`. To update Wrangler, refer to [Install/Update Wrangler](/workers/wrangler/install-and-update/).
:::note[Wrangler version]
Minimum required Wrangler version: 2.2.0. Check your version by running `wrangler version`. To update Wrangler, refer to [Install/Update Wrangler](/workers/wrangler/install-and-update/).
:::

To configure a Logpush job, verify that your Cloudflare account role can use Logpush. To check your role:

Expand All @@ -40,6 +44,7 @@ To create a Logpush job in the Cloudflare dashboard:
3. Select **Add Logpush job**.
4. Select **Workers trace events** as the data set > **Next**.
5. If needed, customize your data fields. Otherwise, select **Next**.

6. Follow the instructions on the dashboard to verify ownership of your data's destination and complete job creation.

### Via cURL
Expand Down
16 changes: 11 additions & 5 deletions src/content/docs/workers/observability/logs/workers-logs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ title: Workers Logs
head: []
description: Store, filter, and analyze log data emitted from Cloudflare Workers.
sidebar:
order: 2
badge:
variant: tip
text: New
Expand All @@ -14,7 +15,6 @@ import { TabItem, Tabs, Steps } from "~/components"

Workers Logs is a fully managed service that allows you to collect, store, filter, and analyze logging data emitted from Cloudflare Workers. Logs include [execution logs](/workers/observability/logs/workers-logs/#execution-logs), [custom logs](/workers/observability/logs/workers-logs/#add-custom-logs), errors, and uncaught exceptions. All newly created Workers will come with the observability setting enabled by default. Workers Logs is available to all developers.


![Example showing the Workers Logs Dashboard](~/assets/images/workers-observability/preview.png)

If you want to send logs to a third party, use [Workers Logpush](/workers/observability/logging/logpush/) or [Tail Workers](/workers/observability/logging/tail-workers/).
Expand Down Expand Up @@ -58,6 +58,12 @@ To view Workers logs associated with any deployed Worker using the Cloudflare da
3. In **Overview**, select your **Worker** > and select **Logs**.
</Steps>

## Best Practices

### Logging JSON objects

To get the most out of Workers Logs, it is recommended to log in JSON format. Workers Logs automatically extracts the fields and indexes TODO

## Features

### Add custom logs
Expand Down Expand Up @@ -116,9 +122,9 @@ Head-based sampling allows you to log only a subset of incoming requests to your

To enable head-based sampling, simply set `head_sampling_rate` within the observability configuration. For example, setting a sampling rate of 0.01 (1%) will log one out of every one hundred requests. If the `head_sampling_rate` is unspecified, it is configured to a default value of 1 (100%).

### Summary Logs
### Execution Logs

Each Workers invocation returns an execution log that contain details about the Request, Response, and related metadata.
Each Workers invocation returns an execution log that contain details about the Request, Response, and related metadata. TODO

## Limits

Expand All @@ -144,7 +150,7 @@ Each Workers invocation returns an execution log that contain details about the

#### Example 1

A Worker serves 15 million requests per month. Each request emits 1 summary log and 1 `console.log`. `head_sampling_rate` is configured to 1.
A Worker serves 15 million requests per month. Each request emits 1 execution log and 1 `console.log`. `head_sampling_rate` is configured to 1.

| | Monthly Costs | Formula |
| ---------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------- |
Expand All @@ -153,7 +159,7 @@ A Worker serves 15 million requests per month. Each request emits 1 summary log

#### Example 2

A Worker serves 1 billion requests per month. Each request emits 1 summary log and 1 `console.log`. `head_sampling_rate` is configured to 0.1.
A Worker serves 1 billion requests per month. Each request emits 1 execution log and 1 `console.log`. `head_sampling_rate` is configured to 0.1.

| | Monthly Costs | Formula |
| ---------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------- |
Expand Down

0 comments on commit 3e0ff6b

Please sign in to comment.