Conversation
Anish Ramasekar (aramase)
left a comment
There was a problem hiding this comment.
One issue I think needs to change (inline on settings.yaml): monitoring mode turns on Envoy tracing toward a collector that only has a metrics pipeline. The other inline comments are non-blocking. Since this builds on #2, changes there may need a re-check here.
| $patch: replace | ||
| {{ if .MonitoringEnabled }} | ||
| OTEL_SDK_DISABLED: "false" | ||
| OTEL_EXPORTER_OTLP_ENDPOINT: http://substrate-aks-otel.ate-system.svc.cluster.local:4317 |
There was a problem hiding this comment.
Setting OTEL_EXPORTER_OTLP_ENDPOINT in ate-otel-config also turns on Envoy tracing: atenet-router reads this ConfigMap through envFrom and defaults --otlp-collector-address to that variable (cmd/atenet/internal/router/cmd.go:108 at the pinned substrate commit; upstream notes this at manifests/ate-install/atenet-router.yaml:281), then configures HCM tracing with 1% sampling. OTEL_TRACES_EXPORTER=none only affects the Go SDK. The collector in deploy/monitoring.yaml has only a metrics pipeline, so the OTLP receiver doesn't register the trace service and every sampled span export fails. That contradicts "OTLP logs and traces stay disabled" in docs/monitoring.md:78 and deploy/README.md:23. Could monitoring mode pass --otlp-collector-address= to the router (upstream does the same for egress in atenet-egress.yaml) and extend TestPinnedUpstreamMonitoringContract to assert it?
There was a problem hiding this comment.
Fixed in 7bb03eb. Monitoring now sets only OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, so the router's --otlp-collector-address default is empty and Envoy tracing stays off without patching the router. TestPinnedUpstreamMonitoringContract now checks that no generic, traces or logs endpoint is set and that the router's args match upstream.
| dnsPrefix: clusterName | ||
| kubernetesVersion: kubernetesVersion | ||
| enableRBAC: true | ||
| azureMonitorProfile: { |
There was a problem hiding this comment.
Non-blocking: azureMonitorProfile.metrics.enabled is now sent on every install, so a disabled install PUTs enabled: false where the base sent nothing. On a cluster where managed Prometheus was enabled outside the installer, a re-provision would turn it off. Could the block be emitted only when monitoring is enabled, with a conditional spread like the one at line 320?
There was a problem hiding this comment.
Done in f1c0bbc: the profile is sent only when monitoring is enabled, so installs without monitoring leave the cluster's setting alone. A contract test evaluates the template both ways.
| } | ||
| } | ||
|
|
||
| resource grafanaAdmin 'Microsoft.Authorization/roleAssignments@2022-04-01' = { |
There was a problem hiding this comment.
Non-blocking: the grafanaAdmin role assignment sets no principalType, unlike the asset publisher assignment in resources.bicep. A newly created service principal can hit PrincipalNotFound during replication; passing the same conditional principalType avoids that.
There was a problem hiding this comment.
Done in 75286d0: the publisher's principal type is passed through and set on the Grafana admin assignment when it's known.
| return fmt.Errorf("Azure Monitor-managed resource group %q remains for workspace %q, but the tagged installation resource group %q was not found; refusing target reuse or image-reference reset. Wait for any in-progress teardown to finish, then retry. If it persists, inspect Azure for incomplete teardown or changed ownership tags before reusing this configuration", group.Name, group.ManagedBy, a.Config.Azure.ResourceGroup) | ||
| } | ||
| if group.ManagedBy != "" { | ||
| return fmt.Errorf("resource group %q is managed by %q, which does not match configured AKS cluster %q; refusing to reuse this installation ID. Restore aks.clusterName and azure.resourceGroup to this installation's original values for management or teardown; use a new configuration for a separate installation", group.Name, group.ManagedBy, clusterID) |
There was a problem hiding this comment.
Non-blocking: if a monitoring-enabled install is later edited to monitoring.enabled=false, the existing MA_ managed group falls through to "managed by ... does not match configured AKS cluster", which points the operator at the wrong fix. inspectOwnedGroup has the right message, but guardTarget runs first. Could this detect a Monitor-account managedBy and report a monitoring-mode mismatch instead?
There was a problem hiding this comment.
Done in 19c2b85: with monitoring off, the installation's own Monitor-managed group now gets a monitoring-mode mismatch message. Foreign or malformed managers are still refused as before.
| } | ||
| } | ||
|
|
||
| func transientGrafanaError(err error) bool { |
There was a problem hiding this comment.
Non-blocking, not verified live: transientGrafanaError doesn't retry a Grafana 400 or 500 from the datasource query endpoint. While the Grafana identity's Monitoring Data Reader assignment is still propagating, the query may surface as a 400 that wraps the upstream 403, and verifyMetrics would fail right away instead of waiting. Consider retrying query-level errors within the existing 10-minute budget.
There was a problem hiding this comment.
Leaving this as is for now. I'd like to see how the propagation error actually surfaces on a fresh install before widening the retries, and I'll follow up then.
5c057b5 to
9b4a7ea
Compare
Provision opt-in managed monitoring with scoped Grafana access and a metrics-only OTLP collector. Wire upstream telemetry and managed scrape targets, verify ingestion through Grafana, and provide grouped Substrate, AKS, storage and PostgreSQL dashboards. Cover configuration, lifecycle, pinned upstream contracts and the actual collector pipeline, and document costs and operational limits. Signed-off-by: Ridwan Hoq <943533+ridhoq@users.noreply.github.com>
The router uses OTEL_EXPORTER_OTLP_ENDPOINT as the default for Envoy's trace collector, so setting it for metrics also turned on Envoy tracing toward a collector that has only a metrics pipeline. Set OTEL_EXPORTER_OTLP_METRICS_ENDPOINT instead, with the same URL and protocol. Control-plane components export metrics directly and workers through atelet's relay. Monitored source checkouts move to a new cache generation, so a checkout prepared with the generic endpoint is fetched and adapted again. Signed-off-by: Ridwan Hoq <943533+ridhoq@users.noreply.github.com>
…abled The cluster template sent azureMonitorProfile.metrics.enabled on every deployment, so a deployment with monitoring disabled explicitly asked for enabled: false where earlier versions sent nothing. On a cluster whose managed Prometheus was turned on outside the installer, that request could turn it off. Send the profile, with metrics enabled, only when monitoringEnabled is true and omit it otherwise. The installer still refuses to switch monitoring mode on an existing installation. The docs describe the direct template behavior without promising how Azure treats an omitted profile, which has not been verified. A new contract test evaluates resources.bicep locally with az bicep snapshot for both values. Signed-off-by: Ridwan Hoq <943533+ridhoq@users.noreply.github.com>
…min role The Grafana Admin role assignment in monitoring.bicep set no principalType, unlike the asset publisher's storage assignment, so Azure had to resolve the principal itself. A newly created service principal can fail that lookup with PrincipalNotFound while it replicates. Add an optional grafanaAdminPrincipalType parameter to the monitoring module, with the same allowed values as the root templates and an empty default that keeps the property out, and forward assetPublisherPrincipalType to it from resources.bicep. Signed-off-by: Ridwan Hoq <943533+ridhoq@users.noreply.github.com>
… managed group If an installation provisioned with monitoring is later run with monitoring.enabled=false, the Azure Monitor workspace's managed resource group still carries the installation tag. The target guard runs before the recorded-mode check and reported that the group's manager did not match the configured AKS cluster, pointing at the cluster and resource group settings instead of the monitoring setting. When monitoring is disabled and a group is managed by a Monitor account that is valid for the configured subscription and resource group, refuse with a monitoring-mode mismatch and ask for the original monitoring settings. The refusal itself is unchanged, and managers that are foreign or malformed still get the existing message. Signed-off-by: Ridwan Hoq <943533+ridhoq@users.noreply.github.com>
The monitoring template contracts evaluate the templates with az bicep snapshot, which needs Bicep CLI 0.41.2 or later. List it with the contract prerequisites, with a version check and the upgrade command, and make the tests say so when the command is missing instead of reporting only an exit status. Signed-off-by: Ridwan Hoq <943533+ridhoq@users.noreply.github.com>
encoding/json ignores omitempty on struct fields, so every installation record carried a monitoring section, including records with monitoring off. Builds without managed monitoring reject unknown fields, so they could no longer read those records. Use omitzero, as the database section does, so only monitored installations need this build. Signed-off-by: Ridwan Hoq <943533+ridhoq@users.noreply.github.com>
9b4a7ea to
d8a901a
Compare
Anish Ramasekar (aramase)
left a comment
There was a problem hiding this comment.
Two blocking error-path issues inline (install reported failed after it finished; status drops pods/PVCs without the PodMonitor API). Optional nits:
- deploy/monitoring.yaml:94-95: the pinned upstream
ate-system-observabilitypolicy allows any source on any port namedmetrics, so the ama-metrics-only rule doesn't restrict anything. Not a defect since upstream opens these on purpose, but renaming the port (e.g.otel-metrics) would make the "scoped ingress" claim in the PR body true; otherwise drop that claim. - internal/installer/monitoring.go:161-167: the data-source update matches only by uid, so a hand-made source with the same name fails with a 409 that isn't retried. Match by name too, or document the names as reserved.
- docs/monitoring.md:89-92: when Grafana Admin goes to a group, say to sign in as a group member.
- monitoring_dashboards.go:168-180: the HorizonDB branch is unreachable (database.go:59 accepts only Flexible Server); could go along with its synthetic test row.
- source.go:55-61: the "Earlier builds also used -v3" history could come out of the comment.
| dashboardURL, err := a.MonitoringDashboardURL(ctx) | ||
| if err != nil { | ||
| return err | ||
| } |
There was a problem hiding this comment.
Install has already recorded deployed (cluster.go:425) when this calls MonitoringDashboardURL, which reads Azure again (ownedGroup plus the subscription deployment listing). A transient Azure error or a cancel here makes a finished install return an error, and guided setup (setup.go:537-560) then stops before the receipt or offers to rerun the whole install. Could the URL come from the infrastructure details Install already validated, so nothing after deployed can fail?
There was a problem hiding this comment.
Fixed in 1c21b4d. Install now returns the dashboard URL built from the infrastructure it validated before deploying, and the CLI prints that, so nothing runs after the deployed record; MonitoringDashboardURL is gone. TestInstallReturnsDashboardWithoutReadingAzureAfterDeployment scripts a full monitored install that ends at the deployed record, so any later Azure read fails it.
| } | ||
| } | ||
| a.progress("Fetching Substrate pods and persistent volumes") | ||
| _, err = a.runKubectl(ctx, nil, true, "get", "pods,pvc", "--namespace=ate-system", "--output=wide") |
There was a problem hiding this comment.
When the podmonitors listing fails, this returns before the pod/PVC listing. That happens when install timed out waiting for the PodMonitor CRD (monitoring.go:63-70) after recording installing:, which is exactly when someone runs status, and also if the metrics add-on is disabled later. Could pods and PVCs always be listed, with the monitoring error reported separately?
There was a problem hiding this comment.
Fixed in 12aed65. status now always lists pods and PVCs. A failed deployments,podmonitors listing is kept as a separate "listing monitoring workloads" error and returned together with the pod/PVC result. TestStatusListsPodsWhenPodMonitorsAreUnavailable covers the missing PodMonitor API.
Anish Ramasekar (aramase)
left a comment
There was a problem hiding this comment.
Marking the two error-path issues from my earlier review as blocking; the other items there stay optional.
| dashboardURL, err := a.MonitoringDashboardURL(ctx) | ||
| if err != nil { | ||
| return err | ||
| } |
There was a problem hiding this comment.
Blocking: the dashboard URL lookup runs after deployed is recorded, so a transient Azure error or cancel here reports a finished install as failed (details in my earlier comment on this line).
| } | ||
| } | ||
| a.progress("Fetching Substrate pods and persistent volumes") | ||
| _, err = a.runKubectl(ctx, nil, true, "get", "pods,pvc", "--namespace=ate-system", "--output=wide") |
There was a problem hiding this comment.
Blocking: status returns before listing pods and PVCs when the PodMonitor API is missing (details in my earlier comment on this line).
…zure read install recorded the deployed phase and then read the infrastructure again to print the dashboard URL, so a transient Azure error or a cancel made a finished installation fail and stopped guided setup before its receipt. Install now returns the URL from the infrastructure it validated before deploying. Signed-off-by: Ridwan Hoq <943533+ridhoq@users.noreply.github.com>
status returned before listing pods and PVCs when the PodMonitor API was missing, which happens after install times out waiting for that API or when the metrics add-on is disabled later. status now always lists pods and PVCs and reports the monitoring listing failure alongside. Signed-off-by: Ridwan Hoq <943533+ridhoq@users.noreply.github.com>
Upstream's ate-system observability policy admits any source on ports named metrics, so the collector's ama-metrics-only ingress rule did not restrict its application metrics port. The contract test now checks that no collector scrape port is one upstream opens. Signed-off-by: Ridwan Hoq <943533+ridhoq@users.noreply.github.com>
Managed PostgreSQL is always a Flexible Server, so the HorizonDB panels and their synthetic test rows could not be reached. Signed-off-by: Ridwan Hoq <943533+ridhoq@users.noreply.github.com>
Document that the installer's data-source names are reserved because it matches its data sources by UID, say to sign in as a group member when the Grafana admin is a group, and drop cache-generation history from a source comment. Signed-off-by: Ridwan Hoq <943533+ridhoq@users.noreply.github.com>
|
Thanks, all the nits are taken. 71166af renames the collector port to |
Stack
Stacks on #2. The base is
postgres-install, notmain; this PR contains the monitoring commit and its review fixes. Merge #2 first, then rebase/retarget this PR ontomain.Summary
For a new installation:
Monitoring adds ongoing charges. Endpoints are publicly reachable and authenticated, the collector is a single in-memory replica, and teardown deletes the monitoring workspace and its data. This does not make the experimental installer production-ready.
Must fix
No blocking correctness issues found in the monitoring-only diff after reviewing configuration, infrastructure, lifecycle, upstream contracts, dashboard queries, tests, and docs. Rebased onto #2's current head (
b154c62). As #2 does fordatabase, records omit themonitoringsection when monitoring is off. #2 no longer includes HorizonDB, so the rebase drops the HorizonDB text fromdocs/monitoring.mdand adapts the monitoring tests to #2's installer API. The dashboard code's HorizonDB branch is unchanged and is now unreachable.Consider
cmd/substrate-aks/setup_test.go:89-100: the receipt fixture supplies a simulated Grafana URL.TestSetupMonitoringReceiptchecks line/workspace receipt behavior, but would not catch removal of the realrunCommandresult assignment. Direct coverage of that handoff would strengthen the regression; the wiring was reviewed by inspection.Unverified
Existing monitored installations
Installs made with an earlier build of this branch pick up the tracing fix in two steps: rerun
bin/substrate-aks install NAME, which updatesate-otel-config, then runkubectl -n ate-system rollout restart deployment/atenet-router. Don't restart other components: the nextate-controllerrestart rolls each worker pool once through eviction, so let that happen in a quiet window. Records those builds wrote with monitoring off still carry amonitoringsection, which builds without this PR reject.Checks run
All passed on
d8a901a:make build verify test-unit test-contract bicep-- binary build, formatting, vet, module hygiene, the full race-enabled unit and TUI suite, infrastructure compilation, and the race-enabled integration selection intest-contract: pinned upstream, monitoring, managed PostgreSQL, image-check/publisher/Podman contracts; deployment-history query; managed network/vault scopes and database SKU; and the actual PostgreSQL bootstrap script in Docker.make test-monitoring-- actual pinned OpenTelemetry collector pipeline in Docker.make test-contractnow evaluates the Bicep templates locally withaz bicep snapshot, which needs Bicep CLI 0.41.2 or later (see CONTRIBUTING); no Azure sign-in is needed.