Skip to content

Nextended.Aspire.Hosting.Grafana — API-Referenz

🇬🇧 This page in English

Die vollständige öffentliche Oberfläche von Nextended.Aspire.Hosting.Grafana, erzeugt aus der gebauten Assembly.

Generiert

Diese Seite wird von tools/ApiRef aus der kompilierten Assembly erzeugt — sie zeigt auch Member ohne XML-Kommentar und kann daher nicht vom Code abweichen. Nicht von Hand bearbeiten.

Zurück zur Paketseite

Nextended.Aspire.Hosting.Grafana

CAdvisorResource

class

cAdvisor — per-container CPU/Memory/Network metrics (local-only, needs the Docker socket).

Konstruktoren

  • CAdvisorResource(string name)
    cAdvisor — per-container CPU/Memory/Network metrics (local-only, needs the Docker socket).

Felder

  • 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.

Konstruktoren

  • GrafanaDatasource()

Eigenschaften

  • Access : string { get; set; }
    Access mode. proxy (server-side, default) or direct.
  • 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 under jsonData:. Values may be scalars, nested Dictionary2` (string → object) or lists.
  • Name : string { get; set; }
    Display name in Grafana. Required.
  • SecureJsonData : Dictionary<string, object> { get; }
    Secret settings, serialized under secureJsonData:. 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 of Name.
  • Url : string { get; set; }
    Target URL, e.g. http://prometheus:9090 or my-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.

Konstruktoren

  • GrafanaResource(string name)
    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.

Felder

  • DefaultTargetPort : int
    Default internal container port Grafana listens on.
  • HttpEndpointName : string
    Name of the primary HTTP endpoint.

LokiResource

class

Loki log aggregation backend.

Konstruktoren

  • LokiResource(string name)
    Loki log aggregation backend.

Felder

  • DefaultTargetPort : int
  • HttpEndpointName : string

OtelCollectorResource

class

OpenTelemetry Collector — central OTLP receiver that fans out to the stack's backends.

Konstruktoren

  • OtelCollectorResource(string name)
    OpenTelemetry Collector — central OTLP receiver that fans out to the stack's backends.

Felder

  • OtlpGrpcEndpointName : string
  • OtlpGrpcTargetPort : int
  • OtlpHttpEndpointName : string
  • OtlpHttpTargetPort : int

PostgresExporterResource

class

postgres_exporter sidecar — Postgres internals as Prometheus metrics.

Konstruktoren

  • PostgresExporterResource(string name)
    postgres_exporter sidecar — Postgres internals as Prometheus metrics.

Felder

  • DefaultTargetPort : int

PrometheusResource

class

Prometheus metrics database (scraper + TSDB + remote-write receiver).

Konstruktoren

  • PrometheusResource(string name)
    Prometheus metrics database (scraper + TSDB + remote-write receiver).

Felder

  • DefaultTargetPort : int
  • HttpEndpointName : string

PrometheusScrapeJob

class

A Prometheus scrape job pointing at one static target.

Konstruktoren

  • PrometheusScrapeJob(string JobName, string Target, string MetricsPath = null)
    A Prometheus scrape job pointing at one static target.

Eigenschaften

  • 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; }
    Prometheus job_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).

Konstruktoren

  • 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).

Konstruktoren

  • TempoResource(string name)
    Tempo distributed-tracing backend (OTLP receiver + trace store).

Felder

  • DefaultTargetPort : int
  • HttpEndpointName : string
  • OtlpGrpcEndpointName : 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.

Konstruktoren

  • ObservabilityStackOptions()

Eigenschaften

  • AspireDashboardOtlpEndpoint : string { get; set; }
    Aspire-dashboard OTLP endpoint that the OTel-Collector mirrors traces to. Default points at host.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). When null, defaults to {ConfigRootPath}/grafana/dashboards. Set explicitly if dashboards live outside the config tree.
  • GrafanaAdminPassword : string { get; set; }
    Admin password used when GrafanaAnonymousAdmin is 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 supply GrafanaAdminUser/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. When null, 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.

Konstruktoren

  • PostgresExporterOptions()

Eigenschaften

  • 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.

Eigenschaften

  • ProjectPath : string { get; }
    The path to the Aspire Host project.

Zurück zur Paketseite