Skip to content

Commit 878e06f

Browse files
authored
Merge pull request #21 from SwimResults/develop
add prometheus endpoint; update go 1.24
2 parents 3535e22 + 2ef900c commit 878e06f

File tree

13 files changed

+153
-130
lines changed

13 files changed

+153
-130
lines changed

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Set up Go
2323
uses: actions/setup-go@v3
2424
with:
25-
go-version: 1.18
25+
go-version: 1.24
2626

2727
- name: Build
2828
run: CGO_ENABLED=0 go build -v -o . -x ./...

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM golang:1.16-alpine
3+
FROM golang:1.24-alpine
44

55
WORKDIR /app
66

client/disq_client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ package client
2222
//
2323
// r, _, e := client.ImportDisqualification(start1, "Guter Grund", time.Now())
2424
// if e != nil {
25-
// fmt.Printf(e.Error())
25+
// fmt.Println(e)
2626
// }
2727
// fmt.Println(r)
2828
// //fmt.Printf("id: %s, number: %d, start: %s", r.Identifier.String(), r.Number, r.StartEstimation.Format("15:04"))

client/heat_client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ package client
1111
// tm, _ := time.Parse("2006-01-02 15:04", "2019-12-06 13:02")
1212
// r, _, e := client.ImportHeat("IESC19", 13, 3, tm)
1313
// if e != nil {
14-
// fmt.Printf(e.Error())
14+
// fmt.Println(e)
1515
// }
1616
// fmt.Printf("id: %s, number: %d, start: %s", r.Identifier.String(), r.Number, r.StartEstimation.Format("15:04"))
1717
//}

client/start_client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestStartClient_ImportStart(t *testing.T) {
3636
//
3737
// r, _, e := client.ImportStart(start1)
3838
// if e != nil {
39-
// fmt.Printf(e.Error())
39+
// fmt.Println(e)
4040
// }
4141
// fmt.Println(r)
4242
// //fmt.Printf("id: %s, number: %d, start: %s", r.Identifier.String(), r.Number, r.StartEstimation.Format("15:04"))
@@ -63,7 +63,7 @@ func TestStartClient_ImportStart(t *testing.T) {
6363
//
6464
// r, _, e := client.ImportResult(start1, result1)
6565
// if e != nil {
66-
// fmt.Printf(e.Error())
66+
// fmt.Println(e)
6767
// }
6868
// fmt.Println(r)
6969
// fmt.Printf("type: %s, time: %f", r.ResultType, r.Time.Seconds())

controller/controller.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"github.com/gin-gonic/gin"
66
"github.com/swimresults/start-service/service"
7+
ginprometheus "github.com/zsais/go-gin-prometheus"
78
"net/http"
89
"os"
910
)
@@ -19,6 +20,11 @@ func Run() {
1920
return
2021
}
2122

23+
p := ginprometheus.NewWithConfig(ginprometheus.Config{
24+
Subsystem: "gin",
25+
})
26+
p.Use(router)
27+
2228
startController()
2329
heatController()
2430
disqualificationController()

controller/disq_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func importDisqualification(c *gin.Context) {
2121

2222
disqualification, _, err := service.ImportDisqualification(request.Start, request.Disqualification)
2323
if err != nil {
24-
fmt.Printf(err.Error())
24+
fmt.Println(err)
2525
c.IndentedJSON(http.StatusInternalServerError, gin.H{"message": err.Error()})
2626
return
2727
}

controller/heat_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ func importHeat(c *gin.Context) {
257257

258258
heat, r, err := service.ImportHeat(request.Heat)
259259
if err != nil {
260-
fmt.Printf(err.Error())
260+
fmt.Println(err)
261261
c.IndentedJSON(http.StatusInternalServerError, gin.H{"message": err.Error()})
262262
return
263263
}

controller/result_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func importResult(c *gin.Context) {
2121

2222
result, _, err := service.ImportResult(request.Start, request.Result)
2323
if err != nil {
24-
fmt.Printf(err.Error())
24+
fmt.Println(err)
2525
c.IndentedJSON(http.StatusInternalServerError, gin.H{"message": err.Error()})
2626
return
2727
}

controller/start_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ func importStart(c *gin.Context) {
345345

346346
start, r, err := service.ImportStart(request.Start)
347347
if err != nil {
348-
fmt.Printf(err.Error())
348+
fmt.Println(err)
349349
c.IndentedJSON(http.StatusInternalServerError, gin.H{"message": err.Error()})
350350
return
351351
}

0 commit comments

Comments
 (0)