Mixes TimedValue benefit over simple datetime field

#1

What are the advantages of mixing in TimedValue as compared to creating a field of datetime?

TimedValue doesn’t look to inherit any other types and only contains a single field “timestamp”

0 Likes

#2

TimedValue is the value for a TimedValueHistory. You can find more details in the In Depth article about “Timed Values”

0 Likes

#3

Definitely read the In Depth article @seth.horrigan mentioned, but I noticed one other benefit to Metrics which I couldn’t find reference to in those article.

If you define A type like this:

entity type A mixes TimedValueHistory<AParent> schema name "A" {
  child: AChild
}

rather than this:

entity type A schema name "A" {
  parent: AParent
  child: AChild
  timestamp: datetime
}

Then the platform doesn’t implicitly know how to resolve the temporal relationship between instances of type AParent and instances of type AChild (side note: I would use TimedRelation for this type of relationship but the point still stands). If you do use a Timed* type then a temporal relationship is implied by the platform and any metric that traverses through your Timed* type will also resolve the temporal dependency, for example this metric:

//Metric example
{
  ...
  srcType:  "AParent",
  path: "fkeyArrayFieldOfTypeA.child",
  expression: "identity(someFieldOnChild)"
}

Will give stitch together a timeseries of someFieldOnChild from type AChild values based on the timestamps defined on type A . Make sense?

I have found these Timed* types to be very useful for certain data relationships while defining metrics. Its also very useful if you need to partition your Timeseries to get around data volume limits in cassandra. Simply make your “Timeseries Header” mixin TimedIntervalValue and you can write your metric as if there is a single series header.

0 Likes

#4

What exactly is the rule?

0 Likes

#5

Take a look at the documentation that was mentioned by Seth above (In Depth article about “Timed Values”) for more details.

0 Likes

#6

Thanks, I cannot find it in v7.6. Currently waiting for my VPN so that I can search elsewhere.

0 Likes