@@ -24,10 +24,31 @@ import (
2424
2525 "buf.build/go/protoyaml"
2626 "github.com/dennwc/iters"
27+ "go.opentelemetry.io/otel/attribute"
2728 proto "google.golang.org/protobuf/proto"
2829 "gopkg.in/yaml.v3"
2930)
3031
32+ const (
33+ TraceKeyPref = "lk."
34+
35+ TraceKeyRoomPrefix = TraceKeyPref + "room."
36+ TraceKeyRoomID = attribute .Key (TraceKeyRoomPrefix + "id" )
37+ TraceKeyRoomName = attribute .Key (TraceKeyRoomPrefix + "name" )
38+
39+ TraceKeyParticipantPrefix = TraceKeyPref + "participant."
40+ TraceKeyParticipantID = attribute .Key (TraceKeyParticipantPrefix + "id" )
41+ TraceKeyParticipantIdentity = attribute .Key (TraceKeyParticipantPrefix + "identity" )
42+
43+ TraceKeyTrackPrefix = TraceKeyPref + "track."
44+ TraceKeyTrackID = attribute .Key (TraceKeyTrackPrefix + "id" )
45+
46+ TraceKeySIPPrefix = TraceKeyPref + "sip."
47+ TraceKeySIPHeaderPrefix = TraceKeySIPPrefix + "h."
48+ TraceKeySIPCallID = attribute .Key (TraceKeySIPPrefix + "callID" )
49+ TraceKeySIPCallIDHeader = attribute .Key (TraceKeySIPHeaderPrefix + "CallID" )
50+ )
51+
3152type TrackID string
3253type ParticipantID string
3354type ParticipantIdentity string
@@ -47,6 +68,8 @@ type ParticipantKey struct {
4768type JobID string
4869type DispatchID string
4970type AgentName string
71+ type SIPCallID string
72+ type SIPCallIDHeader string
5073
5174func (s TrackID ) String () string { return string (s ) }
5275func (s ParticipantID ) String () string { return string (s ) }
@@ -59,10 +82,34 @@ func (s NodeID) String() string { return string(s) }
5982func (s JobID ) String () string { return string (s ) }
6083func (s DispatchID ) String () string { return string (s ) }
6184func (s AgentName ) String () string { return string (s ) }
85+ func (s SIPCallID ) String () string { return string (s ) }
86+ func (s SIPCallIDHeader ) String () string { return string (s ) }
6287func (s ParticipantKey ) String () string {
6388 return fmt .Sprintf ("%s_%s_%s" , s .ProjectID , s .RoomName , s .Identity )
6489}
6590
91+ func (s ParticipantID ) Trace () attribute.KeyValue {
92+ return TraceKeyParticipantID .String (string (s ))
93+ }
94+ func (s ParticipantIdentity ) Trace () attribute.KeyValue {
95+ return TraceKeyParticipantIdentity .String (string (s ))
96+ }
97+ func (s RoomID ) Trace () attribute.KeyValue {
98+ return TraceKeyRoomID .String (string (s ))
99+ }
100+ func (s RoomName ) Trace () attribute.KeyValue {
101+ return TraceKeyRoomName .String (string (s ))
102+ }
103+ func (s TrackID ) Trace () attribute.KeyValue {
104+ return TraceKeyTrackID .String (string (s ))
105+ }
106+ func (s SIPCallID ) Trace () attribute.KeyValue {
107+ return TraceKeySIPCallID .String (string (s ))
108+ }
109+ func (s SIPCallIDHeader ) Trace () attribute.KeyValue {
110+ return TraceKeySIPCallIDHeader .String (string (s ))
111+ }
112+
66113type stringTypes interface {
67114 ParticipantID | RoomID | TrackID | ParticipantIdentity | ParticipantName | RoomName | ConnectionID | NodeID
68115}
0 commit comments