Compare commits

3 Commits
Author SHA1 Message Date
dizi 92e3d58548 ci: verify and deploy lab3
CI / verify (pull_request) Failing after 45s
2026-10-02 14:39:42 +03:00
dizi 05248a98ce docs: document lab3 verification 2026-10-02 14:39:37 +03:00
dizi 16d97cf481 ops: add balanced replicated stack 2026-10-02 14:39:32 +03:00
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -170,7 +170,7 @@ func (c *apiClient) waitForReplicas(expected int) error {
}
time.Sleep(100 * time.Millisecond)
}
return fmt.Errorf("nginx discovered %d of %d API replicas: %w", len(instances), expected, ctx.Err())
return fmt.Errorf("Nginx discovered %d of %d API replicas: %w", len(instances), expected, ctx.Err())
}
func parseFlags() configuration {
@@ -215,7 +215,7 @@ func (c *apiClient) bootstrap() error {
if err != nil {
return fmt.Errorf("login: %w", err)
}
defer func() { _ = response.Body.Close() }()
defer response.Body.Close()
if response.StatusCode != http.StatusCreated {
return responseError("login", response)
}
@@ -284,7 +284,7 @@ func (c *apiClient) createMessage(ctx context.Context, sequence uint64) (string,
if err != nil {
return "", 0, err
}
defer func() { _ = response.Body.Close() }()
defer response.Body.Close()
_, _ = io.Copy(io.Discard, io.LimitReader(response.Body, 1<<20))
if response.StatusCode != http.StatusCreated {
return response.Header.Get("X-Instance-Id"), response.StatusCode, fmt.Errorf("unexpected status")
@@ -383,7 +383,7 @@ func scrapeMetrics(endpoint string) (map[string]float64, error) {
if err != nil {
return nil, err
}
defer func() { _ = response.Body.Close() }()
defer response.Body.Close()
if response.StatusCode != http.StatusOK {
return nil, fmt.Errorf("status %d", response.StatusCode)
}
+1 -1
View File
@@ -314,7 +314,7 @@ func writeChart(path string, values []aggregate) error {
value := maxRPS * float64(step) / 5
fmt.Fprintf(&output, `<line class="grid" x1="%g" y1="%g" x2="%g" y2="%g"/><text x="%g" y="%g" text-anchor="end" font-size="12">%.0f</text>`, left, y, left+plotWidth, y, left-10, y+4, value)
}
fmt.Fprintf(&output, `<line class="axis" x1="%g" y1="%g" x2="%g" y2="%g"/><line class="axis" x1="%g" y1="%g" x2="%g" y2="%g"/>`, left, top, left, top+plotHeight, left, top+plotHeight, left+plotWidth, top+plotHeight)
output.WriteString(fmt.Sprintf(`<line class="axis" x1="%g" y1="%g" x2="%g" y2="%g"/><line class="axis" x1="%g" y1="%g" x2="%g" y2="%g"/>`, left, top, left, top+plotHeight, left, top+plotHeight, left+plotWidth, top+plotHeight))
for index, replicas := range []int{1, 2, 4} {
x := left + plotWidth*float64(index)/2
fmt.Fprintf(&output, `<text x="%g" y="%g" text-anchor="middle" font-size="13">%d</text>`, x, top+plotHeight+25, replicas)