API reference#
This page describes the public API exported from @bluedynamics/cdk8s-monitoring.
The package is TypeScript-only and ships no generated API document; this curated reference is authoritative.
Orchestrator#
MonitoringChartThe top-level
Chartthat synthesizes the whole stack. Construct it with a resolvedMonitoringConfig. Signature:new MonitoringChart(scope, id, config, props?). It instantiates every stack construct below in sync-wave order; see Sync waves.
Configuration helpers#
mergeConfig(input)Resolves a full
MonitoringConfigby deep-merging the caller’s overrides overDEFAULT_CONFIG. Accepts aMonitoringConfigInputand returns aMonitoringConfig. Throws when an enabled opt-in block lacks a value it needs:tempo.bucket,traefik.namespace,longhorn.namespace,embedding.frameAncestors, orstagingAlerts.namespaces.DEFAULT_CONFIGThe package-shipped
DefaultableConfig. See Configuration options for every value.
Configuration interfaces#
MonitoringConfigThe fully resolved configuration consumed by
MonitoringChart.MonitoringConfigInputThe input to
mergeConfig:RequiredClusterConfigplus aDeepPartialofDefaultableConfig.RequiredClusterConfigThe fields with no default:
namespace,clusterName,domains,s3,smtp,integrations.clusterNamesets theclusterexternal label on metrics and logs.IntegrationsConfigThe names of external Crossplane and External Secrets Operator resources the stack references but does not create. Fields:
s3ProviderConfig,s3SecretStore,s3CredentialsKey,grafanaSecretStore,grafanaCredentialsKey. All are required strings; see Configuration options for each one.DefaultableConfigThe fields with defaults:
versions,retention,storage,replicas,resources,tempo,traefik,longhorn,embedding,stagingAlerts,alertRouting,externalUrls, andpriorityClasses.TempoConfigThe opt-in distributed tracing block. Fields:
enabled(defaultfalse),bucket(required when enabled),retention, andtailSampling. See Configuration options for each one.TempoTailSamplingConfigThe tail-sampling policy for the Alloy traces gateway. Fields:
latencyThresholdMsandprobabilisticPercent. Error traces are always kept in addition to these.TraefikConfigThe opt-in Traefik monitor. Fields:
enabled,namespace, anddashboard.LonghornConfigThe opt-in Longhorn monitor. Fields:
enabled,namespace, andalerts.EmbeddingConfigThe opt-in Grafana iframe embedding. Fields:
enabledandframeAncestors.StagingAlertsConfigThe opt-in demoted routing for staging namespaces. Fields:
enabledandnamespaces.AlertRoutingConfigThe Alertmanager notification pacing. Field:
repeatInterval.ExternalUrlsConfigThe browser-facing URLs used in notification links. Fields:
alertmanagerandprometheus.PriorityClassesConfigThe scheduling priority of the stack’s pods by role. Fields:
create,capture, andquery.SmtpPasswordSecretThe reference to the Secret that holds the SMTP password. Fields:
nameandkey.DeepPartial<T>A recursive partial type used to type selective overrides.
The sub-interfaces VersionConfig, RetentionConfig, StorageConfig, ReplicaConfig, ResourceConfig, S3Config, SmtpConfig, DomainConfig, ResourceRequirements, and ResourceAllocation are documented field by field in Configuration options, as are the fields of every interface above.
Stack constructs#
MonitoringChart creates each of these, and the package exports them individually so an integration chart can compose them directly when needed.
NamespaceConstructCreates the monitoring namespace. Wave 0.
PriorityClassConstructCreates the
high-priorityPriorityClasswith value10000. Wave 0.MonitoringChartcreates it only whenpriorityClasses.createis true.ThanosS3BucketConstructCreates the Crossplane
Bucketfor Thanos metrics. Wave 1.LokiS3BucketConstructCreates the Crossplane
Bucketfor Loki logs. Wave 1.ThanosS3CredentialsConstructCreates the
ExternalSecretthat renders the Thanosobjstore.yml. Wave 1.LokiS3CredentialsConstructCreates the
ExternalSecretthat renders the Loki S3 credentials. Wave 1.GrafanaPasswordSecretCreates the
ExternalSecretfor the stable Grafana admin password. Wave 1.PrometheusStackConstructCreates the kube-prometheus-stack
HelmChart(Prometheus, Grafana, Alertmanager). Wave 2.LokiConstructCreates the Loki
HelmChartin SimpleScalable mode. Wave 2.AlloyConstructCreates the Alloy
HelmChartDaemonSet for log collection. Wave 3.ThanosQueryConstructCreates the Thanos Query
DeploymentandServices. Wave 3.ThanosStoreConstructCreates the Thanos Store Gateway
StatefulSetandServices. Wave 3.ThanosCompactorConstructCreates the Thanos Compactor
StatefulSetandService. Wave 3.
The following four constructs are created only when config.tempo.enabled is true.
TempoS3BucketConstructCreates the Crossplane
Bucketfor trace storage. Wave 1.TempoS3CredentialsConstructCreates the
ExternalSecretthat renders the Tempo S3 credentials astempo-s3-credentials. Wave 1.TempoConstructCreates the monolithic Grafana Tempo
HelmChartbacked by S3. Wave 3.AlloyTracesConstructCreates the single-replica Alloy
HelmChartdeployment that acts as the OTLP tail-sampling gateway. Wave 3.
When tracing is enabled, PrometheusStackConstruct also adds a Tempo datasource to Grafana, wired for traces-to-logs and traces-to-metrics correlation.
The following two constructs are created only when their configuration block is enabled.
TraefikMonitorConstructCreates the
traefik-metricsPodMonitorand, unlesstraefik.dashboardis false, thetraefik-dashboardConfigMap. Props:monitoringNamespaceandtraefik.MonitoringChartcreates it whentraefik.enabledis true.LonghornMonitorConstructCreates the
longhorn-metricsServiceMonitorand, unlesslonghorn.alertsis false, thelonghorn-volume-healthPrometheusRule. Props:monitoringNamespaceandlonghorn.MonitoringChartcreates it whenlonghorn.enabledis true.
Re-exported helper#
KubeConfigMapRe-exported from the generated Kubernetes imports. Integration charts use it to build Grafana dashboard
ConfigMaps without depending on the generated imports directly. See Add application dashboards and alerts.
See also#
Configuration options — every configuration field and default.
Sync waves — the order in which the constructs are applied.