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

refactor: update clients to have different user agents #1595

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Botseer
Copy link

@Botseer Botseer commented Oct 27, 2023

Pull Request

Related issue

Fixes #1437

What does this PR do?

The users agents for BrowserClient and NodeClient have been differentiated as per the issue for better metrics.

As for the code changes, I have made the change such that the necessary user agents are provided while constructing the respective client itself. Therefore there is no need to handle user agents in the http-request file.

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

@Botseer
Copy link
Author

Botseer commented Oct 30, 2023

@brunoocasali Please review this PR 🙏

brunoocasali
brunoocasali previously approved these changes Oct 31, 2023
Copy link
Member

@brunoocasali brunoocasali left a comment

Choose a reason for hiding this comment

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

Thanks @Botseer

bors merge

@brunoocasali brunoocasali added the enhancement New feature or request label Oct 31, 2023
meili-bors bot added a commit that referenced this pull request Oct 31, 2023
1595: refactor: update clients to have different user agents r=brunoocasali a=Botseer

# Pull Request

## Related issue
Fixes #1437

## What does this PR do?
The users agents for BrowserClient and NodeClient have been differentiated as per the issue for better metrics.

As for the code changes, I have made the change such that the necessary user agents are provided while constructing the respective client itself. Therefore there is no need to handle user agents in the `http-request` file.

## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!


Co-authored-by: Botseer <homeu99@gmail.com>
@meili-bors
Copy link
Contributor

meili-bors bot commented Oct 31, 2023

Build failed:

@Botseer
Copy link
Author

Botseer commented Oct 31, 2023

@brunoocasali please do review again, sorry previously it seems I missed the tests

@codecov
Copy link

codecov bot commented Oct 31, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.31%. Comparing base (cd61a8c) to head (65ec149).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1595      +/-   ##
==========================================
- Coverage   97.43%   97.31%   -0.12%     
==========================================
  Files          22       22              
  Lines         858      857       -1     
  Branches       93       87       -6     
==========================================
- Hits          836      834       -2     
  Misses         22       22              
- Partials        0        1       +1     

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

@brunoocasali
Copy link
Member

Hey @Botseer, sorry for the late reply, but can you check why the coverage dropped?

...config,
clientAgents: [
...(config.clientAgents ?? []),
`Meilisearch Node (v${PACKAGE_VERSION})`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Considering that this package might be used by any other runtime like Deno and Bun and more, does it make sense to call it Node? Maybe it would be best if we'd only ship one client, one that runs everywhere, and is a lot more treeshakeable, but that's part of another issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a custom user-agent for Node users.
4 participants