Go
import { Aside } from ‘@astrojs/starlight/components’;
Quickstart
Historical package install steps below. Prefer check-in recipes for new setups.
Get from zero to your first data in under 3 minutes.
1. Prerequisites
- Go 1.21+
- A Crontinel account (sign up free)
- An app created in the dashboard
- Your API key (
crn_live_...) from app settings
2. Install
go get github.com/crontinel/go3. Configure
Create a quickstart.go file:
package main
import ( "fmt" "os" "github.com/crontinel/go")
func main() { apiKey := os.Getenv("CRONTINEL_API_KEY") client := crontinel.NewClient(apiKey)
client.ScheduleRun("hello-from-go", 100, 0)
fmt.Println("Data sent to Crontinel!")}Set your API key and run it:
export CRONTINEL_API_KEY=crn_live_xxxxxxxxxxxxgo run quickstart.go4. Dashboard verification
- Go to app.crontinel.com → Apps → your app
- Check the Cron section — you should see the
hello-from-gojob with exit code0and100msduration - Your first data is on the dashboard!
Install
go get github.com/crontinel/goQuick Start
package main
import ( "time" "github.com/crontinel/go")
func main() { client := crontinel.NewClient("your_api_key")
client.ScheduleRun("reports:generate", 1500, 0) client.QueueProcessed("emails", 50, 2, 3200) client.Event("deployment", "Application deployed", "info", nil)}MonitorSchedule
Run a function and auto-report its outcome:
durationMs, exitCode := client.MonitorSchedule("reports:generate", func() error { return generateReports()})fmt.Printf("Completed in %dms, exit_code=%d\n", durationMs, exitCode)Asynq integration
import "github.com/hibiken/asynq"import "github.com/crontinel/go"
func HandleTask(ctx context.Context, t *asynq.Task) error { start := time.Now() err := processTask(t.Payload()) durationMs := time.Since(start).Milliseconds() if err != nil { client.QueueProcessed("default", 0, 1, durationMs) return err } client.QueueProcessed("default", 1, 0, durationMs) return nil}Options
client := crontinel.NewClient("key", crontinel.WithAPIURL("https://custom.example.com"), crontinel.WithAppName("my-worker"), crontinel.WithTimeout(30*time.Second),)Environment variables
| Variable | Default | Description |
|---|---|---|
CRONTINEL_API_KEY | — | Your Crontinel API key |
CRONTINEL_API_URL | https://app.crontinel.com | SaaS or self-hosted endpoint |