[PR #136] [MERGED] Code, pointer, variable cleanups. And metrics! #1279

Closed
opened 2025-12-29 02:29:32 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/136
Author: @kradalby
Created: 10/2/2021
Status: Merged
Merged: 10/4/2021
Merged by: @kradalby

Base: mainHead: db-cleaning


📝 Commits (10+)

  • 0475eb6 Move DB call of pollmap to Machine inside a function
  • 0d4a006 Consitently use Machine pointers
  • 3c3189c Move toNode, add type helpers, split peers and shared
  • 1bddf11 Resolve merge conflict
  • 7793012 Add error if peer api is empty
  • 31b4f03 Set integration logging to trace
  • 2090a13 Remove docker network, it wasnt used, comment out portmapping to host
  • 772541a add comment about poor error handling when headscale isnt becoming available
  • 931ef94 Add checks to see if we can fetch the ip from map, remove possible null assignment
  • c09428a Revert "Remove docker network, it wasnt used, comment out portmapping to host"

📊 Changes

12 files changed (+498 additions, -239 deletions)

View changed files

📝 api.go (+30 -7)
📝 app.go (+7 -0)
📝 go.mod (+4 -2)
📝 go.sum (+26 -0)
📝 integration_test.go (+14 -8)
📝 integration_test/etc/config.json (+1 -1)
📝 machine.go (+242 -151)
📝 machine_test.go (+43 -2)
metrics.go (+41 -0)
📝 namespaces.go (+1 -0)
📝 poll.go (+40 -26)
📝 sharing_test.go (+49 -42)

📄 Description

This PR was suppose to be cleaning up some database calls that were all over the code, but it ended up being a chase for the cause of #97.

It contains a couple of things:

I have narrowed down what is causing the occasional storm of update requests, but not sure yet, so will continue to dig.

However this PR is of a size that it should be handled before it become even bigger (worse).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/juanfont/headscale/pull/136 **Author:** [@kradalby](https://github.com/kradalby) **Created:** 10/2/2021 **Status:** ✅ Merged **Merged:** 10/4/2021 **Merged by:** [@kradalby](https://github.com/kradalby) **Base:** `main` ← **Head:** `db-cleaning` --- ### 📝 Commits (10+) - [`0475eb6`](https://github.com/juanfont/headscale/commit/0475eb6ef7ffc70fa544c9f31f1e697d4235323e) Move DB call of pollmap to Machine inside a function - [`0d4a006`](https://github.com/juanfont/headscale/commit/0d4a006536a5d854f7c822f617a810354800ab1f) Consitently use Machine pointers - [`3c3189c`](https://github.com/juanfont/headscale/commit/3c3189caa612781fe271f11475f30461623b4f42) Move toNode, add type helpers, split peers and shared - [`1bddf11`](https://github.com/juanfont/headscale/commit/1bddf1147bc29994c32a8e3c120a84186300bbc5) Resolve merge conflict - [`7793012`](https://github.com/juanfont/headscale/commit/779301240972e6aa1291fcb014485467667b94a4) Add error if peer api is empty - [`31b4f03`](https://github.com/juanfont/headscale/commit/31b4f03f96329ef8d5c91dff339763d436b5be5e) Set integration logging to trace - [`2090a13`](https://github.com/juanfont/headscale/commit/2090a13dcd8ab18d25ec7ea99b50f233e512dfb6) Remove docker network, it wasnt used, comment out portmapping to host - [`772541a`](https://github.com/juanfont/headscale/commit/772541afaba27716e3b5bd2a861a993f347dbfbd) add comment about poor error handling when headscale isnt becoming available - [`931ef94`](https://github.com/juanfont/headscale/commit/931ef9482b4d7d66a9e42fe702fa367d90c971ae) Add checks to see if we can fetch the ip from map, remove possible null assignment - [`c09428a`](https://github.com/juanfont/headscale/commit/c09428accad05a829c2aabfb4db8d2f63f0bdc1e) Revert "Remove docker network, it wasnt used, comment out portmapping to host" ### 📊 Changes **12 files changed** (+498 additions, -239 deletions) <details> <summary>View changed files</summary> 📝 `api.go` (+30 -7) 📝 `app.go` (+7 -0) 📝 `go.mod` (+4 -2) 📝 `go.sum` (+26 -0) 📝 `integration_test.go` (+14 -8) 📝 `integration_test/etc/config.json` (+1 -1) 📝 `machine.go` (+242 -151) 📝 `machine_test.go` (+43 -2) ➕ `metrics.go` (+41 -0) 📝 `namespaces.go` (+1 -0) 📝 `poll.go` (+40 -26) 📝 `sharing_test.go` (+49 -42) </details> ### 📄 Description This PR was suppose to be cleaning up some database calls that were all over the code, but it ended up being a chase for the cause of #97. It contains a couple of things: - A lot of fixed type, pointer and variable inconsistencies - Initial work on adding metrics (available at `/metrics`) for chasing #97 - More unit tests - Improving a bit of the setup of integration tests I have narrowed down what is causing the occasional storm of update requests, but not sure yet, so will continue to dig. However this PR is of a size that it should be handled before it become even bigger (worse). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 02:29:32 +01:00
adam closed this issue 2025-12-29 02:29:32 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#1279