-
-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package actor | ||
|
||
import "time" | ||
|
||
type Config struct { | ||
DeadLetterThrottleInterval time.Duration //throttle deadletter logging after this interval | ||
DeadLetterThrottleCount int //throttle deadletter logging after this count | ||
DeadLetterRequestLogging bool //do not log deadletters with sender | ||
DeveloperSupervisionLogging bool //console log and promote supervision logs to Warning level | ||
DiagnosticsSerializer func(Actor) string //extract diagnostics from actor and return as string | ||
} | ||
|
||
func defaultActorSystemConfig() Config { | ||
return Config{ | ||
DeadLetterThrottleInterval: time.Duration(0), | ||
DeadLetterThrottleCount: 0, | ||
DeadLetterRequestLogging: true, | ||
DeveloperSupervisionLogging: false, | ||
DiagnosticsSerializer: func(actor Actor) string { | ||
return "" | ||
}, | ||
} | ||
} | ||
|
||
func NewConfig() Config { | ||
return defaultActorSystemConfig() | ||
} | ||
|
||
func (asc Config) WithDeadLetterThrottleInterval(duration time.Duration) Config { | ||
asc.DeadLetterThrottleInterval = duration | ||
return asc | ||
} | ||
|
||
func (asc Config) WithDeadLetterThrottleCount(count int) Config { | ||
asc.DeadLetterThrottleCount = count | ||
return asc | ||
} | ||
|
||
func (asc Config) WithDeadLetterRequestLogging(enabled bool) Config { | ||
asc.DeadLetterRequestLogging = enabled | ||
return asc | ||
} | ||
|
||
func (asc Config) WithDeveloperSupervisionLogging(enabled bool) Config { | ||
asc.DeveloperSupervisionLogging = enabled | ||
return asc | ||
} | ||
|
||
func (asc Config) WithDiagnosticsSerializer(serializer func(Actor) string) Config { | ||
asc.DiagnosticsSerializer = serializer | ||
return asc | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package actor | ||
|
||
import "github.com/AsynkronIT/protoactor-go/extensions" | ||
|
||
var extensionId = extensions.NextExtensionId() | ||
|
||
type Metrics struct { | ||
} | ||
|
||
func (m *Metrics) Id() extensions.ExtensionId { | ||
return extensionId | ||
} | ||
|
||
func NewMetrics() *Metrics { | ||
return &Metrics{} | ||
} |