chapter5-monitoring #2

Merged
carmen merged 13 commits from chapter5-monitoring into main 2026-11-04 16:38:38 +00:00
4 changed files with 92 additions and 15 deletions
Showing only changes of commit 7670134c2a - Show all commits

View File

@ -31,13 +31,13 @@ what has been verified.
\endhead
\bottomrule
\endlastfoot
1 & Deployment and reproducibility (15) & \StatusPending & Restart persistence and backup recorded (Nov.~2). Second team member's verification.\\
1 & Deployment and reproducibility (15) & \StatusPass & Baseline commit, second-member verification (CC), restart persistence, and backup recorded.\\
2 & Metrics and probes (15) & \StatusPass & Host comparison and target health recorded (Nov.~1); Jenkins probe exception approved (Nov.~4).\\
3 & HTTPS and access control (10) & \StatusPass & Grafana HTTPS, Caddy route, and outside tests recorded; public Grafana \texttt{/metrics} closed (Nov.~4).\\
4 & Dashboard and CI correlation (15) & \StatusPending & Dashboard screenshot recorded (Nov.~1). Normal-build before/during/after comparison.\\
4 & Dashboard and CI correlation (15) & \StatusPass & Dashboard recorded (Nov.~1); build comparison for PR-4 build 15 (Nov.~4).\\
5 & SLI, SLO, and error budget (10) & \StatusPass & Definitions, worked example, and measured incident window (Nov.~2).\\
6 & Alerts and runbooks (15) & \StatusPass & Both rules fired, emailed, and resolved; receipt confirmed; runbook links live (Nov.~2).\\
7 & Incident and recovery (10) & \StatusPending & Exercise, timeline, and review recorded (Nov.~2). Owned issues 5 and 6 opened. Passing pipeline check.\\
7 & Incident and recovery (10) & \StatusPass & Exercise, timeline, review, owned issues 5 and 6, and post-incident pipeline and commit status (Nov.~2--4).\\
8 & Manual integration and traceability (10) & \StatusPending & Reviewed final commit and successful automated PDF build links.\\
\end{tabularx}
@ -47,9 +47,20 @@ what has been verified.
\subsection{Baseline and Change Plan}
Issue~3 tracks the change; implementation is on
\texttt{feature/issue-3-monitoring}, and MB is the implementation owner.
\StatusPending{} The second team member who verifies the deployment, the
starting commit, and the passing Jenkins and manual builds recorded before
the change still need to be named and linked here.
\StatusPass{} The change starts from pricing-app \texttt{main} at commit
\texttt{db64ac1} (``Add Jenkins deployment configuration and operator
notes'', October 23, 2026), the base of \texttt{feature/issue-3-monitoring}.
The last passing Jenkins run before the change is PR-2 build 2 on October 23
(\autoref{Figure:CIRepairRun}). The manual's automated PDF build is recorded
in \autoref{sec:mon-manual}.
CC, a second team member who did not deploy the stack, verified the
deployment from November 1 to 4: scrape targets and host metrics
(\autoref{sec:mon-metrics}), HTTPS and outside exposure
(\autoref{sec:mon-access}), both alert rules end to end
(\autoref{sec:mon-alerts}), the controlled incident and recovery
(\autoref{sec:mon-incident}), restart persistence, and the backup procedure
below.
The host runs Ubuntu 24.04.4 with two virtual CPUs, 2~GB RAM, and a 60~GB
root disk. Before deployment, at 22:33~UTC on October 30, about 612~MB RAM and
@ -478,12 +489,49 @@ available.}
\label{Figure:MonitoringDashboard}
\end{figure}
\StatusPending{} Capture host metrics before, during, and after one normal run of the existing Jenkins
pipeline, annotated with the build ID, commit, start and end times, and
execution location. Builds run on the Python agent container on the same
host (\ChapterRef{JenkinsCI}), so any change appears in whole-host metrics.
Explain the observed change or why none was visible; whole-host correlation
does not attribute CPU or memory to Jenkins alone.
\subsection{Build Correlation}
\StatusPass{} The normal pipeline run used for this comparison is
\texttt{pricing-app} » \texttt{PR-4} build 15: commit
\texttt{be6829f}, agent \texttt{python-agent}, started by the Gitea webhook,
SUCCESS, from 10:26:56 to 10:27:13 EST on November 4, 2026 (15:26:56 to
15:27:13~UTC; full details in \autoref{Table:MonitoringPostIncidentBuild}).
The agent container runs on the same host (\ChapterRef{JenkinsCI}), so any
change appears in the whole-host panels
(\autoref{Figure:MonitoringBuildDashboard}).
\begin{table}[htbp]\centering\small
\begin{tabular}{L{2.6cm}L{3.0cm}L{3.2cm}L{3.6cm}}
\toprule Panel & Before (10:20--10:26) & During and just after the build & After\\\midrule
Host CPU & about 2--3\% & rose to about 7\% from about 10:27 to 10:31 & back to about 2--3\%\\
Available memory & about 760~MiB & fell to about 590~MiB at about 10:27 & stayed near 590~MiB until Grafana was recreated at about 10:40\\
Root disk & 68\% available & no visible change & no visible change\\
Gitea and Jenkins availability & 1 & 1 & 1\\
Probe duration & mostly under 50~ms & no visible change & mostly under 50~ms\\\bottomrule
\end{tabular}
\caption{Host metrics around PR-4 build 15, read from the dashboard. Times
are EST.}
\label{Table:MonitoringBuildCorrelation}
\end{table}
The build itself lasted 17~seconds, but CPU stayed slightly higher for about
four minutes and about 170~MiB of memory stayed in use afterward. The likely
reason is that the Jenkins controller and agent keep work and caches in
memory after a run, but whole-host metrics cannot attribute the change to a
particular process or container, so this is an inference, not a measurement.
The memory recovery at about 10:40 EST matches the Grafana recreation that
deployed the \path{/metrics} fix (\autoref{sec:mon-access}); the CPU rise
and the 1.2-second Jenkins probe spike at about 10:40--10:45 belong to that
restart, not to the build. The build did not affect Gitea or Jenkins
availability. With about 590~MiB available after a short build, the result
supports follow-up issue 6 on memory headroom.
\begin{figure}[htbp]\centering
\includegraphics[width=\linewidth]{prism-uploads/ch5-build-dashboard-top.png}\\[4pt]
\includegraphics[width=\linewidth]{prism-uploads/ch5-build-dashboard-bottom.png}
\caption{Dashboard for about 10:18 to 11:18 EST on November 4, 2026
(15:18--16:18~UTC), around PR-4 build 15 at 10:26:56--10:27:13 EST.}
\label{Figure:MonitoringBuildDashboard}
\end{figure}
\section{SLI, SLO, and Error Budget}
\label{sec:mon-slo}
@ -777,9 +825,38 @@ probe took about 2.3~seconds while Jenkins was still starting.
\label{Figure:MonitoringIncidentDashboard}
\end{figure}
\StatusPending{} Run one pricing-app pipeline on \texttt{main} and record the
build number, commit, agent, start and end times, and result. Confirm the
Gitea webhook and commit status, and record the manual PDF build.
\paragraph{Pipeline, webhook, and commit status.} \StatusPass{} After the
incident, a push to the pricing-app pull request branch triggered a Jenkins
build through the Gitea webhook, with no manual start. The build record was
read from the Jenkins home directory on the host, because the Jenkins web
page is reachable only through the SSH tunnel.
\begin{table}[htbp]\centering\small
\begin{tabular}{L{3.0cm}L{9.4cm}}
\toprule Item & Value\\\midrule
Build & \texttt{pricing-app} » \texttt{PR-4} build 15\\
Result & SUCCESS\\
Commit & \path{be6829f26e50833b0e366817bbd07bc6b306727d} (\texttt{feature/issue-3-monitoring})\\
Agent & \texttt{python-agent}, workspace \path{/home/jenkins/agent/workspace/pricing-app_PR-4}\\
Start and end & November 4, 2026, 15:26:56.910 to 15:27:13.736~UTC (16.8~s)\\
Trigger & Gitea webhook on push\\\bottomrule
\end{tabular}
\caption{Post-incident pipeline run, from \texttt{build.xml} and the build
log in \texttt{/var/jenkins\_home/jobs/pricing-app/branches/PR-4/builds/15}.}
\label{Table:MonitoringPostIncidentBuild}
\end{table}
Jenkins reported the result back to Gitea: the commit shows the required
check \texttt{pricing-app/pipeline/pr-main} as successful
(\autoref{Figure:MonitoringCommitStatus}). The webhook, the pipeline, and the
commit-status integration therefore all worked after Jenkins was restarted.
The manual PDF build is recorded in \autoref{sec:mon-manual}.
\begin{figure}[htbp]\centering
\includegraphics[width=0.7\linewidth]{prism-uploads/ch5-commit-status.png}
\caption{Gitea commit status for \texttt{be6829f}: all checks successful.}
\label{Figure:MonitoringCommitStatus}
\end{figure}
\subsection{Difference from the Chapter 4 Failure}
The Chapter 4 exercise changed application code so a test failed while

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB