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 units
type Duration float64
const (
Nanosecond = Second * 1e-9
Microsecond = Second * 1e-6
Millisecond = Second * 1e-3
Centisecond = Second * 1e-2
Decisecond = Second * 1e-1
Second Duration = 1e0
Minute = Second * 60
Hour = Minute * 60
Day = Hour * 24
Week = Day * 7
)
// durationConverter is an implementation of Converter for durations.
type durationConverter struct {
}
func NewDurationConverter() Converter {
return &durationConverter{}
}
func (*durationConverter) Name() string {
return "duration"
}
func FromTimeUnit(u Unit) Duration {
switch u {
case "ns":
return Nanosecond
case "us", "µs":
return Microsecond
case "ms":
return Millisecond
case "cs":
return Centisecond
case "ds":
return Decisecond
case "s":
return Second
case "m", "min":
return Minute
case "h":
return Hour
case "d":
return Day
case "w", "wk":
return Week
default:
return Second
}
}
func (c *durationConverter) Convert(v Value, to Unit) Value {
return Value{
F: v.F * float64(FromTimeUnit(v.U)) / float64(FromTimeUnit(to)),
U: to,
}
}