diff --git a/cmd/create/environment.go b/cmd/create/environment.go index 401eca11..96c5c6be 100644 --- a/cmd/create/environment.go +++ b/cmd/create/environment.go @@ -62,7 +62,7 @@ func init() { func execute(cmd *cobra.Command) { ctx := cmd.Context() - traceId := util.GenerateTraceId() + traceID := util.GenerateTraceID() // Validate accounts parameter if err := validateAccounts(accounts); err != nil { log.Fatal("Invalid accounts parameter: ", err) @@ -71,10 +71,10 @@ func execute(cmd *cobra.Command) { EnvName: envName, Accounts: util.SplitProviderAccount(accounts), ProvisioningType: provisioningType, - }, traceId) + }, traceID) if err != nil { - log.Info("TraceId: ", traceId) + log.Info("TraceId: ", traceID) log.Fatal("Failed to create environment ", err) } } diff --git a/cmd/delete/environment.go b/cmd/delete/environment.go index edd25617..5bf61cc4 100644 --- a/cmd/delete/environment.go +++ b/cmd/delete/environment.go @@ -35,13 +35,13 @@ func init() { func execute(cmd *cobra.Command) { ctx := cmd.Context() - traceId := util.GenerateTraceId() + traceID := util.GenerateTraceID() err := environmentClient.DeleteEnvironment(&ctx, &environment.DeleteEnvironmentRequest{ EnvName: name, - }, traceId) + }, traceID) if err != nil { - log.Info("TraceId: ", traceId) + log.Info("TraceId: ", traceID) log.Fatal("Failed to delete environment ", err) } } diff --git a/cmd/deploy/service-set.go b/cmd/deploy/service-set.go index ef624ae9..55ab4875 100644 --- a/cmd/deploy/service-set.go +++ b/cmd/deploy/service-set.go @@ -37,7 +37,7 @@ func executeDeployServiceSet(cmd *cobra.Command) { env = config.EnsureEnvPresent(env) ctx := cmd.Context() - traceId := util.GenerateTraceId() + traceID := util.GenerateTraceID() if serviceSetName == "" && provisioningFile == "" { log.Fatal("Please provide either --name or --file.") } @@ -63,8 +63,9 @@ func executeDeployServiceSet(cmd *cobra.Command) { deployServiceSetRequest.Name = serviceSetName } - err := serviceClient.DeployServiceSet(&ctx, &deployServiceSetRequest, traceId) + err := serviceClient.DeployServiceSet(&ctx, &deployServiceSetRequest, traceID) if err != nil { - log.Fatal("Failed to deploy service ", err) + log.Info("TraceId: ", traceID) + log.Fatal("Failed to deploy service set", err) } } diff --git a/cmd/deploy/service.go b/cmd/deploy/service.go index c7eb0be9..547e299e 100644 --- a/cmd/deploy/service.go +++ b/cmd/deploy/service.go @@ -44,7 +44,7 @@ func init() { func execute(cmd *cobra.Command) { env = config.EnsureEnvPresent(env) ctx := cmd.Context() - traceId := util.GenerateTraceId() + traceID := util.GenerateTraceID() if (serviceName == "" && serviceVersion == "") && (definitionFile != "" && provisioningFile != "") { definitionData, err := os.ReadFile(definitionFile) if err != nil { @@ -71,10 +71,10 @@ func execute(cmd *cobra.Command) { EnvName: env, ServiceDefinition: &definitionProto, ProvisioningConfig: provisioningProto, - }, traceId) + }, traceID) if err != nil { - log.Info("TraceId: ", traceId) + log.Info("TraceId: ", traceID) log.Fatal("Failed to deploy service ", err) } } else if (serviceName != "" && serviceVersion != "") && (definitionFile == "" && provisioningFile == "") { @@ -85,10 +85,10 @@ func execute(cmd *cobra.Command) { ServiceName: serviceName, ServiceVersion: serviceVersion, }, - }, traceId) + }, traceID) if err != nil { - log.Info("TraceId: ", traceId) + log.Info("TraceId: ", traceID) log.Fatal("Failed to deploy service ", err) } } else { diff --git a/cmd/describe/component.go b/cmd/describe/component.go index c7611115..af09d838 100644 --- a/cmd/describe/component.go +++ b/cmd/describe/component.go @@ -46,14 +46,14 @@ func executeDescribeComponentType(cmd *cobra.Command) { "version": componentVersion, } ctx := cmd.Context() - traceId := util.GenerateTraceId() + traceID := util.GenerateTraceID() response, err := componentClient.DescribeComponentType(&ctx, &comp.DescribeComponentTypeRequest{ ComponentType: componentName, Params: params, - }, traceId) + }, traceID) if err != nil { - log.Info("TraceId: ", traceId) + log.Info("TraceId: ", traceID) log.Fatal("Failed to describe service: ", err) } diff --git a/cmd/describe/environment.go b/cmd/describe/environment.go index ab2380bf..40620738 100644 --- a/cmd/describe/environment.go +++ b/cmd/describe/environment.go @@ -37,7 +37,7 @@ func init() { func executeEnv(cmd *cobra.Command) { ctx := cmd.Context() - traceId := util.GenerateTraceId() + traceID := util.GenerateTraceID() params := map[string]string{} if serviceName != "" { @@ -49,10 +49,10 @@ func executeEnv(cmd *cobra.Command) { response, err := environmentClient.DescribeEnvironment(&ctx, &environment.DescribeEnvironmentRequest{ Params: params, EnvName: name, - }, traceId) + }, traceID) if err != nil { - log.Info("TraceId: ", traceId) + log.Info("TraceId: ", traceID) log.Fatal("Failed to describe environment ", err) } diff --git a/cmd/describe/service.go b/cmd/describe/service.go index a254f4f0..4b730946 100644 --- a/cmd/describe/service.go +++ b/cmd/describe/service.go @@ -58,12 +58,12 @@ func execute(cmd *cobra.Command) { } ctx := cmd.Context() - traceId := util.GenerateTraceId() + traceID := util.GenerateTraceID() response, err := serviceClient.DescribeService(&ctx, &service.DescribeServiceRequest{ ServiceName: serviceName, Version: serviceVersion, Params: params, - }, traceId) + }, traceID) if err != nil { log.Fatal("Failed to describe service: ", err) diff --git a/cmd/list/componentType.go b/cmd/list/componentType.go index eaa6be4a..a9c9eff2 100644 --- a/cmd/list/componentType.go +++ b/cmd/list/componentType.go @@ -37,7 +37,7 @@ func init() { func componentExecute(cmd *cobra.Command) { ctx := cmd.Context() - traceId := util.GenerateTraceId() + traceID := util.GenerateTraceID() params := make(map[string]string) // Add non-empty parameters to the map @@ -51,7 +51,7 @@ func componentExecute(cmd *cobra.Command) { // Make the API call with the populated parameters response, err := componentTypeClient.ListComponentType(&ctx, &component.ListComponentTypeRequest{ Params: params, - }, traceId) + }, traceID) if err != nil { log.Fatal("Failed to list component types ", err) diff --git a/cmd/list/environment.go b/cmd/list/environment.go index 6e4b2570..a6da5593 100644 --- a/cmd/list/environment.go +++ b/cmd/list/environment.go @@ -42,14 +42,14 @@ func init() { func execute(cmd *cobra.Command) { ctx := cmd.Context() - traceId := util.GenerateTraceId() + traceID := util.GenerateTraceID() response, err := environmentClient.ListEnvironments(&ctx, &environment.ListEnvironmentRequest{ Params: map[string]string{ "name": name, "account": account, "provisioningType": provisioningType, "displayAll": strconv.FormatBool(displayAll)}, - }, traceId) + }, traceID) if err != nil { log.Fatal("Failed to list environments ", err) diff --git a/cmd/list/service.go b/cmd/list/service.go index 56853574..21fa8fc4 100644 --- a/cmd/list/service.go +++ b/cmd/list/service.go @@ -37,12 +37,12 @@ func init() { func listService(cmd *cobra.Command) { ctx := cmd.Context() - traceId := util.GenerateTraceId() + traceID := util.GenerateTraceID() response, err := serviceClient.ListService(&ctx, &serviceProto.ListServiceRequest{ Name: serviceName, Version: version, Tags: tags, - }, traceId) + }, traceID) if err != nil { log.Fatal("Failed to list services ", err) diff --git a/cmd/operate/component.go b/cmd/operate/component.go index 4ca31622..e277891e 100644 --- a/cmd/operate/component.go +++ b/cmd/operate/component.go @@ -6,7 +6,6 @@ import ( "github.com/dream11/odin/internal/service" "github.com/dream11/odin/pkg/config" - fileUtil "github.com/dream11/odin/pkg/util" serviceProto "github.com/dream11/odin/proto/gen/go/dream11/od/service/v1" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -55,7 +54,7 @@ func execute(cmd *cobra.Command) { env = config.EnsureEnvPresent(env) ctx := cmd.Context() - traceId := util.GenerateTraceId() + traceID := util.GenerateTraceID() //validate the variables var optionsData map[string]interface{} @@ -67,7 +66,7 @@ func execute(cmd *cobra.Command) { } if isFilePresent { - parsedConfig, err := fileUtil.ParseFile(file) + parsedConfig, err := util.ParseFile(file) if err != nil { log.Fatal("Error while parsing file " + file + " : " + err.Error()) } @@ -91,7 +90,7 @@ func execute(cmd *cobra.Command) { IsComponentOperation: true, Operation: operation, Config: config, - }, traceId) + }, traceID) if err != nil { log.Fatal("Failed to operate on component", err) diff --git a/cmd/operate/service.go b/cmd/operate/service.go index df733b54..369c75f3 100644 --- a/cmd/operate/service.go +++ b/cmd/operate/service.go @@ -6,7 +6,6 @@ import ( "github.com/dream11/odin/internal/service" "github.com/dream11/odin/pkg/config" - fileUtil "github.com/dream11/odin/pkg/util" serviceProto "github.com/dream11/odin/proto/gen/go/dream11/od/service/v1" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -45,7 +44,7 @@ func executeOperateService(cmd *cobra.Command) { env = config.EnsureEnvPresent(env) ctx := cmd.Context() - traceId := util.GenerateTraceId() + traceID := util.GenerateTraceID() //validate the variables var optionsData map[string]interface{} @@ -57,7 +56,7 @@ func executeOperateService(cmd *cobra.Command) { } if isFilePresent { - parsedConfig, err := fileUtil.ParseFile(file) + parsedConfig, err := util.ParseFile(file) if err != nil { log.Fatal("Error while parsing file " + file + " : " + err.Error()) } @@ -80,7 +79,7 @@ func executeOperateService(cmd *cobra.Command) { IsComponentOperation: false, Operation: operation, Config: config, - }, traceId) + }, traceID) if err != nil { log.Fatal("Failed to operate on service", err) diff --git a/cmd/release/service.go b/cmd/release/service.go index bccd2f4d..fcc68ab6 100644 --- a/cmd/release/service.go +++ b/cmd/release/service.go @@ -39,7 +39,7 @@ func init() { func execute(cmd *cobra.Command) { ctx := cmd.Context() - traceId := util.GenerateTraceId() + traceID := util.GenerateTraceID() var err error @@ -104,7 +104,7 @@ func execute(cmd *cobra.Command) { } serviceReleaseRequest.ProvisioningConfigs = provisioningConfigMap serviceReleaseRequest.ServiceDefinition = &definitionProto - err = serviceClient.ReleaseService(&ctx, &serviceReleaseRequest, traceId) + err = serviceClient.ReleaseService(&ctx, &serviceReleaseRequest, traceID) if err != nil { log.Fatal("Failed to release service ", err) } diff --git a/cmd/undeploy/service.go b/cmd/undeploy/service.go index 39e60e0d..789e15dd 100644 --- a/cmd/undeploy/service.go +++ b/cmd/undeploy/service.go @@ -40,12 +40,12 @@ func execute(cmd *cobra.Command) { envName = config.EnsureEnvPresent(envName) ctx := cmd.Context() - traceId := util.GenerateTraceId() + traceID := util.GenerateTraceID() err := serviceClient.UndeployService(&ctx, &serviceProto.UndeployServiceRequest{ EnvName: envName, ServiceName: name, - }, traceId) + }, traceID) if err != nil { log.Fatal("Failed to undeploy service ", err) diff --git a/internal/service/client.go b/internal/service/client.go index 63d6c641..425d3c40 100644 --- a/internal/service/client.go +++ b/internal/service/client.go @@ -15,12 +15,12 @@ import ( "google.golang.org/grpc/metadata" ) -func grpcClient(ctx *context.Context, traceIdOptional ...string) (*grpc.ClientConn, *context.Context, error) { +func grpcClient(ctx *context.Context, traceIDOptional ...string) (*grpc.ClientConn, *context.Context, error) { appConfig := config.GetConfig() - traceId := "" - if len(traceIdOptional) > 0 { - traceId = traceIdOptional[0] + traceID := "" + if len(traceIDOptional) > 0 { + traceID = traceIDOptional[0] } if appConfig.BackendAddress == "" { @@ -49,6 +49,6 @@ func grpcClient(ctx *context.Context, traceIdOptional ...string) (*grpc.ClientCo return nil, nil, err } // Enrich context with authorisation metadata - requestCtx := metadata.AppendToOutgoingContext(*ctx, "Authorization", fmt.Sprintf("Bearer %s", appConfig.AccessToken), "TraceId", traceId) + requestCtx := metadata.AppendToOutgoingContext(*ctx, "Authorization", fmt.Sprintf("Bearer %s", appConfig.AccessToken), "TraceId", traceID) return conn, &requestCtx, nil } diff --git a/internal/service/component.go b/internal/service/component.go index 39e275bf..dce075be 100644 --- a/internal/service/component.go +++ b/internal/service/component.go @@ -18,8 +18,8 @@ import ( type Component struct{} // OperateComponent operate Component -func (e *Component) OperateComponent(ctx *context.Context, request *serviceProto.OperateServiceRequest, traceId string) error { - conn, requestCtx, err := grpcClient(ctx, traceId) +func (e *Component) OperateComponent(ctx *context.Context, request *serviceProto.OperateServiceRequest, traceID string) error { + conn, requestCtx, err := grpcClient(ctx, traceID) if err != nil { return err } @@ -56,8 +56,8 @@ func (e *Component) OperateComponent(ctx *context.Context, request *serviceProto } // ListComponentType List component types -func (e *Component) ListComponentType(ctx *context.Context, request *component.ListComponentTypeRequest, traceId string) (*component.ListComponentTypeResponse, error) { - conn, requestCtx, err := grpcClient(ctx, traceId) +func (e *Component) ListComponentType(ctx *context.Context, request *component.ListComponentTypeRequest, traceID string) (*component.ListComponentTypeResponse, error) { + conn, requestCtx, err := grpcClient(ctx, traceID) if err != nil { return nil, err } @@ -71,8 +71,8 @@ func (e *Component) ListComponentType(ctx *context.Context, request *component.L } // DescribeComponentType List component types -func (e *Component) DescribeComponentType(ctx *context.Context, request *component.DescribeComponentTypeRequest, traceId string) (*component.DescribeComponentTypeResponse, error) { - conn, requestCtx, err := grpcClient(ctx, traceId) +func (e *Component) DescribeComponentType(ctx *context.Context, request *component.DescribeComponentTypeRequest, traceID string) (*component.DescribeComponentTypeResponse, error) { + conn, requestCtx, err := grpcClient(ctx, traceID) if err != nil { return nil, err } diff --git a/internal/service/environment.go b/internal/service/environment.go index 48f499cc..9ab2b059 100644 --- a/internal/service/environment.go +++ b/internal/service/environment.go @@ -16,8 +16,8 @@ import ( type Environment struct{} // ListEnvironments List environments -func (e *Environment) ListEnvironments(ctx *context.Context, request *environment.ListEnvironmentRequest, traceId string) (*environment.ListEnvironmentResponse, error) { - conn, requestCtx, err := grpcClient(ctx, traceId) +func (e *Environment) ListEnvironments(ctx *context.Context, request *environment.ListEnvironmentRequest, traceID string) (*environment.ListEnvironmentResponse, error) { + conn, requestCtx, err := grpcClient(ctx, traceID) if err != nil { return nil, err } @@ -31,8 +31,8 @@ func (e *Environment) ListEnvironments(ctx *context.Context, request *environmen } // CreateEnvironment creates environment -func (e *Environment) CreateEnvironment(ctx *context.Context, request *environment.CreateEnvironmentRequest, traceId string) error { - conn, requestCtx, err := grpcClient(ctx, traceId) +func (e *Environment) CreateEnvironment(ctx *context.Context, request *environment.CreateEnvironmentRequest, traceID string) error { + conn, requestCtx, err := grpcClient(ctx, traceID) if err != nil { return err } @@ -69,8 +69,8 @@ func (e *Environment) CreateEnvironment(ctx *context.Context, request *environme } // DeleteEnvironment deletes environment -func (e *Environment) DeleteEnvironment(ctx *context.Context, request *environment.DeleteEnvironmentRequest, traceId string) error { - conn, requestCtx, err := grpcClient(ctx, traceId) +func (e *Environment) DeleteEnvironment(ctx *context.Context, request *environment.DeleteEnvironmentRequest, traceID string) error { + conn, requestCtx, err := grpcClient(ctx, traceID) if err != nil { return err } @@ -126,8 +126,8 @@ func (e *Environment) UpdateEnvironment(ctx *context.Context, request *environme } // DescribeEnvironment shows environment details including services and resources in it -func (e *Environment) DescribeEnvironment(ctx *context.Context, request *environment.DescribeEnvironmentRequest, traceId string) (*environment.DescribeEnvironmentResponse, error) { - conn, requestCtx, err := grpcClient(ctx, traceId) +func (e *Environment) DescribeEnvironment(ctx *context.Context, request *environment.DescribeEnvironmentRequest, traceID string) (*environment.DescribeEnvironmentResponse, error) { + conn, requestCtx, err := grpcClient(ctx, traceID) if err != nil { return nil, err } diff --git a/internal/service/service.go b/internal/service/service.go index 03ee5121..4d45f7a9 100644 --- a/internal/service/service.go +++ b/internal/service/service.go @@ -18,9 +18,9 @@ import ( type Service struct{} // DeployService deploys service -func (e *Service) DeployService(ctx *context.Context, request *serviceProto.DeployServiceRequest, traceId string) error { +func (e *Service) DeployService(ctx *context.Context, request *serviceProto.DeployServiceRequest, traceID string) error { - conn, requestCtx, err := grpcClient(ctx, traceId) + conn, requestCtx, err := grpcClient(ctx, traceID) if err != nil { return err } @@ -60,8 +60,8 @@ func (e *Service) DeployService(ctx *context.Context, request *serviceProto.Depl } // DeployServiceSet deploys service-set -func (e *Service) DeployServiceSet(ctx *context.Context, request *serviceProto.DeployServiceSetRequest, traceId string) error { - conn, requestCtx, err := grpcClient(ctx, traceId) +func (e *Service) DeployServiceSet(ctx *context.Context, request *serviceProto.DeployServiceSetRequest, traceID string) error { + conn, requestCtx, err := grpcClient(ctx, traceID) if err != nil { return err } @@ -104,8 +104,8 @@ func (e *Service) DeployServiceSet(ctx *context.Context, request *serviceProto.D } // DeployReleasedService deploys service -func (e *Service) DeployReleasedService(ctx *context.Context, request *serviceProto.DeployReleasedServiceRequest, traceId string) error { - conn, requestCtx, err := grpcClient(ctx, traceId) +func (e *Service) DeployReleasedService(ctx *context.Context, request *serviceProto.DeployReleasedServiceRequest, traceID string) error { + conn, requestCtx, err := grpcClient(ctx, traceID) if err != nil { return err } @@ -149,8 +149,8 @@ func (e *Service) DeployReleasedService(ctx *context.Context, request *servicePr } // UndeployService undeploy service -func (e *Service) UndeployService(ctx *context.Context, request *serviceProto.UndeployServiceRequest, traceId string) error { - conn, requestCtx, err := grpcClient(ctx, traceId) +func (e *Service) UndeployService(ctx *context.Context, request *serviceProto.UndeployServiceRequest, traceID string) error { + conn, requestCtx, err := grpcClient(ctx, traceID) if err != nil { return err } @@ -193,8 +193,8 @@ func (e *Service) UndeployService(ctx *context.Context, request *serviceProto.Un } // OperateService :service operations -func (e *Service) OperateService(ctx *context.Context, request *serviceProto.OperateServiceRequest, traceId string) error { - conn, requestCtx, err := grpcClient(ctx, traceId) +func (e *Service) OperateService(ctx *context.Context, request *serviceProto.OperateServiceRequest, traceID string) error { + conn, requestCtx, err := grpcClient(ctx, traceID) if err != nil { return err } @@ -235,8 +235,8 @@ func (e *Service) OperateService(ctx *context.Context, request *serviceProto.Ope } // ListService deploys service -func (e *Service) ListService(ctx *context.Context, request *serviceProto.ListServiceRequest, traceId string) (*serviceProto.ListServiceResponse, error) { - conn, requestCtx, err := grpcClient(ctx, traceId) +func (e *Service) ListService(ctx *context.Context, request *serviceProto.ListServiceRequest, traceID string) (*serviceProto.ListServiceResponse, error) { + conn, requestCtx, err := grpcClient(ctx, traceID) if err != nil { return &serviceProto.ListServiceResponse{}, err } @@ -246,8 +246,8 @@ func (e *Service) ListService(ctx *context.Context, request *serviceProto.ListSe } // ReleaseService :service operatioms -func (e *Service) ReleaseService(ctx *context.Context, request *serviceProto.ReleaseServiceRequest, traceId string) error { - conn, requestCtx, err := grpcClient(ctx, traceId) +func (e *Service) ReleaseService(ctx *context.Context, request *serviceProto.ReleaseServiceRequest, traceID string) error { + conn, requestCtx, err := grpcClient(ctx, traceID) if err != nil { return err } @@ -309,8 +309,8 @@ func (e *Service) ConvertToDeployServiceSetRequest(serviceSet *serviceDto.Servic } // DescribeService describe service -func (e *Service) DescribeService(ctx *context.Context, request *serviceProto.DescribeServiceRequest, traceId string) (*serviceProto.DescribeServiceResponse, error) { - conn, requestCtx, err := grpcClient(ctx, traceId) +func (e *Service) DescribeService(ctx *context.Context, request *serviceProto.DescribeServiceRequest, traceID string) (*serviceProto.DescribeServiceResponse, error) { + conn, requestCtx, err := grpcClient(ctx, traceID) if err != nil { return nil, err } diff --git a/main.go b/main.go index 4c265627..46e8b182 100644 --- a/main.go +++ b/main.go @@ -21,7 +21,7 @@ import ( ) func main() { - // Configure Logrus to disable timestamps + // Configure Logrus to fix timestamp format logrus.SetFormatter(&logrus.TextFormatter{ TimestampFormat: "2006-01-02 15:04:05", // Custom format FullTimestamp: true, diff --git a/pkg/util/file.go b/pkg/util/file.go index ff08ed05..1428ccac 100644 --- a/pkg/util/file.go +++ b/pkg/util/file.go @@ -3,7 +3,6 @@ package util import ( "encoding/json" "errors" - "io/fs" "os" "strings" @@ -15,27 +14,6 @@ func Read(filePath string) ([]byte, error) { return os.ReadFile(filePath) } -// Write : write data to file -func Write(filePath, data string, permission fs.FileMode) error { - byteData := []byte(data) - err := os.WriteFile(filePath, byteData, permission) - - return err -} - -// FindAndReadAllAllowedFormat : takes in file path and allowed format list and returns data path and error -func FindAndReadAllAllowedFormat(path string, allowedFormats []string) ([]byte, string, error) { - for _, allowedFormat := range allowedFormats { - filepath := path + allowedFormat - data, err := Read(filepath) - if err == nil { - return data, filepath, nil - } - } - - return nil, "", errors.New("unable to read file: " + path) -} - // ParseFile parse json or yaml file given path to json and return as interface func ParseFile(filePath string) (interface{}, error) { var parsedContent interface{} diff --git a/pkg/util/util.go b/pkg/util/util.go index 70259936..b65e03bb 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -2,12 +2,10 @@ package util import ( "fmt" + v1 "github.com/dream11/odin/proto/gen/go/dream11/od/service/v1" "github.com/google/uuid" "net" "strings" - "time" - - v1 "github.com/dream11/odin/proto/gen/go/dream11/od/service/v1" ) // SplitProviderAccount splits string into list of cloud provider accounts @@ -54,7 +52,7 @@ func GenerateResponseMessageComponentSpecific(response *v1.ServiceResponse, comp return message } -// GenerateTraceId generates a trace id -func GenerateTraceId() string { - return fmt.Sprintf("%d-%s", time.Now().Unix(), strings.Split(uuid.New().String(), "-")[0]) +// GenerateTraceID generates a trace id +func GenerateTraceID() string { + return uuid.New().String() }