This documentation and the Cisco Observability Platform functionalities it describes are subject to change. Data saved on the platform may disappear and APIs may change without notice.


Metrics

The Cisco Observability Platform needs to store incoming metrics in fmm:metric knowledge objects. Space Fleet defines all of the metrics it needs in the file spacefleet/objects/fmm/metrics/metric-types.json, which contains an array of fmm:metric object definitions. Each of the following metrics is represented by its own fmm:metric object in this file:

  • speed - Speed on spacecraft and torpedo
  • torpedo_count - Number of torpedos available in tube or ship
  • torpedoes_launched_count - Number of torpedos launched from tube
  • current_occupancy - Number of crew members in a room
  • officer_count - Number of officers on the bridge
  • screens_inuse - Number of screens in use on the bridge
  • earth_day - Total time from the date ship was launched in epochmillis
  • antimatter_level - Anti-matter level
  • matter_level - Matter level
  • shield_level - Shield level of a room or spacecraft
  • trip_count - Trip count for warp drive
  • suggestion_count - Number of mess_hall suggestion events
  • shield_event_count - Number of shield_event events
  • newsfeed_count - Number of newsfeed events
  • test_metric - Test metric

Contents of spacefleet/objects/fmm/metrics/metric-types.json:

[
  {
    "namespace": {
      "name": "spacefleet",
      "version": 1
    },
    "kind": "metric",
    "name": "speed",
    "displayName": "Speed",
    "description": "Metric to Definie speed on spacecraft and torpedo",
    "category": "current",
    "contentType": "gauge",
    "aggregationTemporality": "unspecified",
    "isMonotonic": false,
    "type": "double",
    "unit": "m/s",
    "ingestGranularities": [
      60
    ]
  },
  {
    "namespace": {
      "name": "spacefleet",
      "version": 1
    },
    "kind": "metric",
    "name": "torpedo_count",
    "displayName": "Torpedo Count",
    "description": "Number of torpedos available in tube or ship",
    "category": "current",
    "contentType": "gauge",
    "aggregationTemporality": "unspecified",
    "isMonotonic": false,
    "type": "long",
    "unit": "{count}",
    "ingestGranularities": [
      60
    ]
  },
  {
    "namespace": {
      "name": "spacefleet",
      "version": 1
    },
    "kind": "metric",
    "name": "torpedoes_launched_count",
    "displayName": "Torpedoes Launched",
    "description": "Number of torpedos launched from tube",
    "category": "current",
    "contentType": "gauge",
    "aggregationTemporality": "unspecified",
    "isMonotonic": false,
    "type": "long",
    "unit": "{count}",
    "ingestGranularities": [
      60
    ]
  },
  {
    "namespace": {
      "name": "spacefleet",
      "version": 1
    },
    "kind": "metric",
    "name": "current_occupancy",
    "displayName": "Current Occupancy",
    "description": "Crew members in a room",
    "category": "current",
    "contentType": "gauge",
    "aggregationTemporality": "unspecified",
    "isMonotonic": false,
    "type": "long",
    "unit": "{count}",
    "ingestGranularities": [
      60
    ]
  },
  {
    "namespace": {
      "name": "spacefleet",
      "version": 1
    },
    "kind": "metric",
    "name": "officer_count",
    "displayName": "Officer Count",
    "description": "Total number of officers on the bridge",
    "category": "current",
    "contentType": "gauge",
    "aggregationTemporality": "unspecified",
    "isMonotonic": false,
    "type": "long",
    "unit": "{count}",
    "ingestGranularities": [
      60
    ]
  },
  {
    "namespace": {
      "name": "spacefleet",
      "version": 1
    },
    "kind": "metric",
    "name": "screens_inuse",
    "displayName": "Screens In Use",
    "description": "Screens Live in Bridge",
    "category": "current",
    "contentType": "gauge",
    "aggregationTemporality": "unspecified",
    "isMonotonic": false,
    "type": "long",
    "unit": "{count}",
    "ingestGranularities": [
      60
    ]
  },
  {
    "namespace": {
      "name": "spacefleet",
      "version": 1
    },
    "kind": "metric",
    "name": "earth_day",
    "displayName": "Duration",
    "description": "Total time from the date ship was launched in epochmillis",
    "category": "current",
    "contentType": "gauge",
    "aggregationTemporality": "unspecified",
    "isMonotonic": false,
    "type": "long",
    "unit": "{days}",
    "ingestGranularities": [
      60
    ]
  },
  {
    "namespace": {
      "name": "spacefleet",
      "version": 1
    },
    "kind": "metric",
    "name": "antimatter_level",
    "displayName": "Antimatter level",
    "description": "Anti matter level",
    "category": "current",
    "contentType": "gauge",
    "aggregationTemporality": "unspecified",
    "isMonotonic": false,
    "type": "long",
    "unit": "%",
    "ingestGranularities": [
      60
    ]
  },
  {
    "namespace": {
      "name": "spacefleet",
      "version": 1
    },
    "kind": "metric",
    "name": "matter_level",
    "displayName": "Matter Level",
    "description": "Matter level",
    "category": "current",
    "contentType": "gauge",
    "aggregationTemporality": "unspecified",
    "isMonotonic": false,
    "type": "long",
    "unit": "%",
    "ingestGranularities": [
      60
    ]
  },
  {
    "namespace": {
      "name": "spacefleet",
      "version": 1
    },
    "kind": "metric",
    "name": "shield_level",
    "displayName": "Shield Level",
    "description": "shield level of a room or spacecraft",
    "category": "current",
    "contentType": "gauge",
    "aggregationTemporality": "unspecified",
    "isMonotonic": false,
    "type": "double",
    "unit": "%",
    "ingestGranularities": [
      60
    ]
  },
  {
    "namespace": {
      "name": "spacefleet",
      "version": 1
    },
    "kind": "metric",
    "name": "trip_count",
    "displayName": "Trip Count",
    "description": "trip count for warp drive",
    "category": "sum",
    "contentType": "sum",
    "aggregationTemporality": "delta",
    "isMonotonic": false,
    "type": "long",
    "unit": "{count}",
    "ingestGranularities": [
      60
    ]
  },
  {
    "namespace": {
      "name": "spacefleet",
      "version": 1
    },
    "kind": "metric",
    "name": "suggestion_count",
    "displayName": "Mess hall suggestion events count",
    "description": "Number of mess_hall suggestion events",
    "category": "sum",
    "contentType": "sum",
    "aggregationTemporality": "delta",
    "isMonotonic": true,
    "type": "long",
    "unit": "{events}"
  },
  {
    "namespace": {
      "name": "spacefleet",
      "version": 1
    },
    "kind": "metric",
    "name": "shield_event_count",
    "displayName": "Sheild event count",
    "description": "Number of shield_event events",
    "category": "sum",
    "contentType": "sum",
    "aggregationTemporality": "delta",
    "isMonotonic": true,
    "type": "long",
    "unit": "{events}",
    "attributeDefinitions": {
      "attributes": {
        "type": {
          "type": "string",
          "description": "Shield event type"
        }
      }
    }
  },
  {
    "namespace": {
      "name": "spacefleet",
      "version": 1
    },
    "kind": "metric",
    "name": "newsfeed_count",
    "displayName": "Newsfeed event count",
    "description": "Number of newsfeed events",
    "category": "sum",
    "contentType": "sum",
    "aggregationTemporality": "delta",
    "isMonotonic": true,
    "type": "long",
    "unit": "{events}",
    "attributeDefinitions": {
      "attributes": {
        "feed_type": {
          "type": "string",
          "description": "Newsfeed event type"
        }
      }
    }
  },
  {
    "namespace": {
      "name": "spacefleet",
      "version": 1
    },
    "kind": "metric",
    "name": "test_metric",
    "displayName": "Test metric",
    "description": "Test metric",
    "category": "current",
    "contentType": "gauge",
    "aggregationTemporality": "unspecified",
    "isMonotonic": false,
    "type": "long",
    "unit": "{count}"
  }
]

