...
- 'filter' field of FetchSpec
- 'expression' field of ComplexMetricCompoundMetric
- 'value' field of tsDecl component of tsDecl Metrics.
Official C3 documentation for ExpressionEngineFunctions: https://developer.c3.ai/docs/7.12.0/type/ExpressionEngineFunction
...
Code Block | ||
---|---|---|
| ||
sample_met = c3.SimpleMetric.make({
'id': 'SampleMetric_SampleType',
'name': 'SampleMetric',
'srcType': 'SampleType',
'path': 'timeseriesValues',
'expression': 'avg(avg(normalized.data.x))'
}) |
Another variety of SimpleMetric is a tsDecl Metric. These can be used to turn traditionally non-timeseries data such as event data or status data into timeseries. A tsDecl metric is the same as a SimpleMetric, but instead of an 'expression' field, a 'tsDecl' field is used. The same example can be re-written as:
Code Block |
---|
sample_met = c3.SimpleMetric({
'id': 'SampleMetric_SampleType',
'name': 'SampleMetric',
'srcType': 'SampleType',
'path': 'timeseriesValues',
'tsDecl': {
'data': 'data',
'treatment': 'AVERAGE',
'start': 'start',
'value': 'value'
}
}) |
Please note that the above examples do not have an example context in which they work. This will be updated soon with a version backed up Please note that the above example does not have an example context in which it will work. This will be updated soon with a version backed up by a working exercise.
For more detail, see the C3 documentation on SimpleMetrics here: https://developer.c3.ai/docs/7.12.0/guide/guide-c3aisuite-basic/metrics-simple-metrics, and tsDecl metrics here: https://developer.c3.ai/docs/7.12.17/guide/guide-c3aisuite-basic/metrics-tsdecl-metrics
CompoundMetrics
Compound metrics are generally easier to define and use as they operate on already defined metrics either Simple or Compound. They essentially just consist of and id/name, and an expression defining the metric in terms of constants and already defined metrics. If you try and execute a CompoundMetric on a type for which some necessary SimpleMetric is not defined, you'll get an error.
...