Classes Files

mama/statslogger.h

Types

  Name
enum mamaSlEvent_ { MAMA_SL_EVENT_LOGIN = 0, MAMA_SL_EVENT_LOGOUT = 1, MAMA_SL_EVENT_SUB_CREATE = 2, MAMA_SL_EVENT_SUB_FAIL = 3, MAMA_SL_EVENT_SUB_DESTROY = 4, MAMA_SL_EVENT_SUB_ENT_PASS = 5}
enum mamaSlSubFailReason_ { MAMA_SL_SUB_FAIL_REGEX = 0, MAMA_SL_SUB_FAIL_CODE = 1, MAMA_SL_SUB_FAIL_TIMEOUT = 2, MAMA_SL_SUB_FAIL_NOT_FOUND = 3}
typedef enum mamaSlEvent_ mamaSlEvent
typedef enum mamaSlSubFailReason_ mamaSlSubFailReason

Functions

  Name
MAMAExpDLL const char * mamaStatsLogger_eventToString(mamaSlEvent event)
MAMAExpDLL const char * mamaStatsLogger_subFailReasonToString(mamaSlSubFailReason subFailReason)
MAMAExpDLL mama_status mamaStatsLogger_allocate(mamaStatsLogger * logger)
MAMAExpDLL mama_status mamaStatsLogger_create(mamaStatsLogger logger, mamaQueue queue, mamaTransport tport)
MAMAExpDLL mama_status mamaStatsLogger_createForStats(mamaStatsLogger logger, mamaQueue queue, mamaTransport tport, const char * topic)
MAMAExpDLL mama_status mamaStatsLogger_destroy(mamaStatsLogger logger)
MAMAExpDLL mama_status mamaStatsLogger_setReportInterval(mamaStatsLogger logger, mama_f64_t interval)
MAMAExpDLL mama_status mamaStatsLogger_setReportSize(mamaStatsLogger logger, mama_size_t numEvents)
MAMAExpDLL mama_status mamaStatsLogger_setUserName(mamaStatsLogger logger, const char * userName)
MAMAExpDLL mama_status mamaStatsLogger_getUserName(const mamaStatsLogger logger, const char ** userName)
MAMAExpDLL mama_status mamaStatsLogger_setHostName(mamaStatsLogger logger, const char * hostName)
MAMAExpDLL mama_status mamaStatsLogger_getHostName(const mamaStatsLogger logger, const char ** hostName)
MAMAExpDLL mama_status mamaStatsLogger_setApplicationName(mamaStatsLogger logger, const char * appName)
MAMAExpDLL mama_status mamaStatsLogger_getApplicationName(const mamaStatsLogger logger, const char ** appName)
MAMAExpDLL mama_status mamaStatsLogger_setApplicationClass(mamaStatsLogger logger, const char * applClass)
MAMAExpDLL mama_status mamaStatsLogger_getApplicationClass(const mamaStatsLogger logger, const char ** appClass)
MAMAExpDLL mama_status mamaStatsLogger_setIpAddress(mamaStatsLogger logger, const char * ipAddress)
MAMAExpDLL mama_status mamaStatsLogger_getIpAddress(const mamaStatsLogger logger, const char ** ipAddress)
MAMAExpDLL mama_status mamaStatsLogger_logLogin(mamaStatsLogger logger)
MAMAExpDLL mama_status mamaStatsLogger_logLogout(mamaStatsLogger logger)
MAMAExpDLL mama_status mamaStatsLogger_logSubscriptionEntitlePass(mamaStatsLogger logger, mamaSubscription subscription, int32_t entitleCode)
MAMAExpDLL mama_status mamaStatsLogger_logSubscriptionFail(mamaStatsLogger logger, mamaSubscription subscription, mamaSlSubFailReason reason)
MAMAExpDLL mama_status mamaStatsLogger_logSubscriptionDestroy(mamaStatsLogger logger, mamaSubscription subscription)
MAMAExpDLL mama_status mamaStatsLogger_addStatMsg(mamaStatsLogger * logger, mamaMsg msg)
MAMAExpDLL mama_status mamaStatsLogger_sendReport(mamaStatsLogger * logger)
MAMAExpDLL mama_status mamaStatsLogger_getLogMsgStats(mamaStatsLogger logger, mama_bool_t * logMsgStats)
MAMAExpDLL mama_status mamaStatsLogger_setLogMsgStats(mamaStatsLogger logger, mama_bool_t logMsgStats)
MAMAExpDLL mama_status mamaStatsLogger_incMsgCount(mamaStatsLogger statsLogger)

Defines

  Name
  SL_TOPIC_USAGE_LOG
  STATS_TOPIC

Types Documentation

enum mamaSlEvent_

Enumerator Value Description
MAMA_SL_EVENT_LOGIN 0  
MAMA_SL_EVENT_LOGOUT 1  
MAMA_SL_EVENT_SUB_CREATE 2  
MAMA_SL_EVENT_SUB_FAIL 3  
MAMA_SL_EVENT_SUB_DESTROY 4  
MAMA_SL_EVENT_SUB_ENT_PASS 5  

The event types handled by the stats logger

enum mamaSlSubFailReason_

Enumerator Value Description
MAMA_SL_SUB_FAIL_REGEX 0  
MAMA_SL_SUB_FAIL_CODE 1  
MAMA_SL_SUB_FAIL_TIMEOUT 2  
MAMA_SL_SUB_FAIL_NOT_FOUND 3  

The reasons for a subscription to fail

typedef mamaSlEvent

typedef enum mamaSlEvent_ mamaSlEvent;

The event types handled by the stats logger

typedef mamaSlSubFailReason

typedef enum mamaSlSubFailReason_ mamaSlSubFailReason;

The reasons for a subscription to fail

Functions Documentation

function mamaStatsLogger_eventToString

MAMAExpDLL const char * mamaStatsLogger_eventToString(
    mamaSlEvent event
)

Parameters:

  • event The mamaSlEvent to convert.

Convert a mamaSlEvent value to a string. Do no attempt to free the string result.

function mamaStatsLogger_subFailReasonToString

MAMAExpDLL const char * mamaStatsLogger_subFailReasonToString(
    mamaSlSubFailReason subFailReason
)

Parameters:

  • subFailReason The mamaSlSubFailReason to convert.

Convert a mamaSlSubFailReason value to a string. Do no attempt to free the string result.

function mamaStatsLogger_allocate

MAMAExpDLL mama_status mamaStatsLogger_allocate(
    mamaStatsLogger * logger
)

Parameters:

  • logger Where the address of the new logger will be written

Allocate memory for a new stats logger. The logger is not actually created until a call the create() functions is made. Memory must be freed using the mamaStatsLogger_Deallocate() function.

function mamaStatsLogger_create

MAMAExpDLL mama_status mamaStatsLogger_create(
    mamaStatsLogger logger,
    mamaQueue queue,
    mamaTransport tport
)

Parameters:

  • logger The location of a mamaStatsLogger
  • queue The queue for the Stats Logger to use for publishing
  • tport the transport

Create and activate mamaStatsLogger object.

function mamaStatsLogger_createForStats

MAMAExpDLL mama_status mamaStatsLogger_createForStats(
    mamaStatsLogger logger,
    mamaQueue queue,
    mamaTransport tport,
    const char * topic
)

function mamaStatsLogger_destroy

MAMAExpDLL mama_status mamaStatsLogger_destroy(
    mamaStatsLogger logger
)

Parameters:

  • logger The location of a mamaStatsLogger

Destroy a mamaStatsLogger object, freeing any memory

function mamaStatsLogger_setReportInterval

MAMAExpDLL mama_status mamaStatsLogger_setReportInterval(
    mamaStatsLogger logger,
    mama_f64_t interval
)

Parameters:

  • logger The location of a mamaStatsLogger
  • interval The report interval in seconds

Set the reporting interval

function mamaStatsLogger_setReportSize

MAMAExpDLL mama_status mamaStatsLogger_setReportSize(
    mamaStatsLogger logger,
    mama_size_t numEvents
)

Parameters:

  • logger The location of a mamaStatsLogger
  • numEvents The number of events to report after

Set the maximum number of events to cache before reporting

function mamaStatsLogger_setUserName

MAMAExpDLL mama_status mamaStatsLogger_setUserName(
    mamaStatsLogger logger,
    const char * userName
)

Parameters:

  • logger The logger object to update.
  • userName The user name for the logger

Set the userName

function mamaStatsLogger_getUserName

MAMAExpDLL mama_status mamaStatsLogger_getUserName(
    const mamaStatsLogger logger,
    const char ** userName
)

Parameters:

  • logger The logger object to check.
  • userName Location of the result for the description of the logger.

Get the userName

function mamaStatsLogger_setHostName

MAMAExpDLL mama_status mamaStatsLogger_setHostName(
    mamaStatsLogger logger,
    const char * hostName
)

Parameters:

  • logger The logger object to update.
  • hostName The host name for the logger

Set the hostName

function mamaStatsLogger_getHostName

MAMAExpDLL mama_status mamaStatsLogger_getHostName(
    const mamaStatsLogger logger,
    const char ** hostName
)

Parameters:

  • logger The logger object to check.
  • hostName Location of the result for the description of the logger.

Get the hostName

function mamaStatsLogger_setApplicationName

MAMAExpDLL mama_status mamaStatsLogger_setApplicationName(
    mamaStatsLogger logger,
    const char * appName
)

Parameters:

  • logger The logger object to update.
  • appName The applicationName for the logger

Set the applicationName

function mamaStatsLogger_getApplicationName

MAMAExpDLL mama_status mamaStatsLogger_getApplicationName(
    const mamaStatsLogger logger,
    const char ** appName
)

Parameters:

  • logger The logger object to check.
  • appName Location of the result for the applicationName

Get the applicationName

function mamaStatsLogger_setApplicationClass

MAMAExpDLL mama_status mamaStatsLogger_setApplicationClass(
    mamaStatsLogger logger,
    const char * applClass
)

Parameters:

  • logger The logger object to update.
  • applClass The applicationName for the logger

Set the applicationClass

function mamaStatsLogger_getApplicationClass

MAMAExpDLL mama_status mamaStatsLogger_getApplicationClass(
    const mamaStatsLogger logger,
    const char ** appClass
)

Parameters:

  • logger The logger object to check.
  • appClass Location of the result for the applicationClass

Get the applicationClass

function mamaStatsLogger_setIpAddress

MAMAExpDLL mama_status mamaStatsLogger_setIpAddress(
    mamaStatsLogger logger,
    const char * ipAddress
)

Parameters:

  • logger The logger object to update.
  • ipAddress The ipAddress for the logger

Set the ipAddress

function mamaStatsLogger_getIpAddress

MAMAExpDLL mama_status mamaStatsLogger_getIpAddress(
    const mamaStatsLogger logger,
    const char ** ipAddress
)

Parameters:

  • logger The logger object to check.
  • ipAddress Location of the result for the ipAddress of the logger.

Get the ipAddress

function mamaStatsLogger_logLogin

MAMAExpDLL mama_status mamaStatsLogger_logLogin(
    mamaStatsLogger logger
)

Parameters:

  • logger The logger object to use.

Log a login event

function mamaStatsLogger_logLogout

MAMAExpDLL mama_status mamaStatsLogger_logLogout(
    mamaStatsLogger logger
)

Parameters:

  • logger The logger object to use.

Log a logout event

function mamaStatsLogger_logSubscriptionEntitlePass

MAMAExpDLL mama_status mamaStatsLogger_logSubscriptionEntitlePass(
    mamaStatsLogger logger,
    mamaSubscription subscription,
    int32_t entitleCode
)

Parameters:

  • logger The logger object to use.
  • subscription the subscription
  • entitleCode the entitlement code

Log a subscription entitlement check pass event

function mamaStatsLogger_logSubscriptionFail

MAMAExpDLL mama_status mamaStatsLogger_logSubscriptionFail(
    mamaStatsLogger logger,
    mamaSubscription subscription,
    mamaSlSubFailReason reason
)

Parameters:

  • logger The logger object to use.
  • subscription the subscription
  • reason the reason

Log a subscription fail event

function mamaStatsLogger_logSubscriptionDestroy

MAMAExpDLL mama_status mamaStatsLogger_logSubscriptionDestroy(
    mamaStatsLogger logger,
    mamaSubscription subscription
)

Parameters:

  • logger The logger object to use.
  • subscription the subscription

Log a subscription destroy event

function mamaStatsLogger_addStatMsg

MAMAExpDLL mama_status mamaStatsLogger_addStatMsg(
    mamaStatsLogger * logger,
    mamaMsg msg
)

function mamaStatsLogger_sendReport

MAMAExpDLL mama_status mamaStatsLogger_sendReport(
    mamaStatsLogger * logger
)

function mamaStatsLogger_getLogMsgStats

MAMAExpDLL mama_status mamaStatsLogger_getLogMsgStats(
    mamaStatsLogger logger,
    mama_bool_t * logMsgStats
)

function mamaStatsLogger_setLogMsgStats

MAMAExpDLL mama_status mamaStatsLogger_setLogMsgStats(
    mamaStatsLogger logger,
    mama_bool_t logMsgStats
)

function mamaStatsLogger_incMsgCount

MAMAExpDLL mama_status mamaStatsLogger_incMsgCount(
    mamaStatsLogger statsLogger
)

Macros Documentation

define SL_TOPIC_USAGE_LOG

#define SL_TOPIC_USAGE_LOG "SL_TOPIC_USAGE_LOG"

define STATS_TOPIC

#define STATS_TOPIC "STATS_TOPIC"

Source code

/* $Id$
 *
 * OpenMAMA: The open middleware agnostic messaging API
 * Copyright (C) 2011 NYSE Technologies, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef MamaStatsLoggerH__
#define MamaStatsLoggerH__

#include <mama/status.h>
#include <mama/types.h>

#if defined(__cplusplus)
extern "C" {
#endif

/************************************************************************
* Constants
*************************************************************************/
#define SL_TOPIC_USAGE_LOG "SL_TOPIC_USAGE_LOG"
#define STATS_TOPIC        "STATS_TOPIC"

/************************************************************************
* Typedefs
*************************************************************************/
typedef enum mamaSlEvent_
{
    MAMA_SL_EVENT_LOGIN         = 0,
    MAMA_SL_EVENT_LOGOUT        = 1,
    MAMA_SL_EVENT_SUB_CREATE    = 2,
    MAMA_SL_EVENT_SUB_FAIL      = 3,
    MAMA_SL_EVENT_SUB_DESTROY   = 4,
    MAMA_SL_EVENT_SUB_ENT_PASS  = 5
} mamaSlEvent;

typedef enum mamaSlSubFailReason_
{
    MAMA_SL_SUB_FAIL_REGEX      = 0,
    MAMA_SL_SUB_FAIL_CODE       = 1,
    MAMA_SL_SUB_FAIL_TIMEOUT    = 2,
    MAMA_SL_SUB_FAIL_NOT_FOUND  = 3
} mamaSlSubFailReason;

/************************************************************************
* Functions
*************************************************************************/

MAMAExpDLL
extern const char*
mamaStatsLogger_eventToString (mamaSlEvent  event);
MAMAExpDLL
extern const char*
mamaStatsLogger_subFailReasonToString (mamaSlSubFailReason  subFailReason);

MAMAExpDLL
extern mama_status
mamaStatsLogger_allocate (mamaStatsLogger* logger);

MAMAExpDLL
extern mama_status
mamaStatsLogger_create (mamaStatsLogger  logger,
                        mamaQueue        queue,
                        mamaTransport    tport);

MAMAExpDLL
extern mama_status
mamaStatsLogger_createForStats (mamaStatsLogger  logger,
                                mamaQueue        queue,
                                mamaTransport    tport,
                                const char*      topic);


MAMAExpDLL
extern mama_status
mamaStatsLogger_destroy (mamaStatsLogger  logger);

MAMAExpDLL
extern mama_status
mamaStatsLogger_setReportInterval (mamaStatsLogger logger,
                                   mama_f64_t      interval);

MAMAExpDLL
extern mama_status
mamaStatsLogger_setReportSize(mamaStatsLogger logger,
                              mama_size_t     numEvents);

MAMAExpDLL
extern mama_status
mamaStatsLogger_setUserName (mamaStatsLogger    logger,
                            const char*         userName);

MAMAExpDLL
extern mama_status
mamaStatsLogger_getUserName (const mamaStatsLogger  logger,
                             const char**           userName);


MAMAExpDLL
extern mama_status
mamaStatsLogger_setHostName (mamaStatsLogger logger,
                             const char*     hostName);

MAMAExpDLL
extern mama_status
mamaStatsLogger_getHostName (const mamaStatsLogger logger,
                             const char**          hostName);

MAMAExpDLL
extern mama_status
mamaStatsLogger_setApplicationName (mamaStatsLogger    logger,
                                    const char*        appName);

MAMAExpDLL
extern mama_status
mamaStatsLogger_getApplicationName (const mamaStatsLogger  logger,
                                    const char**           appName);

MAMAExpDLL
extern mama_status
mamaStatsLogger_setApplicationClass (mamaStatsLogger logger,
                                    const char*      applClass);

MAMAExpDLL
extern mama_status
mamaStatsLogger_getApplicationClass (const mamaStatsLogger  logger,
                                     const char**           appClass);

MAMAExpDLL
extern mama_status
mamaStatsLogger_setIpAddress (mamaStatsLogger logger,
                              const char*     ipAddress);

MAMAExpDLL
extern mama_status
mamaStatsLogger_getIpAddress (const mamaStatsLogger  logger,
                              const char**           ipAddress);

MAMAExpDLL
extern mama_status
mamaStatsLogger_logLogin (mamaStatsLogger logger);

MAMAExpDLL
extern mama_status
mamaStatsLogger_logLogout (mamaStatsLogger logger);

MAMAExpDLL
extern mama_status
mamaStatsLogger_logSubscriptionEntitlePass (mamaStatsLogger logger,
                                            mamaSubscription subscription,
                                            int32_t          entitleCode);

MAMAExpDLL
extern mama_status
mamaStatsLogger_logSubscriptionFail (mamaStatsLogger     logger,
                                     mamaSubscription    subscription,
                                     mamaSlSubFailReason reason);
MAMAExpDLL
extern mama_status
mamaStatsLogger_logSubscriptionDestroy (mamaStatsLogger  logger,
                                        mamaSubscription subscription);

MAMAExpDLL
extern mama_status
mamaStatsLogger_addStatMsg (mamaStatsLogger* logger,
                                mamaMsg          msg);

MAMAExpDLL
extern mama_status
mamaStatsLogger_sendReport (mamaStatsLogger* logger);

MAMAExpDLL
extern mama_status
mamaStatsLogger_getLogMsgStats (mamaStatsLogger  logger,
                                mama_bool_t*     logMsgStats);
MAMAExpDLL
extern mama_status
mamaStatsLogger_setLogMsgStats (mamaStatsLogger  logger,
                                mama_bool_t      logMsgStats);

MAMAExpDLL
extern mama_status
mamaStatsLogger_incMsgCount (mamaStatsLogger statsLogger);

#if defined(__cplusplus)
}
#endif

#endif

Updated on 2023-03-31 at 15:29:16 +0100