Nextended.Aspire.Hosting.Grafana — API reference
The complete public surface of Nextended.Aspire.Hosting.Grafana, generated from the compiled assembly.
Generated
This page is generated by tools/ApiRef from the compiled assembly — it includes members with no XML comment and therefore cannot drift from the code. Do not edit by hand.
Nextended.Aspire.Hosting.Grafana
CAdvisorResource
class
cAdvisor — per-container CPU/Memory/Network metrics (local-only, needs the Docker socket).
Constructors
CAdvisorResource(string name)
cAdvisor — per-container CPU/Memory/Network metrics (local-only, needs the Docker socket).
Fields
DefaultTargetPort : int
GrafanaBuilderExtensions
static class
Fluent API for a composable Grafana observability stack. Start with AddGrafana, then attach components — every component call also provisions the matching Grafana datasource, wires start ordering and groups the container under Grafana in the Aspire dashboard. Call order does not matter: cross-component configs are generated at application start.
GrafanaDatasource
class
A Grafana datasource that gets written into the generated provisioning YAML. The stack auto-creates datasources for Prometheus / Loki / Tempo / Postgres; use WithDatasource for anything else Grafana supports (MySQL, MSSQL, Elasticsearch, InfluxDB, …) — Type takes the Grafana datasource type id, JsonData/SecureJsonData map 1:1 to the provisioning schema.
Constructors
GrafanaDatasource()
Properties
Access : string { get; set; }
Access mode.proxy(server-side, default) ordirect.Editable : bool { get; set; }
Whether the datasource may be edited in the Grafana UI. Default false (provisioning owns it).IsDefault : bool { get; set; }
Marks this datasource as Grafana's default.JsonData : Dictionary<string, object> { get; }
Non-secret settings, serialized underjsonData:. Values may be scalars, nestedDictionary2` (string → object) or lists.Name : string { get; set; }
Display name in Grafana. Required.SecureJsonData : Dictionary<string, object> { get; }
Secret settings, serialized undersecureJsonData:. Prefer env-var references like${MY_VAR}over literals — the generated YAML lands on disk, Grafana expands the variable on load.Type : string { get; set; }
Grafana datasource type id, e.g.prometheus,loki,tempo,postgres,mysql. Required.Uid : string { get; set; }
Stable uid used by dashboards to reference this datasource. Defaults to a slug ofName.Url : string { get; set; }
Target URL, e.g.http://prometheus:9090ormy-db:5432. Required.User : string { get; set; }
Login user for datasources that need one (e.g. SQL databases).
GrafanaResource
class
Grafana dashboards UI. Acts as the hub of the observability stack: every component added via WithPrometheus / WithLoki / WithTempo / WithOtelCollector / … registers itself here and is auto-provisioned as a Grafana datasource. Configs are generated at application start (not at builder time), so the With* calls can come in any order.
Constructors
GrafanaResource(string name)
Grafana dashboards UI. Acts as the hub of the observability stack: every component added viaWithPrometheus/WithLoki/WithTempo/WithOtelCollector/ … registers itself here and is auto-provisioned as a Grafana datasource. Configs are generated at application start (not at builder time), so theWith*calls can come in any order.
Fields
DefaultTargetPort : int
Default internal container port Grafana listens on.HttpEndpointName : string
Name of the primary HTTP endpoint.
LokiResource
class
Loki log aggregation backend.
Constructors
LokiResource(string name)
Loki log aggregation backend.
Fields
DefaultTargetPort : intHttpEndpointName : string
OtelCollectorResource
class
OpenTelemetry Collector — central OTLP receiver that fans out to the stack's backends.
Constructors
OtelCollectorResource(string name)
OpenTelemetry Collector — central OTLP receiver that fans out to the stack's backends.
Fields
OtlpGrpcEndpointName : stringOtlpGrpcTargetPort : intOtlpHttpEndpointName : stringOtlpHttpTargetPort : int
PostgresExporterResource
class
postgres_exporter sidecar — Postgres internals as Prometheus metrics.
Constructors
PostgresExporterResource(string name)
postgres_exporter sidecar — Postgres internals as Prometheus metrics.
Fields
DefaultTargetPort : int
PrometheusResource
class
Prometheus metrics database (scraper + TSDB + remote-write receiver).
Constructors
PrometheusResource(string name)
Prometheus metrics database (scraper + TSDB + remote-write receiver).
Fields
DefaultTargetPort : intHttpEndpointName : string
PrometheusScrapeJob
class
A Prometheus scrape job pointing at one static target.
Constructors
PrometheusScrapeJob(string JobName, string Target, string MetricsPath = null)
A Prometheus scrape job pointing at one static target.
Properties
ExtraYaml : string { get; set; }
Optional raw YAML appended to the job (relabel configs etc.), indented two spaces relative to the job.JobName : string { get; set; }
Prometheusjob_name.MetricsPath : string { get; set; }
Metrics path when it differs from/metrics.Target : string { get; set; }
host:port of the metrics endpoint (Docker DNS — use the resource name as host).
PromtailResource
class
Promtail — ships Docker container logs to Loki (local-only, needs the Docker socket).
Constructors
PromtailResource(string name)
Promtail — ships Docker container logs to Loki (local-only, needs the Docker socket).
TempoResource
class
Tempo distributed-tracing backend (OTLP receiver + trace store).
Constructors
TempoResource(string name)
Tempo distributed-tracing backend (OTLP receiver + trace store).
Fields
DefaultTargetPort : intHttpEndpointName : stringOtlpGrpcEndpointName : string
Nextended.Aspire.Hosting.Observability
ObservabilityStackExtensions
static class
One-call observability stack for an Aspire application: • Grafana — dashboards UI (acts as the parent resource that all other monitoring containers nest under in the Aspire dashboard) • Prometheus — metrics scraping • postgres_exporter — Postgres internals as Prometheus metrics • Loki — log aggregation • Promtail — Docker container log shipper → Loki (local-only) • cAdvisor — per-container metrics (local-only) • Tempo — traces backend (opt-in) • OTel-Collector — OTLP receiver / fan-out (opt-in) This is a thin composition over the fluent building blocks in GrafanaBuilderExtensions — use those directly for piecemeal setups. YAML configs are GENERATED at startup from the actual resource hostnames and bind-mounted into the containers; no hardcoded hostnames in the file tree. Publish-mode (azd up): Promtail and cAdvisor are auto-skipped because they rely on the host's Docker socket, which Azure Container Apps doesn't expose. The rest of the stack deploys cleanly.
ObservabilityStackOptions
class
Options for AddObservabilityStack — the one-call, batteries-included way to get the full stack. For piecemeal composition use the fluent AddGrafana().WithPrometheus()… API from GrafanaBuilderExtensions; this options class drives exactly those building blocks.
Constructors
ObservabilityStackOptions()
Properties
AspireDashboardOtlpEndpoint : string { get; set; }
Aspire-dashboard OTLP endpoint that the OTel-Collector mirrors traces to. Default points athost.docker.internal:18889— Aspire 13's standard local-dev port. Set to""to disable the mirror exporter.CAdvisorImage : string { get; set; }CAdvisorImageTag : string { get; set; }ConfigRootPath : string { get; set; }
Working directory where the stack writes its generated YAML configs and (by default) reads dashboard JSONs from. Required. The stack creates a.generated/sub-folder here at runtime for the Prometheus / Loki / Promtail / Tempo / OTel-Collector / Grafana-Provisioning YAMLs.DashboardsPath : string { get; set; }
Folder containing the Grafana dashboard JSON files (one file = one dashboard, auto-loaded by Grafana's provisioning). Whennull, defaults to{ConfigRootPath}/grafana/dashboards. Set explicitly if dashboards live outside the config tree.GrafanaAdminPassword : string { get; set; }
Admin password used whenGrafanaAnonymousAdminis false. Should come from a secret in production scenarios.GrafanaAdminUser : string { get; set; }GrafanaAnonymousAdmin : bool { get; set; }
When true (default), Grafana is started with anonymous Admin access — no login form. Convenient for local dev. Set false for shared/deployed setups and supplyGrafanaAdminUser/GrafanaAdminPassword.GrafanaDashboardsFolder : string { get; set; }
Grafana folder name under which auto-provisioned dashboards appear in the sidebar. Default"Application". Change to e.g. your app's name to brand the experience without touching dashboard JSON files.GrafanaImage : string { get; set; }GrafanaImageTag : string { get; set; }IncludeCAdvisor : bool { get; set; }
cAdvisor — per-container CPU / Memory / Network metrics scraped from the Docker socket.IncludeGrafana : bool { get; set; }IncludeLoki : bool { get; set; }IncludeOtelCollector : bool { get; set; }IncludePrometheus : bool { get; set; }IncludePromtail : bool { get; set; }IncludeTempo : bool { get; set; }LokiImage : string { get; set; }LokiImageTag : string { get; set; }OtelCollectorImage : string { get; set; }OtelCollectorImageTag : string { get; set; }PostgresExporter : PostgresExporterOptions { get; set; }
Postgres-Exporter config. Whennull, no exporter container is added — useful if the consuming app doesn't use Postgres or already has metrics from elsewhere.PostgresExporterImage : string { get; set; }PostgresExporterImageTag : string { get; set; }PrometheusImage : string { get; set; }PrometheusImageTag : string { get; set; }PrometheusRetention : string { get; set; }
Grafana retention for Prometheus (--storage.tsdb.retention.time). Default 15 days.PromtailImage : string { get; set; }PromtailImageTag : string { get; set; }ResourceNamePrefix : string { get; set; }
Name prefix used for every Aspire resource the stack creates. Final names look like{ResourceNamePrefix}-prometheus,{ResourceNamePrefix}-grafana, etc. Defaults to"monitoring". Set to""to keep bare names.TempoImage : string { get; set; }TempoImageTag : string { get; set; }
PostgresExporterOptions
class
Connection options for the postgres_exporter sidecar.
Constructors
PostgresExporterOptions()
Properties
Database : string { get; set; }Host : string { get; set; }
Hostname or container name of the Postgres instance (Docker DNS). Required.Password : string { get; set; }
Password for the exporter's read connection. Required.Port : int { get; set; }SslMode : string { get; set; }
SSL mode. Default"disable"for local Docker setups.Username : string { get; set; }
Projects
Nextended_Aspire_Hosting_Grafana
class
Metadata for the Aspire AppHost project.
Properties
ProjectPath : string { get; }
The path to the Aspire Host project.