(profile_oid_collection, oid_node)
Updates a collection of profile nodes, indexed by oid, adding a column node
Updates a collection of profile nodes, indexed by oid, adding a column node
Updates a collection of profile nodes indexed by oid adding a column node
def _add_profile_column_node(profile_oid_collection, oid_node):
    """
    Updates a collection of profile nodes, indexed by oid, adding a column node
    """
    if oid_node.node_type != 'column':
        raise ValueError('Must be a column node')
    name = oid_node.name
    # Table oids are defined as:
    # <TABLE_OID>.<TABLE_ENTRY>.<COLUMN_NUM>
    # where <TABLE_ENTRY> is always 1
    oid = oid_node.oid
    table_oid = '.'.join(oid.split('.')[:-2])
    if table_oid not in profile_oid_collection:
        # create table if it does not exist yet
        table = {'OID': table_oid}
        profile_node = {'table': table, 'symbols': [], 'metric_tags': []}
        profile_oid_collection[table_oid] = profile_node

    symbol = {'name': name, 'OID': oid}
    if oid_node.description is not None:
        symbol['description'] = oid_node.description
    symbols = profile_oid_collection[table_oid]['symbols']
    symbols.append(symbol)
    profile_oid_collection[table_oid]['symbols'] = symbols
def _add_profile_column_node ( profile_oid_collection , oid_node ) : if oid_node . node_type != 'column' : raise ValueError ( 'Must be a column node' ) name = oid_node . name # Table oids are defined as: # <TABLE_OID>.<TABLE_ENTRY>.<COLUMN_NUM> # where <TABLE_ENTRY> is always 1 oid = oid_node . oid table_oid = '.' . join ( oid . split ( '.' ) [ : - 2 ] ) if table_oid not in profile_oid_collection : # create table if it does not exist yet table = { 'OID' : table_oid } profile_node = { 'table' : table , 'symbols' : [ ] , 'metric_tags' : [ ] } profile_oid_collection [ table_oid ] = profile_node symbol = { 'name' : name , 'OID' : oid } if oid_node . description is not None : symbol [ 'description' ] = oid_node . description symbols = profile_oid_collection [ table_oid ] [ 'symbols' ] symbols . append ( symbol ) profile_oid_collection [ table_oid ] [ 'symbols' ] = symbols