Skip to content

Commit 5d5dd51

Browse files
committed
Merge branch 'main' into new-api
2 parents c34bf2c + 73eb7fd commit 5d5dd51

File tree

6 files changed

+90
-8
lines changed

6 files changed

+90
-8
lines changed

.github/dependabot.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "docker"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 10
8+
commit-message:
9+
prefix: "chore(deps): "
10+
- package-ecosystem: "github-actions"
11+
directory: "/"
12+
schedule:
13+
interval: "weekly"
14+
open-pull-requests-limit: 10
15+
commit-message:
16+
prefix: "chore(deps): "
17+
- package-ecosystem: "gomod"
18+
directory: "/"
19+
schedule:
20+
interval: "daily"
21+
open-pull-requests-limit: 10
22+
commit-message:
23+
prefix: "chore(deps): "
24+
- package-ecosystem: 'npm'
25+
directory: '/pkg/web/'
26+
schedule:
27+
interval: 'daily'
28+
open-pull-requests-limit: 10
29+
commit-message:
30+
prefix: "chore(deps): "

.github/workflows/build.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Check Formatting & Build
2+
on: [push]
3+
4+
jobs:
5+
runner-job:
6+
runs-on: ubuntu-latest
7+
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
12+
- name: Setup Go
13+
uses: actions/setup-go@v5
14+
15+
- name: Setup Goimports
16+
run: go install golang.org/x/tools/cmd/goimports@latest
17+
18+
- name: Check Formatting
19+
run: make format-check
20+
21+
- name: Build Binary
22+
run: make build

.github/workflows/docker.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and push Docker images
1+
name: Build and Push Docker Images
22
on:
33
release:
44
types:
@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v3
1212
- name: Login to the registry
13-
uses: docker/login-action@v1
13+
uses: docker/login-action@v3
1414
with:
1515
registry: ghcr.io
1616
username: ${{ github.actor }}
@@ -20,7 +20,7 @@ jobs:
2020
- name: Set up Docker Buildx
2121
uses: docker/setup-buildx-action@v3
2222
- name: Set version
23-
uses: actions/github-script@v6
23+
uses: actions/github-script@v7
2424
id: set_version
2525
with:
2626
script: |
@@ -29,7 +29,7 @@ jobs:
2929
core.setOutput('tag', tag)
3030
core.setOutput('tag-no-v', tag_no_v)
3131
- name: Build Docker image and push to the Registry
32-
uses: docker/build-push-action@v5
32+
uses: docker/build-push-action@v6
3333
with:
3434
context: .
3535
file: ./Dockerfile

.github/workflows/k6-tests.yaml

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
1-
name: k6 - Test Suite
2-
on: [push]
1+
name: Run k6 Test Suite
2+
on:
3+
push:
4+
paths:
5+
- 'scripts/**'
6+
- 'k6/**'
7+
release:
8+
types:
9+
- created
10+
11+
# Important: The k6 test suite will only be run against the latest
12+
# release of the Quickpizza service, not against the code in the
13+
# commit itself. Therefore, we only run this Action when the test
14+
# files themselves are modified (or on a new release).
315

416
jobs:
517
runner-job:
@@ -22,7 +34,7 @@ jobs:
2234

2335
- name: Cache k6
2436
id: cache-k6
25-
uses: actions/cache@v3
37+
uses: actions/cache@v4
2638
with:
2739
path: /usr/bin/k6
2840
key: ${{ runner.os }}-k6

k6/foundations/16.grpc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Client, StatusOK } from 'k6/net/grpc';
22
import { check, sleep } from 'k6';
33

4-
const BASE_URL = 'localhost:3334';
4+
const BASE_URL = __ENV.BASE_URL || 'http://localhost:3334';
55

66
const client = new Client();
77
client.load(['definitions'], '../../../proto/quickpizza.proto');

pkg/http/http.go

+18
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,28 @@ var (
5353
Buckets: []float64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20},
5454
})
5555

56+
numberOfIngredientsPerPizzaNativeHistogram = promauto.NewHistogram(prometheus.HistogramOpts{
57+
Name: "number_of_ingredients_per_pizza_alternate",
58+
Help: "The number of ingredients per pizza (Native Histogram)",
59+
NativeHistogramBucketFactor: 1.1,
60+
NativeHistogramMaxBucketNumber: 100,
61+
NativeHistogramMinResetDuration: 1 * time.Hour,
62+
})
63+
5664
pizzaCaloriesPerSlice = promauto.NewHistogram(prometheus.HistogramOpts{
5765
Name: "pizza_calories_per_slice",
5866
Help: "The number of calories per slice of pizza",
5967
Buckets: []float64{100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000},
6068
})
6169

70+
pizzaCaloriesPerSliceNativeHistogram = promauto.NewHistogram(prometheus.HistogramOpts{
71+
Name: "pizza_calories_per_slice_alternate",
72+
Help: "The number of calories per slice of pizza (Native Histogram)",
73+
NativeHistogramBucketFactor: 1.1,
74+
NativeHistogramMaxBucketNumber: 100,
75+
NativeHistogramMinResetDuration: 1 * time.Hour,
76+
})
77+
6278
httpRequests = promauto.NewCounterVec(prometheus.CounterOpts{
6379
Name: "http_requests_total",
6480
Help: "The total number of HTTP requests",
@@ -699,7 +715,9 @@ func (s *Server) WithRecommendations(catalogClient CatalogClient, copyClient Cop
699715
}).Inc()
700716

701717
numberOfIngredientsPerPizza.Observe(float64(len(p.Ingredients)))
718+
numberOfIngredientsPerPizzaNativeHistogram.Observe(float64(len(p.Ingredients)))
702719
pizzaCaloriesPerSlice.Observe(float64(pizzaRecommendation.Calories))
720+
pizzaCaloriesPerSliceNativeHistogram.Observe(float64(pizzaRecommendation.Calories))
703721

704722
s.log.InfoContext(r.Context(), "New pizza recommendation", "pizza", pizzaRecommendation.Pizza.Name)
705723

0 commit comments

Comments
 (0)