[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-server-cvs
Subject:    [Server-cvs] include hxservermetrics.h,NONE,1.1.2.1
From:       dcollins () helixcommunity ! org
Date:       2013-07-30 20:17:41
[Download RAW message or body]

Update of /cvsroot/server/include
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv30222

Added Files:
      Tag: SERVER_NUCLEUS
	hxservermetrics.h 
Log Message:
Synopsis
========
Implements an RPDS API to allow plugins to report metrics to metricspln

Branches:  Jupiter / SERVER_NUCLEUS
Suggested Reviewers:  Jamie, Chytanya


Description
===========
This implements a server-core mechanism to provide a simple and
light-weight mechanism for plugins to report metrics to metricspln.
Metricspln asynchronously takes responsibility for relaying these
metrics upstream as appropriate.

Plugins QI the context for IHXServerMetricsNotifier:
* metricspln calls IHXServerMetricsNotifier::Init() once to establish
  itself as the recipient of metrics events.  There can be only
  one server-wide recipient of metrics events.
* Plugins with stats (for now just cloudpln) send them with
  IHXServerMetricsNotifier::NotifyEvent().

Events are wrapped in a generic IHXServerMetricsEvent COM interface.
The specific event objects that cloudmgr sends are implemented in a
new library, metricsutil/metricsevents.cpp.  This approach was taken
to keep all details of the events out of the server core.  Only
the sender and recipient plugins need to know the event details.

The server context for each thread in the server core is updated
to have a MetricsNotifier object, which implements the
IHXServerMetricsNotifier interface.
For event senders, this object dispatches the event over to the
metrics plugin.  For the metrics plugin thread, this object calls
the IHXServerMetricsObserver::NotifyEvent() callback.

Events are dispatched between threads using the IHXRemoteScheduler
mechanism, which is built on top of DispatchQ and ServerScheduler.
The NotifyEvent() callbacks run outside the server's mainlock.

This does not update metricspln to actually use the metrics
event mechanism, so currently this code does not actually 
dispatch the metrics events.  Before this can be enabled
additional dev integration and debugging is needed.



Files Affected
==============
NEW:
server/include/hxservermetrics.h
server/engine/context/metrics_notifier.cpp
server/engine/context/pub/metrics_notifier.h
server_rn/nucleus/cloud/manager/cloudmetrics.cpp
server_rn/nucleus/cloud/manager/cloudmetrics.h
server_rn/nucleus/analytics/metricsutil/Umakefil
server_rn/nucleus/analytics/metricsutil/metricsevents.cpp
server_rn/nucleus/analytics/metricsutil/pub/metricsevents.h

MODIFIED:
server_rn/nucleus/cloud/manager/downloadmgr.cpp
server_rn/nucleus/cloud/manager/downloadmgr.h
server_rn/nucleus/cloud/manager/make_plugin
server_rn/nucleus/cloud/manager/uploadmgr.cpp
server_rn/nucleus/cloud/manager/uploadmgr.h
server/engine/context/Umakefil
server/engine/core/proc_container.cpp
server/engine/core/server_context.cpp
server/engine/core/pub/proc_container.h
server/include/server_piids.h
SERVER_NUCLEUS.bif


Testing Performed
=================
Unit Tests:
- None

Integration Tests:
- Used an observer stub for initial debugging.  More dev testing
  is needed prior to completion.

Leak Tests:
- None

Performance Tests:
- None

Platforms Tested:  Windows 7 / x86 (Debug)
Builds Verified:  VC10 / x86 / Debug


QA Hints
========
N/A 


--- NEW FILE: hxservermetrics.h ---
/* ***** BEGIN LICENSE BLOCK *****
 * Source last modified: $Id: hxservermetrics.h,v 1.1.2.1 2013/07/30 20:17:34 dcollins Exp $
 *
 * Copyright (c) 1995-2013 RealNetworks, Inc. All Rights Reserved.
 *
 * ***** END LICENSE BLOCK ***** */

/*
 *  hxserverobserver.h
 *
 *  Server metrics-related interfaces.
 *
 */
#ifndef _HXSERVERMETRICS_H_
#define _HXSERVERMETRICS_H_

typedef _INTERFACE      IHXServerMetricsEvent           IHXServerMetricsEvent;
typedef _INTERFACE      IHXServerMetricsNotifier        IHXServerMetricsNotifier;
typedef _INTERFACE      IHXServerMetricsObserver        IHXServerMetricsObserver;


/****************************************************************************
 * 
 *  Interface:
 * 
 *	IHXServerMetricsEvent
 * 
 *  Purpose:
 * 
 *	TBD
 * 
 *  IID_IHXServerMetricsEvent:
 * 
 *      {C9D6131A-7B11-4D62-890E-CE4D28E8484E}
 * 
 */
DEFINE_GUID(IID_IHXServerMetricsEvent,
0xc9d6131a, 0x7b11, 0x4d62, 0x89, 0xe, 0xce, 0x4d, 0x28, 0xe8, 0x48, 0x4e);

#define CLSID_IHXServerMetricsEvent IID_IHXServerMetricsEvent

#undef  INTERFACE
#define INTERFACE       IHXServerMetricsEvent

#define METRICS_EVENT_UNKNOWN           0
#define METRICS_EVENT_CLOUD_UPLOAD      1
#define METRICS_EVENT_CLOUD_DOWNLOAD    2


DECLARE_INTERFACE_(IHXServerMetricsEvent, IUnknown)
{
    // IUnknown methods

    STDMETHOD(QueryInterface)               (THIS_
                                            REFIID riid,
                                            void** ppvObj) PURE;

    STDMETHOD_(UINT32,AddRef)               (THIS) PURE;

    STDMETHOD_(UINT32,Release)              (THIS) PURE;

    
    // IHXServerMetricsEvent methods

    /****************************************************************************
     *  Method:
     *      IHXServerMetricsEvent::SetEventInfo
     *  Purpose:
     *      Sets the type and data associated with an event.
     */
    STDMETHOD (SetEventInfo)   (THIS_
                                UINT32     ulEventType,
                                IUnknown*  pEventData) PURE;

    /****************************************************************************
     *  Method:
     *      IHXServerMetricsEvent::GetEventInfo
     *  Purpose:
     *      Gets the type and data associated with an event.
     */
    STDMETHOD (GetEventInfo)   (THIS_
                                REF(UINT32)    ulEventType,
                                REF(IUnknown*) pEventData) PURE;

    /****************************************************************************
     *  Method:
     *      IHXServerMetricsEvent::GetEventType
     *  Purpose:
     *      Gets the type of an event.
     */
    STDMETHOD_(UINT32, GetEventType)   (THIS) PURE;

    /****************************************************************************
     *  Method:
     *      IHXServerMetricsEvent::GetEventData
     *  Purpose:
     *      Gets the data associated with an event.
     */
    STDMETHOD (GetEventData)   (THIS_
                                REF(IUnknown*) pEventData) PURE;
};



/****************************************************************************
 * 
 *  Interface:
 * 
 *	IHXServerMetricsNotifier
 * 
 *  Purpose:
 * 
 *	Dispatches metrics-related events from any arbitrary sender thread to
 *      the metrics observer plugin thread.
 *      One instance per server thread.
 * 
 *  IID_IHXServerMetricsNotifier:
 * 
 *      {7D5CA642-9C52-4D64-A578-3B1629EE95E1}
 * 
 */
DEFINE_GUID(IID_IHXServerMetricsNotifier, 
0x7d5ca642, 0x9c52, 0x4d64, 0xa5, 0x78, 0x3b, 0x16, 0x29, 0xee, 0x95, 0xe1);

#define CLSID_IHXServerMetricsNotifier IID_IHXServerMetricsNotifier

#undef  INTERFACE
#define INTERFACE       IHXServerMetricsNotifier

DECLARE_INTERFACE_(IHXServerMetricsNotifier, IUnknown)
{
    // IUnknown methods

    STDMETHOD(QueryInterface)               (THIS_
                                            REFIID riid,
                                            void** ppvObj) PURE;

    STDMETHOD_(UINT32,AddRef)               (THIS) PURE;

    STDMETHOD_(UINT32,Release)              (THIS) PURE;

    
    // IHXServerMetricsNotifier methods

    /****************************************************************************
     *  Method:
     *      IHXServerMetricsNotifier::Init
     *  Purpose:
     *      Records information about the metrics observer plugin which will
     *      receive metrics event notifications.
     */
    STDMETHOD (Init)                  (THIS_
                                       IHXServerMetricsObserver* pObserver) PURE;

    /****************************************************************************
     *  Method:
     *      IHXServerMetricsNotifier::NotifyEvent
     *  Purpose:
     *      Notify the metrics observer that a metrics-related event has occurred.
     *      Notifications will be dispatched across threads to the recipient.
     */
    STDMETHOD (NotifyEvent)           (THIS_
                                       IHXServerMetricsEvent* pEvent) PURE;

    /****************************************************************************
     *  Method:
     *      IHXServerMetricsNotifier::Close
     *  Purpose:
     *      De-initializes the metrics notifier.
     */
    STDMETHOD (Close)                 (THIS) PURE;

};


/****************************************************************************
 * 
 *  Interface:
 * 
 *	IHXServerMetricsObserver
 * 
 *  Purpose:
 * 
 *	Receives metrics-related events dispatched from any arbitrary sender thread.
 *      One instance per server process.
 * 
 *  IID_IHXServerMetricsObserver:
 * 
 *      {53C00FA9-AB17-416C-84A8-96D9E7525AED}
 * 
 */
DEFINE_GUID(IID_IHXServerMetricsObserver,
0x53c00fa9, 0xab17, 0x416c, 0x84, 0xa8, 0x96, 0xd9, 0xe7, 0x52, 0x5a, 0xed);


#define CLSID_IHXServerMetricsObserver IID_IHXServerMetricsObserver

#undef  INTERFACE
#define INTERFACE       IHXServerMetricsObserver

DECLARE_INTERFACE_(IHXServerMetricsObserver, IUnknown)
{
    // IUnknown methods

    STDMETHOD(QueryInterface)               (THIS_
                                            REFIID riid,
                                            void** ppvObj) PURE;

    STDMETHOD_(UINT32,AddRef)               (THIS) PURE;

    STDMETHOD_(UINT32,Release)              (THIS) PURE;

    
    // IHXServerMetricsObserver methods

    /****************************************************************************
     *  Method:
     *      IHXServerMetricsObserver::NotifyEvent
     *  Purpose:
     *      Notify the metrics observer that a metrics-related event has occurred.
     *      Notifications will be dispatched across threads to the recipient.
     */
    STDMETHOD (NotifyEvent)           (THIS_
                                       IHXServerMetricsEvent* pEvent) PURE;

};


#endif /* _HXSERVERMETRICS_H_ */


_______________________________________________
Server-cvs mailing list
Server-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/server-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic