我正在尝试将异常记录到Application Insights.我通过TelemetryClient.TrackException直接打电话成功完成了这项工作.但是,我想在我的代码中抽象出来,以防我将来想要登录其他平台,所以我想只关注ILogger接口.
我发现你可以使用ILoggerFactory.AddApplicationInsights(在这里实现),但不管我做了什么,我都没有看到日志在ApplicationInsights中出现.
以下是我的代码:
Startup.cs
IConfigurationRoot Configuration { get; set; }
ILoggerFactory LoggerFactory { get; set; }
IServiceProvider ServiceProvider { get; set; }
public Startup( IHostingEnvironment hostingEnvironment, ILoggerFactory loggerFactory )
{
this.LoggerFactory = loggerFactory;
string configurationFilePath = "abc.json";
this.Configuration = new ConfigurationBuilder()
.SetBasePath( hostingEnvironment.ContentRootPath )
.AddJsonFile( configurationFilePath, optional: true, reloadOnChange: true )
.AddEnvironmentVariables()
.Build();
}
public void Configure(
IApplicationBuilder applicationBuilder,
IHostingEnvironment hostingEnvironment,
ILoggerFactory loggerFactory,
IServiceProvider serviceProvider )
{
this.ServiceProvider = serviceProvider;
loggerFactory.AddApplicationInsights( serviceProvider ); …Run Code Online (Sandbox Code Playgroud) c# logging azure-application-insights azure-web-app-service asp.net-core
据我所知,MongoDB的存储大小应始终大于数据大小.但是,升级到Mongo 3.0并使用WiredTiger后,我开始看到数据大小大于存储大小.
这是来自其中一个数据库:
{
"db" : "Results",
"collections" : NumberInt(1),
"objects" : NumberInt(251816),
"avgObjSize" : 804.4109548241573,
"dataSize" : NumberInt(202563549),
"storageSize" : NumberInt(53755904),
"numExtents" : NumberInt(0),
"indexes" : NumberInt(5),
"indexSize" : NumberInt(41013248),
"ok" : NumberInt(1)
}
Run Code Online (Sandbox Code Playgroud)
注意到202563549> 53755904到目前为止.我很困惑这是怎么回事.db.stats()现在阅读Mongo 3.0的方式有何不同?
我将 xUnit 与 Visual Studio 测试资源管理器一起使用,当 中出现错误时Assert.Equal(),我会收到实际和预期的截断版本。
例如,
Xunit.Sdk.EqualException
Assert.Equal() Failure
Expected: List<Result>
[Result {
Status = StatusEnumValue1,
Message = "The request or response type contains a special ty"...,
Path = "1234" }]
Actual: WhereListIterator<Result>
[Result {
Status = StatusEnumValue1,
Message = "The request or response type contains a special ty"...,
Path = "1234" }]
Run Code Online (Sandbox Code Playgroud)
该测试失败,因为Messages 不同,但考虑到Messages 被截断,我看不到它们实际上与测试资源管理器不同的部分。即使我把它复制出来,它仍然被截断。
这是 xUnit 的已知缺点吗?我可以继续调试测试或用于WriteLine比较Messages,但令我惊讶的是 xUnit 框架没有办法允许显示完整的响应。我还尝试了 Resharper 测试浏览器,但这并不能解决问题。
如何在Spark中为Dataframe强制完全外部联接以使用Boradcast Hash Join?这是代码片段:
sparkConfiguration.set("spark.sql.autoBroadcastJoinThreshold", "1000000000")
val Result = BigTable.join(
org.apache.spark.sql.functions.broadcast(SmallTable),
Seq("X", "Y", "Z", "W", "V"),
"outer"
)
Run Code Online (Sandbox Code Playgroud)
我的SmallTable的大小比autoBroadcastJoinThreshold上面指定的小得多。另外,如果我使用inner,left_outer或right_outerjoin,则从DAG可视化中可以看到该join正在BroadcastHashJoin按预期使用。
但是,当我使用“ outer”作为联接类型时,spark SortMergeJoin出于某种未知原因决定使用该联接。有谁知道如何解决这个问题?根据我看到的左外部联接的性能,BroadcastHashJoin将有助于加快我的应用程序的运行速度。
由于以下错误消息,我的 Spark 流应用程序(在 HD Insights 上运行)不断有任务失败:
ExecutorLostFailure (executor 525 exited unrelated to the running tasks) Reason: Container container_1495825717937_0056_01_000916 on host: 10.0.0.14 was preempted.
Run Code Online (Sandbox Code Playgroud)
你有什么想法我应该在这里做什么吗?我应该如何处理此错误消息对我来说并不明显。
apache-spark ×2
asp.net-core ×1
c# ×1
executor ×1
hadoop-yarn ×1
logging ×1
mongodb ×1
scala ×1
xunit ×1
xunit.net ×1