File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,9 +10,13 @@ import (
1010 "net/url"
1111 "strings"
1212
13+ "go.opentelemetry.io/otel"
14+
1315 "github.com/featherbread/randomizer/internal/randomizer"
1416)
1517
18+ var tracer = otel .Tracer ("github.com/featherbread/randomizer/internal/slack" )
19+
1620// App serves the randomizer through the Slack slash command API.
1721//
1822// App supports legacy static verification tokens to confirm the legitimacy of
Original file line number Diff line number Diff line change 99
1010 "github.com/aws/aws-sdk-go-v2/aws"
1111 "github.com/aws/aws-sdk-go-v2/service/ssm"
12+ "go.opentelemetry.io/otel/attribute"
1213
1314 "github.com/featherbread/randomizer/internal/awsconfig"
1415)
@@ -76,14 +77,24 @@ func AWSParameter(name string, ttl time.Duration) TokenProvider {
7677 )
7778
7879 return func (ctx context.Context ) (string , error ) {
80+ ctx , span := tracer .Start (ctx , "AWSParameterTokenProvider" )
81+ defer span .End ()
82+
83+ span .AddEvent ("LockStart" )
7984 select {
8085 case lock <- struct {}{}:
86+ span .AddEvent ("Lock" )
8187 defer func () { <- lock }()
8288 case <- ctx .Done ():
89+ span .AddEvent ("LockCancel" )
8390 return "" , ctx .Err ()
8491 }
8592
8693 if time .Now ().Before (expiry ) {
94+ span .SetAttributes (
95+ attribute .Float64 (
96+ "randomizer.slack.awsparameter.ttl" ,
97+ time .Until (expiry ).Seconds ()))
8798 return token , nil
8899 }
89100
You can’t perform that action at this time.
0 commit comments