-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.go
More file actions
85 lines (66 loc) · 2.34 KB
/
Copy pathapp.go
File metadata and controls
85 lines (66 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package main
import (
"context"
"fmt"
"strings"
"github.com/andrewbytecoder/mgap/internal/app"
)
type App struct {
ctx context.Context
service *app.Service
}
func NewApp() *App {
return &App{
service: app.NewService(),
}
}
func (a *App) startup(ctx context.Context) {
a.ctx = ctx
}
func (a *App) DetectURL(input string) ([]app.EndpointResult, error) {
return a.service.DetectURL(a.ctx, input)
}
func (a *App) FetchMetrics(input string, metric string, profileSeconds uint64, useMock bool) (*app.MetricsSnapshot, error) {
return a.service.FetchMetrics(a.ctx, input, metric, profileSeconds, useMock)
}
func (a *App) ImportProfile(metric string) (*app.MetricsSnapshot, error) {
return a.service.ImportProfile(a.ctx, metric)
}
func (a *App) ImportProfiles(metric string) ([]*app.MetricsSnapshot, error) {
return a.service.ImportProfiles(a.ctx, metric)
}
func (a *App) ExportProfile(metric string) (string, error) {
return a.service.ExportProfile(a.ctx, metric)
}
func (a *App) ProfileMeta(metric string) (app.ProfileMeta, error) {
return a.service.ProfileMeta(metric)
}
func (a *App) FetchProfileCatalog(input string) ([]app.ProfileCatalogEntry, error) {
return a.service.FetchProfileCatalog(a.ctx, input)
}
func (a *App) FetchProfileText(input string, profile string, debug int, seconds uint64) (string, error) {
return a.service.FetchProfileText(a.ctx, input, profile, debug, seconds)
}
func (a *App) DownloadProfile(input string, profile string, debug int, seconds uint64) (string, error) {
return a.service.DownloadProfile(a.ctx, input, profile, debug, seconds)
}
func (a *App) GetProfileFlamegraph(input string, profile string, seconds uint64) (*app.FlamegraphNode, error) {
return a.service.GetProfileFlamegraph(a.ctx, input, profile, seconds)
}
func (a *App) NormalizeURL(input string) (string, error) {
return a.service.NormalizeURL(input)
}
func (a *App) InitialURL() string {
return a.service.InitialURL()
}
func (a *App) AvailableMetrics() []app.MetricInfo {
return a.service.AvailableMetrics()
}
func (a *App) AppInfo() map[string]string {
return map[string]string{
"name": "MGAP",
"description": "Desktop pprof monitor go application pprof.",
"stack": strings.Join([]string{"go", "live", "pprof"}, " + "),
"hint": fmt.Sprintf("Enter a pprof endpoint manually, such as %s", "http://localhost:6060/debug/pprof"),
}
}