Skip to Content
Lynq

Monitoring & Observability

Set up Prometheus metrics, Grafana dashboards, and structured logging for Lynq. Includes metrics catalog, events reference, and alerting overview.

Lynq exposes 15 Prometheus metrics at :8443/metrics, emits structured Kubernetes events per reconciliation, and ships a pre-built Grafana dashboard.

Setup

Prometheus

Enable ServiceMonitor (requires Prometheus Operator): uncomment the prometheus section in config/default/kustomization.yaml:

- ../prometheus   # uncomment this line

Then redeploy:

kubectl apply -k config/default

Manual scrape config:

# prometheus.yml
scrape_configs:
- job_name: lynq
  kubernetes_sd_configs:
  - role: pod
    namespaces:
      names: [lynq-system]
  relabel_configs:
  - source_labels: [__meta_kubernetes_pod_label_control_plane]
    action: keep
    regex: controller-manager
  - source_labels: [__meta_kubernetes_pod_container_port_name]
    action: keep
    regex: https

Test the endpoint:

kubectl port-forward -n lynq-system deployment/lynq-controller-manager 8443:8443
curl -k https://localhost:8443/metrics | grep lynqnode_

Troubleshoot no metrics data:

# Check flag is set
kubectl get deployment -n lynq-system lynq-controller-manager -o yaml | grep metrics-bind-address
# Should show: --metrics-bind-address=:8443 (not "0")

# Check service exists
kubectl get svc -n lynq-system lynq-controller-manager-metrics-service

# Check ServiceMonitor (if using prometheus-operator)
kubectl get servicemonitor -n lynq-system

Grafana Dashboard

Import config/monitoring/grafana-dashboard.json via Dashboards → Import in the Grafana UI. Select your Prometheus datasource. The dashboard ships 17 panels grouped into four categories:

  • Top-line stat panels: Total Desired / Ready / Failed Nodes, Total Conflicted Resources
  • Reconciliation health: Reconciliation Duration percentiles, Reconciliation Rate, Error Rate, LynqNode Ready Status, Degraded Nodes
  • Resource & conflict breakdowns: Resource Counts by Node and Total, Conflicted Resources by Node and Total, Conflicts Rate by Node
  • Hub & runtime internals: Hub Health, Apply Rate by Kind, Work Queue Depth

Metrics Catalog

MetricTypeLabelsDescription
lynqnode_reconcile_duration_secondsHistogramresultDuration of LynqNode reconciliation in seconds
lynqnode_resources_readyGaugelynqnode, namespaceNumber of ready resources for a LynqNode
lynqnode_resources_desiredGaugelynqnode, namespaceTotal number of desired resources for a LynqNode
lynqnode_resources_failedGaugelynqnode, namespaceNumber of failed resources for a LynqNode
hub_desiredGaugehub, namespaceNumber of desired LynqNodes from the hub data source
hub_readyGaugehub, namespaceNumber of ready LynqNodes for a hub
hub_failedGaugehub, namespaceNumber of failed LynqNodes for a hub
apply_attempts_totalCounterkind, result, conflict_policyTotal number of resource apply attempts
lynqnode_condition_statusGaugelynqnode, namespace, typeStatus of LynqNode conditions (0=False, 1=True, 2=Unknown)
lynqnode_conflicts_totalCounterlynqnode, namespace, resource_kind, conflict_policyTotal number of resource conflicts encountered during reconciliation
lynqnode_resources_conflictedGaugelynqnode, namespaceNumber of resources currently in conflict state for a LynqNode
lynqnode_degraded_statusGaugelynqnode, namespace, reasonIndicates if a LynqNode is in degraded state (1=degraded, 0=not degraded)
lynqform_rollout_updating_nodesGaugeform, namespaceNumber of nodes currently being updated for a LynqForm (updated, update not completed yet; recovering nodes excluded)
lynqform_rollout_phaseGaugeform, namespaceCurrent rollout phase for a LynqForm (0=Idle, 1=InProgress, 2=Failed, 3=Complete)
lynqform_rollout_progressGaugeform, namespaceRollout progress percentage for a LynqForm (nodes that completed the update/totalNodes * 100)

Generated from internal/metrics/metrics.go

hub_ready counts LynqNodes with Ready=True; hub_failed counts nodes that need an operator (failed or conflicted resources, or Degraded). A node that is rolling out or recovering lost pods is in neither, so hub_desired - hub_ready - hub_failed is the number still progressing. The lynqform_rollout_* metrics exist since v1.1.16.

For PromQL queries using these metrics, see Prometheus Query Examples.

Events

Kubernetes events are emitted for key lifecycle transitions.

# Events for a specific node
kubectl describe lynqnode <name>

