HomeForumSourceResearchGuide
Sign in to contribute to source. how it works
Type definition file pal.Perception by barry
expand copy to clipboardexpand
uses time.DateTime

/* { "description" : "Data type used to hold a metric entry in a batch of perception data." } */
data Metric {
	/* { "@description" : "The name of the metric." } */
	char name[]
	/* { "@description" : "The originating component of the metric (this may not always be set)." } */
	char sourceComponent[]
	/* { "@description" : "The total value of metrics by this name." } */
	int totalValue
	/* { "@description" : "The total number of metrics recorded by this name." } */
	int totalCount
	/* { "@description" : "Application-indicated information of whether a high or low value is considered to be better for this metric." } */
	bool preferHigh
	/* { "@description" : "The timestamp of the first metric by this name." } */
	DateTime timeFirst
	/* { "@description" : "The timestamp of the last metric by this name." } */
	DateTime timeLast
	}

/* { "description" : "Data type used to hold an event entry in a batch of perception data." } */
data Event {
	/* { "@description" : "The name of the event." } */
	char name[]
	/* { "@description" : "The originating component of the event (this may not always be set)." } */
	char sourceComponent[]
	/* { "@description" : "The total value of events by this name." } */
	int totalValue
	/* { "@description" : "The total number of events by this name." } */
	int totalCount
	/* { "@description" : "The timestamp of the first event by this name." } */
	DateTime timeFirst
	/* { "@description" : "The timestamp of the last event by this name." } */
	DateTime timeLast
	}

/* { "description" : "Data type used to hold a trace entry in a batch of perception data." } */
data Trace {
	/* { "@description" : "The trace content as reported by the origin of this trace entry." } */
	char content[]
	}

/* { "description" : "Data type used to return a batch of perception data." } */
data PerceptionData {
	/* { "@description" : "List of events in this batch." } */
	Event events[]
	/* { "@description" : "List of metrics in this batch." } */
	Metric metrics[]
	/* { "@description" : "List of trace entries in this batch." } */
	Trace trace[]
	}

/* { "description" : "Accepts perception data from components and returns all perception data recorded so far." } */
interface Perception {
	
	/* { "@description" : "Records a metric with a given name. Metrics are used to understand the current performance of a component." } */
	void addMetric(char name[], int value, bool preferHigh, opt bool overwrite)
	
	/* { "@description" : "Records an event with a given name. Events are used to understand the deployment environment of a component." } */
	void addEvent(char name[], int value, opt bool overwrite)
	
	/* { "@description" : "Records trace data that is used for additional system diagnostics, for example from an injected proxy capturing data travelling across a specific interface." } */
	void addTrace(char content[])
	
	/* { "@description" : "Returns all perception data recorded since the last time this function was called." } */
	PerceptionData getPerception()
	
	}
Revision history
To propose a new revision to this entity, use dana source put -ut your/new/version.dn -n pal.Perception -m "reason for update" -u yourUsername
Version 2 (this version) by barry
Notes for this version: Updates docstrings
Version 1 by barry