Skip to content

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

Terminal window
go get github.com/crontinel/go

3. 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:

Terminal window
export CRONTINEL_API_KEY=crn_live_xxxxxxxxxxxx
go run quickstart.go

4. Dashboard verification

  1. Go to app.crontinel.com → Apps → your app
  2. Check the Cron section — you should see the hello-from-go job with exit code 0 and 100ms duration
  3. Your first data is on the dashboard!

Install

Terminal window
go get github.com/crontinel/go

Quick 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

VariableDefaultDescription
CRONTINEL_API_KEY—Your Crontinel API key
CRONTINEL_API_URLhttps://app.crontinel.comSaaS or self-hosted endpoint