Add Cameron Page Stub #6

Merged
vanhouc merged 4 commits from feature/cameron-page into main 2025-07-02 10:43:16 -04:00
vanhouc commented 2025-07-02 10:37:33 -04:00 (Migrated from github.com)

This pull request introduces multiple changes across the codebase, focusing on improving observability, modularizing code, and enhancing the project's configuration. Key updates include the addition of a new dependency, refactoring of the OTLP reporter initialization, and updates to the docker-compose.yml file. Below is a detailed breakdown of the most important changes:

Observability Improvements:

  • Refactored the OTLP reporter initialization in src/main.rs by moving the logic into a new initialize_otlp_reporter function, improving modularity and error handling using the anyhow crate. [1] [2]
  • Added #[fastrace::trace] attribute to the cameron and layout functions in src/cameron.rs to enable tracing for these functions. [1] [2]

Dependency Management:

  • Added the anyhow crate (version 1.0.98) to Cargo.toml for enhanced error handling.

Configuration Enhancements:

  • Updated docker-compose.yml to simplify the build configuration and introduce a develop section with a watch action for automatic rebuilds.
  • Changed the LOG_LEVEL environment variable in docker-compose.yml from debug to info for less verbose logging in production.

Code Simplification:

  • Consolidated the layout function in src/cameron.rs to include the HTML structure for the application, reducing duplication and improving maintainability.
This pull request introduces multiple changes across the codebase, focusing on improving observability, modularizing code, and enhancing the project's configuration. Key updates include the addition of a new dependency, refactoring of the OTLP reporter initialization, and updates to the `docker-compose.yml` file. Below is a detailed breakdown of the most important changes: ### Observability Improvements: * Refactored the OTLP reporter initialization in `src/main.rs` by moving the logic into a new `initialize_otlp_reporter` function, improving modularity and error handling using the `anyhow` crate. [[1]](diffhunk://#diff-42cb6807ad74b3e201c5a7ca98b911c5fa08380e942be6e4ac5807f8377f87fcL34-R37) [[2]](diffhunk://#diff-42cb6807ad74b3e201c5a7ca98b911c5fa08380e942be6e4ac5807f8377f87fcR63-R84) * Added `#[fastrace::trace]` attribute to the `cameron` and `layout` functions in `src/cameron.rs` to enable tracing for these functions. [[1]](diffhunk://#diff-49d5dfca1bce8c7e5d388ac95be4ea7bdf7a12a969a7ef0f12f5b8cd8a629741L2-R8) [[2]](diffhunk://#diff-49d5dfca1bce8c7e5d388ac95be4ea7bdf7a12a969a7ef0f12f5b8cd8a629741R19-R49) ### Dependency Management: * Added the `anyhow` crate (version 1.0.98) to `Cargo.toml` for enhanced error handling. ### Configuration Enhancements: * Updated `docker-compose.yml` to simplify the `build` configuration and introduce a `develop` section with a `watch` action for automatic rebuilds. * Changed the `LOG_LEVEL` environment variable in `docker-compose.yml` from `debug` to `info` for less verbose logging in production. ### Code Simplification: * Consolidated the `layout` function in `src/cameron.rs` to include the HTML structure for the application, reducing duplication and improving maintainability.
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-07-02 10:39:27 -04:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull Request Overview

Adds a new “Cameron” page stub with tracing, refactors OTLP reporter setup, and enhances development tooling and configuration.

  • Extracted OTLP reporter initialization into a new function with anyhow-based error handling
  • Introduced a cameron route and inline HTML layout in src/cameron.rs with tracing annotations
  • Simplified Docker build, added a watch action for development, and lowered default log level in docker-compose.yml
  • Added the anyhow dependency for better error propagation

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

File Description
src/main.rs Extracted OTLP reporter setup into initialize_otlp_reporter() and updated fastrace usage
src/cameron.rs Added cameron handler, tracing attributes, and inline HTML layout
docker-compose.yml Simplified build: syntax, added a develop.watch rebuild step, changed LOG_LEVEL to info
Cargo.toml Added anyhow = "1.0.98"
Comments suppressed due to low confidence (2)

src/cameron.rs:24

  • The <html> element is closed before the <main> and <footer>, which will generate invalid HTML structure; ensure these elements are nested inside <body>.
        html {

src/main.rs:63

  • [nitpick] Consider adding unit tests for initialize_otlp_reporter to verify behavior when OTLP_EXPORTER_ENDPOINT is set or missing.
fn initialize_otlp_reporter() -> Result<OpenTelemetryReporter, anyhow::Error> {
## Pull Request Overview Adds a new “Cameron” page stub with tracing, refactors OTLP reporter setup, and enhances development tooling and configuration. - Extracted OTLP reporter initialization into a new function with `anyhow`-based error handling - Introduced a `cameron` route and inline HTML layout in `src/cameron.rs` with tracing annotations - Simplified Docker build, added a watch action for development, and lowered default log level in `docker-compose.yml` - Added the `anyhow` dependency for better error propagation ### Reviewed Changes Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments. | File | Description | | ---------------- | --------------------------------------------------------------------------------------------- | | src/main.rs | Extracted OTLP reporter setup into `initialize_otlp_reporter()` and updated `fastrace` usage | | src/cameron.rs | Added `cameron` handler, tracing attributes, and inline HTML layout | | docker-compose.yml | Simplified `build:` syntax, added a `develop.watch` rebuild step, changed `LOG_LEVEL` to `info` | | Cargo.toml | Added `anyhow = "1.0.98"` | <details> <summary>Comments suppressed due to low confidence (2)</summary> **src/cameron.rs:24** * The `<html>` element is closed before the `<main>` and `<footer>`, which will generate invalid HTML structure; ensure these elements are nested inside `<body>`. ``` html { ``` **src/main.rs:63** * [nitpick] Consider adding unit tests for `initialize_otlp_reporter` to verify behavior when `OTLP_EXPORTER_ENDPOINT` is set or missing. ``` fn initialize_otlp_reporter() -> Result<OpenTelemetryReporter, anyhow::Error> { ``` </details>
@ -20,0 +33,4 @@
header {
nav {
ul {
li { a href="/" { "Home" } }
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-07-02 10:39:27 -04:00

[nitpick] This layout function duplicates similar logic in src/main.rs; consider extracting a shared module to avoid code duplication and keep HTML boilerplate in one place.

[nitpick] This `layout` function duplicates similar logic in `src/main.rs`; consider extracting a shared module to avoid code duplication and keep HTML boilerplate in one place.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-07-02 10:39:27 -04:00

Silently ignoring errors from initialize_otlp_reporter may make debugging difficult; consider logging the error when initialization fails.

    match initialize_otlp_reporter() {
        Ok(reporter) => fastrace::set_reporter(reporter, Config::default()),
        Err(error) => error!("Failed to initialize OTLP reporter: {error}"),
Silently ignoring errors from `initialize_otlp_reporter` may make debugging difficult; consider logging the error when initialization fails. ```suggestion match initialize_otlp_reporter() { Ok(reporter) => fastrace::set_reporter(reporter, Config::default()), Err(error) => error!("Failed to initialize OTLP reporter: {error}"), ```
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cameron/website!6
No description provided.