Skip to content

Conversation

@MWillWallT
Copy link

Summary

This PR merges the barnacle-gemini work into master, introducing a refactored Buccaneer metrics pipeline, new Pixel Streaming integrations (v1 & v2), and multiple robustness and observability improvements across the Unreal plugins and Buccaneer server.

Key Changes

  • Metrics refactor and configuration

    • Refactored metrics handling to use a more general FMetricsCollection, reducing duplication and simplifying stat management.
    • Reworked BuccaneerCommon into clearer module boundaries with BuccaneerCommonModule, BuccaneerMetrics, and BuccaneerSettings split into dedicated source files.
    • Added richer stat descriptions, improved name sanitisation, and consistent < / > formatting for metric names.
    • Introduced additional application-level stats (e.g. ResX/ResY) and updated metric sending logic while preserving backwards‑compatible behaviour with existing Buccaneer functionality.
    • Updated public interfaces to reduce surface area and rely more on well-defined module interfaces (e.g. IBuccaneerCommonModule).
  • Pixel Streaming integrations

    • Refactored the original Pixel Streaming plugin into Buccaneer4PixelStreaming with cleaner separation between public and private headers.
    • Added a new Buccaneer4PixelStreaming2 plugin for Pixel Streaming v2, including its own module interfaces, settings, and logging.
    • Implemented sending of application stats from both Pixel Streaming v1 and v2, ensuring that Pixel Streaming sessions report metrics correctly into Barnacle/Buccaneer.
    • Added editor/project settings for controlling reporting intervals and other Pixel Streaming-related options.
  • Events & stats modules

    • Introduced BuccaneerEvents and BuccaneerStats as first‑class modules with their own build files, module interfaces, logging, and blueprint function libraries.
    • Removed/deprecated older semantic/TimeSeries emitter code in favour of the new event and stats modules.
    • Standardised logging across modules (Logging.cpp / Logging.h per module) for more consistent diagnostics.
  • Buccaneer server improvements

    • Enhanced BuccaneerServer (Go) to improve robustness and avoid deadlocks, including:
      • Added missing lock/unlock pairs and protection for concurrent access to shared state.
      • Fixed a race condition and added safeguards against writing into corrupted or undersized files.
      • Updated append/rewrite handling to avoid false append removal and corrupted output.
    • Improved logging in main.go for better server observability and debugging.
    • Exposed the Buccaneer server port as a configurable argument.
  • Docker / local dev workflow

    • Updated Examples/Compose/docker-compose.yml and added docker-compose-all.yml to support running the full stack for local development.
    • Adjusted Docker setup in Server/BuccaneerServer/Dockerfile so docker-compose up works more smoothly for local dev and testing.
  • Configuration & documentation

    • Updated readme.md to align with the new Barnacle/Buccaneer integration and Pixel Streaming workflows.
    • Added/updated .uplugin descriptors for the Buccaneer and Pixel Streaming plugins, including the new Buccaneer4PixelStreaming2 plugin and icon resources.
    • Cleaned up namespaces and copyright headers.
  • Dashboards & stability fixes

    • Added new Grafana dashboards for visualising Pixel Streaming stats and Buccaneer metrics out of the box.
    • Fixed an Unreal Editor crash related to stats handling, improving editor-time stability when the Buccaneer plugins are enabled.

Motivation / Rationale

  • Provide a unified and more maintainable metrics architecture that can serve both existing Buccaneer use cases and the newer Barnacle and Pixel Streaming integrations.
  • Enable first‑class metrics and events for Pixel Streaming v1 and v2 clients, with clear project settings and better diagnostics.
  • Increase the reliability of the Buccaneer server in production scenarios by addressing deadlocks, race conditions, and file corruption edge cases.
  • Improve the local development experience with better Docker Compose configurations and documentation.

Testing

  • Verified that Buccaneer metrics still function as before after the FMetricsCollection refactor.
  • Tested that Pixel Streaming v1 and v2 sessions report stats correctly into Barnacle/Buccaneer.
  • Manually exercised the Buccaneer server with the updated locking and logging in place and validated that it no longer deadlocks under the previously problematic workloads.
  • Confirmed Docker Compose setups (docker-compose.yml and docker-compose-all.yml) start the expected services for local development.

New CVars and command-line flags (including JSON output)

