Skip to content

Commit

Permalink
working on stats API and cache
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuelef committed Sep 22, 2023
1 parent e4f06c8 commit f2c1bbc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"log"
"net/url"
"os"
"runtime"
"sync"
Expand Down Expand Up @@ -134,8 +135,13 @@ func main() {

// Basic GET API to show the OtelFiber middleware is taking
// care of creating the span when called
app.Get("/hello", func(c *fiber.Ctx) error {
repo := "kubernetes/kubernetes"
app.Get("/stats", func(c *fiber.Ctx) error {
param := c.Query("repo")
repo, err := url.QueryUnescape(param)
if err != nil {
return err
}

if res, hit := cache.Get(repo); hit {
return c.JSON(res)
}
Expand Down

0 comments on commit f2c1bbc

Please sign in to comment.