Files
hatchet/CONTRIBUTING.md
abelanger5 4d03592aec chore: telemetry improvements (#101)
* fix: simple example

* chore: telemetry improvements

- Adds opentelemetry integration for the engine
- Adds standard logger with json and more readable output formats

* remove env from nodemon config files
2024-01-11 13:09:06 -05:00

2.3 KiB

Development Setup

Note: this guide assumes you're using MacOS. We simply don't have the bandwidth to test local development on native Windows. Most distros of Linux should work and we would like to support them, so please file an issue if running into an issue with a common distro.

Prerequisites

  • go 1.21+
  • docker-compose
  • Taskfile
  • The following additional devtools:
    • protoc: brew install protobuf@25
    • caddy and nss: brew install caddy nss

Setup

  1. Spin up Postgres and RabbitMQ: docker-compose up -d

  2. Run pnpm install inside of ./frontend/app.

  3. Generate certificates needed for communicating between the Hatchet client and engine: task generate-certs

  4. Create environment variables:

alias randstring='f() { openssl rand -base64 69 | tr -d "\n" | tr -d "=+/" | cut -c1-$1 };f'

cat > .env <<EOF
DATABASE_URL='postgresql://hatchet:hatchet@127.0.0.1:5431/hatchet'
SERVER_TLS_CERT_FILE=./hack/dev/certs/cluster.pem
SERVER_TLS_KEY_FILE=./hack/dev/certs/cluster.key
SERVER_TLS_ROOT_CA_FILE=./hack/dev/certs/ca.cert

SERVER_PORT=8080
SERVER_URL=https://app.dev.hatchet-tools.com

SERVER_AUTH_COOKIE_SECRETS="$(randstring 16) $(randstring 16)"
SERVER_AUTH_COOKIE_DOMAIN=app.dev.hatchet-tools.com
SERVER_AUTH_COOKIE_INSECURE=false
SERVER_AUTH_SET_EMAIL_VERIFIED=true
EOF
  1. Migrate the database: task prisma-migrate

  2. Generate all files: task generate

  3. Seed the database: task seed-dev

  4. Start the Hatchet engine, API server, dashboard, and Prisma studio:

task start-dev
  1. To create and test workflows, run the examples in the ./examples directory. You will need to add the tenant (output from the task seed-dev command) to the .env file in each example directory.

Logging

You can set the following logging formats to configure your logging:

# info, debug, error, etc
SERVER_LOGGER_LEVEL=debug

# json or console
SERVER_LOGGER_FORMAT=json

DATABASE_LOGGER_LEVEL=debug
DATABASE_LOGGER_FORMAT=console

OpenTelemetry

You can set the following to enable distributed tracing:

SERVER_OTEL_SERVICE_NAME=engine
SERVER_OTEL_COLLECTOR_URL=<collector-url>

# optional
OTEL_EXPORTER_OTLP_HEADERS=<optional-headers>

# optional
OTEL_EXPORTER_OTLP_ENDPOINT=<collector-url>