This PR also adds/standardises a set of CVars and command-line flags to make it easy to point Buccaneer at a server, toggle stats/events, and optionally write JSON locally for inspection.

  • Core Buccaneer CVars / flags

    • Buccaneer.URL-BuccaneerURL="http://127.0.0.1:8000"

      • Target URL for the Buccaneer server (stats/events endpoint).
    • Buccaneer.ID-BuccaneerID="MyMachine01"

      • Optional ID to identify this instance; defaults to a GUID if not provided.
    • Buccaneer.EnableStats-BuccaneerEnableStats=true|false

      • Enables/disables performance metric collection.
    • Buccaneer.EnableEvents-BuccaneerEnableEvents=true|false

      • Enables/disables semantic event collection.
    • Buccaneer.Metadata-BuccaneerMetadata=Key1:Value1;Key2:Value2

      • Arbitrary key/value metadata attached to all stats/events.
    • Buccaneer.ReportingInterval-BuccaneerReportingInterval=1.0

      • Controls how often metrics are reported (seconds).
    • Buccaneer.EnableJSONOutput-BuccaneerEnableJSONOutput=true|false

      • When enabled, writes stats/events to JSON on disk instead of sending to the Buccaneer server.
    • Buccaneer.JSONOutputDirectory-BuccaneerJSONOutputDirectory="C:/Temp/Buccaneer"

      • Directory to write JSON output files to when BuccaneerEnableJSONOutput is enabled.
    • Example end-to-end launch line (local Barnacle dev):

      -BuccaneerURL="http://127.0.0.1:8000" -BuccaneerID="DevRig01" -BuccaneerEnableStats=true -BuccaneerEnableEvents=true -BuccaneerEnableJSONOutput=true -BuccaneerJSONOutputDirectory="C:/Temp/Buccaneer"
      
  • Pixel Streaming–specific CVars / flags

    • Pixel Streaming 1 (Buccaneer4PixelStreaming):

      • Buccaneer4PixelStreaming.EnableStats-Buccaneer4PixelStreamingEnableStats=true|false
        • Toggles sending Pixel Streaming v1 stats to Buccaneer.
      • Buccaneer4PixelStreaming.ReportingInterval-Buccaneer4PixelStreamingReportingInterval=0.5
        • Interval (seconds) at which Pixel Streaming v1 metrics are reported. <= 0 disables reporting.
    • Pixel Streaming 2 (Buccaneer4PixelStreaming2):

      • Buccaneer4PixelStreaming2.EnableStats-Buccaneer4PixelStreaming2EnableStats=true|false
        • Toggles sending Pixel Streaming v2 stats to Buccaneer.
      • Buccaneer4PixelStreaming2.ReportingInterval-Buccaneer4PixelStreaming2ReportingInterval=0.5
        • Interval (seconds) at which Pixel Streaming v2 metrics are reported.
    • Example Pixel Streaming 2 launch line:

      -BuccaneerURL="http://127.0.0.1:8000" -Buccaneer4PixelStreaming2EnableStats=true -Buccaneer4PixelStreaming2ReportingInterval=0.5
      

Breaking Changes / Migration Notes

  • Some public headers and types have been moved or renamed (e.g. BuccaneerCommon split into module, metrics, and settings types; some headers moved from Public to Private). Projects using internal or previously non‑intended public headers may need to update includes to the new module interfaces.
  • New settings options are available for Pixel Streaming metrics and reporting intervals; projects may want to review and adjust these to suit their workloads.

Belchy06 and others added 30 commits August 12, 2025 17:57
New barnacle based branch of buccaneer, with code changes from Gemini Code assist
- Added new logic to write to file without opening/closing it
- Fix TEXT arrays issue
…onModule.cpp

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
- Added protection from writing into a corrupted file that is not big enough
Better describes the function
… functionality. Tested and working.

Co-authored-by: Luke Bermingham <[email protected]>
Denis was here too!
Introduces FMetricsCollection and FBuccaneerMetric structures for unified metrics representation. Replaces ad-hoc JSON construction with structured metrics collection and serialization in BuccaneerCommon, BuccaneerStats, and PixelStreaming modules. Updates interfaces and implementations to use SendMetrics instead of SendStats, improving code clarity and extensibility for metrics reporting.

Co-Authored-By: Denis Phoenix <[email protected]>
Co-Authored-By: Luke Bermingham <[email protected]>
Good commit for Denis and Michael to practice/attempt reformat of JSON structure.
Fixing compile error with consts
… compose up work for local dev, improved stat name sanitizing
@MWillWallT MWillWallT changed the title Buccaneer Upgrade Buccaneer Upgrade / Barnacle Nov 20, 2025
Copilot finished reviewing on behalf of MWillWallT November 20, 2025 06:16
@gemini-code-assist
Copy link

Summary of Changes

Hello @MWillWallT, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly upgrades the Buccaneer metrics and event pipeline, integrating it more deeply and robustly across Unreal Engine plugins and the Go server. The primary goal is to provide a unified, maintainable architecture for metrics, especially enabling first-class support for Pixel Streaming v1 and v2. It also focuses on enhancing the reliability of the Buccaneer server and streamlining the local development experience through updated Docker configurations and comprehensive CVar options.

Highlights

  • Metrics Pipeline Refactor: Reorganized metrics handling with a new FMetricsCollection structure, reducing duplication and simplifying stat management. The BuccaneerCommon module was split into distinct, clearer boundaries: BuccaneerCommonModule, BuccaneerMetrics, and BuccaneerSettings.
  • Pixel Streaming Integrations: Introduced refactored Buccaneer4PixelStreaming (for v1) and a new Buccaneer4PixelStreaming2 (for v2) plugins. Both now send application stats and offer configurable settings, ensuring metrics are correctly reported into Barnacle/Buccaneer.
  • Events & Stats Modules: BuccaneerEvents and BuccaneerStats are now first-class modules with their own build files, interfaces, logging, and Blueprint function libraries, replacing older semantic/TimeSeries emitter code.
  • Buccaneer Server Robustness: Enhanced the Go server to prevent deadlocks, fix race conditions, and add safeguards against corrupted files. Logging was improved for better observability, and the server port is now configurable.
  • Improved Dev Workflow: Updated Docker Compose configurations to support running the full stack for local development (docker-compose-all.yml) and a lightweight setup for just the monitoring components (docker-compose.yml).
  • Configuration & Dashboards: Added new Grafana dashboards for visualizing Pixel Streaming and Buccaneer metrics. New CVars and command-line flags were introduced to easily configure Buccaneer, including URL, ID, metadata, reporting intervals, and JSON output options.
  • Stability Fixes: Addressed an Unreal Editor crash related to stats handling, improving editor-time stability when Buccaneer plugins are enabled.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a comprehensive refactoring of the Buccaneer metrics and events pipeline, introducing support for Pixel Streaming v1 and v2 with improved modularity, thread safety, and configuration management. The refactor splits the monolithic BuccaneerCommon module into dedicated BuccaneerStats, BuccaneerEvents, and BuccaneerMetrics components, while adding new Pixel Streaming integration plugins and enhancing the Go server with better concurrency handling and configurability.

Key Changes:

  • Refactored metrics architecture using FMetricsCollection for unified stats handling across Pixel Streaming v1, v2, and core application metrics
  • Added thread-safe mutex locking in the Go server to prevent race conditions and deadlocks
  • Introduced new Buccaneer4PixelStreaming2 plugin alongside refactored Buccaneer4PixelStreaming plugin
  • Split Docker Compose configurations into development-only (docker-compose.yml) and full demo (docker-compose-all.yml) setups

Reviewed Changes

Copilot reviewed 56 out of 59 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Server/BuccaneerServer/main.go Added configurable port via CLI, mutex locking for thread safety, graceful handling of missing descriptions, and health check endpoint
Server/BuccaneerServer/Dockerfile Simplified COPY commands for go.mod and go.sum
Plugins/Buccaneer4PixelStreaming2/** New plugin for Pixel Streaming v2 with module interfaces, settings, logging, and stats collection
Plugins/Buccaneer4PixelStreaming/** Refactored v1 plugin with new module interfaces, settings system, and improved metrics handling
Plugins/Buccaneer/Source/BuccaneerCommon/** Refactored into modular components with IBuccaneerCommonModule, BuccaneerSettings, and BuccaneerMetrics
Plugins/Buccaneer/Source/BuccaneerStats/** New dedicated stats module replacing TimeSeriesDataEmitter
Plugins/Buccaneer/Source/BuccaneerEvents/** New dedicated events module replacing SemanticEventEmitter
readme.md Updated documentation distinguishing dev setup from full demo
Examples/Compose/docker-compose.yml Modified for development workflow (monitoring stack only)
Examples/Compose/docker-compose-all.yml New file for complete demo including Unreal application
Plugins/Buccaneer/Buccaneer.uplugin Updated module names from old to new naming scheme

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This is a significant and well-executed pull request that refactors the metrics pipeline, introduces new integrations, and hardens the Buccaneer server. The separation of concerns into distinct modules like BuccaneerCommon, BuccaneerMetrics, and BuccaneerSettings is a major improvement for maintainability. The fixes for race conditions and deadlocks in the Go server are crucial for stability. I've identified a few issues, including a critical bug in metadata parsing, a couple of high-severity correctness and concurrency bugs, and some medium-severity items related to performance and code clarity. Once these are addressed, this will be an excellent upgrade.

@MWillWallT
Copy link
Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This is a substantial pull request that refactors the metrics pipeline, introduces new integrations for Pixel Streaming, and improves the Buccaneer server. The changes are well-structured and significantly improve the modularity and configurability of the plugins. The move to UDeveloperSettings and dedicated modules for stats and events is a great improvement.

I've found a few issues, mainly related to a race condition in the Go server and a copy-paste error in the new Grafana dashboards. I've also noted a potential improvement for the Docker Compose setup. My detailed comments are below.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
// Case: Sending stats to disk
if (UBuccaneerSettings::CVarEnableJSONOutput.GetValueOnAnyThread())
{
WriteJSON(TEXT("stats.json"), JsonObject);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should dump the stats with a unique file name that is based on a combination of BucID and time.

So something then ends up being in the format {BucId}_{UnixTimestamp}_Stats.json (this is not valid syntax btw, just an example of the file name pattern).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha coincidental you bring this up. I'm working on an arg that allows you to specify the filename if desired. We should chat on this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated alongside the new filename arg. See commit here: b3013f2

Copy link
Member

@lukehb lukehb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor change requested about produced json file.

New arg: -BuccaneerJSONOutputFile=<filename>
Tested to ensure it works with or without .json file extension.
Default output filename has been updated to BuccID_Unixtime. Unix time is based on application start time.
Using -BuccaneerID= allows users to specify the BuccID in the default name output.

Tested changes / args to ensure robustness.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants