goque

module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT

README

goque

Coverage

A blazing fast and dead simple http-based jq processor written in go.

Features

  • Fast HTTP service with Fiber
  • Fast JQ processing with gojq
  • Jaeger metrics
  • A playground for testing TBD
  • Small footprint
Tracing

Goque exports jaeger metrics. See tracing configuration.

Installation

Local Copy
  • git clone https://github.com/Max-Clark/goque.git
  • cd ./goque
  • go build ./cmd/goque
Go Installation

TBD

Docker
  • docker build --tag local/goque -f goque.dockerfile .
  • docker run -d --name=goque -p 8888:8080 local/goque

Usage

Goque is highly configurable, but defaults will work for most deployments.

./goque  # Start a new goque instance
curl --request POST \
  --url http://localhost:8080/api/v1/jq \
  --header 'Content-Type: application/json' \
  --header 'x-goque-jq-filter: .test' \
  --data '{"test":{"peanuts": true,"pineapple":"nope."}}'
{"peanuts":true,"pineapple":"nope."}%

Assigning a JQ filter with environment variables or command line will compile the jq code, resulting in faster processing.

# GOQUE_JQ_FILTER='."test"' ./goque
./goque -jq '."test"'  # Both work, but cli has preference
Goque Configuration

NOTE Variable preference is Env Var < Command Line < HTTP Header

Description Default Env Var CLI HTTP Header
JQ filter string nil GOQUE_JQ_FILTER -jq x-goque-jq-filter
JQ API path "/api/v1/jq" GOQUE_PATH -a
Server host "" GOQUE_HOST -h
Server port "8080" GOQUE_PORT -p
Escape HTML on return false GOQUE_HTML_ESCAPE -e
Default log level Info GOQUE_LOG_LEVEL -l
Tracer disable false GOQUE_TRACER_DISABLE -td
Tracer ratio, [0,1] 1 GOQUE_TRACER_RATIO -tr
Tracer export dest. http://localhost:14268/api/traces GOQUE_TRACER_EXPORT_DEST -te

Building

go build -v -ldflags="-X 'main.Version=v1.0.0' -X 'app/build.User=$(id -u -n)' -X 'app/build.Time=$(date)'"


Version history

v0.1.1
  • Integrated github actions and docker repo
v0.1.0
  • Initial release with working and tested code

Plan

  • Initial commit
  • Logging
    • Research logging
    • Implement basic logging
    • More robust logging
  • Tracing
  • Metrics
  • [ ] OAS It's a pretty obvious API, going to work on gojqplay instead
  • [-] Configuration Validation
    • Crucial items validated
  • JQ
    • Investigate gojq
      • Yup, it's fast
    • Implement gojq from env variable
      • Compile filter
      • Error on bad filter
    • Implement gojq from http header
      • Error on bad filterr
    • Implement benchmarking scaffolding
    • Research testing methodologies/libraries
    • Implement testing scaffolding
  • HTTP
    • Implement basic server with http
    • Investigate http libraries
    • Implement TLS
    • Investigate websocket usage
    • Investigate sidecar usage
      • Proper implementation? MITM?
    • Implement benchmarking scaffolding
    • Research testing methodologies/libraries
    • Implement testing scaffolding
  • GoquePlay Going to make gojqplay instead, probably better to separate and probably more popular
  • CI
    • Lock main branch, merge by request
    • Run tests
    • Run vuln scan
    • Build wasm module
    • Test wasm module
    • Github release
    • Build image and push

Directories

Path Synopsis
cmd
goque command

Jump to

Keyboard shortcuts

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