Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/api/internal/cache/templates/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"github.com/google/uuid"
"github.com/redis/go-redis/v9"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"

"github.com/e2b-dev/infra/packages/api/internal/api"
sqlcdb "github.com/e2b-dev/infra/packages/db/client"
Expand Down Expand Up @@ -109,7 +111,12 @@ func (c *TemplateCache) GetMetadata(ctx context.Context, templateID string) (*Te
// Does NOT do alias resolution - callers should use ResolveAlias first.
// Performs access control and cluster checks.
func (c *TemplateCache) Get(ctx context.Context, templateID string, tag *string, teamID uuid.UUID, clusterID uuid.UUID) (*api.Template, *queries.EnvBuild, error) {
ctx, span := tracer.Start(ctx, "get template")
ctx, span := tracer.Start(ctx, "get template", trace.WithAttributes(
attribute.String("template_id", templateID),
attribute.String("tag", sharedUtils.DerefOrDefault(tag, "")),
attribute.String("team_id", teamID.String()),
attribute.String("cluster_id", clusterID.String()),
Comment on lines +115 to +118
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for some of these attributes, we have WithTeamID, WithClusterID (etc) helpers to keep the attribute name united

))
defer span.End()

// Step 1: Get template with build by ID and tag
Expand Down
Loading