# All files / src/model events.coffee

100% Statements 7/7
100% Branches 0/0
100% Functions 0/0
100% Lines 7/7

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    291x
    1x
    1x
    1x

    1x

    1x

    1x
     mongoose = require "mongoose"
    server = require "../server"
    connectionDefault = server.connectionDefault
    Schema = mongoose.Schema

    exports.eventTypes = ['channel', 'primary', 'route', 'orchestration']

    # Active transaction events
    #
    # A short term collection for functions that require 'live' analysis of transactions
    # e.g. alerting and the visualizer
    #
    # Events are more fine-grained than individual transactions
    #
    EventsSchema = new Schema
      "created":              type: Date, default: Date.now, expires: '1h'
      "channelID":            type: Schema.Types.ObjectId, required: true
      "transactionID":        type: Schema.Types.ObjectId, required: true
      "type":                 type: String, enum: exports.EventTypes
      "event":                type: String, enum: ['start', 'end']
      "name":                 String
      "status":               Number
      "statusType":           type: String, enum: ['success', 'error']  # status string supported by visualizer (e.g. 'error' is red)
      "normalizedTimestamp":  String
      "mediator":             String
      "autoRetryAttempt":     Number

    exports.Event = connectionDefault.model 'Event', EventsSchema