Skip to content

Instantly share code, notes, and snippets.

@TimSimmons
TimSimmons / test_test.go
Created March 18, 2022 20:59
Is a regex with (things|in|it) slow vs iterating a slice?
$ go test -bench=.
goos: darwin
goarch: amd64
pkg: example.com/test
cpu: VirtualApple @ 2.50GHz
BenchmarkRegexOne-8 18224203 65.00 ns/op
BenchmarkSliceOne-8 391034821 3.078 ns/op
BenchmarkRegexThree-8 12396331 96.85 ns/op
BenchmarkSliceThree-8 270857839 4.426 ns/op
BenchmarkRegexFive-8 11875524 100.4 ns/op
{
"alerts": [
{
"labels": {
"alertname": "ComputerSad",
"instance": "sadboi-01.internal.digitalocean.com",
"service": "pandoraboi",
"severity": "warning",
"team": "observability"
},
route:
receiver: catch-unrouted
group_by:
- alertname
- team
routes:
- receiver: alertlogger
continue: true
- receiver: infra-team
match:
@TimSimmons
TimSimmons / thanos-compact-log2.txt
Created March 23, 2018 02:09
`thanos compact` logs
This file has been truncated, but you can view the full file.
level=info ts=2018-03-22T19:58:06.636626791Z caller=compact.go:222 msg="starting compact node"
level=debug ts=2018-03-22T19:58:06.836834635Z caller=compact.go:177 msg="download meta" block=01C8RGN5CR3AYD3TA0MPB9VYH4
level=debug ts=2018-03-22T19:58:07.149253464Z caller=compact.go:177 msg="download meta" block=01C8RGN6XZZA35ZG1358C1Y8X9
level=debug ts=2018-03-22T19:58:07.496940832Z caller=compact.go:177 msg="download meta" block=01C8RQGWMRWTCNJADBZGD7SQMP
level=debug ts=2018-03-22T19:58:07.759733424Z caller=compact.go:177 msg="download meta" block=01C8RQGY61816AKH3QWW1R8ZMV
level=debug ts=2018-03-22T19:58:08.09632796Z caller=compact.go:177 msg="download meta" block=01C8RYCKWTF05HTHVG9KKA1R5C
level=debug ts=2018-03-22T19:58:08.369711651Z caller=compact.go:177 msg="download meta" block=01C8RYCNE1EM0SJFQVRVR2WY1G
level=debug ts=2018-03-22T19:58:08.80510202Z caller=compact.go:177 msg="download meta" block=01C8S58B4S8HAGNM5SYFAJSDSP
level=debug ts=2018-03-22T19:58:09.033075106Z caller=compact.go:177 msg="download me
# HELP concourse_builds_aborted_total Total number of Concourse builds aborted.
# TYPE concourse_builds_aborted_total counter
concourse_builds_aborted_total 0
# HELP concourse_builds_duration_seconds Build time in seconds
# TYPE concourse_builds_duration_seconds histogram
concourse_builds_duration_seconds_bucket{pipeline="",team="main",le="1"} 0
concourse_builds_duration_seconds_bucket{pipeline="",team="main",le="60"} 0
concourse_builds_duration_seconds_bucket{pipeline="",team="main",le="180"} 6
concourse_builds_duration_seconds_bucket{pipeline="",team="main",le="300"} 6
concourse_builds_duration_seconds_bucket{pipeline="",team="main",le="600"} 6
$ dep init -v -gopath
Getting direct dependencies...
Checked 1 directories for packages.
Found 5 direct dependencies.
Importing configuration from godep. These are only initial constraints, and are further refined during the solve process.
Detected godep configuration files...
Loading /home/tim/code/work/go/src/github.com/concourse/concourse/src/github.com/concourse/atc/metric/emitter/Godeps/Godeps.json
Converting from Godeps.json ...
Using master as initial constraint for imported dep github.com/beorn7/perks
Trying master (4c0e845) as initial lock for imported dep github.com/beorn7/perks
@TimSimmons
TimSimmons / dump.txt
Last active June 15, 2017 14:52
Prometheus hanging during a checkpoint Goroutine dump
goroutine 184516782 [running]:
runtime/pprof.writeGoroutineStacks(0x274c720, 0xc6667650a0, 0x30, 0xc8123126c0)
/usr/local/go/src/runtime/pprof/pprof.go:603 +0x79
runtime/pprof.writeGoroutine(0x274c720, 0xc6667650a0, 0x2, 0xc6b1b0a870, 0x40fe28)
/usr/local/go/src/runtime/pprof/pprof.go:592 +0x44
runtime/pprof.(*Profile).WriteTo(0x27fa5c0, 0x274c720, 0xc6667650a0, 0x2, 0xc6667650a0, 0xc6b1b0aaa0)
/usr/local/go/src/runtime/pprof/pprof.go:302 +0x3b5
net/http/pprof.handler.ServeHTTP(0xc812312461, 0x9, 0x275b560, 0xc6667650a0, 0xc826701100)
/usr/local/go/src/net/http/pprof/pprof.go:209 +0x1d1
net/http/pprof.Index(0x275b560, 0xc6667650a0, 0xc826701100)
```
time="2016-04-11T12:33:14Z" level=warning msg="Crash recovery complete." source="crashrecovery.go:143"
time="2016-04-11T12:33:14Z" level=info msg="619076 series loaded." source="storage.go:267"
time="2016-04-11T12:33:14Z" level=info msg="Starting target manager..." source="targetmanager.go:114"
time="2016-04-11T12:33:14Z" level=info msg="Listening on :9090" source="web.go:223"
time="2016-04-11T12:43:14Z" level=info msg="Checkpointing in-memory metrics and chunks..." source="persistence.go:539"
time="2016-04-11T12:45:43Z" level=info msg="Done checkpointing in-memory metrics and chunks in 2m29.213872064s." source="persistence.go:563"
time="2016-04-11T12:49:44Z" level=info msg="Completed maintenance sweep through 83 archived fingerprints in 16m19.226913312s." source="storage.go:852"
time="2016-04-11T12:55:43Z" level=info msg="Checkpointing in-memory metrics and chunks..." source="persistence.go:539"
time="2016-04-11T12:58:23Z" level=info msg="Done checkpointing in-memory metrics and chunks in 2m39.15
@TimSimmons
TimSimmons / out
Last active February 8, 2016 18:31
$ python task.py
Starting Task Task
Starting Task PeriodicRecovery
Starting Task RecoverZone
Starting Task CreateZone
Starting Task CreateZoneOnTarget
Finished Task: CreateZoneOnTarget
created zone midcycle.com. on ns1.foo.com.
Starting Task CreateZoneOnTarget
Finished Task: CreateZoneOnTarget