This is Notion's fork of honeycombio/refinery. It exists to carry a small patch set that upstream does not have: individual span (partial trace) sampling.
Spans that arrive with the meta.refinery.individual_span attribute receive an
immediate, independent sampling decision from the configured sampler — as though
they were a trace consisting of a single span. The decision is not recorded in any
cache, and the span is never forwarded to peers, so the rest of the trace continues
to be sampled normally. Notion's app servers tail-sample spans and mark the kept
ones with this attribute (see NotionTailSamplerSpanProcessor and the
transform/refinery_individual_span OTel collector processor in notion-next).
Originally implemented by Ben Hughes on a v2.9.5-era fork
(schleyfox/refinery#1, preserved
here as the v2-main-fork branch) and ported onto v3.2.2.
An additional v2-era experiment, batch uniform sampling for individual spans
(schleyfox/refinery#2), is preserved
on v2-buffer-spans-for-accuracy but has not been ported to v3 or deployed.
notion-main(default): upstream release + Notion patches. This is what we build and deploy.main: pristine upstreamhoneycombio/refinerymain, for syncing.v2-main-fork,v2-buffer-spans-for-accuracy: Ben Hughes's original v2-era branches, kept for provenance.
git remote add upstream https://github.com/honeycombio/refinery.git
git fetch upstream --tags
git push origin upstream/main:main # keep our mirror of upstream current
git checkout -b notion-main-vX.Y.Z vX.Y.Z # start from the new release tag
git cherry-pick <patch commits from notion-main>
go test ./types/ ./collect/... ./route/Then fast-forward/reset notion-main to the new branch once tests pass and the
image has been verified (see "Building" below). The patch touches
types/payload.go, route/route.go, collect/collect.go,
collect/collector_worker.go, collect/mockCollector.go, and tests; expect to
re-resolve it by hand if upstream reworks the collector again.
The deployable image is built from this repo and pushed to the refinery-base ECR
repo, then consumed by docker/refinery/Dockerfile in notion-next:
./build-docker.sh(orko builddirectly) to build the image.- Tag and push as
274567149370.dkr.ecr.us-west-2.amazonaws.com/refinery-base:<short commit sha>. - Update the
FROMtag in notion-nextdocker/refinery/Dockerfile.
The pubsub package's Redis tests require a local Redis on :6379; all other tests
run standalone.
This fork also owns the @notionhq/refinery-config-types package, generated
from the canonical configuration metadata. When upgrading metadata, run
npm ci && npm run generate && npm test and include the updated declarations.
See config-types/README.md for consumption, provenance,
and validation limitations. Carry the package and its CI check forward when
rebasing the Notion patch set onto a new upstream release.