SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
package utils
// Map as in map-reduce.
func MapSlice[Slice ~[]Elem, Elem any, Output any](
slice Slice, mapper func(Elem) Output,
) []Output {
result := []Output{}
for _, item := range slice {
mapped := mapper(item)
result = append(result, mapped)
}
return result
}
func FilterSlice[Slice ~[]Elem, Elem any](
slice Slice, filterFn func(Elem) bool,
) Slice {
result := Slice{}
for _, item := range slice {
if filterFn(item) {
result = append(result, item)
}
}
return result
}