sampling-fingers-crossed

command
v0.54.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

HTTP server example: sampling + fingers-crossed logging

This example demonstrates how to enable gosoline's context-based sampling and fingers-crossed logging in an HTTP service.

Run

go run .

Server listens on http://127.0.0.1:8088.

Endpoints

  • GET /success: returns HTTP 200
  • GET /fail: returns HTTP 500 (useful to see fingers-crossed flushing)

Try it

1) Normal request
curl -i http://127.0.0.1:8088/success
2) Force sampling via request header
curl -i -H 'X-Goso-Sampled: true' http://127.0.0.1:8088/success
curl -i -H 'X-Goso-Sampled: false' http://127.0.0.1:8088/success
3) Trigger a failure (flushes buffered logs)
curl -i -H 'X-Goso-Sampled: false' http://127.0.0.1:8088/fail

On a non-sampled request, gosoline buffers most log lines and flushes them on errors and failed requests.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL