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 REST Posting File to v1/listen #265

Merged
merged 1 commit into from
Oct 19, 2024

Conversation

dvonthenen
Copy link
Contributor

@dvonthenen dvonthenen commented Oct 19, 2024

Proposed changes

Addresses: #125

Tested examples.speech-to-text/rest/file. Works as expected now.

Types of changes

What types of changes does your code introduce to the community Go SDK?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update or tests (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • I have lint'ed all of my code using repo standards
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

NA

Summary by CodeRabbit

  • New Features

    • Enhanced logging for the Deepgram client to provide more detailed information during execution.
    • Added logging for the usage of the SetupRequest method in multiple client packages to improve traceability.
  • Bug Fixes

    • Updated the request setup in the DoStream method to reflect a new structure in the REST client organization.

These changes improve the debugging experience and maintain the overall functionality of the application.

Copy link

coderabbitai bot commented Oct 19, 2024

Walkthrough

The changes in this pull request involve modifications to logging configurations and method invocations across several files. The LogLevel for the Deepgram client is updated to a more verbose setting in main.go. Additionally, logging statements are introduced in the SetupRequest methods of two different REST client implementations to enhance debugging visibility. Finally, a structural change in the DoStream method of the Client struct reflects an updated way of accessing the SetupRequest method.

Changes

File Path Change Summary
examples/speech-to-text/rest/file/main.go Updated LogLevel from client.LogLevelTrace to client.LogLevelVerbose in the main function.
pkg/client/common/v1/rest.go Added a logging statement in the SetupRequest method to indicate its usage from the Common Package.
pkg/client/listen/v1/rest/client.go Modified DoStream to call c.RESTClient.Client.SetupRequest instead of c.RESTClient.SetupRequest.
pkg/client/rest/v1/rest.go Added a logging statement in the SetupRequest method with verbosity level 3.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Client
    participant RESTClient

    User->>Client: Initiate streaming request
    Client->>RESTClient: Call SetupRequest
    RESTClient->>Client: Setup complete
    Client->>User: Streaming started
Loading

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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

@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

🧹 Outside diff range and nitpick comments (1)
pkg/client/rest/v1/rest.go (1)

50-51: LGTM! Consider adding the method name to the log message.

The added logging statement enhances debugging capabilities without altering the functionality. It's consistent with the existing logging style and uses an appropriate verbosity level.

To further improve the log message, consider including the method name:

klog.V(3).Infof("Client.SetupRequest: Using SetupRequest from REST Package\n")

This addition would make it easier to trace the exact location of the log in the code.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 3a0a4d2 and ce50723.

📒 Files selected for processing (4)
  • examples/speech-to-text/rest/file/main.go (1 hunks)
  • pkg/client/common/v1/rest.go (1 hunks)
  • pkg/client/listen/v1/rest/client.go (1 hunks)
  • pkg/client/rest/v1/rest.go (1 hunks)
🧰 Additional context used
🔇 Additional comments (3)
examples/speech-to-text/rest/file/main.go (1)

27-27: Approved change, but clarification needed

The change from LogLevelTrace to LogLevelVerbose aligns with the goal of enhancing debugging visibility. However, I have a few points to address:

  1. Could you clarify how this change specifically addresses the REST posting file issue mentioned in the PR objectives?
  2. Consider adding a comment explaining why LogLevelVerbose was chosen for this example.
  3. Is LogLevelVerbose intended to be the default for this example, or should it be configurable? If it's meant to be configurable, consider adding a command-line flag or environment variable to set the log level.

To ensure this change doesn't affect other parts of the codebase, let's check for other occurrences of LogLevel:

✅ Verification successful

LogLevel Change Verified

The update to LogLevelVerbose in examples/speech-to-text/rest/file/main.go is isolated and does not affect other parts of the codebase. This change effectively enhances debugging visibility as intended.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other occurrences of LogLevel in the codebase
# Expected: Only this occurrence should be changed

rg --type go 'LogLevel:' -C 2

Length of output: 12110

pkg/client/common/v1/rest.go (1)

41-42: LGTM! Enhances debugging visibility.

The added logging statement improves debugging capabilities by clearly indicating when the SetupRequest method from the Common Package is being used. This aligns well with the goal of enhancing visibility for debugging purposes.

To ensure this change addresses the mentioned bug fix for REST posting file to v1/listen (Issue #125), please run the following verification:

Could you please provide more context on how this logging statement specifically addresses the bug mentioned in Issue #125?

pkg/client/listen/v1/rest/client.go (1)

129-129: LGTM! Verify the impact on other parts of the codebase.

The change from c.RESTClient.SetupRequest to c.RESTClient.Client.SetupRequest appears to be correct and aligns with the comment above it. This modification suggests a refactoring of the RESTClient structure, possibly to improve organization or introduce new functionality.

To ensure this change doesn't introduce any unintended side effects, please run the following verification script:

This will help identify any other locations in the codebase that might need similar updates.

✅ Verification successful

Verified the Change

The modification from c.RESTClient.SetupRequest to c.RESTClient.Client.SetupRequest in pkg/client/listen/v1/rest/client.go is correct and does not affect other parts of the codebase. All other usages of SetupRequest remain consistent.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of SetupRequest method across the codebase

# Test: Search for other occurrences of SetupRequest to ensure consistency
rg --type go -e 'SetupRequest'

# Test: Check for any remaining instances of c.RESTClient.SetupRequest
rg --type go -e 'c\.RESTClient\.SetupRequest'

Length of output: 3286

@dvonthenen
Copy link
Contributor Author

thanks @jpvajda for the approve

@dvonthenen dvonthenen merged commit 30cd597 into deepgram:main Oct 19, 2024
3 checks passed
@dvonthenen dvonthenen deleted the fix-rest-post-file branch October 19, 2024 16:54
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.

2 participants