![](/img/trans.png)
[英]Azure Application Insights on AWS with Elastic Beanstalk?
[英]Application Insights with AWS Elastic Beanstalk
我試圖讓Application Insights在AWS Elastic Beanstalk的多個實例上托管的應用程序上運行。 問題在於服務器都被視為單個服務器。 我認為這是因為它們都具有相同的主機名。
有誰知道我怎么做:
如果該字段是公共字段,則可以使用Telemetry Initializer更改設置值,或者可以創建自己的屬性來存儲正確的名稱。 無論哪種方式, 遙測初始化器都看起來像一種方法:
public class MyTelemetryInitializer : ITelemetryInitializer
{
public void Initialize(ITelemetry telemetry)
{
var requestTelemetry = telemetry as RequestTelemetry;
// Is this a TrackRequest() ?
if (requestTelemetry == null) return;
int code;
bool parsed = Int32.TryParse(requestTelemetry.ResponseCode, out code);
if (!parsed) return;
if (code >= 400 && code < 500)
{
// If we set the Success property, the SDK won't change it:
requestTelemetry.Success = true;
// Allow us to filter these requests in the portal:
requestTelemetry.Context.Properties["Overridden400s"] = "true";
}
// else leave the SDK to set the Success property
}
如您所見,您可以訪問遙測項目的現有屬性,並在需要時添加新屬性。 我希望這有幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.