ModularPipelines icon indicating copy to clipboard operation
ModularPipelines copied to clipboard

Add configurable HTTP logging to prevent verbose output from GitHub operations

Open Copilot opened this issue 3 months ago • 0 comments

GitHub API operations (especially file uploads) were logging full request/response bodies including binary streams, generating >15,000 lines of output per operation.

Changes

Configuration

  • Added PipelineOptions.DefaultHttpLogging (default: StatusCode | Duration)
  • Added GitHubOptions.HttpLogging for per-integration override
  • Reused existing HttpLoggingType flags: None, Request, Response, StatusCode, Duration

Implementation

  • Modified GitHub.cs to conditionally add HTTP handlers based on configured logging level
  • Handler chain now built dynamically instead of always including all handlers

Testing & Documentation

  • Added unit tests for configuration scenarios
  • Updated GitHub package docs with usage examples

Usage

// Default: only status codes and duration (no request/response bodies)
await PipelineHostBuilder.Create()
    .ExecutePipelineAsync();

// Disable HTTP logging entirely
await PipelineHostBuilder.Create()
    .ConfigureServices((_, services) =>
    {
        services.Configure<GitHubOptions>(opt => 
            opt.HttpLogging = HttpLoggingType.None);
    })
    .ExecutePipelineAsync();

// Enable verbose logging when debugging
services.Configure<GitHubOptions>(opt => 
    opt.HttpLogging = HttpLoggingType.Request | HttpLoggingType.Response);

Impact

  • Default behavior prevents log spam while retaining useful debugging info
  • Pattern consistent with existing CommandLogging configuration
  • No breaking changes
Original prompt

This section details on the original issue you should resolve

<issue_title>IHttpLogger spams messages</issue_title> <issue_description>The ModularPipelines.GitHub.GitHub class has IHttpLogger, but it is overly aggressive. For example, for a call to

        return await targetFiles
            .SelectAsync(async file =>
                {
                    var asset = new ReleaseAssetUpload
                    {
                        ContentType = "application/x-binary",
                        FileName = file.Name,
                        RawData = file.GetStream()
                    };

                    return await context.GitHub().Client.Repository.Release.UploadAsset(release, asset, cancellationToken);
                },
                cancellationToken)
            .ProcessOneAtATime();

I get >15,000 lines in the output. The current implementation even logs the stream of the uploaded file.

Image Image

Ideally nice to have something like CommandLogging in Commands, to control it</issue_description>

Comments on the Issue (you are @copilot in this section)

  • Fixes thomhurst/ModularPipelines#1318

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar Nov 15 '25 17:11 Copilot