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

Add user agent metrics #492

Merged
merged 5 commits into from
Mar 22, 2023
Merged

Add user agent metrics #492

merged 5 commits into from
Mar 22, 2023

Conversation

emplam27
Copy link
Contributor

@emplam27 emplam27 commented Mar 20, 2023

What this PR does / why we need it:

  • doc : https://codepair.navercorp.com/p9diyg
  • Add metric about yorkie-sdk-type/version, projectID/Name, server instance name etc.
  • every grpc request success, collect metric about yorkie-sdk information
  • yorkie-js-sdk, yorkie-ios-sdk, yorkie-android-sdk need to set header and put yorkie-sdk informations
  • User can set hostname when the server start (hostname is used in metrics etc.)
    • Use CLI flags : $ yorkie server ... --hostname {host name value} ...
    • Use config.yaml : Backend.Hostname field value

Which issue(s) this PR fixes:

Fixes #393

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Server hostname settings. hostname is used in metrics
- Use CLI flags : `$ yorkie server ... --hostname {host name value} ...`
- Use config.yaml : `Backend.Hostname` field value

Additional documentation:

yorkie documentation : https://yorkie.dev/docs/cli#commands
- required add `--hostname` flag

Checklist:

  • Added relevant tests or not required
  • Didn't break anything

- Add metric about yorkie-sdk-type/version, projectID/Name, server instance name etc.
- every grpc request success, collect metric about yorkie-sdk information
@emplam27 emplam27 requested a review from hackerwins March 20, 2023 06:41
@emplam27 emplam27 self-assigned this Mar 20, 2023
@codecov
Copy link

codecov bot commented Mar 21, 2023

Codecov Report

Merging #492 (ad2deb6) into main (dcf4cfb) will decrease coverage by 0.35%.
The diff coverage is 54.76%.

@@            Coverage Diff             @@
##             main     #492      +/-   ##
==========================================
- Coverage   48.68%   48.33%   -0.35%     
==========================================
  Files          69       69              
  Lines        5953     5896      -57     
==========================================
- Hits         2898     2850      -48     
+ Misses       2714     2705       -9     
  Partials      341      341              
Impacted Files Coverage Δ
client/auth.go 56.25% <0.00%> (-3.75%) ⬇️
server/backend/backend.go 0.00% <0.00%> (ø)
server/backend/config.go 60.97% <ø> (ø)
server/config.go 43.01% <ø> (ø)
server/rpc/yorkie_server.go 38.65% <79.31%> (-6.15%) ⬇️

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@hackerwins hackerwins marked this pull request as ready for review March 22, 2023 02:27
- 1. Move collecting user-agent metrics to interceptors
- 2. Remove gRPC dependency from metrics
- 3. Extract header constants
@hackerwins hackerwins changed the title Add yorkie sdk metric Add user agent metrics Mar 22, 2023
Copy link
Member

@hackerwins hackerwins left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution.

I think it would be good to continue improving this by deploying it and watching actual data.

@hackerwins hackerwins merged commit ead453c into main Mar 22, 2023
@hackerwins hackerwins deleted the yorkie-sdk-metrics branch March 22, 2023 04:35
return nil, fmt.Errorf("get hostname: %w", err)
hostname := conf.Hostname
if hostname == "" {
hostname, err := os.Hostname()
Copy link
Member

@krapie krapie Apr 24, 2023

Choose a reason for hiding this comment

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

This hostname value inside if statement shadows hostname in line 68.
Therefore hostname will not be updated.

I'll fix this in #521

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.

Collect the client version and type that requested the API as a metric
3 participants