# All LynqNode events
kubectl get events -A --field-selector involvedObject.kind=LynqNode --sort-by='.lastTimestamp'
ReasonTypeRecorded byMessage
DataUpdatedNormalLynqHub controllerLynqNode data updated from registry '…'.
LynqNodeDeletedNormalLynqNode controllerLynqNode … deleted successfully. Resources will be cleaned up by Kubernetes garbage collector.
NodeDeletedNormalLynqHub controllerSuccessfully deleted LynqNode '…' (template: …, uid: …)
NodeDeletingNormalLynqHub controllerDeleting LynqNode '…' (template: …, uid: …) - no longer in active dataset.
OrphanedResourceDeletedNormalLynqNode controllerDeleted orphaned resource …/… (ID: …) - removed from template
OrphanedResourceRetainedNormalLynqNode controllerRetained orphaned resource …/… (ID: …) - removed from template, marked with orphan labels
OrphanMarkersAddedNormalinternal/applybuilt at runtime
OrphanMarkersRemovedNormalinternal/applyResource re-adopted into management - orphan markers removed
ResourceRetainedNormalLynqNode controllerResource …/… retained with orphan labels (ownerReferences removed)
RetainResourcePreservedNormalLynqHub controllerRemoved ownerReference from resource … (policy=Retain)
RolloutRecoveredNormalLynqForm controllerRollout is no longer stalled (phase …): …
RolloutThrottledNormalLynqHub controllerLynqForm '…': … node updates throttled (maxSkew=…, currently updating=…)
TemplateAppliedNormalLynqHub controllerApplying LynqForm '…' changes (generation: … -> …).
TemplateAppliedSuccessNormalLynqNode controllerSuccessfully applied LynqForm '…' (generation: …).
TemplateResourcesApplyingNormalLynqNode controllerApplying resources from LynqForm '…' (generation: …).
ValidationPassedNormalLynqForm controllerTemplate validation passed successfully
ApplyFailedWarningLynqNode controllerFailed to apply resource …: …
CleanupFailedWarningLynqHub controllerFailed to cleanup retain resources: …
CleanupPartialFailureWarningLynqNode controllerSome resources could not be cleaned up: …. Kubernetes garbage collector will handle remaining resources with ownerReferences.
DatabaseQueryFailedWarningLynqHub controllerFailed to query database: …
DependencyFailedButProceedingWarningLynqNode controllerDependency '…' failed, but creating resource '…' anyway (skipOnDependencyFailure=false)
DependencySkippedWarningLynqNode controllerResource '…' skipped because dependency '…' failed. Set skipOnDependencyFailure=false to create anyway.
DependencyValidationFailedWarningLynqForm controllerDependency graph validation failed: …
DuplicateResourceIDsWarningLynqForm controllerFound duplicate resource IDs: …
HubNotFoundWarningLynqForm controllerReferenced LynqHub '…' not found in namespace '…'
NodeDeletionFailedWarningLynqHub controllerFailed to delete LynqNode '…': …
ProgressDeadlineExceededWarningLynqNode controllerResource '…' stopped making rollout progress (Progressing=False, reason ProgressDeadlineExceeded)
ReadinessTimeoutWarningLynqNode controllerResource '…' not ready after … (timeout: …)
ResourceConflictWarningLynqNode controllerResource conflict detected for …/… (Kind: …, Policy: …).
RetainResourceProcessFailedWarningLynqHub controllerFailed to process retain resources for node …: …
RolloutFailedWarningLynqForm controllerbuilt at runtime
TemplateAppliedPartialWarningLynqNode controllerApplied LynqForm '…' (generation: …) with partial success.
TemplateRenderErrorWarningLynqNode controllerFailed to render resource …: …
TemplateRenderFailedWarningLynqHub controllerFailed to render template for node …: …
ValidationFailedWarningLynqForm controllerTemplate validation failed: …

Every reason recorded in internal

Logging

Configure log level via the --zap-log-level flag: debug, info (default), error.

All logs are structured JSON:

{"level":"info","ts":"2025-01-15T10:30:00Z","msg":"Reconciliation completed","lynqnode":"acme-web","ready":10,"failed":0}
# Follow all logs
kubectl logs -n lynq-system deployment/lynq-controller-manager -f

# Errors only
kubectl logs -n lynq-system deployment/lynq-controller-manager | grep '"level":"error"'

# Specific node
kubectl logs -n lynq-system deployment/lynq-controller-manager | grep "acme-web"

Alerting

Alert rules are in config/prometheus/alerts.yaml. Deploy with:

kubectl apply -f config/prometheus/alerts.yaml
AlertSeverityFires whenFor
LynqNodeDegradedcriticalmax by (lynqnode, namespace, reason) (lynqnode_degraded_status) > 05m
LynqNodeResourcesFailedcriticallynqnode_resources_failed > 05m
LynqNodeNotReadycriticallynqnode_condition_status{type="Ready"} == 015m
LynqNodeStatusUnknowncriticallynqnode_condition_status{type="Ready"} == 210m
HubManyNodesFailurecriticalhub_failed > 5 or (hub_failed / hub_desired > 0.5 and hub_desired > 0)5m
LynqNodeResourcesMismatchwarning(lynqnode_resources_ready != lynqnode_resources_desired) and (lynqnode_resources_desired > 0) and (lynqnode_resources_failed == 0)15m
LynqNodeResourcesConflictedwarninglynqnode_resources_conflicted > 010m
LynqNodeHighConflictRatewarningrate(lynqnode_conflicts_total[5m]) > 0.110m
HubNodesFailurewarninghub_failed > 0 and hub_failed <= 510m
HubDesiredCountMismatchwarning(hub_ready != hub_desired) and (hub_desired > 0) and (hub_failed == 0)20m
LynqFormRolloutFailedwarninglynqform_rollout_phase == 25m
LynqNodeReconciliationErrorswarningsum(rate(lynqnode_reconcile_duration_seconds_count{result="error"}[5m])) / sum(rate(lynqnode_reconcile_duration_seconds_count[5m])) > 0.110m
LynqNodeReconciliationSlowwarninghistogram_quantile(0.95, sum by (le) (rate(lynqnode_reconcile_duration_seconds_bucket{result="success"}[5m])) ) > 3015m
HighApplyFailureRatewarningsum by (kind) (rate(apply_attempts_total{result="error"}[5m])) / sum by (kind) (rate(apply_attempts_total[5m])) > 0.210m
LynqNodeNewConflictsDetectedinfoincrease(lynqnode_conflicts_total[5m]) > 02m

Generated from config/prometheus/alerts.yaml

For per-alert diagnosis and resolution steps, see Alert Runbooks.

See Also

On this page