Skip to content

Commit

Permalink
[target-allocator] Use gin in release mode and without default logg…
Browse files Browse the repository at this point in the history
…er middleware (#1414)

* Use gin in release mode and without default logger middleware

Signed-off-by: Matej Gera <matej.gera@coralogix.com>

* Add changelog

Signed-off-by: Matej Gera <matej.gera@coralogix.com>

---------

Signed-off-by: Matej Gera <matej.gera@coralogix.com>
  • Loading branch information
matej-g authored Feb 8, 2023
1 parent 3a8b546 commit 55eaffc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .chloggen/1414-adjust-gin-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action)
component: "target allocator"

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Configure `gin` router to be used in release mode and do not use the default logging middleware which is noisy and not formatted properly."

# One or more tracking issues related to the change
issues: [1352]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
4 changes: 3 additions & 1 deletion cmd/otel-allocator/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ func NewServer(log logr.Logger, allocator allocation.Allocator, listenAddr *stri
allocator: allocator,
}

router := gin.Default()
gin.SetMode(gin.ReleaseMode)
router := gin.New()
router.Use(gin.Recovery())
router.UseRawPath = true
router.UnescapePathValues = false
router.Use(s.PrometheusMiddleware)
Expand Down

0 comments on commit 55eaffc

Please sign in to comment.