mirror of
https://github.com/harness/drone.git
synced 2025-05-31 11:43:15 +00:00
30 lines
568 B
Go
30 lines
568 B
Go
package profiler
|
|
|
|
import "fmt"
|
|
|
|
type Profiler interface {
|
|
StartProfiling(serviceName, serviceVersion string)
|
|
}
|
|
|
|
type ProfilerType string
|
|
|
|
const (
|
|
ProfilerTypeGCP ProfilerType = "GCP"
|
|
)
|
|
|
|
func ParseProfiler(profiler string) (ProfilerType, bool) {
|
|
if profiler == string(ProfilerTypeGCP) {
|
|
return ProfilerTypeGCP, true
|
|
}
|
|
return "", false
|
|
}
|
|
|
|
func GetProfiler(profiler ProfilerType) (Profiler, error) {
|
|
switch profiler {
|
|
case ProfilerTypeGCP:
|
|
return &GCPProfiler{}, nil
|
|
default:
|
|
return &NoopProfiler{}, fmt.Errorf("profiler '%s' not supported", profiler)
|
|
}
|
|
}
|