-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
69 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ on: | |
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- '**/README.md' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,40 @@ | ||
# geo-3d-otel | ||
|
||
[![golangci-lint](https://github.com/efumagal/geo-3d-otel/actions/workflows/golangci-lint.yml/badge.svg)](https://github.com/efumagal/geo-3d-otel/actions/workflows/golangci-lint.yml) | ||
|
||
## Introduction | ||
|
||
A simple HTTP client to serve APIs to calculate distance between 3D points. | ||
Implemented using [Fiber](https://gofiber.io) and instrumented using [OpenTelemetry](https://opentelemetry.io). | ||
|
||
When pushing on main the [Publish Docker image to GHCR](.github/workflows/ghcr-build-push.yml) is triggered this performs: | ||
- Build the Docker image and push it to ghcr.io registry | ||
- Scan the docker image using [Snyk](https://snyk.io) | ||
- Update [kustomization.yaml](kustomize/kustomization.yaml) with the newly generated Docker image | ||
|
||
|
||
## Run | ||
|
||
```shell | ||
go run main.go | ||
``` | ||
|
||
## Load test | ||
|
||
Pre-requiste [K6](https://k6.io) | ||
|
||
[Load test K6 script](k6-load/load_distance.js) | ||
|
||
```shell | ||
k6 run load_distance.js | ||
``` | ||
|
||
## TO DOs | ||
|
||
- For a real app consider structuring the Go code using DDD Hexagonal pattern | ||
- Add unit tests and run them on PRs | ||
- Generate OpenAPI specs | ||
|
||
## Notes | ||
|
||
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import http from "k6/http"; | ||
import { check, group, sleep } from "k6"; | ||
|
||
export const options = { | ||
stages: [ | ||
{ duration: "10s", target: 20 }, // simulate ramp-up of traffic from 1 to 20 users over 10s. | ||
{ duration: "20s", target: 100 }, // stay at 100 users for 20 seconds | ||
{ duration: "10s", target: 0 }, // ramp-down to 0 users | ||
], | ||
thresholds: { | ||
http_req_duration: ["p(99)<100"], // 99% of requests must completed below 100ms | ||
}, | ||
}; | ||
|
||
const BASE_URL = "http://localhost:8080/distance"; | ||
|
||
export default () => { | ||
check(http.get(BASE_URL), { | ||
"status is 200": (r) => r.status == 200, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters