Modify the Metadata to Omit Resource Names
The following table provides an overview of elements to define in your class metadata. Some optional elements, such as events
, are not shown. This table is focused on resources. In the "No Resources" column, all statistics are class statistics.
Table 4-1 Class Metadata Elements
No Resources | Statically Defined Resources | Dynamically Defined Resources |
---|---|---|
|
|
|
In the /usr/lib/sstore/metadata/json/site/
directory, create the file class.app.util3.json
with the following content. If you copy the file class.app.util2.json
, the primary changes you need to make are:
-
Delete the
instance-metadata
element. -
Delete the
static-instances
element.
The instance-metadata
and static-instances
elements are not used for dynamically allocated resources.
The stat-names
element is the same as in the previous two examples. The namespaces
element is still needed to define the type of the resources.
You might also want to update the description of the application and the name of the application in the id
.
{ "$schema": "//:class", "description": "Example util1 plus dynamically-allocated resources", "id": "app/util3", "namespaces": [ { "name-type": "string", "resource-name": "inst" } ], "stability": "stable", "stat-names": [ "//:stat.reads", "//:stat.writes", "//:stat.errors" ] }
Create the file stat.util3.json
, which is the same as the stat.util2.json
file except that util2
is changed to util3
in each id
value.
[ { "$schema": "//:stat", "description": "reads", "id": "//:class.app/util3//:stat.reads", "stability": "stable", "type": "counter", "units": "operations" }, { "$schema": "//:stat", "description": "writes", "id": "//:class.app/util3//:stat.writes", "stability": "stable", "type": "counter", "units": "operations" }, { "$schema": "//:stat", "description": "errors", "id": "//:class.app/util3//:stat.errors", "stability": "stable", "type": "counter", "units": "errors" } ]
Restart the sstore:default
service to add the new metadata to the statistics repository.
$ svcadm restart sstore:default
View the util3
statistic metadata.
$ sstore info //:class.app/util3
Identifier: //:class.app/util3
namespaces: {'0': '{'name-type': 'string', 'resource-name': 'inst'}'}
$schema: //:class
description: Example util1 plus dynamically-allocated resources
id: app/util3
stability: stable
stat-names: //:stat.reads
stat-names: //:stat.writes
stat-names: //:stat.errors