-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
expvar: add Map.Delete #13491
Comments
Remove
method to expvar.MapRemove
method to expvar.Map
Thanks. We don't take github pull requests. To contribute your patch please follow the procedure at https://golang.org/doc/contribute.html . Note that at this point it will have to wait for the Go 1.7 release. |
The Remove method was not in the original API because monitoring software of the kind that scrapes such output can often get confused by a disappearing map key. I think any change to add a Remove method would need to justify its usefulness as outweighing potentially malfunctioning monitoring. |
Well, the particular use case I have highlights this fairly well IMO. I have a service which maintains state of downstream services. The list of all downstream services is fluid-- since it is determined by a source of truth service. As such my service has some metrics for each downstream. Since I cannot call "remove" i effectively leak N metrics per service that appears and then gets removed, since I cannot remove the metrics associated with that service. I don't think adding a |
Is there any disagreement with or recommended workaround for @jacksontj's use case? |
I have exactly the same issue as @jacksontj. I don't buy the "borgmon can't handle it so we didn't add this API" argument. We expose a wealth of information over expvar that is useful for troubleshooting problems, how this gets consumed/stored by a particular monitoring backend isn't really the point. Looks like the Kapacitor project already forked the code of The first reason they give why they forked the code:
|
Remove
method to expvar.MapRemove
method to expvar.Map
Moving this to proposal so that it gets some visibility. |
OK, it does seem like this is missing from expvar.Map's methods. |
Remove
method to expvar.Map
Change https://golang.org/cl/139537 mentions this issue: |
I've been using expvar for a few metrics related cases, and its great. The one thing I really see as missing is that there is no mechanism to remove items from an expvar.Map. I had created a PR with a simple Remove method which returns the Var associated with key-- or nil. I don't see any reason that it shouldn't-- so I created a simple patch (#13490) which adds a Remove method to expvar.Map
The text was updated successfully, but these errors were encountered: