MCPcopy Index your code
hub / github.com/darron/sifter

github.com/darron/sifter @v0.7

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.7 ↗ · + Follow
35 symbols 102 edges 8 files 0 documented · 0% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

sifter

Consul watches act in a bit of a interesting way - when you reload the program - they all fire.

It's a fairly well known limitation that doesn't have a fix at the moment.

If it's a really lightweight process then it's not a big deal - but if it's not so lightweight - then it can be a bit of a problem.

If you take a look at what the watch passes on STDIN during a Consul reload - you will see that if it's not actually firing it just passes:

[]\n

So - sifter is a small Go binary that helps protect against event watches firing repeatedly:

{
  "watches": [
    {
      "type": "event",
      "name": "chef-client",
      "handler": "sifter run -e 'chef-client'"
    }
  ]
}

When this gets loaded into Consul - instead of launching copies and copies of chef-client processes - which is not awesome I promise - it will just say:

location='blank' elapsed='226.912µs' exec='chef-client'

When you actually send the event - the logs will show this - and the event will fire:

decoded event='chef-client' ltime='1137'
key='sifter/chef-client/i-c972d41e' value='1137'
location='complete' elapsed='47.448987142s' exec='chef-client'

Afterwards - if it sees the same event:

location='duplicate' elapsed='8.269276ms' exec='chef-client'

Development

brew install forego if you want to start up Redis and Consul to test.

Have added some watches in the config/ folder as well as example Consul output - input to sifter in the test/ folder.

Core symbols most depended-on inside this repo

Log
called by 12
commands/logging.go
RunTime
called by 6
commands/logging.go
getEventName
called by 3
commands/event.go
getLTime
called by 3
commands/event.go
makeTags
called by 3
commands/dogstatsd.go
runCommand
called by 2
commands/sifter.go
getHostname
called by 2
commands/sifter.go
readStdin
called by 2
commands/sifter.go

Shape

Function 23
Method 10
Struct 2

Languages

Go100%

Modules by API surface

commands/event.go11 symbols
commands/key.go9 symbols
commands/dogstatsd.go4 symbols
commands/consul.go4 symbols
commands/sifter.go3 symbols
commands/logging.go2 symbols
main.go1 symbols
commands/root.go1 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add sifter \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact