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

feat: add built-in metrics #421

Merged
merged 9 commits into from
Dec 14, 2023
Merged

Conversation

proost
Copy link
Contributor

@proost proost commented Dec 12, 2023

previous discussion: #199

Add built-in metrics for connection.

I have to otel version up because 1.19.0 doesn't support bucket boundaries.

@codecov-commenter
Copy link

codecov-commenter commented Dec 12, 2023

Codecov Report

Attention: 20 lines in your changes are missing coverage. Please review.

Comparison is base (9dea63a) 97.00% compared to head (ae29088) 96.94%.
Report is 6 commits behind head on main.

Files Patch % Lines
rueidisotel/metrics.go 79.59% 15 Missing and 5 partials ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #421      +/-   ##
==========================================
- Coverage   97.00%   96.94%   -0.06%     
==========================================
  Files          76       77       +1     
  Lines       31588    31671      +83     
==========================================
+ Hits        30641    30705      +64     
- Misses        796      811      +15     
- Partials      151      155       +4     

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

.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10,
}

var ErrDialFnRequired = errors.New("rueidisotel: clientOption.DialFn is required")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we set a default DialFn instead of throwing this error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. I Change it. e026def

// - rueidis_dial_success: number of successful dials
// - rueidis_dial_conns: number of active connections
// - rueidis_dial_latency: dial latency in seconds
type Client struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Well, I think we should reuse and extend the otelclient struct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

e026def

I changed it. but It is bit weired.

type connTracker struct {
net.Conn
conns metric.Int64UpDownCounter
once sync.Once
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
once sync.Once
once int32

sync.Once is overkill. An int32 is enough for this use case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@proost proost requested a review from rueian December 12, 2023 16:20
}
)

type DialLatencyHistogramOption struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
type DialLatencyHistogramOption struct {
type HistogramOption struct {

I believe we can reuse this option struct for other histogram metrics. So, name it just HistogramOption may be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@proost proost requested a review from rueian December 13, 2023 17:35
@rueian rueian added the feature label Dec 14, 2023
@rueian rueian merged commit a035425 into redis:main Dec 14, 2023
@rueian
Copy link
Collaborator

rueian commented Dec 14, 2023

Looks good to me. Thank you for your contribution! @proost

@proost proost deleted the feat-add-built-in-metrics branch December 15, 2023 02:16
rueian added a commit that referenced this pull request Dec 15, 2023
This reverts commit 5cacd16.

Revert "chore: go mod tidy"

This reverts commit 5ff7f42.

Revert "feat: add built-in metrics (#421)"

This reverts commit a035425.
rueian added a commit that referenced this pull request Dec 17, 2023
This reverts commit 5cacd16.

Revert "chore: go mod tidy"

This reverts commit 5ff7f42.

Revert "feat: add built-in metrics (#421)"

This reverts commit a035425.
rueian added a commit that referenced this pull request Dec 17, 2023
This reverts commit 5cacd16.

Revert "chore: go mod tidy"

This reverts commit 5ff7f42.

Revert "feat: add built-in metrics (#421)"

This reverts commit a035425.
rueian added a commit that referenced this pull request Dec 29, 2023
This reverts commit 5cacd16.

Revert "chore: go mod tidy"

This reverts commit 5ff7f42.

Revert "feat: add built-in metrics (#421)"

This reverts commit a035425.
rueian added a commit that referenced this pull request Dec 29, 2023
This reverts commit 5cacd16.

Revert "chore: go mod tidy"

This reverts commit 5ff7f42.

Revert "feat: add built-in metrics (#421)"

This reverts commit a035425.
rueian added a commit that referenced this pull request Jan 12, 2024
This reverts commit 5cacd16.

Revert "chore: go mod tidy"

This reverts commit 5ff7f42.

Revert "feat: add built-in metrics (#421)"

This reverts commit a035425.
rueian added a commit that referenced this pull request Jan 12, 2024
This reverts commit 5cacd16.

Revert "chore: go mod tidy"

This reverts commit 5ff7f42.

Revert "feat: add built-in metrics (#421)"

This reverts commit a035425.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants