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] Node Server Metrics Implementation #278

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

Conversation

prajwalvathreya
Copy link
Contributor

@prajwalvathreya prajwalvathreya commented Oct 2, 2024

This PR is to get the metrics of the functions performed by the node server. The functions for which the metrics are implemented are:

NodePublishVolume
NodeUnpublishVolume
NodeStageVolume
NodeUnstageVolume
NodeExpandVolume

General:

  • Have you removed all sensitive information, including but not limited to access keys and passwords?
  • Have you checked to ensure there aren't other open or closed Pull Requests for the same bug/feature/question?

Pull Request Guidelines:

  1. Does your submission pass tests?
  2. Have you added tests?
  3. Are you addressing a single feature in this PR?
  4. Are your commits atomic, addressing one change per commit?
  5. Are you following the conventions of the language?
  6. Have you saved your large formatting changes for a different PR, so we can focus on your work?
  7. Have you explained your rationale for why this feature is needed?
  8. Have you linked your PR to an open issue

Copy link

codecov bot commented Oct 2, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 70 lines in your changes missing coverage. Please review.

Project coverage is 73.84%. Comparing base (6c0a633) to head (f3093ff).

Files with missing lines Patch % Lines
internal/driver/nodeserver.go 14.86% 63 Missing ⚠️
internal/driver/server.go 65.00% 6 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #278      +/-   ##
==========================================
- Coverage   76.33%   73.84%   -2.50%     
==========================================
  Files          21       22       +1     
  Lines        1644     1747     +103     
==========================================
+ Hits         1255     1290      +35     
- Misses        289      356      +67     
- Partials      100      101       +1     

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

@prajwalvathreya prajwalvathreya marked this pull request as ready for review October 14, 2024 18:24
@prajwalvathreya prajwalvathreya requested review from a team as code owners October 14, 2024 18:24
@prajwalvathreya prajwalvathreya changed the title - added prometheus scraping to one function in nodeserver.go to test … - Node Server Metrics endpoint Oct 14, 2024
- fixed `ineffassign` error for variable `success`
@prajwalvathreya prajwalvathreya changed the title - Node Server Metrics endpoint - [Feat] Node Server Metrics Implementation Oct 14, 2024
@komer3 komer3 changed the title - [Feat] Node Server Metrics Implementation [Feat] Node Server Metrics Implementation Oct 14, 2024
}

func (s *nonBlockingGRPCServer) Start(endpoint string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer) {
s.wg.Add(1)
go s.serve(endpoint, ids, cs, ns)
go s.startMetricsServer(":8081")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make this dynamic and get the value from the ENV var? May be also only enable metric server if a flag is set to true

SuccessFalse = "false"
)

var (
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add some comments about these prom metrics? Would be helpful in future when trying to understand this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure

Comment on lines 103 to 106
success = metrics.SuccessFalse
// Record failure metric before returning
metrics.NodePublishTotal.WithLabelValues(success).Inc()
metrics.NodePublishDuration.WithLabelValues(success).Observe(time.Since(start).Seconds())
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like these lines are being used multiple times, we should consider encapsulating it in some func or var?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this makes sense. I have pushed changes to encapsulate this.

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