Skip to content

Commit

Permalink
ingest: small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
absorbb committed Dec 19, 2023
1 parent 6712725 commit 2ffbf92
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ingest/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func (a *Context) InitContext(settings *appbase.AppSettings) error {
a.server = &http.Server{
Addr: fmt.Sprintf("0.0.0.0:%d", a.config.HTTPPort),
Handler: router.Engine(),
ReadTimeout: time.Second * 60,
ReadHeaderTimeout: time.Second * 60,
ReadTimeout: time.Second * 2,
ReadHeaderTimeout: time.Second * 2,
IdleTimeout: time.Second * 65,
}
a.metricsServer = NewMetricsServer(a.config)
Expand Down
Binary file added ingest/default.pgo
Binary file not shown.
5 changes: 3 additions & 2 deletions ingest/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/jitsucom/bulker/eventslog"
"github.com/jitsucom/bulker/jitsubase/appbase"
"github.com/jitsucom/bulker/jitsubase/timestamp"
"github.com/jitsucom/bulker/jitsubase/utils"
"github.com/jitsucom/bulker/jitsubase/uuid"
"github.com/jitsucom/bulker/kafkabase"
Expand Down Expand Up @@ -105,7 +106,7 @@ func NewRouter(appContext *Context) *Router {
m.SetDuration([]float64{0.02, 0.05, 0.1, 0.2, 0.5})
m.UseWithoutExposingEndpoint(engine)
fast := engine.Group("")
fast.Use(timeout.Timeout(timeout.WithTimeout(10 * time.Second)))
fast.Use(timeout.Timeout(timeout.WithTimeout(5 * time.Second)))
fast.Use(router.CorsMiddleware)
fast.Match([]string{"GET", "OPTIONS", "POST"}, "/v1/projects/:writeKey/settings", router.SettingsHandler)
fast.Match([]string{"GET", "OPTIONS", "POST"}, "/projects/:writeKey/settings", router.SettingsHandler)
Expand Down Expand Up @@ -490,7 +491,7 @@ func patchEvent(c *gin.Context, event *AnalyticsServerEvent, tp string, ingestTy
ctx["locale"] = strings.TrimSpace(strings.Split(c.GetHeader("Accept-Language"), ",")[0])
}
ev["context"] = ctx
nowIsoDate := time.Now().Format(time.RFC3339Nano)
nowIsoDate := time.Now().UTC().Format(timestamp.JsonISO)
ev["receivedAt"] = nowIsoDate
ev["type"] = typeFixed
if _, ok = ev["timestamp"]; !ok {
Expand Down
3 changes: 3 additions & 0 deletions jitsubase/timestamp/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const Key = "_timestamp"
// Layout is an ISO date time format. Note: for parsing use time.RFC3339Nano.
const Layout = "2006-01-02T15:04:05.000000Z"

// Layout is an ISO date time format. Note: for parsing use time.RFC3339Nano.
const JsonISO = "2006-01-02T15:04:05.000Z"

// DayLayout is a Day format of time.Time
const DayLayout = "20060102"

Expand Down

0 comments on commit 2ffbf92

Please sign in to comment.