@@ -2,12 +2,15 @@ package generator
22
33import (
44 "bufio"
5+ "context"
56 "fmt"
67 "maps"
78 "slices"
89 "sort"
910 "strings"
1011
12+ "go.opentelemetry.io/otel"
13+
1114 "github.com/authzed/spicedb/pkg/caveats"
1215 caveattypes "github.com/authzed/spicedb/pkg/caveats/types"
1316 "github.com/authzed/spicedb/pkg/genutil/mapz"
@@ -18,18 +21,23 @@ import (
1821 "github.com/authzed/spicedb/pkg/spiceerrors"
1922)
2023
24+ var tracer = otel .Tracer ("spicedb/pkg/schemadsl/generator" )
25+
2126// Ellipsis is the relation name for terminal subjects.
2227const Ellipsis = "..."
2328
2429// MaxSingleLineCommentLength sets the maximum length for a comment to made single line.
2530const MaxSingleLineCommentLength = 70 // 80 - the comment parts and some padding
2631
2732func GenerateSchema (definitions []compiler.SchemaDefinition ) (string , bool , error ) {
28- return GenerateSchemaWithCaveatTypeSet (definitions , caveattypes .Default .TypeSet )
33+ return GenerateSchemaWithCaveatTypeSet (context . TODO (), definitions , caveattypes .Default .TypeSet )
2934}
3035
3136// GenerateSchemaWithCaveatTypeSet generates a DSL view of the given schema.
32- func GenerateSchemaWithCaveatTypeSet (definitions []compiler.SchemaDefinition , caveatTypeSet * caveattypes.TypeSet ) (string , bool , error ) {
37+ func GenerateSchemaWithCaveatTypeSet (ctx context.Context , definitions []compiler.SchemaDefinition , caveatTypeSet * caveattypes.TypeSet ) (string , bool , error ) {
38+ _ , span := tracer .Start (ctx , "GenerateSchemaWithCaveatTypeSet" )
39+ defer span .End ()
40+
3341 generated := make ([]string , 0 , len (definitions ))
3442 flags := mapz .NewSet [string ]()
3543
0 commit comments