Logging.xid.xml 17.2 KB
<?xml version="1.0" encoding="UTF-8" ?>

<!--
  Copyright (c) 2017, TeleCommunication Systems, Inc.,
  a wholly-owned subsidiary of Comtech Telecommunications Corp.
  and/or affiliates of TeleCommunication Systems, Inc.
  All rights reserved.
  TeleCommunication Systems, Inc. PROPRIETARY/CONFIDENTIAL.
  Use is subject to license terms included in the distribution.
-->

<specification xmlns="https://xid.location.studio/schema/V1.0.0/XtensibleInterfaceDefinition.xsd"
               xmlns:xid="https://xid.location.studio/schema/V1.0.0/XtensibleInterfaceDefinition.xsd"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="https://xid.location.studio/schema/V1.0.0/XtensibleInterfaceDefinition.xsd https://xid.location.studio/schema/V1.0.0/XtensibleInterfaceDefinition.xsd"
               identity="Logging.xid.xml">
  <title>Tensor Logging Messages</title>
  <comment>
    This file contains the base type definitions for logging messages and data. All ENT micro-service compliant systems shall support these datatypes
    for capturing various types of logging information including actionable messages, trace, and usage data.  Logging messages are polymorphic and extensible
    as needed to support various types of information.
  </comment>

  <import ref="https://xid.location.studio/Tensor/V1.1/Common.xid.xml" local="Common.xid.xml" />

  <namespace name="Logging">
    <using namespace="Tensor"/>

    <!-- 
    *******************************************************
    Enumeration Definitions
    *******************************************************
    -->
    <enum name="MessageType" type="Tensor.uint8" default="undefined">
      <comment>
        Message types define the base type identifiers for logging messages.  These are used to
        identify the type of logging data.  The Message type is not a closed set and can be extended as needed.
        The types defined here are common to every system.   Type values below 64 are reserved for the core logging extensions
        Any non-core message types should define type identifiers greater than 64.
      </comment>
      <literal name="undefined" value="0">
        <comment>Message type is not defined.  This is a reserved value and should not be used in most situations.</comment>
      </literal>
      <literal name="ActionMsg" value="1">
        <comment>Defines a message that requires some responsive action. See Tensor.Logging.ActionMsg structure for more information.</comment>
      </literal>
      <literal name="TraceMsg" value="2">
        <comment>Defines a message capturing software trace data typically used for debugging.  See Tensor.Logging.TraceMsg structure for more information.</comment>
      </literal>
      <literal name="UsageMsg" value="3">
        <comment>Defines a message for capturing usage data.   See Tensor.Logging.UsageMsg for more information.</comment>
      </literal>
      <literal name="MetricMsg" value="4">
        <comment>Defines a message for capturing metric data.   See Tensor.Logging.MetricMsg for more information.</comment>
      </literal>
    </enum>

    <enum name="Severity" type="int8" default="indeterminate">
      <comment>
        Severity is defined as part of an Tensor.Logging.ActionMsg describing the severity of the issue. This is an extensible list that can be added to as
        new severities are determine.   In general, try to use the core defined severities or add new core ones as needed.  Custom severity should be avoided.  If defined,
        however, start with values > 64.  Values less than 64 are reserved.
      </comment>
      <literal name="indeterminate" value="0">
        <comment>Severity of the issue is indeterminate.</comment>
      </literal>
      <literal name="warning" value="1">
        <comment>
          Severity indicates message is a warning regarding the specified issue.  Warnings describe a potental issue that
          may require additional monitoring over time.  However, it is not deemed as having a significant
          impaction on system operation.
        </comment>
      </literal>
      <literal name="minor" value="2">
        <comment>
          Message is describing a minor issue, which requires some action. A
          minor issue is something that does not have a wide scale impact on system operation.
          For example a minor issue might be something that would affect a single transaction.
        </comment>
      </literal>
      <literal name="major" value="3">
        <comment>
          Message is describing a major issue, which requires action.  A
          major issue is something that affects the system in a signficant way
          such as having impact on multiple transactions.
        </comment>
      </literal>
      <literal name="critical" value="4">
        <comment>
          Message is describing a critical issue, which requires immediate action. Critical issues
          are typically catastrophic system issues affecting all transactions in a very significant way.
        </comment>
      </literal>
      <literal name="cleared" value="5">
        <comment>Message is describing an issue has been resolved or no longer requires actions.</comment>
      </literal>
    </enum>

    <enum name="Category" type="int8" default="processingError">
      <comment>
        The category decribes the general category for an ActionMsg.   This is an extensible list that can be added to as
        new categories are needed.   In general, try to use the core defined categories or add new ones as needed.  Custom categories should start with
        values > 64.   Values less than 64 are reserved.
      </comment>
      <literal name ="undefined" value ="0">
        <comment>Action category is undefined or not known.</comment>
      </literal>
      <literal name="communications" value="1">
        <comment>A communications and/or networking related issue.</comment>
      </literal>
      <literal name="qualityOfService" value="2">
        <comment>A quality of service related issue.</comment>
      </literal>
      <literal name="processingError" value="3">
        <comment>A processing or runtime related issue.</comment>
      </literal>
      <literal name="equipment" value="4">
        <comment>An equipment related issue.</comment>
      </literal>
      <literal name="environmental" value="5">
        <comment>A environment related issue.</comment>
      </literal>
    </enum>

    <enum name="TraceLevel" type="Tensor.int8" default="undefined">
      <comment>Trace level defines the level of tracing information reported.  This allows for filtering of information based on rank.</comment>
      <literal name="undefined" value="0">
        <comment>Trace level is not defined.</comment>
      </literal>
      <literal name="overview" value="1">
        <comment>Information contained in the trace message is high-level or summary.</comment>
      </literal>
      <literal name="trace" value="2">
        <comment>Information contained in the trace message is related to program flow and sequencing.</comment>
      </literal>
      <literal name="detail" value="3">
        <comment>Information contained in the trace message is detailed information.</comment>
      </literal>
      <literal name="debug" value="4">
        <comment>Information contained in the trace message contains debugging information.</comment>
      </literal>
    </enum>

    <struct name="DebugInfo">
      <comment>
        Structure captures the file and line number information for Trace Messages.   This provides information about where the trace message was sent.
      </comment>
      <elem name="file" type="Tensor.string" multiplicity="1" ord="64">
        <comment>File name where this message was logged.</comment>
      </elem>
      <elem name="line" type="Tensor.uint32" multiplicity="1" ord="65">
        <comment>Line number in file where this message is logged.</comment>
      </elem>
      <elem name="thid" type="Tensor.uint64" multiplicity="1" default="0" ord="66">
        <comment>Optional Thread ID,  if not specified, default value is 0.</comment>
      </elem>

    </struct>

    <!-- 
    *******************************************************
    Metric Structure Definitions
    *******************************************************
    -->

    <enum name="MetricType" type="Tensor.uint8" default="undefined">
      <literal name="undefined" value="0">
        <comment>Metric type is not defined.  This is a reserved value and should not be used in most situations.</comment>
      </literal>
      <literal name="PegCount" value="1">
        <comment>Defines a simple monotonically incremented counter.</comment>
      </literal>
      <literal name="AppMetrics" value="2">
        <comment>Defines a complex metric measuring duration and concurrency.</comment>
      </literal>
    </enum>

    <struct name="Metric">
      <elem name="metricType" type="MetricType" multiplicity="1" rttd="true" ord="64">
        <comment>This specifies the type of the reported metric.</comment>
      </elem>
      <elem name="name" type="string" multiplicity="1" ord="65">
        <comment>Name of the reported metric.</comment>
      </elem>
    </struct>

    <struct name="PegCount" type="Metric" rttkey="Logging.MetricType.PegCount">
      <elem name="value"        type="uint32" multiplicity="1" ord="80">
        <comment>Value of peg count since last reporting.</comment>
      </elem>
    </struct>

    <struct name="AppMetrics" type="Metric" rttkey="Logging.MetricType.AppMetrics">
      <elem name="totalCount"   type="uint32" multiplicity="1" ord="80">
        <comment>Total count of invocations since last reporting.</comment>
      </elem>
      <elem name="currentCount" type="uint32" multiplicity="1" ord="81">
        <comment>concurrent invocations at time of reporting.</comment>
      </elem>
      <elem name="peakCount"    type="uint32" multiplicity="1" ord="82">
        <comment>Peak concurrent invocations since last reporting.</comment>
      </elem>
      <elem name="totalTime"    type="uint64" multiplicity="1" ord="83">
        <comment>Total time spent on invocations in nanoseconds since last reporting.</comment>
      </elem>
      <elem name="peakTime"     type="uint64" multiplicity="1" ord="84">
        <comment>Peak time for an invocation in nanoseconds since last reporting.</comment>
      </elem>
      <elem name="successCount" type="uint32" multiplicity="1" ord="85">
        <comment>Count of successful invocations since last reporting.</comment>
      </elem>
      <elem name="failureCount" type="uint32" multiplicity="1" ord="86">
        <comment>Count of failed invocations since last reporting.</comment>
      </elem>
    </struct>



    <!-- 
    *******************************************************
    Message Structure Definitions
    *******************************************************
    -->

    <struct name="MessageBase">
      <comment>
        Base type for all messages.  This contains only the polymorphic type data.  The structure Message derives from this
        structure and provides common fields typically useful in logging related applications.   Derive from this structure
        if messages are related to logging but do not require the standard fields.  It is recommended that most specializations
        should start with Message as the base type.
      </comment>
      <elem name="type" type="MessageType" multiplicity="1" rttd="true" ord="64">
        <comment> This specifies the type of message.</comment>
      </elem>
      <elem name="date" type="datetime" multiplicity="1" ord="65">
        <comment>The date/time the message occured.</comment>
      </elem>
      <elem name="source" type="Tensor.uri" multiplicity="1" ord="66">
        <comment>URI Identifying name of the component or process logging the message.</comment>
      </elem>
      <elem name="info" type="string" multiplicity="0..1" ord="67">
        <comment>Optional free form string data.</comment>
      </elem>
      <elem name="data" type="Tensor.json" multiplicity="0..1" ord="68">
        <comment>Optional structured data.</comment>
      </elem>
      <elem name="debug" type="DebugInfo" multiplicity="0..1" ord="69">
        <comment>Optional debug information for message.</comment>
      </elem>
    </struct>

    <!-- Message type -->
    <struct name="TransactionMsg" type="MessageBase">
      <comment>
        Basic logging message data common to all types of logging.  This specializes MessageBase and is the standard logging message.  Create custom message types as needed; however, consider
        specializing from the core defined sub-types of ActionMsg, Trace, or Usage depending upon need.   In most cases, you should not use this message directly.
      </comment>
      <elem name="tid" type="Tensor.UUID" multiplicity="1" ord="80">
        <comment>Unique ID identifying the internal transaction related to the message.</comment>
      </elem>
      <elem name="etid" type="string" multiplicity="0..1" ord="81">
        <comment>Optional externally defined transaction ID.</comment>
      </elem>
      <elem name="acctid" type="string" multiplicity="0..1" ord="82">
        <comment>Optional externally defined account/group identifier.</comment>
      </elem>
      <elem name="devid" type="string" multiplicity="0..1" ord="83">
        <comment>Optional externally defined device identifier.</comment>
      </elem>
      <elem name="appid" type="string" multiplicity="0..1" ord="84">
        <comment>Optional externally defined application (or application key) identifier.</comment>
      </elem>

    </struct>

    <!-- ActionMsg type -->
    <struct name="ActionMsg" type="TransactionMsg" rttkey="Logging.MessageType.ActionMsg">
      <comment>
        A message that requires another system/user to respond with some action.
      </comment>
      <elem name="id" type="Tensor.uri" multiplicity="1" ord="96">
        <comment>Error code identifying the fault type</comment>
      </elem>
      <elem name="severity" type="Severity" multiplicity="1" ord="97"/>
      <elem name="category" type="Category" multiplicity="1" ord="98"/>
      <elem name="iid" type="Tensor.uri" multiplicity="0..1" ord="99">
        <comment>Optional incident identifier used to identify an action instance uniquely.  This is needed when there are stateful clearing events.</comment>
      </elem>
    </struct>

    <!-- TraceMsg type -->
    <struct name="TraceMsg" type="TransactionMsg" rttkey="Logging.MessageType.TraceMsg">
      <comment>
        Trace message for general logging and reporting of information
      </comment>
      <elem name="level" type="TraceLevel" multiplicity="1" ord="96">
        <comment>Indicates the level of the trace: overview is the highest level and debug is the lowest</comment>
      </elem>
    </struct>

    <!-- UsageMsg type -->
    <struct name="UsageMsg" type="TransactionMsg" rttkey="Logging.MessageType.UsageMsg">
      <comment>
        Message capturing usage information for reporting statistical, transactional, edge, location, or other useful information generated in the normal
        operation of the system.
      </comment>
      <elem name="uri" type="Tensor.uri" multiplicity="1" rttd="true" ord="96">
        <comment> Usage id specific to a type of usage information.  Can be general or application specific.</comment>
      </elem>
    </struct>

    <!-- MetricMsg type -->
    <struct name="MetricMsg" type="MessageBase" rttkey="Logging.MessageType.MetricMsg">
      <elem name="start" type="datetime" multiplicity="1" ord="80">
        <comment>The date/time of the start of the report interval.  date is end the end of the report interval.</comment>
      </elem>
      <elem name="duration" type="uint16" multiplicity="1" ord="81">
        <tag name="unit" value="sec"/>
        <comment>The interval in seconds for the metric report.</comment>
      </elem>
      <elem name="metrics" type="Metric" multiplicity="1..*" polymorphic="true" ord="82">
        <comment>List of metrics being reported.</comment>
      </elem>
    </struct>

    <!-- 
    *******************************************************
    Standard Usage Definitions
    *******************************************************
    -->

    <!--TaskReport Msg-->
    <struct name="TaskReport"  type="Logging.UsageMsg" rttkey='"tpf://taskrpt"'>
      <comment>
        Message reports processing task result data.  Tasks are any execution unit the
        that is deemed to have a specific beginning and end.  This is a fairly generic
        definition making the usage report suitable for a variety of applications.
      </comment>
      <elem name="taskid" type="string" multiplicity="1" ord="112">
        <comment>
          The unique tasks identifier. A source may have multiple tasks, this field assigns
          an identifier that uniquely characterizes what the task was that was accomplished.
        </comment>
      </elem>
      <elem name="start" type="datetime" multiplicity="1" ord="113">
        <comment>
          The start time at which the processor is used.
        </comment>
      </elem>
      <elem name="duration" type="uint32" multiplicity="1" ord="114">
        <tag name="unit" value="usec"/>
        <comment>
          The duration of the processing in microseconds.
        </comment>
      </elem>
      <elem name="result" type="ResultCode" multiplicity="1" ord="115">
        <comment>The task result code.</comment>
      </elem>
    </struct>

  </namespace>
</specification>