Space Fleet includes the fmm:metric object in its manifest, spacefleet/manifest.json, in the dependencies and objects arrays:

  1. In the dependencies array, line 3 pulls in the fmm component, which is what the fmm:metric object depends on:

    "dependencies": [
        "dashui",
        "fmm",
        "k8s",
        "zodiac",
        "codex",
        "healthrule",
        "iam"
    ],
    
  2. In the objects array, these lines pull in the definition of Space Fleet's fmm:namespace object:

    "objects": [
    {
        "type": "fmm:metric",
        "objectsFile": "objects/fmm/metrics/metric-types.json"
    }
    ]
    
  3. Each of the Space Fleet solution's entity definitions in the fmm:entity object it defines must reference the metrics it defines in its fmm:metric object.

Metric Aggregations

Space Fleet defines the following aggregations that roll up metrics:

  • It rolls up metrics for shield entities into its spacecraft entities.
  • It rolls up metrics for torpedo_tube entities into its spacecraft entities.

To define these aggregations, the solution defines a MELT workflow of type fmm:metricAggregation in the file spacefleet/objects/fmm/metrics/metric-aggregations.json with the following contents:

[
    {
        "kind": "metricAggregation",
        "name": "shiled_to_spacecraft_aggregation_config",
        "displayName": "Shield To Spacecraft Metric Aggregation",
        "namespace": {
            "name": "spacefleet",
            "version": 1
        },
        "scopeFilter": "true",
        "fromEntityType": "spacefleet:shield",
        "toEntityType": "spacefleet:spacecraft",
        "path": "entities(spacefleet:shield).in(common:consists_of).from(spacefleet:spacecraft)",
        "metricMappings": [
            {
                "fromMetric": {
                    "type": "spacefleet:shield_level"
                },
                "toMetric": {
                    "type": "spacefleet:shield_level"
                }
            }
        ]
    },
    {
        "kind": "metricAggregation",
        "name": "torpedo_tube_to_spacecraft_aggregation_config",
        "displayName": "Torpedo Tube To Spacecraft Metric Aggregation",
        "namespace": {
            "name": "spacefleet",
            "version": 1
        },
        "scopeFilter": "true",
        "fromEntityType": "spacefleet:torpedo_tube",
        "toEntityType": "spacefleet:spacecraft",
        "path": "entities(spacefleet:torpedo_tube).in(common:consists_of).from(spacefleet:spacecraft)",
        "metricMappings": [
            {
                "fromMetric": {
                    "type": "spacefleet:torpedo_count"
                },
                "toMetric": {
                    "type": "spacefleet:torpedo_count"
                }
            }
        ]
    }
]

