Skip to content

Commit

Permalink
Use correct default value for templateRefreshTimeout
Browse files Browse the repository at this point in the history
The correct recommended default is 600s, not 1800s. 1800s is the
recommended default for templateLifeTime (3 times
templateRefreshTimeout).

We also update the UDP collector process to timeout the client after
templateLifeTime instead of templateRefreshTimeout. This makes more
sense as templateLifeTime is a collector process configuration
parameter, while templateRefreshTimeout is for the exporter process.

Signed-off-by: Antonin Bas <[email protected]>
  • Loading branch information
antoninbas committed Aug 23, 2024
1 parent a4ae35d commit f9bc12a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/collector/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (cp *CollectingProcess) createUDPClient(addr string) *clientHandler {
cp.wg.Add(1)
go func() {
defer cp.wg.Done()
ticker := time.NewTicker(time.Duration(entities.TemplateRefreshTimeOut) * time.Second)
ticker := time.NewTicker(time.Duration(entities.TemplateTTL) * time.Second)
defer ticker.Stop()
defer close(client.closeClientChan)
defer func() {
Expand Down Expand Up @@ -178,7 +178,7 @@ func (cp *CollectingProcess) createUDPClient(addr string) *clientHandler {
}
klog.V(4).Infof("Processed message from exporter %v, number of records: %v, observation domain ID: %v",
message.GetExportAddress(), message.GetSet().GetNumberOfRecords(), message.GetObsDomainID())
ticker.Reset(time.Duration(entities.TemplateRefreshTimeOut) * time.Second)
ticker.Reset(time.Duration(entities.TemplateTTL) * time.Second)
}
}
}()
Expand Down
5 changes: 4 additions & 1 deletion pkg/entities/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ import (

const (
// TemplateRefreshTimeOut is the template refresh time out for exporting process
TemplateRefreshTimeOut uint32 = 1800
// The default is based on https://datatracker.ietf.org/doc/html/rfc5153#section-6.2
// and https://datatracker.ietf.org/doc/html/rfc6728#section-4.4.2
TemplateRefreshTimeOut uint32 = 600
// TemplateTTL is the template time to live for collecting process
// See https://datatracker.ietf.org/doc/html/rfc6728#section-4.5.2
TemplateTTL = TemplateRefreshTimeOut * 3
// TemplateSetID is the setID for template record
TemplateSetID uint16 = 2
Expand Down

0 comments on commit f9bc12a

Please sign in to comment.