14 Commits

Author SHA1 Message Date
David Reiss
28643d8c4b Fix flaky TestCurrentCounterAndGauge (#8085)
## What changed?
Fix flaky test

## How did you test it?
ran 1000 times locally
2025-07-23 08:29:37 -07:00
David Reiss
bc89526a73 Add metrics for suspected deadlocks (#7782)
## What changed?
- Add counter metric for total suspected deadlocks
- Add gauge metric for current unresolved suspected deadlocks

## Why?
These could be used in alerting or health checking.

## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [x] added new unit test(s)
- [ ] added new functional test(s)
2025-05-16 12:33:55 -07:00
Alex Shtin
91893f1064 Remove license header from every file (#7689)
## What changed?
<!-- Describe what has changed in this PR -->
Remove license header from every file. Because it is really hard to
follow in this PR here is the summary:
1. License header is removed from all `.go` and `.proto` files
:fireworks::fireworks:🎆.
2. `LICENSE` file in the root directory has only Temporal and Uber
copyrights.
3. 5 other `LICENSE` files added to the packages which have copyrights
different from Temporal and Uber: Datadog, Xargin, "Mat Ryer, Tyler
Bunnell and contributors".
4. `license_file` flag is removed from all code generation tools.
5. `copyright_file` flag is removed from `go:generate mockgen`
directive.
6. All copyright related targets are removed from `Makefile`.
7. Updated Temporal copyright year to 2025 everywhere.

## Why?
<!-- Tell your future self why have you made these changes -->
I double checked with legal department that it is not needed to have
license header in every file. One file per repo is enough. I put all
copyrights to the root `LICENSE` file and removed header from all other
files. Also updated tools and `Makefile`.
2025-05-01 18:50:21 -07:00
Stephan Behnke
ee925c7b89 Move packages from internal to common (#7526)
## What changed?
<!-- Describe what has changed in this PR -->

Moved all packages inside `/internal` to `/common`.

## Why?
<!-- Tell your future self why have you made these changes -->

While the `internal` package provides the benefit of preventing any
external party from depending on them, we find that in practice this has
little benefit.

Our compatibility guarantees do not coverage any APIs in `common`
anyway.

Furthermore, splitting commonly-used packages into two places hinders
discoverability. And adds (albeit minor) mental friction.

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->

Compiler.

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->

External users could start relying on these packages. But that's their
risk assessment to make. There are no guarantees (just like for any
other package in this repo!) outside of the external APIs.

## Documentation
<!-- Have you made sure this change doesn't falsify anything currently
stated in `docs/`? If significant
new behavior is added, have you described that in `docs/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2025-03-25 21:12:46 +00:00
Jacob Barzee
0836b0fff0 Import alignment (#6426)
## What changed?
Make import formatting a part of the build, and test validity with
"ensure-no-changes" target

## Why?
So we never discuss import order again (hopefully)

## How did you test it?
its a build change, so the build will test it!

## Potential risks
As long as build works, the only thing I risk is the ire of coworker who
want imports to be different ;)

## Documentation
N/A

## Is hotfix candidate?
No
2024-08-23 14:48:10 -06:00
David Reiss
8e63f71fe3 Reduce sensitivity of deadlock detector (#6344)
## What changed?
- Run checks every 60s instead of 30s.
- Increase grace period for shard lock and shard io semaphore checks.

## Why?
These are a little too sensitive and can fire when persistence is slow
for an extended time. The longer timeouts will still catch true
deadlocks in a reasonable amount of time.

## How did you test it?
didn't
2024-07-26 14:29:56 -07:00
David Reiss
de16a6c0b6 Use AdaptivePool in deadlockDetector (#6138)
## What changed?
Use AdaptivePool in deadlockDetector.

## Why?
consolidate code

## How did you test it?
manual test with extra sleep in ping routine
2024-07-10 18:10:59 -07:00
David Reiss
34107bc2e1 Move pingable interface to separate package (#6132)
## What changed?
Moving an interface.

## Why?
Avoid import cycles: I want to use this from dynamicconfig which can't
depend on common.
2024-06-14 11:35:44 -07:00
David Reiss
93c6d0c020 Typed dynamic config (#5739)
## What changed?
Dynamic config improvements:
- Typed settings to prevent misuse
- Moved defaults to where settings are defined
- Code generation to make it easy to add new types and filters
- Shorter names for readability

## Why?
Making it easier to use, preventing misuse, making it easy to extend,
easier to parse and generate documentation from, base for future
enhancements (e.g. validation at load time)

## How did you test it?
modified existing tests

## Potential risks
typo or missed something in all the merges and refactors
2024-05-06 11:25:19 -07:00
Michael Snowden
8f798a9d66 Use time.NewTimer instead of time.After (#4596)
<!-- Describe what has changed in this PR -->
**What changed?**
I replaced all usages of `time.After` with `time.NewTimer`. I also added
a linter rule which bans usage of `time.After`.

<!-- Tell your future self why have you made these changes -->
**Why?**
`time.After` leaks resources. It's unclear what resources exactly
because `startTimer` is [implemented in
src/runtime](https://go.dev/src/runtime/time.go#L206), and the docs just
say "The underlying Timer is not recovered by the garbage collector
until the timer fires."

In any case, `NewTimer` is strictly more efficient, and it's not much
harder to use.

<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
**How did you test it?**
I verified that I can create an issue with it:
<img width="1415" alt="image"
src="https://github.com/temporalio/temporal/assets/5942963/315b6839-bdd4-4127-a3dc-1db966755366">


<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->
**Potential risks**
This is a bit more verbose for people to use. People also may forget to
call `.Stop()`.

<!-- Is this PR a hotfix candidate or require that a notification be
sent to the broader community? (Yes/No) -->
**Is hotfix candidate?**
No
2023-07-10 10:43:14 -07:00
Mindaugas Rukas
0b4df6a678 Rename metrics.Handler to avoid name stuttering (#3713) 2022-12-15 20:23:09 -08:00
David Reiss
788b2b76a3 Use fx group for deadlock detector (#3650) 2022-11-23 09:10:33 -08:00
Yu Xia
9fa1a9043b Replace metrics client/scope with MetricsHandler (#3561)
* Deprecate metrics client and scope in all source code
2022-11-07 22:03:54 -08:00
David Reiss
1f697219ee Add deadlock detector (#3492) 2022-10-31 20:53:48 -07:00