When AppScope has interposed a function, and then the application being scoped executes that function, AppScope can emit events and metrics. Both events and metrics follow patterns that are rigorously defined in validatable JSON Schema, and documented in the Schema Reference.
AppScope outputs metrics either in StatsD format or in equivalent JSON. AppScope can also watch for and intercept StatsD-formatted metrics being emitted by a scoped application.
Events describe the action performed by the interposed function. For example, a
net.open event could tell you that a network connection was established by Firefox, from the local IP/port
172.16.198.210:54388 to the remote IP/port
22.214.171.124:80, using HTTP over TCP.
configevent is set to
true, AppScope sends a process‑start message upon establishing a new connection. This message – the start.msg event – reports the configs in effect at the time. The
start.msg.info.process.libscopever element reports the version of AppScope that's being used.
The process‑start message also includes four distinct identifiers:
uuidand a value in canonical UUID form. UUID is a universally-unique process identifier, meaning that no two processes will ever have the same UUID value on the same machine.
machine_idand a value that AppScope obtains from
/etc/machine-id. The machine ID uniquely identifies the host, as described in the man page. When
/etc/machine-idis not available (e.g., in Alpine, or in a container), AppScope generates the machine ID using a repeatable MD5 hash of the host's first MAC address. Two containers on the same host can have the same machine ID.
pidand a value that is always unique at any given time, but that the machine can reuse for different processes at different times.
idand a value that concatenates (and may truncate) the scoped app's hostname, procname, and command. This value is not guaranteed to be unique.
By itself, the UUID process ID is unique for a given machine. In principle, UUID and Machine ID together constitute a tuple ID that is unique across all machine namespaces.
Metrics can do any of three things:
Metric verbosity levelsection of the config file.) For example, a
fs.readmetric could tell you that an
httpdprocess has read a total of 320967 bytes from the filesystem, having performed multiple reads over a 10-second period.
fs.readmetric could tell you that an
httpdprocess has done one read of 8245 bytes from one specific file,
proc, metrics periodically report information about resource usage at a point in time. For example, a
proc.memmetric could tell you that
httpdis currently using 62,123 KB of memory.
The table below gives the gory details:
|Verbosity Level||Cardinality (dimensions)||Aggregate Error Metrics?||Aggregate DNS Metrics?||Filesystem Metrics to Aggregate||Network Metrics to Aggregate|
|2||same as 1, plus
|3||same as 2, plus
|4||same as 3, plus
|5||same as 4, plus
|6||same as 5, plus
|7||same as 6, plus
|8||same as 7, plus
||same as 7|
|9||same as 8||no||no||all but
To interpret a given metric, you must consider its type. There are four possibilities:
|Metric Type||Value Description|
||A numeric value that can increase or decrease over time – like a temperature or pressure gauge.|
||A cumulative numeric value – it can only increase over time.|
||Measures how long a given event type takes (duration).|
||A StatsD histogram distributes sampled observations into buckets. With AppScope, we encounter histograms only in the special case where AppScope intercepts StatsD-formatted metrics whose type is
proc.fd is a
gauge that indicates how many files were open at one point in time. If we're scoping
top, that's typically fewer than 10. By contrast,
fs.open is a
count that increments every time a file is opened. When scoping
top over a reporting period of 10 seconds, you could see values in the hundreds or thousands.
It's important to take into account whether the application or command you are scoping is short-lived or longer-lasting. For commands that complete very quickly, a
gauge will report the value at the moment that AppScope exits the process.
By default, all classes of events and metrics are turned on – but you can turn any class of metric or event data on or off individually. To do this, include or omit the desired watch type(s) from the
metric > watch[*] array and/or the
event > watch[*] array in the config file. Environment variables can achieve the same effect. For example, the environment variable to turn off metrics of watch type
statsd would be
SCOPE_METRIC_STATSD=false. To turn on events of watch type
logfile, you'd use