Skip to content

Capture HTTP request/response details and send them to AWS XRay

License

Notifications You must be signed in to change notification settings

waxtell/AWSXRay.Http.Extension

Repository files navigation

AWSXRay.Http.Extension

Capture HTTP request/response details and send them to AWS XRay

BuildPublish to nuget

Startup.cs

        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();
            services.AddHttpXRayTracing(Configuration);
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseXRay("SampleApp9000", Configuration);
            app.ActivateXRayHttpDiagnosticsLogging();

To include all hosts and all headers:

appsettings.json

  "XRayHttpDiagnosticLoggerOptions": {
    "CaptureHosts": [
      {
        "type": "include",
        "Expression": ".*",
        "IsRegEx": true,
        "IncludeRequestBody": false,
        "IncludeResponseBody": true,
        "Traced": false,
        "CaptureRequestHeaders": [
          {
            "type": "include",
            "Expression": ".*",
            "IsRegEx": true
          }
        ],
        "CaptureResponseHeaders": [
          {
            "type": "include",
            "Expression": ".*",
            "IsRegEx": true
          }
        ]
      }
    ]
  }

To include all hosts except google.com (you can exclude as many hosts as you want):

appsettings.json

  "XRayHttpDiagnosticLoggerOptions": {
    "CaptureHosts": [
      {
        "type": "include",
        "Expression": ".*",
        "IsRegEx": true,
        "IncludeRequestBody": false,
        "IncludeResponseBody": true,
        "Traced": false,
        "CaptureRequestHeaders": [
          {
            "type": "include",
            "Expression": ".*",
            "IsRegEx": true
          }
        ],
        "CaptureResponseHeaders": [
          {
            "type": "include",
            "Expression": ".*",
            "IsRegEx": true
          }
        ]
      },
      {
        "type": "exclude",
        "Expression": "google.com",
        "IsRegEx": false
      }
    ]
  }

About

Capture HTTP request/response details and send them to AWS XRay

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages