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 telemetry configuration #39

Merged
merged 1 commit into from
May 13, 2024
Merged

Conversation

jamestelfer
Copy link
Collaborator

@jamestelfer jamestelfer commented May 13, 2024

Add configuration for supported values, including default documentation.

Some settings may have been configurable with OTel defaults, but for this small set it's useful to control directly.

See also

OTel default environment documentation: https://opentelemetry.io/docs/specs/otel/protocol/exporter/

Summary by CodeRabbit

  • Documentation

    • Updated instructions for configuring the development environment in .envrc.
  • New Features

    • Introduced new environment variables for enhanced observability in docker-compose.yaml.
    • Added configuration options for telemetry and metrics in the application.
  • Refactor

    • Updated telemetry setup to utilize new configuration parameters, improving observability features.

Add configuration for supported values, including default documentation.
Copy link

coderabbitai bot commented May 13, 2024

Walkthrough

The recent updates focus on enhancing observability within the project's infrastructure. Changes include added instructions and configurations for environment setup, integration of new observability-related variables in Docker, and updates in the Go codebase to support telemetry features like tracing and metrics, based on configurable settings.

Changes

Files Summary
.envrc Updated with additional comments and instructions for local configuration and telemetry setup.
integration/.../docker-compose.yaml Introduced observability variables and disabled metrics for Jaeger standalone.
internal/config/config.go Expanded ObserveConfig with new telemetry-related fields.
internal/observe/telemetry.go Enhanced telemetry setup with configurable parameters and conditional instantiation.

🐇✨
In the burrow of code, under the moon's glow,
A rabbit hopped, with changes in tow.
Observability sprouts, in fields wide,
Through Docker's waves and Go's tide.
Metrics and traces, in harmony bound,
In the garden of code, new flowers found. 🌼🌟


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.

Copy link

codecov bot commented May 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.73%. Comparing base (450b887) to head (0367875).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #39   +/-   ##
=======================================
  Coverage   88.73%   88.73%           
=======================================
  Files          12       12           
  Lines         426      426           
=======================================
  Hits          378      378           
  Misses         33       33           
  Partials       15       15           

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

@jamestelfer jamestelfer merged commit 923d1c4 into main May 13, 2024
5 checks passed
@jamestelfer jamestelfer deleted the jamestelfer/issue11 branch May 13, 2024 04:45
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

Out of diff range and nitpick comments (1)
internal/observe/telemetry.go (1)

[!TIP]
Codebase Verification

The search for configuration validation within the newTraceProvider and newMeterProvider functions did not reveal any specific validation logic directly within these functions. The output shows some conditional checks and error handling in a different function (Configure), which checks if certain features are enabled and handles errors, but this does not directly confirm that the configuration values used in newTraceProvider and newMeterProvider are validated before use.

Given this context, it appears that the configuration values might not be explicitly validated within the functions in question before they are used. This could potentially lead to runtime errors if invalid configuration values are passed to these functions.

Recommendation:

  • It would be prudent to implement explicit validation for the configuration values within newTraceProvider and newMeterProvider, or ensure that any values passed to these functions are validated beforehand.
  • The development team should consider reviewing the configuration management strategy to ensure robustness and error handling.
Analysis chain

Line range hint 97-133: Verify that the configuration values used in newTraceProvider and newMeterProvider are validated before use to prevent runtime errors.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the validation of configuration values before use in `newTraceProvider` and `newMeterProvider`.

# Test: Search for validation logic for configuration values in the `telemetry.go` file. Expect: At least one occurrence of validation logic.
rg --type go 'validateConfig' internal/observe/telemetry.go

Length of output: 59



Script:

#!/bin/bash
# Description: Search for any form of configuration validation in the `newTraceProvider` and `newMeterProvider` functions.

# Search for any inline validation or error handling related to configuration values in the `newTraceProvider` function.
echo "Searching in newTraceProvider:"
rg --type go --context 5 'cfg\.' internal/observe/telemetry.go | grep -E 'if|error'

# Search for any inline validation or error handling related to configuration values in the `newMeterProvider` function.
echo "Searching in newMeterProvider:"
rg --type go --context 5 'cfg\.' internal/observe/telemetry.go | grep -E 'if|error'

Length of output: 965

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 450b887 and 0367875.
Files selected for processing (4)
  • .envrc (2 hunks)
  • integration/docker-compose.yaml (1 hunks)
  • internal/config/config.go (1 hunks)
  • internal/observe/telemetry.go (4 hunks)
Files skipped from review due to trivial changes (1)
  • .envrc
Additional comments not posted (2)
integration/docker-compose.yaml (1)

29-32: Ensure that the new environment variables are documented in the project's README or relevant documentation.

internal/config/config.go (1)

45-50: Confirm that the default values and environment variable names for the new fields in ObserveConfig align with the project's configuration standards.

Comment on lines +57 to +72
tracerProvider, err := newTraceProvider(ctx, cfg, exporters)
if err != nil {
handleErr(err)
return
}
shutdownFuncs = append(shutdownFuncs, tracerProvider.Shutdown)
otel.SetTracerProvider(tracerProvider)

meterProvider, err := newMeterProvider(ctx, exporters)
if err != nil {
handleErr(err)
return
if cfg.MetricsEnabled {
meterProvider, err := newMeterProvider(ctx, cfg, exporters)
if err != nil {
handleErr(err)
return shutdown, err
}
shutdownFuncs = append(shutdownFuncs, meterProvider.Shutdown)
otel.SetMeterProvider(meterProvider)
Copy link

Choose a reason for hiding this comment

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

Review the error handling in the instantiation of tracerProvider and meterProvider. Ensure that errors are properly logged and handled without causing unexpected behavior.

- handleErr(err)
+ if err != nil {
+   handleErr(err)
+   return
+ }

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
tracerProvider, err := newTraceProvider(ctx, cfg, exporters)
if err != nil {
handleErr(err)
return
}
shutdownFuncs = append(shutdownFuncs, tracerProvider.Shutdown)
otel.SetTracerProvider(tracerProvider)
meterProvider, err := newMeterProvider(ctx, exporters)
if err != nil {
handleErr(err)
return
if cfg.MetricsEnabled {
meterProvider, err := newMeterProvider(ctx, cfg, exporters)
if err != nil {
handleErr(err)
return shutdown, err
}
shutdownFuncs = append(shutdownFuncs, meterProvider.Shutdown)
otel.SetMeterProvider(meterProvider)
tracerProvider, err := newTraceProvider(ctx, cfg, exporters)
if err != nil {
if err != nil {
handleErr(err)
return
}
}
shutdownFuncs = append(shutdownFuncs, tracerProvider.Shutdown)
otel.SetTracerProvider(tracerProvider)
if cfg.MetricsEnabled {
meterProvider, err := newMeterProvider(ctx, cfg, exporters)
if err != nil {
if err != nil {
handleErr(err)
return shutdown, err
}
}
shutdownFuncs = append(shutdownFuncs, meterProvider.Shutdown)
otel.SetMeterProvider(meterProvider)

@jamestelfer jamestelfer linked an issue May 13, 2024 that may be closed by this pull request
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.

Telemetry configuration
1 participant