Do not try to call syscall.Kill on Windows (#2986)

Will create a followup to make sure we are doing the right thing on Windows. This will unblock builds for now, although we don't get the metrics for Windows(which was not working anyways).

---

#### Does this PR need a docs update or release note?

- [ ]  Yes, it's included
- [x] 🕐 Yes, but in a later PR
- [ ]  No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [x] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

#### Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* #<issue>

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
Abin Simon 2023-03-30 13:44:33 +05:30 committed by GitHub
parent 03edc603da
commit d99b125087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 7 deletions

View File

@ -6,7 +6,6 @@ import (
"fmt"
"io"
"os"
"syscall"
"time"
"github.com/alcionai/clues"
@ -234,12 +233,6 @@ func dumpMetrics(ctx context.Context, stop <-chan struct{}, sig *metrics.InmemSi
}
}
func signalDump(ctx context.Context) {
if err := syscall.Kill(syscall.Getpid(), metrics.DefaultSignal); err != nil {
logger.CtxErr(ctx, err).Error("metrics interval signal")
}
}
// Inc increments the given category by 1.
func Inc(cat m, keys ...string) {
cats := append([]string{string(cat)}, keys...)

View File

@ -0,0 +1,19 @@
//go:build !windows
// +build !windows
package events
import (
"context"
"syscall"
"github.com/armon/go-metrics"
"github.com/alcionai/corso/src/pkg/logger"
)
func signalDump(ctx context.Context) {
if err := syscall.Kill(syscall.Getpid(), metrics.DefaultSignal); err != nil {
logger.CtxErr(ctx, err).Error("metrics interval signal")
}
}

View File

@ -0,0 +1,11 @@
package events
import (
"context"
"github.com/alcionai/corso/src/pkg/logger"
)
func signalDump(ctx context.Context) {
logger.Ctx(ctx).Warn("cannot send signal on Windows")
}