Changeset 0b89171a


Ignore:
Timestamp:
Apr 1, 2009 8:17:25 PM (11 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
53cb806
Parents:
58fc3a50
Message:

StatisticsManager? - effective in 0.7.2:

  • Spoof uptime to 90m for all
  • Change tunnel stats from 10m to 60m
Location:
router/java/src/net/i2p/router
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/StatisticsManager.java

    r58fc3a50 r0b89171a  
    3030    private RouterContext _context;
    3131    private boolean _includePeerRankings;
    32     private int _publishedStats;
    3332   
    3433    public final static String PROP_PUBLISH_RANKINGS = "router.publishPeerRankings";
    3534    public final static String DEFAULT_PROP_PUBLISH_RANKINGS = "true";
    36     public final static String PROP_MAX_PUBLISHED_PEERS = "router.publishPeerMax";
    37     public final static int DEFAULT_MAX_PUBLISHED_PEERS = 10;
    3835
    3936    private final DecimalFormat _fmt;
     
    5350    }
    5451    public void startup() {
    55         String val = _context.router().getConfigSetting(PROP_PUBLISH_RANKINGS);
    56         try {
    57             if (val == null) {
    58                 if (_log.shouldLog(Log.INFO))
    59                     _log.info("Peer publishing setting " + PROP_PUBLISH_RANKINGS
    60                               + " not set - using default " + DEFAULT_PROP_PUBLISH_RANKINGS);
    61                 val = DEFAULT_PROP_PUBLISH_RANKINGS;
    62             } else {
    63                 if (_log.shouldLog(Log.INFO))
    64                     _log.info("Peer publishing setting " + PROP_PUBLISH_RANKINGS
    65                               + " set to " + val);
    66             }
    67             boolean v = Boolean.TRUE.toString().equalsIgnoreCase(val);
    68             _includePeerRankings = v;
    69             if (_log.shouldLog(Log.DEBUG))
    70                 _log.debug("Setting includePeerRankings = " + v);
    71         } catch (Throwable t) {
    72             if (_log.shouldLog(Log.ERROR))
    73                 _log.error("Error determining whether to publish rankings ["
    74                            + PROP_PUBLISH_RANKINGS + "=" + val
    75                            + "], so we're defaulting to FALSE");
    76             _includePeerRankings = false;
    77         }
    78         val = _context.router().getConfigSetting(PROP_MAX_PUBLISHED_PEERS);
    79         if (val == null) {
    80             _publishedStats = DEFAULT_MAX_PUBLISHED_PEERS;
    81         } else {
    82             try {
    83                 int num = Integer.parseInt(val);
    84                 _publishedStats = num;
    85             } catch (NumberFormatException nfe) {
    86                 if (_log.shouldLog(Log.ERROR))
    87                     _log.error("Invalid max number of peers to publish [" + val
    88                                + "], defaulting to " + DEFAULT_MAX_PUBLISHED_PEERS, nfe);
    89                 _publishedStats = DEFAULT_MAX_PUBLISHED_PEERS;
    90             }
    91         }
    92     }
    93    
     52        String val = _context.getProperty(PROP_PUBLISH_RANKINGS, DEFAULT_PROP_PUBLISH_RANKINGS);
     53        _includePeerRankings = Boolean.valueOf(val);
     54    }
     55   
     56    static final boolean CommentOutIn072 = RouterVersion.VERSION.equals("0.7.1");
     57
    9458    /** Retrieve a snapshot of the statistics that should be published */
    9559    public Properties publishStatistics() {
     
    12589       
    12690        if (_includePeerRankings) {
    127             if (false)
    128                 stats.putAll(_context.profileManager().summarizePeers(_publishedStats));
    129 
    13091            long publishedUptime = _context.router().getUptime();
    13192            // Don't publish these for first hour
     
    173134            //includeRate("stream.con.receiveDuplicateSize", stats, new long[] { 60*60*1000 });
    174135
    175             // Round smaller uptimes to 1 hour, to frustrate uptime tracking
    176             // Round 2nd hour to 90m since peers use 2h minimum to route
    177             if (publishedUptime < 60*60*1000) publishedUptime = 60*60*1000;
    178             else if (publishedUptime < 2*60*60*1000) publishedUptime = 90*60*1000;
    179 
    180             stats.setProperty("stat_uptime", DataHelper.formatDuration(publishedUptime));
     136            if (CommentOutIn072) {
     137                // Round smaller uptimes to 1 hour, to frustrate uptime tracking
     138                // Round 2nd hour to 90m since peers use 2h minimum to route
     139                if (publishedUptime < 60*60*1000) publishedUptime = 60*60*1000;
     140                else if (publishedUptime < 2*60*60*1000) publishedUptime = 90*60*1000;
     141                stats.setProperty("stat_uptime", DataHelper.formatDuration(publishedUptime));
     142            } else {
     143                // So that we will still get build requests
     144                stats.setProperty("stat_uptime", "90m");
     145            }
    181146            //stats.setProperty("stat__rateKey", "avg;maxAvg;pctLifetime;[sat;satLim;maxSat;maxSatLim;][num;lifetimeFreq;maxFreq]");
    182147           
     
    186151           
    187152            //includeRate("tunnel.buildRequestTime", stats, new long[] { 10*60*1000 });
    188             includeRate("tunnel.buildClientExpire", stats, new long[] { 10*60*1000 });
    189             includeRate("tunnel.buildClientReject", stats, new long[] { 10*60*1000 });
    190             includeRate("tunnel.buildClientSuccess", stats, new long[] { 10*60*1000 });
    191             includeRate("tunnel.buildExploratoryExpire", stats, new long[] { 10*60*1000 });
    192             includeRate("tunnel.buildExploratoryReject", stats, new long[] { 10*60*1000 });
    193             includeRate("tunnel.buildExploratorySuccess", stats, new long[] { 10*60*1000 });
     153            long rate = CommentOutIn072 ? 10*60*1000 : 60*60*1000;
     154            includeRate("tunnel.buildClientExpire", stats, new long[] { rate });
     155            includeRate("tunnel.buildClientReject", stats, new long[] { rate });
     156            includeRate("tunnel.buildClientSuccess", stats, new long[] { rate });
     157            includeRate("tunnel.buildExploratoryExpire", stats, new long[] { rate });
     158            includeRate("tunnel.buildExploratoryReject", stats, new long[] { rate });
     159            includeRate("tunnel.buildExploratorySuccess", stats, new long[] { rate });
    194160            //includeRate("tunnel.rejectTimeout", stats, new long[] { 10*60*1000 });
    195161            //includeRate("tunnel.rejectOverloaded", stats, new long[] { 10*60*1000 });
  • router/java/src/net/i2p/router/tunnel/pool/BuildExecutor.java

    r58fc3a50 r0b89171a  
    3838        _context.statManager().createRateStat("tunnel.concurrentBuilds", "How many builds are going at once", "Tunnels", new long[] { 60*1000, 5*60*1000, 60*60*1000 });
    3939        _context.statManager().createRateStat("tunnel.concurrentBuildsLagged", "How many builds are going at once when we reject further builds, due to job lag (period is lag)", "Tunnels", new long[] { 60*1000, 5*60*1000, 60*60*1000 });
    40         _context.statManager().createRateStat("tunnel.buildExploratoryExpire", "How often an exploratory tunnel times out during creation", "Tunnels", new long[] { 60*1000, 10*60*1000 });
    41         _context.statManager().createRateStat("tunnel.buildClientExpire", "How often a client tunnel times out during creation", "Tunnels", new long[] { 60*1000, 10*60*1000 });
    42         _context.statManager().createRateStat("tunnel.buildExploratorySuccess", "Response time for success", "Tunnels", new long[] { 60*1000, 10*60*1000 });
    43         _context.statManager().createRateStat("tunnel.buildClientSuccess", "Response time for success", "Tunnels", new long[] { 60*1000, 10*60*1000 });
    44         _context.statManager().createRateStat("tunnel.buildExploratoryReject", "Response time for rejection", "Tunnels", new long[] { 60*1000, 10*60*1000 });
    45         _context.statManager().createRateStat("tunnel.buildClientReject", "Response time for rejection", "Tunnels", new long[] { 60*1000, 10*60*1000 });
     40        _context.statManager().createRateStat("tunnel.buildExploratoryExpire", "How often an exploratory tunnel times out during creation", "Tunnels", new long[] { 10*60*1000, 60*60*1000 });
     41        _context.statManager().createRateStat("tunnel.buildClientExpire", "How often a client tunnel times out during creation", "Tunnels", new long[] { 10*60*1000, 60*60*1000 });
     42        _context.statManager().createRateStat("tunnel.buildExploratorySuccess", "Response time for success", "Tunnels", new long[] { 10*60*1000, 60*60*1000 });
     43        _context.statManager().createRateStat("tunnel.buildClientSuccess", "Response time for success", "Tunnels", new long[] { 10*60*1000, 60*60*1000 });
     44        _context.statManager().createRateStat("tunnel.buildExploratoryReject", "Response time for rejection", "Tunnels", new long[] { 10*60*1000, 60*60*1000 });
     45        _context.statManager().createRateStat("tunnel.buildClientReject", "Response time for rejection", "Tunnels", new long[] { 10*60*1000, 60*60*1000 });
    4646        _context.statManager().createRateStat("tunnel.buildRequestTime", "How long it takes to build a tunnel request", "Tunnels", new long[] { 60*1000, 10*60*1000 });
    4747        _context.statManager().createRateStat("tunnel.buildRequestZeroHopTime", "How long it takes to build a zero hop tunnel", "Tunnels", new long[] { 60*1000, 10*60*1000 });
Note: See TracChangeset for help on using the changeset viewer.