Files
hatchet/internal/services/controllers/v1/task/create_partitions.go
T
Mohammed Nafees 793df41ccb Deploy HyperDX locally via docker-compose and add traces to task controller (#2058)
* deploy jaegar locally and add traces to task controller

* use jaegar v2

* add SERVER_OTEL_COLLECTOR_AUTH

* fix PR comments

* fix span name
2025-07-29 16:24:38 +02:00

60 lines
1.3 KiB
Go

package task
import (
"context"
"time"
"github.com/hatchet-dev/hatchet/internal/telemetry"
"go.opentelemetry.io/otel/codes"
)
func (tc *TasksControllerImpl) runTaskTablePartition(ctx context.Context) func() {
return func() {
ctx, span := telemetry.NewSpan(ctx, "TasksControllerImpl.runTaskTablePartition")
defer span.End()
tc.l.Debug().Msgf("partition: running task table partition")
// get internal tenant
tenant, err := tc.p.GetInternalTenantForController(ctx)
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, "could not get internal tenant")
tc.l.Error().Err(err).Msg("could not get internal tenant")
return
}
if tenant == nil {
return
}
err = tc.createTablePartition(ctx)
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, "could not create table partition")
tc.l.Error().Err(err).Msg("could not create table partition")
}
}
}
func (tc *TasksControllerImpl) createTablePartition(ctx context.Context) error {
ctx, span := telemetry.NewSpan(ctx, "TasksControllerImpl.createTablePartition")
defer span.End()
qCtx, qCancel := context.WithTimeout(ctx, 10*time.Minute)
defer qCancel()
err := tc.repov1.Tasks().UpdateTablePartitions(qCtx)
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, "could not create table partition")
return err
}
return nil
}