File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package main
3
3
import (
4
4
"context"
5
5
"os"
6
+ "time"
6
7
7
8
"connectrpc.com/connect"
8
9
"github.com/go-kit/log/level"
@@ -23,8 +24,9 @@ func (c *phlareClient) pusherClient() pushv1connect.PusherServiceClient {
23
24
24
25
type uploadParams struct {
25
26
* phlareClient
26
- paths []string
27
- extraLabels map [string ]string
27
+ paths []string
28
+ extraLabels map [string ]string
29
+ overrideTimestamp bool
28
30
}
29
31
30
32
func addUploadParams (cmd commander ) * uploadParams {
@@ -37,6 +39,7 @@ func addUploadParams(cmd commander) *uploadParams {
37
39
38
40
cmd .Arg ("path" , "Path(s) to profile(s) to upload" ).Required ().ExistingFilesVar (& params .paths )
39
41
cmd .Flag ("extra-labels" , "Add additional labels to the profile(s)" ).StringMapVar (& params .extraLabels )
42
+ cmd .Flag ("override-timestamp" , "Set the profile timestamp to now" ).BoolVar (& params .overrideTimestamp )
40
43
return params
41
44
}
42
45
@@ -66,6 +69,14 @@ func upload(ctx context.Context, params *uploadParams) (err error) {
66
69
return err
67
70
}
68
71
72
+ if params .overrideTimestamp {
73
+ profile .TimeNanos = time .Now ().UnixNano ()
74
+ data , err = pprof .Marshal (profile .Profile , true )
75
+ if err != nil {
76
+ return err
77
+ }
78
+ }
79
+
69
80
// detect name if no name has been set
70
81
if lbl .Get (model .LabelNameProfileName ) == "" {
71
82
name := "unknown"
You can’t perform that action at this time.
0 commit comments