{"record":{"id":"4a40f53449c82fc5","repo":"hashicorp/nomad","slug":"telemetry-in-memory-collection-interval-cannot-be","errorCode":null,"errorMessage":"telemetry in-memory collection interval cannot be greater than retention period","messagePattern":"telemetry in-memory collection interval cannot be greater than retention period","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/agent/config.go","lineNumber":1533,"sourceCode":"// Validate the telemetry configuration options. These are used by the agent,\n// regardless of mode, so can live here rather than a structs package. It is\n// safe to call, without checking whether the config object is nil first.\nfunc (t *Telemetry) Validate() error {\n\tif t == nil {\n\t\treturn nil\n\t}\n\n\t// Ensure we have durations that are greater than zero.\n\tif t.inMemoryCollectionInterval <= 0 {\n\t\treturn errors.New(\"telemetry in-memory collection interval must be greater than zero\")\n\t}\n\tif t.inMemoryRetentionPeriod <= 0 {\n\t\treturn errors.New(\"telemetry in-memory retention period must be greater than zero\")\n\t}\n\n\t// Ensure the in-memory durations do not conflict.\n\tif t.inMemoryCollectionInterval > t.inMemoryRetentionPeriod {\n\t\treturn errors.New(\"telemetry in-memory collection interval cannot be greater than retention period\")\n\t}\n\n\treturn nil\n}\n\n// Eventlog is the configuration for the Windows Eventlog\ntype Eventlog struct {\n\t// Enabled controls if Nomad agent logs are sent to the\n\t// Windows eventlog.\n\tEnabled bool `hcl:\"enabled\"`\n\t// Level of logs to send to eventlog. May be set to higher\n\t// severity than LogLevel but lower level will be ignored.\n\tLevel string `hcl:\"level\"`\n}\n\n// Copy is used to copy the Eventlog configuration\nfunc (e *Eventlog) Copy() *Eventlog {\n\treturn &Eventlog{","sourceCodeStart":1515,"sourceCodeEnd":1551,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/agent/config.go#L1515-L1551","documentation":"After both durations individually pass, telemetry validation enforces collection_interval <= retention_period. Collecting more frequently than data is retained would evict samples before a full cycle, so the combination is rejected as conflicting in-memory settings.","triggerScenarios":"Telemetry config where inMemoryCollectionInterval is strictly greater than inMemoryRetentionPeriod (both positive), e.g. collect every 2h but retain only 1h.","commonSituations":"Tuning collection frequency upward without adjusting retention; defaults overridden independently by ops tooling; misunderstanding that retention must be the larger window.","solutions":["Increase the retention period so it is >= the collection interval.","Or decrease the collection interval so it fits within the retention window.","Add a CI/config lint asserting interval <= retention for telemetry settings."],"exampleFix":"// before\ntelemetry {\n  in_memory_collection_interval = \"2h\"\n  in_memory_retention_period    = \"1h\"\n}\n\n// after\ntelemetry {\n  in_memory_collection_interval = \"10s\"\n  in_memory_retention_period    = \"1h\"\n}","handlingStrategy":"validation","validationCode":"if t := cfg.Telemetry; t != nil && t.InMemoryCollectionInterval > t.InMemoryRetentionPeriod {\n    return errors.New(\"telemetry collection interval must be <= retention period\")\n}","typeGuard":"func telemetryDurationsValid(t *Telemetry) bool {\n    return t != nil && t.InMemoryCollectionInterval > 0 &&\n        t.InMemoryRetentionPeriod > 0 &&\n        t.InMemoryCollectionInterval <= t.InMemoryRetentionPeriod\n}","tryCatchPattern":null,"preventionTips":["Tune collection interval and retention together as a pair.","Retain a rule of thumb: retention at least several multiples of the interval.","Add the invariant to your config CI checks."],"tags":["config-validation","telemetry","consistency","duration"],"backgroundTag":"invalid-config-value","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}