Skip to content

ottogiron/metricsworker

Repository files navigation

Metrics Workers

A set of workers processing metrics from RabbitMQ.

Available worker are:

  • distinctName
  • hourlyLog
  • accountName

Note: Workers consume and process metrics from a single queue concurrently.

Build Status GoDoc Go Report Card

Install

Download and install from the releases page

Dependencies

  • RabbitMQ
  • Redis
  • MongoDB
  • PostgreSQL

For testing purposes you can run the docker compose development file docker-compose.dev.yml

docker-compose -f docker-compose.dev.yml up -d

Example

mworker --concurrency=1 \
    --wait-timeout=600 \
    --rabbit-uri=amqp://guest:guest@localhost:5672 \
    --rabbit-queue_name=hello \
    --rabbit-consumer_auto_ack=true \
    --rabbit-exchange="test-exchange" \
    --rabbit-routing_key="test-key"

Usage

mworker [flags]

Flags :
-concurrency int
        Number of concurrent set of workers running (default 1)
  -mongo-events-db string
        mongo events database (default "events")
  -mongo-host string
        mongo host localhost (default "localhost")
  -postgres-db string
        postgres database (default "postgres")
  -postgres-host string
        postgres host (default "localhost")
  -postgres-password string
        postgres password (default "mysecret")
  -postgres-user string
        postgres user (default "postgres")
  -rabbit-binding_wait
        Binding wait
  -rabbit-consumer_auto_ack
        Consumer Auto ACK
  -rabbit-consumer_no_local
        Consumer no local
  -rabbit-consumer_no_wait
        Consumer no wait
  -rabbit-consumer_tag string
        Consumer tag
  -rabbit-exchange string
        Exchange name. If exchange name is empty all other exchange flags are ignored
  -rabbit-exchange_delete_when_complete
        Exchange delete when complete
  -rabbit-exchange_durable
        Exchange durable (default true)
  -rabbit-exchange_internal
        Exchange internal
  -rabbit-exchange_no_wait
        Exchange no wait
  -rabbit-exchange_type string
        Exchange type - direct|fanout|topic|x-custom (default "direct")
  -rabbit-queue_delete_when_used
        Queue delete queue when used
  -rabbit-queue_durable
        Queue durable
  -rabbit-queue_exclusive
        Queue exclusive
  -rabbit-queue_name string
        Rabbit queue name (default "hello-queue")
  -rabbit-queue_no_wait
        Queue no wait
  -rabbit-routing_key string
        Routing Key
  -rabbit-uri string
        Rabbit instance uri e.g. amqp://guest:guest@localhost:5672/ (default "amqp://guest:guest@localhost:5672/")
  -redis-address string
        Redis address example localhost:6779  (default "localhost:6379")
  -redis-db int
        Redis DB
  -wait-timeout int
        Time to wait in miliseconds until new jobs are available in rabbit  (default 500)