solarwinds / OrionSDK

SDK for the SolarWinds Orion platform, including tools, documentation, and samples in PowerShell, C#, Go, Perl, and Java.
https://thwack.com/OrionSDK
Apache License 2.0
401 stars 144 forks source link

Orion.AlertHistory.TimeStamp vs. Orion.ESI.AlertIncident.LastTriggerTime #167

Open mrxinu opened 5 years ago

mrxinu commented 5 years ago

Despite both fields being of type DateTime in the underlying tables, the format of the strings produced when querying with the API differ. The former has a Z suffix and the latter does not.

Querying the Orion.AlertHistory entity:

image

Querying the Orion.ESI.AlertIncident entity:

image

For reference, here are the SQL table definitions for each:

Orion.AlertHistory

image

Orion.ESI.AlertIncident

image

nothrow commented 5 years ago

Hi Steven,

that 'Z' suffix means the datetime is in UTC. Not being in UTC, no suffix (local server time).

The fact, whether DateTime is UTC/not UTC is defined in Orion SWIS schema (<property name="TimeStamp" type="datetime" dateTimeKind="Utc" /> for AlertHistory, nothing for ESI).

For me, that is kind of expected behavior. Kind of, because I'd expect everything to be in UTC, but that is different problem, that is not easy to tackle.

mrxinu commented 5 years ago

Hi @nothrow! Thanks for the quick reply. I don't know specifically why Go's json.Unmarshal pukes on the version without the Z but I'll look into it. In the meantime, if the lack of Z is supposed to indicate local time, why would it be missing when the data from SNI_AlertIncidents is in UTC?

image

nothrow commented 5 years ago

That is apparently bug in the product, we omitted marking the field as UTC in SWIS schema. I filled that bug in. Sorry for the inconvenience.

Ad reasons for choking json.Unmarshal -> I believe it follows RFC3339, which defines timezone information as mandatory, whereas SWIS (C# serializer) does not follow the RFC precisely.

nothrow commented 5 years ago

Keeping this issue open till CORE-12185 is fixed.

danjagnow commented 5 years ago

The internal issue is now OADP-1291.

mrxinu commented 3 years ago

Did this ever get resolved? :)

jammiemil commented 2 years ago

Just spent a solid hour unpicking the same issue trying to integrate Grafana with Solarwinds, Is this fixed in a certain issue we should be upgrading to?