Space Fleet includes the fmm:metricAggregation object in its manifest, spacefleet/manifest.json, in the dependencies and objects arrays:

  1. In the dependencies array, line 3 pulls in the fmm component, which is what the fmm:entity object depends on:

    "dependencies": [
        "dashui",
        "fmm",
        "k8s",
        "zodiac",
        "codex",
        "healthrule",
        "iam"
    ]
    
  2. In the objects array, these lines pull in the definition of Space Fleet's fmm:metricAggregation object:

    "objects": [
        {
            "type": "fmm:metricAggregation",
            "objectsFile": "objects/fmm/metrics/metric-aggregations.json"
        }
    ]
    

Metric Derivations

In addition, the Space Fleet solution derives new metrics from the following events:

  • It derives the suggestion_count metric from a suggestion event.
  • It derives the shield_event_count metric from a shield_event event.

To define these derivations, Space Fleet defines a MELT workflow of type fmm:metricDerivation in the file spacefleet/objects/fmm/metrics/metric-derivations.json with the following contents:

[
    {
        "kind": "metricDerivation",
        "namespace": {
            "name": "spacefleet",
            "version": 1
        },
        "name": "suggestion_event_to_metric_derivation_config",
        "displayName": "count suggestion events",
        "description": "This configuration is for a metric that counts sugegstion events",
        "trigger": {
            "kind": "event",
            "type": "spacefleet:suggestion",
            "scopeFilter": "true"
        },
        "output": {
            "kind": "metric",
            "type": "spacefleet:suggestion_count"
        },
        "mapping": {
            "entity": "trigger.entityMetadata",
            "timestamp": "trigger.timestamp",
            "value": "1",
            "attributes": {}
        }
    },
    {
        "kind": "metricDerivation",
        "namespace": {
            "name": "spacefleet",
            "version": 1
        },
        "name": "shield_event_to_metric_derivation_config",
        "displayName": "count shield_event events",
        "description": "This configuration is for a metric that counts shield_event events",
        "trigger": {
            "kind": "event",
            "type": "spacefleet:shield_event",
            "scopeFilter": "true"
        },
        "output": {
            "kind": "metric",
            "type": "spacefleet:shield_event_count"
        },
        "mapping": {
            "entity": "trigger.entityMetadata",
            "timestamp": "trigger.timestamp",
            "value": "1",
            "attributes": {
              "type": "trigger.attributes.type.value"
            }
        }
    }
]

Space Fleet includes the fmm:metricDerivation object in its manifest, spacefleet/manifest.json, in the dependencies and objects arrays:

  1. In the dependencies array, line 3 pulls in the fmm component, which is what the fmm:metricDerivation object depends on:

    "dependencies": [
        "dashui",
        "fmm",
        "k8s",
        "zodiac",
        "codex",
        "healthrule",
        "iam"
    ]
    
  2. In the objects array, these lines pull in the definition of Space Fleet's fmm:metricDerivation object:

    "objects": [
        {
            "type": "fmm:metricDerivation",
            "objectsFile": "objects/fmm/metrics/metric-derivations.json"
        }
    ]
    

Learn More