Changeset 7009b029e1b54b90126ad1242c59edb399cf0492

Show
Ignore:
Timestamp:
10/24/09 20:36:35 (4 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1256416595 +0000
git-parent:

[7c5375ebbc78acd69e46501e37a917cbe41bc93e]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1256416595 +0000
Message:

make the math right

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sql/scaffolding.sql

    rb354e99 r7009b02  
    5858\i sprocs/stratcon.map_uuid_to_sid.sql 
    5959\i sprocs/stratcon.update_config.sql 
    60 \i sprocs/stratcon.rollup_metric_numeric_5m.sql 
     60\i sprocs/stratcon.rollup_metric_numeric.sql 
    6161\i sprocs/stratcon.metric_name_summary_compile_fts_data.sql 
    6262\i sprocs/stratcon.rollup_metric_numeric.sql 
  • sql/sprocs/stratcon.rollup_metric_numeric.sql

    r6985428 r7009b02  
    6666        END LOOP; 
    6767 
    68         IF in_rollup = '5m' THEN 
     68        IF in_roll = '5m' THEN 
    6969            v_sql := 'SELECT * FROM stratcon.window_robust_derive('||quote_literal(v_min_whence)||')'; 
    7070        ELSE 
    71             v_sql := 'SELECT sid, name, '||quote_literal(v_min_whence)||' as rollup_time, SUM(1) as count_rows, (SUM(avg_value*1)/SUM(1)) as avg_value,'; 
    72             v_sql := v_sql || ' (SUM(counter_dev*1)/SUM(1)) as counter_dev FROM stratcon.unroll_metric_numeric('||quote_literal(v_min_whence)||','; 
     71            v_sql := 'SELECT sid, name, '||quote_literal(v_min_whence)||' as rollup_time, '; 
     72            v_sql := v_sql || ' SUM(coalesce(count_rows, 0)) as count_rows, '; 
     73            v_sql := v_sql || ' (SUM(avg_value*coalesce(count_rows,0))/SUM(coalesce(count_rows, 0))) as avg_value,'; 
     74            v_sql := v_sql || ' (SUM(counter_dev*coalesce(count_rows,0))/SUM(coalesce(count_rows, 0))) as counter_dev '; 
     75            v_sql := v_sql || ' FROM stratcon.unroll_metric_numeric('||quote_literal(v_min_whence)||','; 
    7376            v_sql := v_sql || quote_literal(v_min_whence + (v_conf.seconds - 1) * '1 second'::interval) || ',' || quote_literal(v_conf.dependent_on) ||')'; 
    7477            v_sql := v_sql || ' GROUP BY sid, name';   
    75  
    76        --   v_sql := 'SELECT sid, name, $1 as rollup_time, SUM(1) as count_rows, (SUM(avg_value*1)/SUM(1)) as avg_value, (SUM(counter_dev*1)/SUM(1)) as counter_dev 
    77        --             FROM  stratcon.unroll_metric_numeric( $1, $2, $3) 
    78        --             GROUP BY sid, name'; 
    7978        END IF; 
    80 RAISE NOTICE 'v_sql was (%),v_sql;  
     79RAISE NOTICE 'v_sql was (%)',v_sql;  
    8180 
    8281        FOR v_rec IN EXECUTE v_sql LOOP