tutorial

How to Monitor OpenFunction Serverless Applications with Vigilmon

OpenFunction is a cloud-native, open-source FaaS (Function as a Service) platform built on Kubernetes, Knative, and KEDA. It lets you run functions triggered...

OpenFunction is a cloud-native, open-source FaaS (Function as a Service) platform built on Kubernetes, Knative, and KEDA. It lets you run functions triggered by HTTP requests, events, or cron schedules — without managing pod lifecycles yourself. But because OpenFunction abstracts away the underlying infrastructure, it introduces failure modes that kubectl and internal probes simply cannot detect.

In this tutorial you'll set up external uptime monitoring for your OpenFunction workloads using Vigilmon — free tier, no credit card required.


Why OpenFunction needs external monitoring

OpenFunction handles scale-to-zero automatically. When no traffic arrives, pods are terminated. When a request comes in, a cold start spins up a new pod. This lifecycle is efficient but brittle in specific ways:

  • Cold start timeouts — a function that takes 8 seconds to cold-start will fail clients with aggressive timeouts, even though OpenFunction considers it healthy
  • Knative revision rollout failures — a new function revision fails to start, but traffic routing still points to the broken revision
  • KEDA scaler misconfiguration — an event-driven function's scaler stops working; the function silently stops processing messages
  • Ingress routing breaks — the OpenFunction gateway or Knative ingress updates and drops routes for specific function paths
  • Domain mapping failures — a custom domain stops resolving to your function endpoint after a cluster DNS update

In every case, OpenFunction may report the function as Running while users receive errors or timeouts. External monitoring from outside the cluster is the only reliable way to detect these failures.


What you'll need

  • A Kubernetes cluster with OpenFunction installed (v0.7+ recommended)
  • At least one deployed function accessible via HTTP
  • A free Vigilmon account (sign up takes 30 seconds)

Step 1: Deploy an OpenFunction function with a health endpoint

Start with a simple HTTP function that exposes a /health route. OpenFunction uses the Function CRD to declare your workload.

// function.go
package main

import (
    "encoding/json"
    "net/http"
    "time"

    ofctx "github.com/OpenFunction/functions-framework-go/context"
)

func Hello(ctx ofctx.Context, in []byte) (ofctx.Out, error) {
    if string(in) == "" {
        return ctx.ReturnOnSuccess(), nil
    }
    return ctx.ReturnOnSuccess(), nil
}

func Health(w http.ResponseWriter, r *http.Request) {
    w.Header().Set("Content-Type", "application/json")
    json.NewEncoder(w).Encode(map[string]interface{}{
        "status": "ok",
        "time":   time.Now().UTC(),
    })
}

Declare the function in a Function manifest:

# openfunction.yaml
apiVersion: core.openfunction.io/v1beta2
kind: Function
metadata:
  name: my-http-function
  namespace: production
spec:
  version: "v2.0.0"
  image: "your-registry/my-http-function:latest"
  imageCredentials:
    name: push-secret
  build:
    builder: openfunction/builder-go:latest
    env:
      FUNC_NAME: "Hello"
      FUNC_CLEAR_SOURCE: "true"
    srcRepo:
      url: "https://github.com/your-org/my-function.git"
      sourceSubPath: "functions/hello"
  serving:
    scaleOptions:
      minReplicas: 0
      maxReplicas: 10
    runtime: knative
    knative:
      timeout:
        responseStartTimeout: "60s"
    template:
      containers:
        - name: function
          imagePullPolicy: Always
          resources:
            requests:
              cpu: 100m
              memory: 128Mi
            limits:
              cpu: 500m
              memory: 256Mi

Apply and verify:

kubectl apply -f openfunction.yaml

# Watch the function build and deploy
kubectl get functions -n production -w

# Get the external URL once serving is ready
kubectl get functions my-http-function -n production \
  -o jsonpath='{.status.serving.addresses[0].url}'
# https://my-http-function.production.svc.cluster.local

For external monitoring, you need an externally accessible URL. If you're using Knative with an Ingress, retrieve it:

kubectl get ksvc -n production
# NAME                URL                                              LATESTCREATED   LATESTREADY
# my-http-function    https://my-http-function.example.com             v2              v2

Step 2: Set up HTTP monitoring in Vigilmon

With the function URL in hand, add it to Vigilmon:

  1. Log in to vigilmon.online and go to Monitors → New Monitor
  2. Choose HTTP / HTTPS as the monitor type
  3. Set the URL to your function endpoint: https://my-http-function.example.com/health
  4. Set the check interval to 1 minute
  5. Under Expected response, configure:
    • Status code: 200
    • (Optional) Response body contains: "status":"ok"
  6. Set the timeout to 15 seconds to account for cold starts on the free tier
  7. Save the monitor

Handling cold starts in monitoring

OpenFunction's scale-to-zero behavior means the first probe after a quiet period will hit a cold start. Configure Vigilmon's confirmation count to 2 — a single failed check won't trigger an alert, but two consecutive failures will. This prevents cold start latency from generating false positives while still catching genuine outages quickly.

Multi-region consensus

Vigilmon probes your function from multiple geographic regions simultaneously. For OpenFunction this is especially valuable: a Knative routing misconfiguration might cause failures only when traffic arrives from specific source IPs or geographic paths. Multi-region probing surfaces these asymmetric failures.


Step 3: Monitor function build pipeline health

OpenFunction builds images using Shipwright under the hood. A failing build leaves your function running on a stale image. Add a synthetic heartbeat to your CI/CD pipeline to report successful deployments:

#!/bin/bash
# deploy-and-report.sh

# Build and push the function
kubectl apply -f openfunction.yaml

# Wait for the function to reach Ready state
kubectl wait --for=condition=Ready function/my-http-function \
  -n production --timeout=300s

if [ $? -eq 0 ]; then
  # Report successful deployment to Vigilmon heartbeat monitor
  curl -fsS "https://vigilmon.online/api/v1/heartbeat/YOUR_HEARTBEAT_ID" \
    > /dev/null
  echo "Deployment successful, heartbeat sent"
else
  echo "Deployment failed — heartbeat NOT sent, alert will fire"
  exit 1
fi

Set up the heartbeat monitor in Vigilmon:

  1. Go to Monitors → New Monitor
  2. Choose Heartbeat as the monitor type
  3. Set the expected interval to match your deployment cadence (e.g., every 24 hours for nightly builds)
  4. Copy the heartbeat URL and use it in your deploy script
  5. Save the monitor

If a deployment fails or the pipeline never runs, Vigilmon fires an alert after the interval expires — catching broken builds before users notice stale behavior.


Step 4: Track KEDA-driven functions with event lag monitoring

For event-driven functions backed by KEDA (Kafka, RabbitMQ, Redis Streams, etc.), the function may technically be healthy but failing to consume events. Expose a metrics endpoint and monitor it:

// Add to your function — expose consumer lag as a health signal
func MetricsHealth(w http.ResponseWriter, r *http.Request) {
    lag := getConsumerLag() // your implementation
    status := "ok"
    httpStatus := http.StatusOK

    if lag > 10000 {
        status = "degraded"
        httpStatus = http.StatusServiceUnavailable
    }

    w.WriteHeader(httpStatus)
    w.Header().Set("Content-Type", "application/json")
    json.NewEncoder(w).Encode(map[string]interface{}{
        "status":        status,
        "consumer_lag":  lag,
    })
}

Then add a second Vigilmon monitor pointed at /metrics/health with:

  • Expected status: 200
  • Alert if status returns 503 (high lag detected)

Step 5: Configure alert channels

OpenFunction failures can be silent — the platform may report health internally while users experience errors. Configure alerts to fire immediately:

Email alerts

  1. In Vigilmon, go to Alert Channels → Add Channel → Email
  2. Enter your engineering team's on-call email
  3. Assign the channel to all your function monitors

Webhook alerts (Slack, PagerDuty)

  1. Go to Alert Channels → Add Channel → Webhook
  2. Enter your Slack incoming webhook URL or PagerDuty integration endpoint
  3. Assign to your monitors

Vigilmon sends this payload on an outage:

{
  "monitor_name": "my-http-function /health",
  "status": "down",
  "url": "https://my-http-function.example.com/health",
  "started_at": "2024-01-15T10:23:00Z",
  "duration_seconds": 180
}

Use this in a webhook handler to automatically trigger a function rollback:

# Example: webhook handler that rolls back a bad function revision
kubectl rollout undo deployment -n production \
  -l openfunction.io/function=my-http-function

Step 6: Create a public status page

Group all your OpenFunction services behind a status page so stakeholders can see health without cluster access:

  1. In Vigilmon, go to Status Pages → New Status Page
  2. Name it "Functions Platform"
  3. Add monitors for each deployed function
  4. Group by team or domain (e.g., "Auth Functions", "Payment Functions")
  5. Publish and share the URL

Monitoring reference

| Monitor | Type | What it catches | |---------|------|-----------------| | https://function.example.com/health | HTTP | Cold start failures, routing errors, app crashes | | Deploy pipeline heartbeat | Heartbeat | Failed builds, stalled CI/CD pipelines | | https://function.example.com/metrics/health | HTTP | KEDA consumer lag, event processing failures | | Knative ingress domain | HTTP | DNS failures, TLS certificate expiry |

Useful OpenFunction debugging commands when Vigilmon fires an alert:

# Check function status
kubectl get functions -n production

# View function events
kubectl describe function my-http-function -n production

# Check Knative service revision status
kubectl get ksvc -n production
kubectl get revision -n production

# View KEDA scaler state
kubectl get scaledobjects -n production

# Check if the serving pod is running
kubectl get pods -n production -l openfunction.io/function=my-http-function

# Stream function logs
kubectl logs -n production -l openfunction.io/function=my-http-function -f

What's next

  • SSL certificate monitoring — Vigilmon alerts you before your Knative domain's TLS certificate expires, critical since cert-manager auto-renewal can silently fail after Kubernetes upgrades
  • Multi-environment coverage — create separate monitors for dev, staging, and production function endpoints, grouped on a single status page
  • Async function alerting — pair Vigilmon heartbeat monitors with your event-driven functions to detect stalled consumers before backlogs grow

Get started free at vigilmon.online — no credit card, monitors start running in under a minute.

Monitor your app with Vigilmon

Free plan — 5 monitors, no credit card required. Up and running in 60 seconds.

Start free →