我为我的统计数据运行statsd/graphite.我的统计数据可能看起来像
a.b.c.u1 = 13
a.b.c.u2 = 16
a.b.c.u3 = 18
a.b.c.u4 = 20
a.b.c.u5 = 21
a.b.c.u6 = 22
Run Code Online (Sandbox Code Playgroud)
我希望得到 a.b.c.$u价值> = 20的全部.
我如何使用石墨功能?
./statsd-client.sh 'development.com.alpha.operation.testing.rate:1|c'然后我尝试查询过去24小时的摘要:
http://example.com/render?format=json&target=summarize(stats.development.com.alpha.operation.testing.rate,"24hours","sum",true)&from = -24hours&tz = UTC
我得到1个数据点如下:
"datapoints": [[0.0, 1386277560]]}]
Run Code Online (Sandbox Code Playgroud)
为什么我得到0.0?甚至Graphite Composer也不会显示任何内容
当我执行10次操作时,我期待值为"10".我做错了什么?
存储schemas.conf
[carbon]
pattern = ^carbon\.
retentions = 60:90d
[default_1min_for_1day]
pattern = .*
retentions = 60s:1d
Run Code Online (Sandbox Code Playgroud)
请帮我理解这个问题.
编辑:
根据下面的答案,我更改了存储聚合,并在metric_file.wsp上运行whisper-info后得到以下响应.但我仍然在数据点中获得"0.0"作为值,而Graphite浏览器不显示任何内容.
maxRetention: 86400
xFilesFactor: 0.0
aggregationMethod: sum
fileSize: 17308
Archive 0
retention: 86400
secondsPerPoint: 60
points: 1440
size: 17280
offset: 28
Run Code Online (Sandbox Code Playgroud)
我还看了另一个答案中建议的stats_counts树,但它是一样的.
我的设置有什么问题.我正在使用默认设置,除了存储聚合中下面的答案所建议的更改
我有一个特殊的/奇怪的要求,我需要执行以下操作:
app.put('/example/:entity', function(req, res, next) {
fs.writeFileSync(someFile);
});
Run Code Online (Sandbox Code Playgroud)
由于它是一项sync操作,因此它将阻止事件循环,我担心node.js / express将开始删除http请求。
对于短期解决方案:
我正在尝试测试/实现丢失的网络用例.我有下面提到的代码.
我在Galaxy S6上运行它.我同时启用了移动数据和WiFi.
要禁用网络,我打开"飞行模式"
我的问题是:
如果我从android studio重新启动应用程序,我会被ConnectionChangeReceiver.onReceive()调用.但是,在几次打开/关闭飞行模式后,我没有被onReceive()打电话.
我在工作室设置断点来检查它是否被调用.
我错过了什么吗?
public class ConnectionChangeReceiver extends BroadcastReceiver
{
@Override
public void onReceive( Context context, Intent intent )
{
// get Connectivity Manager object to check connection
ConnectivityManager connectivityManager =(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo();
// Check for network connections
if ( activeNetInfo != null && activeNetInfo.isConnected()) {
Intent newintent = new Intent(BroadcastedIntentFilters.INTERNET_CONNECTED);
LocalBroadcastManager.getInstance(context).sendBroadcast(newintent);
}
}
}
Run Code Online (Sandbox Code Playgroud)
在清单文件中
<receiver
android:name=".Network.ConnectionChangeReceiver"
android:exported="true"
android:label="NetworkConnection" >
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name="android.net.wifi.STATE_CHANGE"/>
</intent-filter>
</receiver> …Run Code Online (Sandbox Code Playgroud) 重要的:
首先,我做了:
NSInteger tzOffset = [[NSTimeZone systemTimeZone] secondsFromGMT];
NSDate *localDate = [inputDate dateByAddingTimeInterval:tzOffset];
int daylightOffset = [[NSTimeZone localTimeZone] daylightSavingTimeOffset];
BOOL isDaylightSavingTimeForDate =
[[NSTimeZone localTimeZone] isDaylightSavingTimeForDate:inputDate];
if (!isDaylightSavingTimeForDate) {
localDate = [localDate dateByAddingTimeInterval:-1*daylightOffset];
}
time_t localTime = (time_t) [localDate timeIntervalSince1970];
Run Code Online (Sandbox Code Playgroud)
DaylightOffset仅当系统处于活动状态时它才有效。当
[[NSTimeZone localTimeZone] daylightSavingTimeOffset]返回0;isDaylightSavingTimeForDate:inputDate回报true有没有更好的方法将 NSDate 转换为 time_t ,其值代表本地 TZ
例子:
我住在太平洋标准时间。2017 年 11 月 UTC = -8 小时,2018 年 5 月,UTC …