Skip to content

StartTime_local / EndTime_local populated with invalid dates when "Import events using local server time" is enabled #522

@PiJoCoder

Description

@PiJoCoder

Problem

When the "Import events using local server time (not UTC)" option is selected, SQLNexus_PostProcessing.sql unconditionally applied a UTC offset (DATEADD(HOUR, @utc_to_local_offset, ...)) to StartTime and EndTime when populating StartTime_local and EndTime_local in tblBatches, tblStatements, and tblConnections. Because the timestamps written by ReadTrace and TraceEventImporter were already in local server time (via the -B bias flag), applying the offset a second time produced incorrect — and in extreme cases invalid — datetime values.

Two additional gaps compounded the issue:

  1. SQLNexus_PostProcessing.sql had no mechanism to detect local-time imports. There was no code path to skip the UTC offset conversion; it always applied regardless of how the data was imported.
  2. Neither importer wrote a flag to signal that timestamps were already local. ReadTraceNexusImporter.WriteLocalTimeFlag() was never called, and TraceEventImporterPlugin had no WriteLocalTimeFlag() implementation at all and did not expose or honor the local server time option.

Root cause

SQLNexus_PostProcessing.sql always applied DATEADD(HOUR, @utc_to_local_offset, StartTime) to populate the _local columns, with no way to distinguish a local-time import from a UTC import. The importers had no way to communicate that the timestamps were already adjusted.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions