Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

routing: log route update id #3112

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions routing/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ func processRouteDefs(o Options, fr filters.Registry, defs []*eskip.Route) (rout
}

type routeTable struct {
id int
m *matcher
once sync.Once
routes []*Route // only used for closing
Expand Down Expand Up @@ -543,10 +544,10 @@ func receiveRouteMatcher(o Options, out chan<- *routeTable, quit <-chan struct{}
updatesRelay <-chan []*eskip.Route
)
updatesRelay = updates
for {
for id := 1; ; id++ {
RomanZavodskikh marked this conversation as resolved.
Show resolved Hide resolved
select {
case defs := <-updatesRelay:
o.Log.Info("route settings received")
o.Log.Infof("route settings received, id: %d", id)

for i := range o.PreProcessors {
defs = o.PreProcessors[i].Do(defs)
Expand Down Expand Up @@ -582,6 +583,7 @@ func receiveRouteMatcher(o Options, out chan<- *routeTable, quit <-chan struct{}
})

rt = &routeTable{
id: id,
m: m,
routes: routes,
validRoutes: validRoutes,
Expand Down
2 changes: 1 addition & 1 deletion routing/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func (r *Routing) startReceivingUpdates(o Options) {
r.firstLoadSignaled = true
}
}
r.log.Info("route settings applied")
r.log.Infof("route settings applied, id: %d", rt.id)
if r.metrics != nil { // existing codebases might not supply metrics instance
r.metrics.UpdateGauge("routes.total", float64(len(rt.validRoutes)))
r.metrics.UpdateGauge("routes.updated_timestamp", float64(rt.created.Unix()))
Expand Down
Loading