Skip to content

Commit a4dc8f3

Browse files
committed
Add notes on canonical log lines
1 parent 7729ed7 commit a4dc8f3

File tree

6 files changed

+55
-31
lines changed

6 files changed

+55
-31
lines changed

.github/workflows/ci.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ jobs:
6868
HUGO_ENVIRONMENT: production
6969
HUGO_ENV: production
7070
run: |
71-
make init
71+
git submodule update --init --recursive
72+
npm ci || true
7273
hugo \
7374
--gc \
7475
--minify \

.github/workflows/update-hugo.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ jobs:
6969
- name: Build site with updated Hugo
7070
if: env.hugo_update_needed == 'true'
7171
run: |
72-
npm ci || true
7372
git submodule update --init --recursive
73+
npm ci || true
7474
hugo --gc --minify
7575
continue-on-error: false
7676

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ public
33
.venv
44
.ruff_cache
55
node_modules
6+
static
67

78

89
# Byte-compiled / optimized / DLL files

Makefile

+23-29
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,35 @@
1-
define PRINT_STEP
2-
@echo "$$(tput setaf 6)$$(tput bold)\n:> $1\n$$(tput sgr0)"
3-
endef
1+
SHELL := /bin/bash -ex
2+
MAKEFLAGS += --silent
43

54
# Define packages as a space-separated list
65
BREW_PACKAGES := gh hugo pre-commit prettier [email protected] uv
76

8-
init:
9-
@git submodule update --init --recursive
10-
@npm install
117

12-
ifeq ($(CI),)
13-
@$(call PRINT_STEP,installing brew dependencies)
14-
@for pkg in $(BREW_PACKAGES); do \
15-
brew list $$pkg &>/dev/null || (echo "Installing $$pkg..." && brew install $$pkg); \
8+
init:
9+
git submodule update --init --recursive
10+
npm install
11+
npm install -g wrangler
12+
for pkg in $(BREW_PACKAGES); do \
13+
brew list $$pkg &>/dev/null || brew install $$pkg; \
1614
done
17-
18-
@$(call PRINT_STEP,creating python venv)
19-
@uv venv -p 3.12
20-
21-
@$(call PRINT_STEP,installing python dependencies)
22-
@. .venv/bin/activate
23-
@uv pip install black blacken-docs mypy pytest pytest-cov ruff
24-
25-
@$(call PRINT_STEP,initialization complete)
26-
endif
27-
15+
uv venv -p 3.12
16+
. .venv/bin/activate
17+
uv pip install black blacken-docs mypy pytest pytest-cov ruff
2818

2919
lint:
30-
@pre-commit run --all-files
31-
@prettier --write .
32-
20+
pre-commit run --all-files
21+
prettier --write .
3322

3423
update:
35-
@git submodule update --remote --merge
36-
@pre-commit autoupdate -j 4
37-
@npm update
38-
24+
git submodule update --remote --merge
25+
pre-commit autoupdate -j 4
26+
npm update
3927

4028
devserver:
41-
@hugo server --disableFastRender -e production --bind 0.0.0.0 --ignoreCache
29+
hugo server --disableFastRender -e production --bind 0.0.0.0 --ignoreCache
30+
31+
upload-static:
32+
find static -type f | while read filepath; do \
33+
key=$$(echo "$$filepath" | sed 's|^|blog/|'); \
34+
wrangler r2 object put $$key --file "$$filepath"; \
35+
done

content/feed/2024.md

+21
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,26 @@ hideMeta: true
88
ShowShareButtons: false
99
---
1010

11+
### September 09
12+
13+
#### [Canonical log lines — Stripe Engineering Blog][8]
14+
15+
I’ve been practicing this for a while but didn’t know what to call it. Canonical log lines
16+
are arbitrarily wide structured log messages that get fired off at the end of a unit of
17+
work. In a web app, you could emit a special log line tagged with different IDs and
18+
attributes at the end of every request. The benefit is that when debugging, these are the
19+
logs you’ll check first. Sifting through fewer messages and correlating them with other logs
20+
makes investigations much more effective, and the structured nature of these logs allows for
21+
easier filtering and automated analysis.
22+
23+
> _Out of all the tools and techniques we deploy to help get insight into production,
24+
> canonical log lines in particular have proven to be so useful for added operational
25+
> visibility and incident response that we’ve put them in almost every service we run—not
26+
> only are they used in our main API, but there’s one emitted every time a webhook is sent,
27+
> a credit card is tokenized by our PCI vault, or a page is loaded in the Stripe Dashboard._
28+
29+
---
30+
1131
### September 07
1232

1333
#### [Recognizing the Gell-Mann Amnesia effect in my use of LLM tools][6]
@@ -115,6 +135,7 @@ his next book, [Recursion][2].
115135

116136
---
117137

138+
[8]: https://stripe.com/blog/canonical-log-lines
118139
[7]: https://en.wikipedia.org/wiki/Michael_Crichton#GellMannAmnesiaEffect
119140
[6]: https://x.com/rednafi/status/1832414343952265432
120141
[5]: https://x.com/fchollet/status/1831029432653599226

wrangler.toml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name = "r2-uploader"
2+
account_id = "f2c208344e8adb0cf3ea1e48dccf7218"
3+
4+
[[r2_buckets]]
5+
binding = "blog"
6+
bucket_name = "blog"
7+
preview_bucket_name = "blog"

0 commit comments

Comments
 (0)