From 812ea70e5616caecbfc25402556b1a2458259a1f Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Tue, 19 Dec 2023 13:47:50 -0800 Subject: [PATCH] up --- .../Azure.Sdk.Tools.HttpFaultInjector/Program.cs | 14 +++----------- .../Properties/launchSettings.json | 13 +++++++++++++ .../Azure.Sdk.Tools.HttpFaultInjector/Utils.cs | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) create mode 100644 tools/http-fault-injector/Azure.Sdk.Tools.HttpFaultInjector/Properties/launchSettings.json diff --git a/tools/http-fault-injector/Azure.Sdk.Tools.HttpFaultInjector/Program.cs b/tools/http-fault-injector/Azure.Sdk.Tools.HttpFaultInjector/Program.cs index cbd390f3902a..a01970baed11 100644 --- a/tools/http-fault-injector/Azure.Sdk.Tools.HttpFaultInjector/Program.cs +++ b/tools/http-fault-injector/Azure.Sdk.Tools.HttpFaultInjector/Program.cs @@ -46,8 +46,8 @@ private static void Run(Options options, string[] args) builder.Services.AddHttpLogging(logging => { logging.LoggingFields = HttpLoggingFields.RequestPropertiesAndHeaders | HttpLoggingFields.ResponsePropertiesAndHeaders; - logging.RequestHeaders.Add("X-Upstream-Base-Uri"); - logging.RequestHeaders.Add("x-ms-faultinjector-response-option"); + logging.RequestHeaders.Add(Utils.ResponseSelectionHeader); + logging.RequestHeaders.Add(Utils.UpstreamBaseUriHeader); logging.RequestHeaders.Add("ETag"); logging.ResponseHeaders.Add("ETag"); }); @@ -66,20 +66,12 @@ private static void Run(Options options, string[] args) } builder.Logging.ClearProviders(); - - /* - alternative: - "Console": { - "IncludeScopes": true, - "TimestampFormat": "[yyyy-MM-dd HH:mm:ss.ffffzzzz] " - } - */ builder.Logging.AddOpenTelemetry(o => { o.SetResourceBuilder(ResourceBuilder.CreateEmpty()); o.IncludeFormattedMessage = false; + o.IncludeScopes = false; o.ParseStateValues = true; - o.IncludeScopes = true; // can add more exporters, e.g. ApplicationInsights o.AddConsoleExporter(); }); diff --git a/tools/http-fault-injector/Azure.Sdk.Tools.HttpFaultInjector/Properties/launchSettings.json b/tools/http-fault-injector/Azure.Sdk.Tools.HttpFaultInjector/Properties/launchSettings.json new file mode 100644 index 000000000000..584845bc3415 --- /dev/null +++ b/tools/http-fault-injector/Azure.Sdk.Tools.HttpFaultInjector/Properties/launchSettings.json @@ -0,0 +1,13 @@ +{ + "profiles": { + "Azure.Sdk.Tools.HttpFaultInjector": { + "commandName": "Project", + "launchBrowser": false, + "environmentVariables": { + "OTEL_SERVICE_NAME": "HttpFaultInjector", + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:7777;https://localhost:7778" + } + } +} \ No newline at end of file diff --git a/tools/http-fault-injector/Azure.Sdk.Tools.HttpFaultInjector/Utils.cs b/tools/http-fault-injector/Azure.Sdk.Tools.HttpFaultInjector/Utils.cs index 7d8e13b6d1b8..a53e05720b77 100644 --- a/tools/http-fault-injector/Azure.Sdk.Tools.HttpFaultInjector/Utils.cs +++ b/tools/http-fault-injector/Azure.Sdk.Tools.HttpFaultInjector/Utils.cs @@ -22,7 +22,7 @@ public static class Utils "Proxy-Connection", // "X-Upstream-Base-Uri" in original request is used as the Base URI in the upstream request - "X-Upstream-Base-Uri", + UpstreamBaseUriHeader, "Host", ResponseSelectionHeader