Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enable HTTP client traces in Open Telemetry output #41

Merged
merged 4 commits into from
May 13, 2024

Conversation

jamestelfer
Copy link
Collaborator

@jamestelfer jamestelfer commented May 13, 2024

Enables HTTP client tracing in the Open Telemetry output.

The use of this functionality can be disabled if cost reduction is required.

Fixes #38

Summary by CodeRabbit

  • New Features

    • Introduced enhanced telemetry configurations for observing HTTP transport and connection details.
    • Enabled multiple Buildkite agents to operate simultaneously using the same configuration.
  • Bug Fixes

    • Improved error handling in the initialization of Buildkite configurations.
  • Refactor

    • Updated HTTP request handling to include method-specific route tagging.
    • Replaced direct handler references with wrapped handlers for improved telemetry in HTTP serving.
  • Documentation

    • Updated environment variables related to telemetry settings for clearer configuration and usage.

Copy link

coderabbitai bot commented May 13, 2024

Walkthrough

The recent updates focus on enhancing HTTP request tracing and improving the Buildkite integration setup. Changes include the introduction of environment variables for detailed HTTP tracing, expansion of Buildkite agents in Docker configurations, and refinements in error handling and telemetry within the codebase. These enhancements aim to increase observability and streamline CI/CD processes.

Changes

File Path Change Summary
.envrc Introduced environment variables for enabling HTTP transport and connection tracing.
integration/.../docker-compose.yaml Added multiple instances of buildkite-agent for expanded CI/CD capability.
internal/.../pipeline.go, pipeline_test.go, config.go, observe/mux.go, mux_test.go, observe/telemetry.go Enhanced API client handling, error management, and telemetry in HTTP services. New configuration fields for HTTP tracing. Updated HTTP route handling in tests.
main.go Improved error handling and telemetry configuration; adjusted HTTP client and server setup.

"In the code's weave, a rabbit hops with glee, 🐇
Tracing each hop, from tree to shining API tree. 🌳 -> 🌐
Buildkite agents multiply, oh what a sight,
As errors shy away into the night. 🌙
With each commit, our garden does grow,
In the digital meadow, where the data streams flow." 🌼📈


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jamestelfer jamestelfer changed the title Jamestelfer/issue38 fix: enable HTTP client traces in Open Telemetry output May 13, 2024
Copy link

codecov bot commented May 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.73%. Comparing base (899f054) to head (826041f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #41      +/-   ##
==========================================
+ Coverage   88.73%   89.73%   +0.99%     
==========================================
  Files          12       12              
  Lines         426      448      +22     
==========================================
+ Hits          378      402      +24     
+ Misses         33       32       -1     
+ Partials       15       14       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 899f054 and ea7f920.
Files ignored due to path filters (2)
  • go.mod is excluded by !**/*.mod
  • go.sum is excluded by !**/*.sum
Files selected for processing (9)
  • .envrc (1 hunks)
  • integration/docker-compose.yaml (1 hunks)
  • internal/buildkite/pipeline.go (2 hunks)
  • internal/buildkite/pipeline_test.go (4 hunks)
  • internal/config/config.go (1 hunks)
  • internal/observe/mux.go (1 hunks)
  • internal/observe/mux_test.go (2 hunks)
  • internal/observe/telemetry.go (2 hunks)
  • main.go (2 hunks)
Files skipped from review due to trivial changes (1)
  • integration/docker-compose.yaml
Additional Context Used
GitHub Check Runs (1)
codecov/patch failure (2)

internal/buildkite/pipeline.go: [warning] 21-22: internal/buildkite/pipeline.go#L21-L22
Added lines #L21 - L22 were not covered by tests


internal/buildkite/pipeline.go: [warning] 29-30: internal/buildkite/pipeline.go#L29-L30
Added lines #L29 - L30 were not covered by tests

Additional comments not posted (12)
internal/observe/mux.go (2)

25-31: LGTM! The OpenTelemetry handler wrapping with route tagging is correctly implemented.


36-36: LGTM! Proper delegation of HTTP handling to the wrapped multiplexer.

internal/observe/mux_test.go (1)

Line range hint 29-38: LGTM! The test correctly verifies the application of route tagging in the Handle method.

internal/config/config.go (1)

45-52: LGTM! The new configuration fields for HTTP transport and connection tracing are correctly added with appropriate default values and environment bindings.

internal/buildkite/pipeline.go (2)

15-16: LGTM! The changes to the PipelineLookup struct support better modularity by decentralizing client creation.


54-80: LGTM! The custom round tripper and token authentication setup in the createClient method are correctly implemented to ensure context and authentication are included in API requests.

.envrc (1)

61-72: LGTM! The new environment variables for controlling HTTP transport and connection tracing are well-documented and align with the observability enhancements.

internal/buildkite/pipeline_test.go (2)

41-45: LGTM! The updated tests for the New function correctly include error handling checks, ensuring the robustness of client initialization.

Also applies to: 82-86, 113-117, 135-139


45-45: LGTM! The tests for the RepositoryLookup method are comprehensive and cover crucial scenarios including error handling and token verification.

Also applies to: 86-86, 117-117, 139-139

main.go (2)

42-46: LGTM! The error handling in the configuration of Buildkite and GitHub clients enhances the robustness of the server setup.


84-97: LGTM! The configuration of telemetry and the HTTP client in the server launch process are correctly implemented, ensuring proper error handling and data capture.

internal/observe/telemetry.go (1)

82-97: LGTM! The conditional configuration of the HTTP transport with OpenTelemetry instrumentation is well-implemented, providing flexibility in tracing setup.

internal/buildkite/pipeline.go Show resolved Hide resolved
The context was not being used in calls, leading to disconnected traces.

Using the context means creating the client each time, as the client does not support per-request context.
@jamestelfer jamestelfer force-pushed the jamestelfer/issue38 branch from ea7f920 to 826041f Compare May 13, 2024 12:52
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between ea7f920 and 826041f.
Files selected for processing (3)
  • internal/buildkite/pipeline.go (2 hunks)
  • internal/buildkite/pipeline_test.go (5 hunks)
  • main.go (2 hunks)
Files skipped from review as they are similar to previous changes (3)
  • internal/buildkite/pipeline.go
  • internal/buildkite/pipeline_test.go
  • main.go

@jamestelfer jamestelfer merged commit fe45341 into main May 13, 2024
5 checks passed
@jamestelfer jamestelfer deleted the jamestelfer/issue38 branch May 13, 2024 12:55
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.

Outgoing HTTP telemetry
1 participant