Repository: opensovereigncloud/cc-intel-platform-registration
Pull request #5: feat: setup prometheus metrics and basic structure
Author: login: SilvaMatteus
Created: 2025-02-04T11:04:00Z | Merged: 2025-03-07T13:43:19Z

closes https://github.com/scontain/cc-intel-platform-registration/issues/2


Diff:
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f34698f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,13 @@
+cc-intel-platform-registration
+.vscode
+
+# skip bin dirs
+**/bin
+
+# Object files
+*.o
+
+# Libraries
+*.a
+*.so
+
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..422deea
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,143 @@
+# Go parameters
+GOCMD=go
+GOBUILD=$(GOCMD) build
+GOTEST=$(GOCMD) test
+GOMOD=$(GOCMD) mod
+
+# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
+ifeq (,$(shell go env GOBIN))
+GOBIN=$(shell go env GOPATH)/bin
+else
+GOBIN=$(shell go env GOBIN)
+endif
+
+
+BINARY_NAME=cc-intel-platform-registration
+
+test:
+	$(GOTEST) -v ./...
+
+clean:
+	$(GOCMD) clean
+	rm -f $(BINARY_NAME)
+
+deps:
+	$(GOMOD) download
+	$(GOMOD) tidy
+
+security-check:
+	$(GOVULNCHECK) ./...
+
+# # Combined check target that runs all verifications
+.PHONY: check
+check: deps security-check test
+
+
+# Setting SHELL to bash allows bash commands to be executed by recipes.
+# Options are set to exit when a recipe line exits non-zero or a piped command fails.
+SHELL = /usr/bin/env bash -o pipefail
+.SHELLFLAGS = -ec
+
+.PHONY: all
+all: lint build
+
+##@ General
+
+# The help target prints out all targets with their descriptions organized
+# beneath their categories. The categories are represented by '##@' and the
+# target descriptions by '##'. The awk command is responsible for reading the
+# entire set of makefiles included in this invocation, looking for lines of the
+# file as xyz: ## something, and then pretty-format the target and help. Then,
+# if there's a line with ##@ something, that gets pretty-printed as a category.
+# More info on the usage of ANSI control characters for terminal formatting:
+# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
+# More info on the awk command:
+# http://linuxcommand.org/lc3_adv_awk.php
+
+.PHONY: help
+help: ## Display this help.
+	@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n  make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf "  \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
+
+.PHONY: fmt
+fmt: ## Run go fmt against code.
+	go fmt ./...
+
+.PHONY: vet
+vet: ## Run go vet against code.
+	go vet ./...
+
+.PHONY: lint
+lint: deadcode govulncheck golangci-lint    ## Run golangci-lint linter
+	$(GOLANGCI_LINT) run ./...
+	$(DEADCODE) ./...
+
+.PHONY: lint-fix
+lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
+	$(GOLANGCI_LINT) run --fix
+
+.PHONY: lint-config
+lint-config: golangci-lint ## Verify golangci-lint linter configuration
+	$(GOLANGCI_LINT) config verify
+
+##@ Build
+.PHONY: build
+build:  deps fmt vet ## Build manager binary.
+	$(GOBUILD) -o $(BINARY_NAME)  -trimpath
+
+.PHONY: run
+run:  fmt vet ## Run a controller from your host.
+	go run main.go
+
+
+ifndef ignore-not-found
+  ignore-not-found = false
+endif
+
+
+##@ Dependencies
+
+## Location to install dependencies to
+LOCALBIN ?= $(shell pwd)/bin
+$(LOCALBIN):
+	mkdir -p $(LOCALBIN)
+
+## Tool Binaries
+GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
+GOVULNCHECK = $(LOCALBIN)/govulncheck
+DEADCODE = $(LOCALBIN)/deadcode
+
+## Tool Versions
+GOLANGCI_LINT_VERSION ?= v1.63.4
+
+
+.PHONY: deadcode
+deadcode: $(DEADCODE) ## Download deadcode locally if necessary.
+$(DEADCODE): $(LOCALBIN)
+	$(call go-install-tool,$(DEADCODE),golang.org/x/tools/cmd/deadcode,latest)
+
+.PHONY: govulncheck
+govulncheck: $(GOVULNCHECK) ## Download govulncheck locally if necessary.
+$(GOVULNCHECK): $(LOCALBIN)
+	$(call go-install-tool,$(GOVULNCHECK),golang.org/x/vuln/cmd/govulncheck,latest)
+
+
+.PHONY: golangci-lint
+golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
+$(GOLANGCI_LINT): $(LOCALBIN)
+	$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
+
+# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
+# $1 - target path with name of binary
+# $2 - package url which can be installed
+# $3 - specific version of package
+define go-install-tool
+@[ -f "$(1)-$(3)" ] || { \
+set -e; \
+package=$(2)@$(3) ;\
+echo "Downloading $${package}" ;\
+rm -f $(1) || true ;\
+GOBIN=$(LOCALBIN) go install $${package} ;\
+mv $(1) $(1)-$(3) ;\
+} ;\
+ln -sf $(1)-$(3) $(1)
+endef
\ No newline at end of file
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..ca225b0
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,32 @@
+module github.com/opensovereigncloud/cc-intel-platform-registration
+
+go 1.22.9
+
+require (
+	github.com/prometheus/client_golang v1.20.5
+	github.com/spf13/pflag v1.0.5
+	github.com/stretchr/testify v1.9.0
+)
+
+require (
+	github.com/davecgh/go-spew v1.1.1 // indirect
+	github.com/klauspost/compress v1.17.9 // indirect
+	github.com/pmezard/go-difflib v1.0.0 // indirect
+	go.uber.org/multierr v1.10.0 // indirect
+	gopkg.in/yaml.v3 v3.0.1 // indirect
+)
+
+require (
+	github.com/beorn7/perks v1.0.1 // indirect
+	github.com/cespare/xxhash/v2 v2.3.0 // indirect
+	github.com/go-logr/logr v1.4.2
+	github.com/go-logr/zapr v1.3.0
+	github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
+	github.com/prometheus/client_model v0.6.1 // indirect
+	github.com/prometheus/common v0.55.0 // indirect
+	github.com/prometheus/procfs v0.15.1 // indirect
+	go.uber.org/zap v1.27.0
+	golang.org/x/sync v0.11.0
+	golang.org/x/sys v0.29.0 // indirect
+	google.golang.org/protobuf v1.34.2 // indirect
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..6689c3d
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,55 @@
+github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
+github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
+github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
+github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
+github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
+github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ=
+github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg=
+github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
+github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
+github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
+github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
+github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
+github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
+github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
+github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
+github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
+github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
+github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
+github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
+github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
+github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
+github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=
+github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8=
+github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
+github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
+github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
+github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
+github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
+github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
+github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
+github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
+go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
+go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
+go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
+go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
+go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
+go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
+golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
+golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
+golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
+golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
+google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
+gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..6ad1645
--- /dev/null
+++ b/main.go
@@ -0,0 +1,295 @@
+package main
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	appName   = "cc-intel-platform-registration"
+	version   = "dev"
+	buildDate = "unknown"
+)
+
+func recoveryMiddleware(logger *slog.Logger) func(http.Handler) http.Handler {
+	return func(next http.Handler) http.Handler {
+		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+			defer func() {
+				if r := recover(); r != nil {
+					logger.Error("panic recovered in HTTP handler", slog.Any("panic", r))
+					metrics.IncrementPanicCounts()
+					w.WriteHeader(http.StatusInternalServerError)
+					_, _ = w.Write([]byte("Internal Server Error"))
+				}
+			}()
+			next.ServeHTTP(w, r)
+		})
+	}
+}
+
+// GetRegistrationServicePort retrieves the Regustration service port from environment variables, defaulting to 8080.
+func GetRegistrationServicePort(logger *slog.Logger) string {
+	port := constants.DefaultRegistrationServicePort
+	portStr := os.Getenv(constants.RegistrationServicePortEnv)
+	if portStr != "" {
+		parsedPort, err := strconv.Atoi(portStr)
+		if err != nil {
+			logger.Error("failed to parse registration service port",
+				slog.String("env_var", constants.RegistrationServicePortEnv),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DefaultRegistrationServicePort))
+			// Continue with default value
+		} else {
+			port = parsedPort
+		}
+	} else {
+		logger.Info("registration service port not set, using default",
+			slog.String("env_var", constants.RegistrationServicePortEnv),
+			slog.String("default_value", strconv.Itoa(constants.DefaultRegistrationServicePort)))
+	}
+	// Prepend ":" to form a valid address for http.Server.
+	return ":" + strconv.Itoa(port)
+}
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.DefaultRegistrationServiceIntervalInMinutesEnv)
+	interval := constants.DefaultRegistrationServiceIntervalInMinutes
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("failed to parse registration service interval",
+				slog.String("env_var", constants.DefaultRegistrationServiceIntervalInMinutesEnv),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DefaultRegistrationServiceIntervalInMinutes))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.DefaultRegistrationServiceIntervalInMinutesEnv),
+			slog.Int("default_value", constants.DefaultRegistrationServiceIntervalInMinutes))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	default:
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
+}
+
+// runService starts the registration service and HTTP server
+func runService(ctx context.Context, logger *slog.Logger) error {
+	// Log application startup information
+	logger.Info("Application starting",
+		slog.String("app", appName),
+		slog.String("version", version),
+		slog.String("buildDate", buildDate))
+
+	signalCtx, signalCancel := signal.NotifyContext(ctx, os.Interrupt, syscall.SIGTERM)
+	defer signalCancel()
+
+	intervalDuration := GetRegistrationServiceIntervalTime(logger)
+	registrationService := registration.NewRegistrationService(logger, intervalDuration)
+
+	// Create a context with cancel function for shutdown
+	g, gCtx := errgroup.WithContext(signalCtx)
+
+	// Start the registration service
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("panic in registration service", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		return registrationService.Run(gCtx)
+	})
+
+	// Setup HTTP server
+	mux := http.NewServeMux()
+	mux.Handle("/metrics", promhttp.Handler())
+	mux.HandleFunc("/live", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is healthy")
+	})
+	mux.HandleFunc("/ready", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is ready")
+	})
+
+	// Create server with timeout configuration
+	server := &http.Server{
+		Addr:    GetRegistrationServicePort(logger),
+		Handler: recoveryMiddleware(logger)(mux),
+	}
+
+	// Start the HTTP server in a goroutine
+	g.Go(func() error {
+		logger.Info("Starting HTTP server",
+			slog.String("address", server.Addr),
+			slog.Int("intervalMinutes", int(intervalDuration.Minutes())))
+
+		err := server.ListenAndServe()
+		if err != nil && !errors.Is(err, http.ErrServerClosed) {
+			logger.Error("http server failed", slog.String("err", err.Error()))
+			return err
+		}
+		return nil
+	})
+
+	// Add server shutdown handler
+	g.Go(func() error {
+		<-gCtx.Done()
+		logger.Info("Shutting down HTTP server")
+
+		// Create a timeout context for shutdown
+		shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 15*time.Second)
+		defer shutdownCancel()
+
+		if err := server.Shutdown(shutdownCtx); err != nil {
+			logger.Error("http server shutdown error", slog.String("err", err.Error()))
+			return err
+		}
+
+		logger.Info("HTTP server shutdown completed")
+		return nil
+	})
+
+	// Wait for all goroutines to complete
+	err := g.Wait()
+	if err != nil && !errors.Is(err, context.Canceled) {
+		logger.Error("service error", slog.String("err", err.Error()))
+		return err
+	}
+
+	logger.Info("Service shutdown complete")
+	return nil
+}
+
+func main() {
+	// Define command line flags using pflag
+	logLevel := pflag.String("zap-log-level", "", "Log level (debug, info, warn, error)")
+	encoder := pflag.String("zap-encoder", "json", "Log encoder (json, console)")
+	timeEncoding := pflag.String("zap-time-encoding", "rfc3339nano", "Time encoding (rfc3339, rfc3339nano, iso8601, millis, nanos)")
+
+	// Add help flag
+	help := pflag.BoolP("help", "h", false, "Display help information")
+
+	// Parse flags
+	pflag.Parse()
+
+	// Display help if requested
+	if *help {
+		fmt.Printf("Usage of %s:\n", appName)
+		pflag.PrintDefaults()
+		os.Exit(0)
+	}
+
+	// Setup panic handler
+	defer func() {
+		if r := recover(); r != nil {
+			// Create a basic logger for panic case
+			logger, _ := createLogger("error", "json", "rfc3339nano")
+			if logger != nil {
+				logger.Error("application panic", slog.Any("panic", r))
+			}
+			os.Exit(1)
+		}
+	}()
+
+	// Create logger
+	logger, err := createLogger(*logLevel, *encoder, *timeEncoding)
+	if err != nil {
+		fmt.Fprintf(os.Stderr, "failed to create logger: %v\n", err)
+		os.Exit(1)
+	}
+
+	// Create context
+	ctx := context.Background()
+
+	// Run the service
+	err = runService(ctx, logger)
+
+	if err != nil {
+		os.Exit(1)
+	}
+
+}
diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go
new file mode 100644
index 0000000..a84a8b5
--- /dev/null
+++ b/pkg/constants/constants.go
@@ -0,0 +1,7 @@
+package constants
+
+const DefaultRegistrationServiceIntervalInMinutes = 60
+const DefaultRegistrationServiceIntervalInMinutesEnv = "CC_IPR_REGISTRATION_INTERVAL_MINUTES"
+
+const DefaultRegistrationServicePort = 8080
+const RegistrationServicePortEnv = "CC_IPR_REGISTRATION_SERVICE_PORT"
diff --git a/pkg/metrics/metrics.go b/pkg/metrics/metrics.go
new file mode 100644
index 0000000..38204ee
--- /dev/null
+++ b/pkg/metrics/metrics.go
@@ -0,0 +1,164 @@
+package metrics
+
+import (
+	"fmt"
+	"log/slog"
+
+	"github.com/prometheus/client_golang/prometheus"
+	"github.com/prometheus/client_golang/prometheus/promauto"
+)
+
+const (
+	// metrics definitions
+	RegistrationServiceStatusCodeMetricValue  = "service_status_code"
+	RegistrationServicePanicCountsMetricValue = "application_panics_total"
+
+	// label definitions
+	HttpStatusCodeLabel = "http_status_code"
+	IntelErrorCodeLabel = "intel_error_code"
+)
+
+// Define a custom type for status codes
+type StatusCode int
+
+type StatusCodeDetails struct {
+	RequiresHTTPStatusCode bool
+	AllowsIntelErrCode     bool
+}
+
+const (
+	Pending                      StatusCode = iota // 0
+	SgxUefiUnavailable           StatusCode = 1
+	RetryNeeded                  StatusCode = 2
+	SgxResetNeeded               StatusCode = 3
+	UefiPersistFailed            StatusCode = 4
+	PlatformRebootNeeded         StatusCode = 5
+	PlatformDirectlyRegistered   StatusCode = 9
+	IntelConnectFailed           StatusCode = 10
+	InvalidRegistrationRequest   StatusCode = 11
+	IntelRegServiceRequestFailed StatusCode = 12
+	UnknownError                 StatusCode = 99
+)
+
+func (s StatusCode) GetDetails() StatusCodeDetails {
+	switch s {
+	case InvalidRegistrationRequest, IntelRegServiceRequestFailed, SgxResetNeeded:
+		return StatusCodeDetails{
+			RequiresHTTPStatusCode: true,
+			AllowsIntelErrCode:     false,
+		}
+	default:
+		return StatusCodeDetails{
+			RequiresHTTPStatusCode: false,
+			AllowsIntelErrCode:     false,
+		}
+	}
+
+}
+
+func (s StatusCode) toInt() int {
+	return int(s)
+}
+
+// Add a String() method for easy conversion to string
+func (s StatusCode) String() string {
+	switch s {
+	case Pending:
+		return "Pending: pending execution"
+	case SgxUefiUnavailable:
+		return "SgxUefiUnavailable: SGX UEFI variables not available"
+	case RetryNeeded:
+		return "RetryNeeded: impossible to determine the registration status; please reattempt"
+	case SgxResetNeeded:
+		return "SgxResetNeeded: impossible to determine the registration status; please reset the SGX"
+	case PlatformRebootNeeded:
+		return "PlatformRebootNeeded: platform registered successfully and a reboot is required"
+	case UefiPersistFailed:
+		return "UefiPersistFailed: failed to persist the UEFI variable content"
+	case PlatformDirectlyRegistered:
+		return "PlatformDirectlyRegistered: platform directly registered"
+	case IntelConnectFailed:
+		return "IntelConnectFailed: failed to connect to Intel RS"
+	case InvalidRegistrationRequest:
+		return "InvalidRegistrationRequest: invalid registration request"
+	case IntelRegServiceRequestFailed:
+		return "IntelRegServiceRequestFailed: intel RS could not process the request"
+	default:
+		return "UnknownError"
+	}
+}
+
+type StatusCodeMetric struct {
+	Status         StatusCode
+	HttpStatusCode string
+	IntelError     string
+}
+
+type RegistrationServiceMetricsRegistry struct {
+	log *slog.Logger
+}
+
+func NewRegistrationServiceMetricsRegistry(logger *slog.Logger) *RegistrationServiceMetricsRegistry {
+	return &RegistrationServiceMetricsRegistry{
+		log: logger,
+	}
+}
+
+var (
+	RegistrationServiceStatusCodeMetric = promauto.NewGaugeVec(
+		prometheus.GaugeOpts{
+			Name: RegistrationServiceStatusCodeMetricValue,
+			Help: "Current status code of the registration service",
+		},
+		[]string{HttpStatusCodeLabel, IntelErrorCodeLabel},
+	)
+
+	RegistrationServicePanicCountsMetric = promauto.NewCounter(prometheus.CounterOpts{
+		Name: RegistrationServicePanicCountsMetricValue,
+		Help: "Total number of go routines panics",
+	})
+)
+
+// helper function to service status code to pending
+func IncrementPanicCounts() {
+	RegistrationServicePanicCountsMetric.Inc()
+}
+
+// helper function to service status code to pending
+func (s *RegistrationServiceMetricsRegistry) SetServiceStatusCodeToPending() error {
+	metricValue := StatusCodeMetric{
+		Status:         Pending,
+		HttpStatusCode: "0",
+		IntelError:     "",
+	}
+	return s.UpdateServiceStatusCodeMetric(metricValue)
+}
+
+func (s *RegistrationServiceMetricsRegistry) UpdateServiceStatusCodeMetric(metricValue StatusCodeMetric) error {
+	// Validate required labels
+	statusDetails := metricValue.Status.GetDetails()
+	if statusDetails.RequiresHTTPStatusCode && metricValue.HttpStatusCode == "" {
+		return fmt.Errorf("warning: status code %d requires HTTP status code but none provided",
+			metricValue.Status)
+	}
+
+	if !statusDetails.AllowsIntelErrCode {
+		metricValue.IntelError = ""
+	}
+
+	// Set the new metric value with labels
+	RegistrationServiceStatusCodeMetric.With(prometheus.Labels{
+		HttpStatusCodeLabel: metricValue.HttpStatusCode,
+		IntelErrorCodeLabel: metricValue.IntelError,
+	}).Set(float64(metricValue.Status))
+
+	s.log.Info(
+		fmt.Sprintf("Status code metric updated - Code: %d, HTTP StatusCode: %s, Intel Error code: %s",
+			metricValue.Status, metricValue.HttpStatusCode, metricValue.IntelError),
+		slog.Int(RegistrationServiceStatusCodeMetricValue, metricValue.Status.toInt()),
+		slog.String(HttpStatusCodeLabel, metricValue.HttpStatusCode),
+		slog.String(IntelErrorCodeLabel, metricValue.IntelError))
+
+	return nil
+
+}
diff --git a/pkg/metrics/metrics_test.go b/pkg/metrics/metrics_test.go
new file mode 100644
index 0000000..21fe4f8
--- /dev/null
+++ b/pkg/metrics/metrics_test.go
@@ -0,0 +1,322 @@
+package metrics
+
+import (
+	"log/slog"
+	"testing"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/stretchr/testify/assert"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"go.uber.org/zap/zaptest/observer"
+)
+
+func TestGetDetails(t *testing.T) {
+	cases := []struct {
+		msg            string
+		statusCode     StatusCode
+		wantedDetails  StatusCodeDetails
+		wantedIntValue int
+	}{
+		{
+			msg:        "Pending returns the expected details",
+			statusCode: Pending,
+			wantedDetails: StatusCodeDetails{
+				RequiresHTTPStatusCode: false,
+				AllowsIntelErrCode:     false,
+			},
+			wantedIntValue: 0,
+		},
+		{
+			msg:        "SgxUefiUnavailable returns the expected details",
+			statusCode: SgxUefiUnavailable,
+			wantedDetails: StatusCodeDetails{
+				RequiresHTTPStatusCode: false,
+				AllowsIntelErrCode:     false,
+			},
+			wantedIntValue: 1,
+		},
+		{
+			msg:        "RetryNeeded returns the expected details",
+			statusCode: RetryNeeded,
+			wantedDetails: StatusCodeDetails{
+				RequiresHTTPStatusCode: false,
+				AllowsIntelErrCode:     false,
+			},
+			wantedIntValue: 2,
+		},
+		{
+			msg:        "SgxResetNeeded returns the expected details",
+			statusCode: SgxResetNeeded,
+			wantedDetails: StatusCodeDetails{
+				RequiresHTTPStatusCode: true,
+				AllowsIntelErrCode:     false,
+			},
+			wantedIntValue: 3,
+		},
+		{
+			msg:        "UefiPersistFailed returns the expected details",
+			statusCode: UefiPersistFailed,
+			wantedDetails: StatusCodeDetails{
+				RequiresHTTPStatusCode: false,
+				AllowsIntelErrCode:     false,
+			},
+			wantedIntValue: 4,
+		},
+		{
+			msg:        "PlatformRebootNeeded returns the expected details",
+			statusCode: PlatformRebootNeeded,
+			wantedDetails: StatusCodeDetails{
+				RequiresHTTPStatusCode: false,
+				AllowsIntelErrCode:     false,
+			},
+			wantedIntValue: 5,
+		},
+		{
+			msg:        "PlatformDirectlyRegistered returns the expected details",
+			statusCode: PlatformDirectlyRegistered,
+			wantedDetails: StatusCodeDetails{
+				RequiresHTTPStatusCode: false,
+				AllowsIntelErrCode:     false,
+			},
+			wantedIntValue: 9,
+		},
+		{
+			msg:        "IntelConnectFailed returns the expected details",
+			statusCode: IntelConnectFailed,
+			wantedDetails: StatusCodeDetails{
+				RequiresHTTPStatusCode: false,
+				AllowsIntelErrCode:     false,
+			},
+			wantedIntValue: 10,
+		},
+		{
+			msg:        "InvalidRegistrationRequest returns the expected details",
+			statusCode: InvalidRegistrationRequest,
+			wantedDetails: StatusCodeDetails{
+				RequiresHTTPStatusCode: true,
+				AllowsIntelErrCode:     false,
+			},
+			wantedIntValue: 11,
+		},
+		{
+			msg:        "IntelRegServiceRequestFailed returns the expected details",
+			statusCode: IntelRegServiceRequestFailed,
+			wantedDetails: StatusCodeDetails{
+				RequiresHTTPStatusCode: true,
+				AllowsIntelErrCode:     false,
+			},
+			wantedIntValue: 12,
+		},
+		{
+			msg:        "UnknownError returns the expected details",
+			statusCode: UnknownError,
+			wantedDetails: StatusCodeDetails{
+				RequiresHTTPStatusCode: false,
+				AllowsIntelErrCode:     false,
+			},
+			wantedIntValue: 99,
+		},
+	}
+
+	for _, c := range cases {
+		actualDetails := c.statusCode.GetDetails()
+		assert.Equal(t, c.wantedDetails, actualDetails, c.msg)
+		assert.Equal(t, c.wantedIntValue, int(c.statusCode), c.msg)
+	}
+}
+
+func TestGetStatusCodeString(t *testing.T) {
+	cases := []struct {
+		msg          string
+		statusCode   StatusCode
+		wantedString string
+	}{
+		{
+			msg:          "Pending returns the expected details",
+			statusCode:   Pending,
+			wantedString: "Pending: pending execution",
+		},
+		{
+			msg:          "SgxUefiUnavailable returns the expected details",
+			statusCode:   SgxUefiUnavailable,
+			wantedString: "SgxUefiUnavailable: SGX UEFI variables not available",
+		},
+		{
+			msg:          "RetryNeeded returns the expected details",
+			statusCode:   RetryNeeded,
+			wantedString: "RetryNeeded: impossible to determine the registration status; please reattempt",
+		},
+		{
+			msg:          "SgxResetNeeded returns the expected details",
+			statusCode:   SgxResetNeeded,
+			wantedString: "SgxResetNeeded: impossible to determine the registration status; please reset the SGX",
+		},
+		{
+			msg:          "UefiPersistFailed returns the expected details",
+			statusCode:   UefiPersistFailed,
+			wantedString: "UefiPersistFailed: failed to persist the UEFI variable content",
+		},
+		{
+			msg:          "PlatformRebootNeeded returns the expected details",
+			statusCode:   PlatformRebootNeeded,
+			wantedString: "PlatformRebootNeeded: platform registered successfully and a reboot is required",
+		},
+		{
+			msg:          "PlatformDirectlyRegistered returns the expected details",
+			statusCode:   PlatformDirectlyRegistered,
+			wantedString: "PlatformDirectlyRegistered: platform directly registered",
+		},
+		{
+			msg:          "IntelConnectFailed returns the expected details",
+			statusCode:   IntelConnectFailed,
+			wantedString: "IntelConnectFailed: failed to connect to Intel RS",
+		},
+		{
+			msg:          "InvalidRegistrationRequest returns the expected details",
+			statusCode:   InvalidRegistrationRequest,
+			wantedString: "InvalidRegistrationRequest: invalid registration request",
+		},
+		{
+			msg:          "IntelRegServiceRequestFailed returns the expected details",
+			statusCode:   IntelRegServiceRequestFailed,
+			wantedString: "IntelRegServiceRequestFailed: intel RS could not process the request",
+		},
+		{
+			msg:          "UnknownError returns the expected details",
+			statusCode:   UnknownError,
+			wantedString: "UnknownError",
+		},
+	}
+
+	for _, c := range cases {
+		actualDetails := c.statusCode.String()
+		assert.Equal(t, c.wantedString, actualDetails, c.msg)
+	}
+}
+
+func TestUpdateServiceStatusCodeMetricWarning(t *testing.T) {
+
+	observedZapCore, observedLogs := observer.New(zap.InfoLevel)
+	observedLogger := zap.New(observedZapCore)
+	logTest := slog.New(logr.ToSlogHandler(zapr.NewLogger(observedLogger)))
+	metricsRegistry := NewRegistrationServiceMetricsRegistry(logTest)
+	// logTest.
+	cases := []struct {
+		msg                string
+		metricUpdate       StatusCodeMetric
+		expectedLogEntries []observer.LoggedEntry
+		expectError        bool
+	}{
+		{
+			msg: "pending state has no warning",
+			metricUpdate: StatusCodeMetric{
+
+				Status:         Pending,
+				HttpStatusCode: "",
+				IntelError:     "",
+			},
+			expectError: false,
+
+			expectedLogEntries: []observer.LoggedEntry{
+				{
+					Entry: zapcore.Entry{
+						Level:   zap.InfoLevel,
+						Message: "Status code metric updated - Code: 0, HTTP StatusCode: , Intel Error code: ",
+					},
+				},
+			},
+		},
+		{
+			msg: "IntelRegServiceRequestFailed requires http code label ",
+			metricUpdate: StatusCodeMetric{
+				Status:         IntelRegServiceRequestFailed,
+				HttpStatusCode: "",
+				IntelError:     "",
+			},
+
+			expectError: true,
+			expectedLogEntries: []observer.LoggedEntry{
+				{
+					Entry: zapcore.Entry{
+						Level:   zap.InfoLevel,
+						Message: "Status code metric updated - Code: 0, HTTP StatusCode: , Intel Error code: ",
+					},
+				},
+			},
+		},
+		{
+			msg: "SgxResetNeeded requires http code label ",
+			metricUpdate: StatusCodeMetric{
+				Status:         SgxResetNeeded,
+				HttpStatusCode: "",
+				IntelError:     "",
+			},
+
+			expectError: true,
+			expectedLogEntries: []observer.LoggedEntry{
+				{
+					Entry: zapcore.Entry{
+						Level:   zap.InfoLevel,
+						Message: "Status code metric updated - Code: 0, HTTP StatusCode: , Intel Error code: ",
+					},
+				},
+			},
+		},
+		{
+			msg: "InvalidRegistrationRequest requires http code label ",
+			metricUpdate: StatusCodeMetric{
+				Status:         InvalidRegistrationRequest,
+				HttpStatusCode: "",
+				IntelError:     "",
+			},
+
+			expectError: true,
+			expectedLogEntries: []observer.LoggedEntry{
+				{
+					Entry: zapcore.Entry{
+						Level:   zap.InfoLevel,
+						Message: "Status code metric updated - Code: 0, HTTP StatusCode: , Intel Error code: ",
+					},
+				},
+			},
+		},
+		{
+			msg: "IntelRegServiceRequestFailed with http status code works fine",
+			metricUpdate: StatusCodeMetric{
+
+				Status:         IntelRegServiceRequestFailed,
+				HttpStatusCode: "400",
+				IntelError:     "",
+			},
+			expectError: false,
+			expectedLogEntries: []observer.LoggedEntry{
+				{
+					Entry: zapcore.Entry{
+						Level:   zap.InfoLevel,
+						Message: "Status code metric updated - Code: 12, HTTP StatusCode: 400, Intel Error code: ",
+					},
+				},
+			},
+		},
+	}
+	for _, c := range cases {
+		err := metricsRegistry.UpdateServiceStatusCodeMetric(c.metricUpdate)
+		if c.expectError {
+			assert.Error(t, err, c.msg)
+		}
+		for _, expectedEntry := range c.expectedLogEntries {
+			thisLogEntryEqualTo(t, expectedEntry, observedLogs.All()[observedLogs.Len()-1], c.msg)
+		}
+	}
+
+}
+
+func thisLogEntryEqualTo(t testing.TB, this, other observer.LoggedEntry, msg string) {
+	t.Helper()
+	// todo(): also check .Data (which has the log fields)
+	assert.Equal(t, this.Level, other.Level, msg)
+	assert.Equal(t, this.Message, other.Message, msg)
+
+}
diff --git a/pkg/registration/registration.go b/pkg/registration/registration.go
new file mode 100644
index 0000000..3e81638
--- /dev/null
+++ b/pkg/registration/registration.go
@@ -0,0 +1,64 @@
+package registration
+
+import (
+	"context"
+	"log/slog"
+	"time"
+
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+)
+
+// RegistrationChecker is an interface to facilitate tests
+type RegistrationChecker interface {
+	Check() metrics.StatusCode
+}
+
+type DefaultRegistrationChecker struct{}
+
+func (rc *DefaultRegistrationChecker) Check() metrics.StatusCode {
+	// todo implement all cases here
+	return metrics.Pending
+}
+
+type RegistrationService struct {
+	intervalDuration    time.Duration
+	serverMetrics       *metrics.RegistrationServiceMetricsRegistry
+	registrationChecker RegistrationChecker
+	log                 *slog.Logger
+}
+
+func (r *RegistrationService) Run(ctx context.Context) error {
+	err := r.serverMetrics.SetServiceStatusCodeToPending()
+
+	if err != nil {
+		return err
+	}
+	ticker := time.NewTicker(r.intervalDuration)
+	defer ticker.Stop()
+
+	for {
+		select {
+		case <-ticker.C:
+			r.CheckRegistrationStatus()
+		case <-ctx.Done():
+			return nil
+		}
+	}
+}
+
+func (r *RegistrationService) CheckRegistrationStatus() {
+	status := r.registrationChecker.Check()
+	r.log.Debug("Registration check completed", slog.String("status", status.String()))
+
+	// todo(): update metrics here based on the status provided
+}
+
+func NewRegistrationService(logger *slog.Logger, intervalDuration time.Duration) *RegistrationService {
+	registrationService := &RegistrationService{
+		intervalDuration:    intervalDuration * time.Minute,
+		serverMetrics:       metrics.NewRegistrationServiceMetricsRegistry(logger), //todo(): inject the logger into metrics registry
+		registrationChecker: &DefaultRegistrationChecker{},
+		log:                 logger,
+	}
+	return registrationService
+}
diff --git a/pkg/registration/registration_test.go b/pkg/registration/registration_test.go
new file mode 100644
index 0000000..f421cd6
--- /dev/null
+++ b/pkg/registration/registration_test.go
@@ -0,0 +1,114 @@
+package registration
+
+import (
+	"context"
+	"log/slog"
+	"testing"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"go.uber.org/zap/zaptest/observer"
+
+	"github.com/stretchr/testify/assert"
+)
+
+type TestRegistrationChecker struct {
+	metricSteps []metrics.StatusCode
+	counter     int
+}
+
+func (rc *TestRegistrationChecker) Check() metrics.StatusCode {
+	if rc.counter == len(rc.metricSteps) {
+		rc.counter = 0
+	}
+	currentMetric := rc.metricSteps[rc.counter]
+	rc.counter++
+	return currentMetric
+}
+
+func TestRegistrationServiceRun(t *testing.T) {
+
+	observedZapCore, observedLogs := observer.New(zap.DebugLevel)
+	observedLogger := zap.New(observedZapCore)
+	logTest := slog.New(logr.ToSlogHandler(zapr.NewLogger(observedLogger)))
+	metricsRegistry := metrics.NewRegistrationServiceMetricsRegistry(logTest)
+	cases := []struct {
+		msg                string
+		metricSteps        []metrics.StatusCode
+		expectedLogEntries []observer.LoggedEntry
+	}{
+		{
+			msg: "first case example",
+			metricSteps: []metrics.StatusCode{
+				metrics.PlatformDirectlyRegistered,
+				metrics.IntelConnectFailed,
+				metrics.RetryNeeded,
+			},
+			expectedLogEntries: []observer.LoggedEntry{
+				{
+					Entry: zapcore.Entry{
+						Level:   zap.InfoLevel,
+						Message: "Status code metric updated - Code: 0, HTTP StatusCode: 0, Intel Error code: ",
+					},
+				},
+				{
+					Entry: zapcore.Entry{
+						Level:   zap.DebugLevel,
+						Message: "Registration check completed",
+					},
+				},
+				{
+					Entry: zapcore.Entry{
+						Level:   zap.DebugLevel,
+						Message: "Registration check completed",
+					},
+				},
+				{
+					Entry: zapcore.Entry{
+						Level:   zap.DebugLevel,
+						Message: "Registration check completed",
+					},
+				},
+			},
+		},
+	}
+	for _, c := range cases {
+		testRegistrationChecker := &TestRegistrationChecker{
+			metricSteps: c.metricSteps,
+		}
+
+		registrationService := &RegistrationService{
+			intervalDuration:    1 * time.Millisecond,
+			serverMetrics:       metricsRegistry,
+			registrationChecker: testRegistrationChecker,
+			log:                 logTest,
+		}
+
+		testContext, cancelFunc := context.WithTimeout(context.TODO(), 100*time.Millisecond)
+		defer cancelFunc()
+		err := registrationService.Run(testContext)
+
+		if err != nil {
+			panic("registration failed: " + err.Error())
+		}
+
+	}
+	c := cases[0]
+	for i, observedLog := range observedLogs.All() {
+		thisLogEntryEqualTo(t, c.expectedLogEntries[i], observedLog, c.msg)
+	}
+
+}
+
+func thisLogEntryEqualTo(t testing.TB, this, other observer.LoggedEntry, msg string) {
+	t.Helper()
+	// todo(): also check .Data (which has the log fields)
+	assert.Equal(t, this.Level, other.Level, msg)
+	assert.Equal(t, this.Message, other.Message, msg)
+
+}
diff --git a/scripts/.gitkeep b/scripts/.gitkeep
new file mode 100644
index 0000000..e69de29


Reviews:
user: login: VolkerKozlowski
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-02-10T09:33:14Z
user: login: VolkerKozlowski
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-02-10T09:38:19Z
user: login: VolkerKozlowski
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-02-10T09:50:52Z
user: login: VolkerKozlowski
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-02-10T09:53:15Z
user: login: VolkerKozlowski
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-02-10T09:54:56Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-02-10T12:23:11Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-02-10T12:23:18Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-02-10T12:23:22Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-02-10T12:23:27Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-10T21:28:31Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-10T21:29:09Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-10T21:31:06Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-10T21:36:36Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-10T21:37:24Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-10T21:39:13Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-10T21:40:45Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-10T21:43:20Z
user: login: SilvaMatteus
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-11T10:55:58Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-12T13:40:47Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-02-13T14:08:49Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-02-13T14:08:56Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-02-13T14:09:02Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-02-13T14:09:07Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-02-13T14:09:19Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-02-13T14:09:26Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-19T13:00:00Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-19T13:02:41Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-02-20T11:25:05Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-02-20T11:30:57Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-27T14:02:35Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-03T20:03:27Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-03T20:03:32Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T10:07:06Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T10:07:59Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T10:11:04Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T10:13:58Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-04T10:14:31Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T10:16:29Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T10:17:14Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T10:17:44Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T10:24:42Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T10:28:11Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T10:28:31Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T10:30:04Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T10:38:05Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T10:44:36Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T10:45:40Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-04T11:17:38Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-04T11:17:43Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-04T11:17:48Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-04T11:17:54Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-04T11:18:09Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-04T11:18:15Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-04T11:18:19Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-04T11:18:24Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-04T11:18:29Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-04T11:18:35Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-04T11:18:45Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-04T11:21:01Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T11:37:07Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T11:39:05Z
user: login: lukas016
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T11:47:20Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-04T11:57:37Z
user: login: dandax123
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-04T12:00:36Z
user: login: SilvaMatteus
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T12:11:01Z
user: login: lukas016
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-07T07:47:27Z

Review comments:
diff_hunk: @@ -0,0 +1,47 @@
+# Go parameters
+GOCMD=go
+GOBUILD=$(GOCMD) build
+GOTEST=$(GOCMD) test
+GOGET=$(GOCMD) get
+GOMOD=$(GOCMD) mod
+BINARY_NAME=cc-intel-platform-registration
+
+# Tools
+GOLANGCI_LINT=golangci-lint
+STATICCHECK=staticcheck
+GOVULNCHECK=$(GOCMD) run golang.org/x/vuln/cmd/govulncheck@latest
+
+.PHONY: all build test clean deps lint security-check check
+
+all: check build
+
+build:
+	$(GOBUILD) -o $(BINARY_NAME) -v
+
+test:
+	$(GOTEST) -v ./...
+
+clean:
+	$(GOCMD) clean
+	rm -f $(BINARY_NAME)
+
+deps:
+	$(GOMOD) download
+	$(GOMOD) tidy
+	$(GOGET) -u honnef.co/go/tools/cmd/staticcheck
+	curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.63.4
path: Makefile
user: login: VolkerKozlowski
body: installation of golangci-lint does not work on my side 
```shell
...
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /bin v1.63.4
golangci/golangci-lint info checking GitHub for tag 'v1.63.4'
golangci/golangci-lint info found version: 1.63.4 for v1.63.4/darwin/arm64
install: /bin/golangci-lint: Operation not permitted
```
Running the curl in terminal is fine but in with make the expression `$(go env GOPATH)/bin` evaluates to empty. Can you check if it does make sense to install it into `./bin`
I would rather create a constant for v1.63.4 like `GOLANGCI_LINT_VERSION`
created_at: 2025-02-10T09:33:14Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,47 @@
+# Go parameters
+GOCMD=go
+GOBUILD=$(GOCMD) build
+GOTEST=$(GOCMD) test
+GOGET=$(GOCMD) get
+GOMOD=$(GOCMD) mod
+BINARY_NAME=cc-intel-platform-registration
+
+# Tools
+GOLANGCI_LINT=golangci-lint
+STATICCHECK=staticcheck
+GOVULNCHECK=$(GOCMD) run golang.org/x/vuln/cmd/govulncheck@latest
+
+.PHONY: all build test clean deps lint security-check check
+
+all: check build
+
+build:
+	$(GOBUILD) -o $(BINARY_NAME) -v
+
+test:
+	$(GOTEST) -v ./...
+
+clean:
+	$(GOCMD) clean
+	rm -f $(BINARY_NAME)
+
+deps:
+	$(GOMOD) download
+	$(GOMOD) tidy
+	$(GOGET) -u honnef.co/go/tools/cmd/staticcheck
path: Makefile
user: login: VolkerKozlowski
body: This command does not install `staticcheck`which is needed in target `lint` later
created_at: 2025-02-10T09:38:19Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,150 @@
+package metrics
+
+import (
+	"fmt"
+
+	"github.com/prometheus/client_golang/prometheus"
+	"github.com/prometheus/client_golang/prometheus/promauto"
+	"github.com/sirupsen/logrus"
+)
+
+const (
+	// metrics definitions
+	SERVICE_STATUS_CODE_METRIC = "service_status_code"
+
+	// label definitions
+	HTTP_STATUS_CODE_LABEL = "http_status_code"
+	INTEL_ERROR_CODE_LABEL = "intel_error_code"
+)
+
+// Define a custom type for status codes
+type StatusCode int
+
+type StatusCodeDetails struct {
+	RequiresHTTPStatusCode bool
+	AllowsIntelErrCode     bool
+}
+
+const (
+	PENDING                      StatusCode = iota // 0
+	SGX_UEFI_UNAVAILABLE         StatusCode = 1
+	RETRY_NEEDED                 StatusCode = 2
+	SGX_RESET_NEEDED             StatusCode = 3
+	UEFI_PERSIST_FAILED          StatusCode = 4
+	PLATFORM_REBOOT_NEEDED       StatusCode = 5
+	PLATFORM_DIRECTLY_REGISTERED StatusCode = 9
+	INTEL_CONNECT_FAILED         StatusCode = 10
+	INVALID_REGISTRATION_REQUEST StatusCode = 11
+	INTEL_RS_REQUEST_FAILED      StatusCode = 12
+	UNKNOWN_ERROR                StatusCode = 99
+)
+
+func (s StatusCode) GetDetails() StatusCodeDetails {
+	switch s {
+	case INVALID_REGISTRATION_REQUEST, INTEL_RS_REQUEST_FAILED, SGX_RESET_NEEDED:
+		return StatusCodeDetails{
+			RequiresHTTPStatusCode: true,
+			AllowsIntelErrCode:     false,
+		}
+	default:
+		return StatusCodeDetails{
+			RequiresHTTPStatusCode: false,
+			AllowsIntelErrCode:     false,
+		}
+	}
+
+}
+
+// Add a String() method for easy conversion to string
+func (s StatusCode) String() string {
+	switch s {
+	case PENDING:
+		return "PENDING: pending execution"
+	case SGX_UEFI_UNAVAILABLE:
+		return "SGX_UEFI_UNAVAILABLE: SGX UEFI variables not available"
+	case RETRY_NEEDED:
+		return "RETRY_NEEDED: impossible to determine the registration status; please reattempt"
+	case SGX_RESET_NEEDED:
+		return "SGX_RESET_NEEDED: impossible to determine the registration status; please reset the SGX"
+	case PLATFORM_REBOOT_NEEDED:
+		return "PLATFORM_REBOOT_NEEDED: platform registered successfully and a reboot is required"
+	case UEFI_PERSIST_FAILED:
+		return "UEFI_PERSIST_FAILED: failed to persist the UEFI variable content"
+	case PLATFORM_DIRECTLY_REGISTERED:
+		return "PLATFORM_DIRECTLY_REGISTERED: platform directly registered"
+	case INTEL_CONNECT_FAILED:
+		return "INTEL_CONNECT_FAILED: failed to connect to Intel RS"
+	case INVALID_REGISTRATION_REQUEST:
+		return "INVALID_REGISTRATION_REQUEST: invalid registration request"
+	case INTEL_RS_REQUEST_FAILED:
+		return "INTEL_RS_REQUEST_FAILED: intel RS could not process the request"
+	default:
+		return "UNKNOWN_ERROR"
+	}
+}
+
+type StatusCodeMetric struct {
+	Status         StatusCode
+	HttpStatusCode string
+	IntelError     string
+}
+
+type RegistrationServiceMetricsRegistry struct {
+	metrics map[string]prometheus.Collector
+	log     logrus.FieldLogger
+}
+
+func NewRegistrationServiceMetricsRegistry(logger logrus.FieldLogger) *RegistrationServiceMetricsRegistry {
+	return &RegistrationServiceMetricsRegistry{
+		metrics: map[string]prometheus.Collector{
+			SERVICE_STATUS_CODE_METRIC: promauto.NewGaugeVec(
+				prometheus.GaugeOpts{
+					Name: SERVICE_STATUS_CODE_METRIC,
+					Help: "Current status code of the registration service",
+				},
+				[]string{HTTP_STATUS_CODE_LABEL, INTEL_ERROR_CODE_LABEL},
+			),
+		},
+		log: logger,
+	}
+}
+
+// helper function to service status code to pending
+func (s *RegistrationServiceMetricsRegistry) SetServiceStatusCodeToPending() {
+	metric_value := StatusCodeMetric{
+		Status:         PENDING,
+		HttpStatusCode: "0",
+		IntelError:     "",
+	}
+	s.UpdateServiceStatusCodeMetric(metric_value)
path: pkg/metrics/metrics.go
user: login: VolkerKozlowski
body: linter:
```
pkg/metrics/metrics.go:119:33: Error return value of `s.UpdateServiceStatusCodeMetric` is not checked (errcheck)
s.UpdateServiceStatusCodeMetric(metric_value)
```
created_at: 2025-02-10T09:50:52Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,109 @@
+package registration
+
+import (
+	"cc-intel-platform-registration/pkg/metrics"
+	"context"
+	"testing"
+	"time"
+
+	"github.com/sirupsen/logrus"
+	"github.com/sirupsen/logrus/hooks/test"
+	"github.com/stretchr/testify/assert"
+)
+
+type TestRegistrationChecker struct {
+	metricSteps []metrics.StatusCode
+	counter     int
+}
+
+func (rc *TestRegistrationChecker) Check() metrics.StatusCode {
+	if rc.counter == len(rc.metricSteps) {
+		rc.counter = 0
+	}
+	currentMetric := rc.metricSteps[rc.counter]
+	rc.counter++
+	return currentMetric
+}
+
+func TestRegistrationServiceRun(t *testing.T) {
+	logTest, logHook := test.NewNullLogger()
+	logTest.SetLevel(logrus.DebugLevel)
+	metricsRegistry := metrics.NewRegistrationServiceMetricsRegistry(logTest)
+	cases := []struct {
+		msg                string
+		metricSteps        []metrics.StatusCode
+		expectedLogEntries []logrus.Entry
+	}{
+		{
+			msg: "first case example",
+			metricSteps: []metrics.StatusCode{
+				metrics.PLATFORM_DIRECTLY_REGISTERED,
+				metrics.INTEL_CONNECT_FAILED,
+				metrics.RETRY_NEEDED,
+			},
+			expectedLogEntries: []logrus.Entry{
+				{
+					Level:   logrus.InfoLevel,
+					Message: "Status code metric updated - Code: 0, HTTP StatusCode: 0, Intel Error code: ",
+					Data: logrus.Fields{
+						metrics.SERVICE_STATUS_CODE_METRIC: metrics.PENDING,
+						metrics.HTTP_STATUS_CODE_LABEL:     "0",
+						metrics.INTEL_ERROR_CODE_LABEL:     "",
+					},
+				},
+				{
+					Level:   logrus.DebugLevel,
+					Message: "Registration check completed",
+					Data: logrus.Fields{
+						"status": metrics.PLATFORM_DIRECTLY_REGISTERED.String(),
+					},
+				},
+				{
+					Level:   logrus.DebugLevel,
+					Message: "Registration check completed",
+					Data: logrus.Fields{
+						"status": metrics.INTEL_CONNECT_FAILED.String(),
+					},
+				},
+				{
+					Level:   logrus.DebugLevel,
+					Message: "Registration check completed",
+					Data: logrus.Fields{
+						"status": metrics.RETRY_NEEDED.String(),
+					},
+				},
+			},
+		},
+	}
+	for _, c := range cases {
+		testRegistrationChecker := &TestRegistrationChecker{
+			metricSteps: c.metricSteps,
+		}
+
+		registrationService := &RegistrationService{
+			intervalDuration:    1 * time.Millisecond,
+			serverMetrics:       metricsRegistry,
+			registrationChecker: testRegistrationChecker,
+			log:                 logTest,
+		}
+
+		testContext, cancelFunc := context.WithTimeout(context.TODO(), 100*time.Millisecond)
+		defer cancelFunc()
+		registrationService.Run(testContext)
path: pkg/registration/registration_test.go
user: login: VolkerKozlowski
body: linter issue:
```shell
pkg/registration/registration_test.go:92:26: Error return value of `registrationService.Run` is not checked (errcheck)
		registrationService.Run(testContext)
```
created_at: 2025-02-10T09:53:15Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,114 @@
+package cmd
+
+import (
+	"context"
+	"fmt"
+	"net/http"
+	"os"
+	"strconv"
+	"time"
+
+	"cc-intel-platform-registration/pkg/constants"
+	"cc-intel-platform-registration/pkg/registration"
+
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	log "github.com/sirupsen/logrus"
+	"github.com/spf13/cobra"
+)
+
+func GetRegistrationServiceIntervalTime() time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			log.Fatalf("Failed to parse %s: %v. Using default value: %d",
+				constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV,
+				err, constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES)
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		log.Infof("%s not set. Using default value: %d",
+			constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV,
+			constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES)
+	}
+	return time.Duration(interval)
+}
+
+// setLogConfig sets the log config.
+func setLogConfig(cmd *cobra.Command, args []string) {
+	logLevelFlag, err := cmd.Flags().GetString(constants.LOG_LEVEL_FLAG)
+	if err != nil {
+		log.Fatalf("internal error: unable to get %s flag", constants.LOG_LEVEL_FLAG)
+	}
+
+	if logLevelFlag != "" {
+		if logLevel, err := log.ParseLevel(logLevelFlag); err == nil {
+			log.SetLevel(logLevel)
+		} else {
+			log.Fatalf("unable to set log level using %s flag: %s", constants.LOG_LEVEL_FLAG, err)
+		}
+	} else {
+		logLevelEnv := os.Getenv(constants.LOG_LEVEL_ENV)
+		if logLevelEnv != "" {
+			if logLevel, err := log.ParseLevel(logLevelEnv); err == nil {
+				log.SetLevel(logLevel)
+			} else {
+				log.Fatalf("unable to set log level from %s env: %s", constants.LOG_LEVEL_ENV, err)
+			}
+		}
+	}
+	log.Debug("log level set to ", log.GetLevel())
+}
+
+func StartCmdFunc(cmd *cobra.Command, args []string) {
+	// logrus.SetLevel(logrus.DebugLevel)
+	intervalDuration := GetRegistrationServiceIntervalTime()
+	registrationService := registration.NewRegistrationService(intervalDuration)
+	ctx, cancelFunc := context.WithCancel(context.TODO())
+	defer cancelFunc()
+
+	go registrationService.Run(ctx)
path: cmd/cli.go
user: login: VolkerKozlowski
body: linter issue: 
```
cmd/cli.go:72:28: Error return value of `registrationService.Run` is not checked (errcheck)
go registrationService.Run(ctx)
```
created_at: 2025-02-10T09:54:56Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,47 @@
+# Go parameters
+GOCMD=go
+GOBUILD=$(GOCMD) build
+GOTEST=$(GOCMD) test
+GOGET=$(GOCMD) get
+GOMOD=$(GOCMD) mod
+BINARY_NAME=cc-intel-platform-registration
+
+# Tools
+GOLANGCI_LINT=golangci-lint
+STATICCHECK=staticcheck
+GOVULNCHECK=$(GOCMD) run golang.org/x/vuln/cmd/govulncheck@latest
+
+.PHONY: all build test clean deps lint security-check check
+
+all: check build
+
+build:
+	$(GOBUILD) -o $(BINARY_NAME) -v
+
+test:
+	$(GOTEST) -v ./...
+
+clean:
+	$(GOCMD) clean
+	rm -f $(BINARY_NAME)
+
+deps:
+	$(GOMOD) download
+	$(GOMOD) tidy
+	$(GOGET) -u honnef.co/go/tools/cmd/staticcheck
path: Makefile
user: login: dandax123
body: Addressed
created_at: 2025-02-10T12:23:11Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,150 @@
+package metrics
+
+import (
+	"fmt"
+
+	"github.com/prometheus/client_golang/prometheus"
+	"github.com/prometheus/client_golang/prometheus/promauto"
+	"github.com/sirupsen/logrus"
+)
+
+const (
+	// metrics definitions
+	SERVICE_STATUS_CODE_METRIC = "service_status_code"
+
+	// label definitions
+	HTTP_STATUS_CODE_LABEL = "http_status_code"
+	INTEL_ERROR_CODE_LABEL = "intel_error_code"
+)
+
+// Define a custom type for status codes
+type StatusCode int
+
+type StatusCodeDetails struct {
+	RequiresHTTPStatusCode bool
+	AllowsIntelErrCode     bool
+}
+
+const (
+	PENDING                      StatusCode = iota // 0
+	SGX_UEFI_UNAVAILABLE         StatusCode = 1
+	RETRY_NEEDED                 StatusCode = 2
+	SGX_RESET_NEEDED             StatusCode = 3
+	UEFI_PERSIST_FAILED          StatusCode = 4
+	PLATFORM_REBOOT_NEEDED       StatusCode = 5
+	PLATFORM_DIRECTLY_REGISTERED StatusCode = 9
+	INTEL_CONNECT_FAILED         StatusCode = 10
+	INVALID_REGISTRATION_REQUEST StatusCode = 11
+	INTEL_RS_REQUEST_FAILED      StatusCode = 12
+	UNKNOWN_ERROR                StatusCode = 99
+)
+
+func (s StatusCode) GetDetails() StatusCodeDetails {
+	switch s {
+	case INVALID_REGISTRATION_REQUEST, INTEL_RS_REQUEST_FAILED, SGX_RESET_NEEDED:
+		return StatusCodeDetails{
+			RequiresHTTPStatusCode: true,
+			AllowsIntelErrCode:     false,
+		}
+	default:
+		return StatusCodeDetails{
+			RequiresHTTPStatusCode: false,
+			AllowsIntelErrCode:     false,
+		}
+	}
+
+}
+
+// Add a String() method for easy conversion to string
+func (s StatusCode) String() string {
+	switch s {
+	case PENDING:
+		return "PENDING: pending execution"
+	case SGX_UEFI_UNAVAILABLE:
+		return "SGX_UEFI_UNAVAILABLE: SGX UEFI variables not available"
+	case RETRY_NEEDED:
+		return "RETRY_NEEDED: impossible to determine the registration status; please reattempt"
+	case SGX_RESET_NEEDED:
+		return "SGX_RESET_NEEDED: impossible to determine the registration status; please reset the SGX"
+	case PLATFORM_REBOOT_NEEDED:
+		return "PLATFORM_REBOOT_NEEDED: platform registered successfully and a reboot is required"
+	case UEFI_PERSIST_FAILED:
+		return "UEFI_PERSIST_FAILED: failed to persist the UEFI variable content"
+	case PLATFORM_DIRECTLY_REGISTERED:
+		return "PLATFORM_DIRECTLY_REGISTERED: platform directly registered"
+	case INTEL_CONNECT_FAILED:
+		return "INTEL_CONNECT_FAILED: failed to connect to Intel RS"
+	case INVALID_REGISTRATION_REQUEST:
+		return "INVALID_REGISTRATION_REQUEST: invalid registration request"
+	case INTEL_RS_REQUEST_FAILED:
+		return "INTEL_RS_REQUEST_FAILED: intel RS could not process the request"
+	default:
+		return "UNKNOWN_ERROR"
+	}
+}
+
+type StatusCodeMetric struct {
+	Status         StatusCode
+	HttpStatusCode string
+	IntelError     string
+}
+
+type RegistrationServiceMetricsRegistry struct {
+	metrics map[string]prometheus.Collector
+	log     logrus.FieldLogger
+}
+
+func NewRegistrationServiceMetricsRegistry(logger logrus.FieldLogger) *RegistrationServiceMetricsRegistry {
+	return &RegistrationServiceMetricsRegistry{
+		metrics: map[string]prometheus.Collector{
+			SERVICE_STATUS_CODE_METRIC: promauto.NewGaugeVec(
+				prometheus.GaugeOpts{
+					Name: SERVICE_STATUS_CODE_METRIC,
+					Help: "Current status code of the registration service",
+				},
+				[]string{HTTP_STATUS_CODE_LABEL, INTEL_ERROR_CODE_LABEL},
+			),
+		},
+		log: logger,
+	}
+}
+
+// helper function to service status code to pending
+func (s *RegistrationServiceMetricsRegistry) SetServiceStatusCodeToPending() {
+	metric_value := StatusCodeMetric{
+		Status:         PENDING,
+		HttpStatusCode: "0",
+		IntelError:     "",
+	}
+	s.UpdateServiceStatusCodeMetric(metric_value)
path: pkg/metrics/metrics.go
user: login: dandax123
body: Addressed
created_at: 2025-02-10T12:23:18Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,109 @@
+package registration
+
+import (
+	"cc-intel-platform-registration/pkg/metrics"
+	"context"
+	"testing"
+	"time"
+
+	"github.com/sirupsen/logrus"
+	"github.com/sirupsen/logrus/hooks/test"
+	"github.com/stretchr/testify/assert"
+)
+
+type TestRegistrationChecker struct {
+	metricSteps []metrics.StatusCode
+	counter     int
+}
+
+func (rc *TestRegistrationChecker) Check() metrics.StatusCode {
+	if rc.counter == len(rc.metricSteps) {
+		rc.counter = 0
+	}
+	currentMetric := rc.metricSteps[rc.counter]
+	rc.counter++
+	return currentMetric
+}
+
+func TestRegistrationServiceRun(t *testing.T) {
+	logTest, logHook := test.NewNullLogger()
+	logTest.SetLevel(logrus.DebugLevel)
+	metricsRegistry := metrics.NewRegistrationServiceMetricsRegistry(logTest)
+	cases := []struct {
+		msg                string
+		metricSteps        []metrics.StatusCode
+		expectedLogEntries []logrus.Entry
+	}{
+		{
+			msg: "first case example",
+			metricSteps: []metrics.StatusCode{
+				metrics.PLATFORM_DIRECTLY_REGISTERED,
+				metrics.INTEL_CONNECT_FAILED,
+				metrics.RETRY_NEEDED,
+			},
+			expectedLogEntries: []logrus.Entry{
+				{
+					Level:   logrus.InfoLevel,
+					Message: "Status code metric updated - Code: 0, HTTP StatusCode: 0, Intel Error code: ",
+					Data: logrus.Fields{
+						metrics.SERVICE_STATUS_CODE_METRIC: metrics.PENDING,
+						metrics.HTTP_STATUS_CODE_LABEL:     "0",
+						metrics.INTEL_ERROR_CODE_LABEL:     "",
+					},
+				},
+				{
+					Level:   logrus.DebugLevel,
+					Message: "Registration check completed",
+					Data: logrus.Fields{
+						"status": metrics.PLATFORM_DIRECTLY_REGISTERED.String(),
+					},
+				},
+				{
+					Level:   logrus.DebugLevel,
+					Message: "Registration check completed",
+					Data: logrus.Fields{
+						"status": metrics.INTEL_CONNECT_FAILED.String(),
+					},
+				},
+				{
+					Level:   logrus.DebugLevel,
+					Message: "Registration check completed",
+					Data: logrus.Fields{
+						"status": metrics.RETRY_NEEDED.String(),
+					},
+				},
+			},
+		},
+	}
+	for _, c := range cases {
+		testRegistrationChecker := &TestRegistrationChecker{
+			metricSteps: c.metricSteps,
+		}
+
+		registrationService := &RegistrationService{
+			intervalDuration:    1 * time.Millisecond,
+			serverMetrics:       metricsRegistry,
+			registrationChecker: testRegistrationChecker,
+			log:                 logTest,
+		}
+
+		testContext, cancelFunc := context.WithTimeout(context.TODO(), 100*time.Millisecond)
+		defer cancelFunc()
+		registrationService.Run(testContext)
path: pkg/registration/registration_test.go
user: login: dandax123
body: Addressed
created_at: 2025-02-10T12:23:22Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,114 @@
+package cmd
+
+import (
+	"context"
+	"fmt"
+	"net/http"
+	"os"
+	"strconv"
+	"time"
+
+	"cc-intel-platform-registration/pkg/constants"
+	"cc-intel-platform-registration/pkg/registration"
+
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	log "github.com/sirupsen/logrus"
+	"github.com/spf13/cobra"
+)
+
+func GetRegistrationServiceIntervalTime() time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			log.Fatalf("Failed to parse %s: %v. Using default value: %d",
+				constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV,
+				err, constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES)
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		log.Infof("%s not set. Using default value: %d",
+			constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV,
+			constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES)
+	}
+	return time.Duration(interval)
+}
+
+// setLogConfig sets the log config.
+func setLogConfig(cmd *cobra.Command, args []string) {
+	logLevelFlag, err := cmd.Flags().GetString(constants.LOG_LEVEL_FLAG)
+	if err != nil {
+		log.Fatalf("internal error: unable to get %s flag", constants.LOG_LEVEL_FLAG)
+	}
+
+	if logLevelFlag != "" {
+		if logLevel, err := log.ParseLevel(logLevelFlag); err == nil {
+			log.SetLevel(logLevel)
+		} else {
+			log.Fatalf("unable to set log level using %s flag: %s", constants.LOG_LEVEL_FLAG, err)
+		}
+	} else {
+		logLevelEnv := os.Getenv(constants.LOG_LEVEL_ENV)
+		if logLevelEnv != "" {
+			if logLevel, err := log.ParseLevel(logLevelEnv); err == nil {
+				log.SetLevel(logLevel)
+			} else {
+				log.Fatalf("unable to set log level from %s env: %s", constants.LOG_LEVEL_ENV, err)
+			}
+		}
+	}
+	log.Debug("log level set to ", log.GetLevel())
+}
+
+func StartCmdFunc(cmd *cobra.Command, args []string) {
+	// logrus.SetLevel(logrus.DebugLevel)
+	intervalDuration := GetRegistrationServiceIntervalTime()
+	registrationService := registration.NewRegistrationService(intervalDuration)
+	ctx, cancelFunc := context.WithCancel(context.TODO())
+	defer cancelFunc()
+
+	go registrationService.Run(ctx)
path: cmd/cli.go
user: login: dandax123
body: Addressed
created_at: 2025-02-10T12:23:27Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,54 @@
+# Go parameters
+GOCMD=go
+GOBUILD=$(GOCMD) build
+GOTEST=$(GOCMD) test
+GOGET=$(GOCMD) get
+GOMOD=$(GOCMD) mod
+GOPATH=$(shell go env GOPATH)
+GOBIN=$(GOPATH)/bin
path: Makefile
user: login: lukas016
body: this is wrong path
created_at: 2025-02-10T21:28:31Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,54 @@
+# Go parameters
+GOCMD=go
+GOBUILD=$(GOCMD) build
+GOTEST=$(GOCMD) test
+GOGET=$(GOCMD) get
+GOMOD=$(GOCMD) mod
+GOPATH=$(shell go env GOPATH)
+GOBIN=$(GOPATH)/bin
+
+
+BINARY_NAME=cc-intel-platform-registration
+
+# Tools
+GOLANGCI_LINT=$(GOBIN)/golangci-lint
+STATICCHECK=$(GOBIN)/staticcheck
+STATICCHECK_VERSION=2023.1.7
+GOLANGCI_LINT_VERSION=v1.63.4
+
+GOVULNCHECK=$(GOCMD) run golang.org/x/vuln/cmd/govulncheck@latest
+
+.PHONY: all build test clean deps lint security-check check
+
+all: check build
+
+build:
+	$(GOBUILD) -o $(BINARY_NAME) -v
+
+test:
+	$(GOTEST) -v ./...
+
+clean:
+	$(GOCMD) clean
+	rm -f $(BINARY_NAME)
+
+deps:
+	$(GOMOD) download
+	$(GOMOD) tidy
+	$(GOCMD) install honnef.co/go/tools/cmd/staticcheck@$(STATICCHECK_VERSION)
+	curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin $(GOLANGCI_LINT_VERSION)
path: Makefile
user: login: lukas016
body: this can be do more elegant. please look on kubebuilder project.
created_at: 2025-02-10T21:29:09Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,54 @@
+# Go parameters
+GOCMD=go
+GOBUILD=$(GOCMD) build
+GOTEST=$(GOCMD) test
+GOGET=$(GOCMD) get
+GOMOD=$(GOCMD) mod
+GOPATH=$(shell go env GOPATH)
+GOBIN=$(GOPATH)/bin
+
+
+BINARY_NAME=cc-intel-platform-registration
+
+# Tools
+GOLANGCI_LINT=$(GOBIN)/golangci-lint
+STATICCHECK=$(GOBIN)/staticcheck
+STATICCHECK_VERSION=2023.1.7
+GOLANGCI_LINT_VERSION=v1.63.4
+
+GOVULNCHECK=$(GOCMD) run golang.org/x/vuln/cmd/govulncheck@latest
+
+.PHONY: all build test clean deps lint security-check check
+
+all: check build
+
+build:
+	$(GOBUILD) -o $(BINARY_NAME) -v
+
+test:
+	$(GOTEST) -v ./...
+
+clean:
+	$(GOCMD) clean
+	rm -f $(BINARY_NAME)
+
+deps:
+	$(GOMOD) download
+	$(GOMOD) tidy
+	$(GOCMD) install honnef.co/go/tools/cmd/staticcheck@$(STATICCHECK_VERSION)
+	curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin $(GOLANGCI_LINT_VERSION)
+
+lint:
path: Makefile
user: login: lukas016
body: pls check kubebuilder makefile too how to setup target properly and automatize installation of dependencies
created_at: 2025-02-10T21:31:05Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,113 @@
+package registration
+
+import (
+	"cc-intel-platform-registration/pkg/metrics"
path: pkg/registration/registration_test.go
user: login: lukas016
body: this doesn't look as proper import path. where is github.com?
created_at: 2025-02-10T21:36:36Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,32 @@
+module cc-intel-platform-registration
path: go.mod
user: login: lukas016
body: this doesn't look as proper module. module has to be ideally whole url. This cannot be imported into another projects
created_at: 2025-02-10T21:37:23Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,123 @@
+package cmd
+
+import (
+	"context"
+	"fmt"
+	"net/http"
+	"os"
+	"strconv"
+	"time"
+
+	"cc-intel-platform-registration/pkg/constants"
+	"cc-intel-platform-registration/pkg/registration"
+
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	log "github.com/sirupsen/logrus"
+	"github.com/spf13/cobra"
+	"golang.org/x/sync/errgroup"
+)
+
+func GetRegistrationServiceIntervalTime() time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			log.Fatalf("Failed to parse %s: %v. Using default value: %d",
+				constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV,
+				err, constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES)
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		log.Infof("%s not set. Using default value: %d",
+			constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV,
+			constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES)
+	}
+	return time.Duration(interval)
+}
+
+// setLogConfig sets the log config.
+func setLogConfig(cmd *cobra.Command, args []string) {
+	logLevelFlag, err := cmd.Flags().GetString(constants.LOG_LEVEL_FLAG)
+	if err != nil {
+		log.Fatalf("internal error: unable to get %s flag", constants.LOG_LEVEL_FLAG)
path: cmd/cli.go
user: login: lukas016
body: using Fatal is very dangerous because it ignore defer. You shouldn't use them.
created_at: 2025-02-10T21:39:13Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,123 @@
+package cmd
+
+import (
+	"context"
+	"fmt"
+	"net/http"
+	"os"
+	"strconv"
+	"time"
+
+	"cc-intel-platform-registration/pkg/constants"
+	"cc-intel-platform-registration/pkg/registration"
+
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	log "github.com/sirupsen/logrus"
path: cmd/cli.go
user: login: lukas016
body: if this project is part of OSC. I don't want to see logrus. We are using zapr in operators so pls use ideally zap in this project to keep configuration and logging format of our application similar.
created_at: 2025-02-10T21:40:44Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,123 @@
+package cmd
path: cmd/cli.go
user: login: lukas016
body: this package doesn't make sense. cmd in standard project has different purpose https://github.com/golang-standards/project-layout?tab=readme-ov-file#cmd and a lot of another golang applications use it differently.
If you don't want to overcomplicated folder structure with standard project layout, it will be enough move cli.go outside from cmd folder and cmd folder can be deleted.
created_at: 2025-02-10T21:43:20Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,54 @@
+# Go parameters
+GOCMD=go
+GOBUILD=$(GOCMD) build
+GOTEST=$(GOCMD) test
+GOGET=$(GOCMD) get
+GOMOD=$(GOCMD) mod
+GOPATH=$(shell go env GOPATH)
+GOBIN=$(GOPATH)/bin
path: Makefile
user: login: SilvaMatteus
body: Hi @lukas016,

Do you have a suggestion of a better path?
created_at: 2025-02-11T10:55:57Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,54 @@
+# Go parameters
+GOCMD=go
+GOBUILD=$(GOCMD) build
+GOTEST=$(GOCMD) test
+GOGET=$(GOCMD) get
+GOMOD=$(GOCMD) mod
+GOPATH=$(shell go env GOPATH)
+GOBIN=$(GOPATH)/bin
path: Makefile
user: login: lukas016
body: use subfolder in project repo. This solution won't override binaries from different repos.
created_at: 2025-02-12T13:40:47Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,54 @@
+# Go parameters
+GOCMD=go
+GOBUILD=$(GOCMD) build
+GOTEST=$(GOCMD) test
+GOGET=$(GOCMD) get
+GOMOD=$(GOCMD) mod
+GOPATH=$(shell go env GOPATH)
+GOBIN=$(GOPATH)/bin
+
+
+BINARY_NAME=cc-intel-platform-registration
+
+# Tools
+GOLANGCI_LINT=$(GOBIN)/golangci-lint
+STATICCHECK=$(GOBIN)/staticcheck
+STATICCHECK_VERSION=2023.1.7
+GOLANGCI_LINT_VERSION=v1.63.4
+
+GOVULNCHECK=$(GOCMD) run golang.org/x/vuln/cmd/govulncheck@latest
+
+.PHONY: all build test clean deps lint security-check check
+
+all: check build
+
+build:
+	$(GOBUILD) -o $(BINARY_NAME) -v
+
+test:
+	$(GOTEST) -v ./...
+
+clean:
+	$(GOCMD) clean
+	rm -f $(BINARY_NAME)
+
+deps:
+	$(GOMOD) download
+	$(GOMOD) tidy
+	$(GOCMD) install honnef.co/go/tools/cmd/staticcheck@$(STATICCHECK_VERSION)
+	curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin $(GOLANGCI_LINT_VERSION)
+
+lint:
path: Makefile
user: login: dandax123
body: Addressed
created_at: 2025-02-13T14:08:49Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,113 @@
+package registration
+
+import (
+	"cc-intel-platform-registration/pkg/metrics"
path: pkg/registration/registration_test.go
user: login: dandax123
body: Addressed
created_at: 2025-02-13T14:08:56Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,32 @@
+module cc-intel-platform-registration
path: go.mod
user: login: dandax123
body: Addressed
created_at: 2025-02-13T14:09:02Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,123 @@
+package cmd
+
+import (
+	"context"
+	"fmt"
+	"net/http"
+	"os"
+	"strconv"
+	"time"
+
+	"cc-intel-platform-registration/pkg/constants"
+	"cc-intel-platform-registration/pkg/registration"
+
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	log "github.com/sirupsen/logrus"
+	"github.com/spf13/cobra"
+	"golang.org/x/sync/errgroup"
+)
+
+func GetRegistrationServiceIntervalTime() time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			log.Fatalf("Failed to parse %s: %v. Using default value: %d",
+				constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV,
+				err, constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES)
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		log.Infof("%s not set. Using default value: %d",
+			constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV,
+			constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES)
+	}
+	return time.Duration(interval)
+}
+
+// setLogConfig sets the log config.
+func setLogConfig(cmd *cobra.Command, args []string) {
+	logLevelFlag, err := cmd.Flags().GetString(constants.LOG_LEVEL_FLAG)
+	if err != nil {
+		log.Fatalf("internal error: unable to get %s flag", constants.LOG_LEVEL_FLAG)
path: cmd/cli.go
user: login: dandax123
body: Addressed
created_at: 2025-02-13T14:09:07Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,123 @@
+package cmd
+
+import (
+	"context"
+	"fmt"
+	"net/http"
+	"os"
+	"strconv"
+	"time"
+
+	"cc-intel-platform-registration/pkg/constants"
+	"cc-intel-platform-registration/pkg/registration"
+
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	log "github.com/sirupsen/logrus"
path: cmd/cli.go
user: login: dandax123
body: Addressed
created_at: 2025-02-13T14:09:19Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,123 @@
+package cmd
path: cmd/cli.go
user: login: dandax123
body: Addressed
created_at: 2025-02-13T14:09:25Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,65 @@
+# Go parameters
+GOCMD=go
+GOBUILD=$(GOCMD) build
+GOTEST=$(GOCMD) test
+GOGET=$(GOCMD) get
+GOMOD=$(GOCMD) mod
+GOPATH=$(shell go env GOPATH)
+
+ifeq (,$(shell go env GOBIN))
+GOBIN=$(shell go env GOPATH)/bin
+else
+GOBIN=$(shell go env GOBIN)
+endif
+
+
+BINARY_NAME=cc-intel-platform-registration
+
+# Tools
+GOLANGCI_LINT_VERSION=v1.63.4
+
+GOVULNCHECK=$(GOCMD) run golang.org/x/vuln/cmd/govulncheck@latest
+
+.PHONY: all build test clean deps lint security-check check
+
+all: check build
+
+build:
+	$(GOBUILD) -o $(BINARY_NAME) -v
+
+test:
+	$(GOTEST) -v ./...
+
+clean:
+	$(GOCMD) clean
+	rm -f $(BINARY_NAME)
+
+deps:
+	$(GOMOD) download
+	$(GOMOD) tidy
+
+.PHONY: lint
+lint: golangci-lint 
+	$(GOLANGCI_LINT) run ./...
+	$(GOCMD) vet ./...
+
+GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
+golangci-lint:
+	@[ -f $(GOLANGCI_LINT) ] || { \
path: Makefile
user: login: lukas016
body: this way of installation still isn't good. Pls copy solution from kubebuilder. Here you will have issue with managing of linter version in Makefile.
created_at: 2025-02-19T12:59:59Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,123 @@
+package cmd
+
+import (
+	"context"
+	"fmt"
+	"net/http"
+	"os"
+	"strconv"
+	"time"
+
+	"cc-intel-platform-registration/pkg/constants"
+	"cc-intel-platform-registration/pkg/registration"
+
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	log "github.com/sirupsen/logrus"
path: cmd/cli.go
user: login: lukas016
body: it is better but i think you didn't understand me. Can we have call and we can discuss how to do it best for both side.
created_at: 2025-02-19T13:02:41Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,123 @@
+package cmd
+
+import (
+	"context"
+	"fmt"
+	"net/http"
+	"os"
+	"strconv"
+	"time"
+
+	"cc-intel-platform-registration/pkg/constants"
+	"cc-intel-platform-registration/pkg/registration"
+
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	log "github.com/sirupsen/logrus"
path: cmd/cli.go
user: login: dandax123
body: sure, we can. Do you have some slots today ?
created_at: 2025-02-20T11:25:05Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,65 @@
+# Go parameters
+GOCMD=go
+GOBUILD=$(GOCMD) build
+GOTEST=$(GOCMD) test
+GOGET=$(GOCMD) get
+GOMOD=$(GOCMD) mod
+GOPATH=$(shell go env GOPATH)
+
+ifeq (,$(shell go env GOBIN))
+GOBIN=$(shell go env GOPATH)/bin
+else
+GOBIN=$(shell go env GOBIN)
+endif
+
+
+BINARY_NAME=cc-intel-platform-registration
+
+# Tools
+GOLANGCI_LINT_VERSION=v1.63.4
+
+GOVULNCHECK=$(GOCMD) run golang.org/x/vuln/cmd/govulncheck@latest
+
+.PHONY: all build test clean deps lint security-check check
+
+all: check build
+
+build:
+	$(GOBUILD) -o $(BINARY_NAME) -v
+
+test:
+	$(GOTEST) -v ./...
+
+clean:
+	$(GOCMD) clean
+	rm -f $(BINARY_NAME)
+
+deps:
+	$(GOMOD) download
+	$(GOMOD) tidy
+
+.PHONY: lint
+lint: golangci-lint 
+	$(GOLANGCI_LINT) run ./...
+	$(GOCMD) vet ./...
+
+GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
+golangci-lint:
+	@[ -f $(GOLANGCI_LINT) ] || { \
path: Makefile
user: login: dandax123
body: Addressed. I did use the kubebuilder makefile example
created_at: 2025-02-20T11:30:57Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,155 @@
+package metrics
+
+import (
+	"fmt"
+	"log/slog"
+
+	"github.com/prometheus/client_golang/prometheus"
+	"github.com/prometheus/client_golang/prometheus/promauto"
+)
+
+const (
+	// metrics definitions
+	SERVICE_STATUS_CODE_METRIC = "service_status_code"
+
+	// label definitions
+	HTTP_STATUS_CODE_LABEL = "http_status_code"
+	INTEL_ERROR_CODE_LABEL = "intel_error_code"
+)
+
+// Define a custom type for status codes
+type StatusCode int
+
+type StatusCodeDetails struct {
+	RequiresHTTPStatusCode bool
+	AllowsIntelErrCode     bool
+}
+
+const (
+	PENDING                      StatusCode = iota // 0
+	SGX_UEFI_UNAVAILABLE         StatusCode = 1
+	RETRY_NEEDED                 StatusCode = 2
+	SGX_RESET_NEEDED             StatusCode = 3
+	UEFI_PERSIST_FAILED          StatusCode = 4
+	PLATFORM_REBOOT_NEEDED       StatusCode = 5
+	PLATFORM_DIRECTLY_REGISTERED StatusCode = 9
+	INTEL_CONNECT_FAILED         StatusCode = 10
+	INVALID_REGISTRATION_REQUEST StatusCode = 11
+	INTEL_RS_REQUEST_FAILED      StatusCode = 12
+	UNKNOWN_ERROR                StatusCode = 99
+)
+
+func (s StatusCode) GetDetails() StatusCodeDetails {
+	switch s {
+	case INVALID_REGISTRATION_REQUEST, INTEL_RS_REQUEST_FAILED, SGX_RESET_NEEDED:
+		return StatusCodeDetails{
+			RequiresHTTPStatusCode: true,
+			AllowsIntelErrCode:     false,
+		}
+	default:
+		return StatusCodeDetails{
+			RequiresHTTPStatusCode: false,
+			AllowsIntelErrCode:     false,
+		}
+	}
+
+}
+
+func (s StatusCode) toInt() int {
+	return int(s)
+}
+
+// Add a String() method for easy conversion to string
+func (s StatusCode) String() string {
+	switch s {
+	case PENDING:
+		return "PENDING: pending execution"
+	case SGX_UEFI_UNAVAILABLE:
+		return "SGX_UEFI_UNAVAILABLE: SGX UEFI variables not available"
+	case RETRY_NEEDED:
+		return "RETRY_NEEDED: impossible to determine the registration status; please reattempt"
+	case SGX_RESET_NEEDED:
+		return "SGX_RESET_NEEDED: impossible to determine the registration status; please reset the SGX"
+	case PLATFORM_REBOOT_NEEDED:
+		return "PLATFORM_REBOOT_NEEDED: platform registered successfully and a reboot is required"
+	case UEFI_PERSIST_FAILED:
+		return "UEFI_PERSIST_FAILED: failed to persist the UEFI variable content"
+	case PLATFORM_DIRECTLY_REGISTERED:
+		return "PLATFORM_DIRECTLY_REGISTERED: platform directly registered"
+	case INTEL_CONNECT_FAILED:
+		return "INTEL_CONNECT_FAILED: failed to connect to Intel RS"
+	case INVALID_REGISTRATION_REQUEST:
+		return "INVALID_REGISTRATION_REQUEST: invalid registration request"
+	case INTEL_RS_REQUEST_FAILED:
+		return "INTEL_RS_REQUEST_FAILED: intel RS could not process the request"
+	default:
+		return "UNKNOWN_ERROR"
+	}
+}
+
+type StatusCodeMetric struct {
+	Status         StatusCode
+	HttpStatusCode string
+	IntelError     string
+}
+
+type RegistrationServiceMetricsRegistry struct {
+	metrics map[string]prometheus.Collector
+	log     *slog.Logger
+}
+
+func NewRegistrationServiceMetricsRegistry(logger *slog.Logger) *RegistrationServiceMetricsRegistry {
+	return &RegistrationServiceMetricsRegistry{
+		metrics: map[string]prometheus.Collector{
+			SERVICE_STATUS_CODE_METRIC: promauto.NewGaugeVec(
path: pkg/metrics/metrics.go
user: login: lukas016
body: we need to create follow up issue for simplify creating of metrics.
created_at: 2025-02-27T14:02:35Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,123 @@
+package cmd
+
+import (
+	"context"
+	"fmt"
+	"net/http"
+	"os"
+	"strconv"
+	"time"
+
+	"cc-intel-platform-registration/pkg/constants"
+	"cc-intel-platform-registration/pkg/registration"
+
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	log "github.com/sirupsen/logrus"
path: cmd/cli.go
user: login: dandax123
body: Addressed
created_at: 2025-03-03T20:03:27Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,155 @@
+package metrics
+
+import (
+	"fmt"
+	"log/slog"
+
+	"github.com/prometheus/client_golang/prometheus"
+	"github.com/prometheus/client_golang/prometheus/promauto"
+)
+
+const (
+	// metrics definitions
+	SERVICE_STATUS_CODE_METRIC = "service_status_code"
+
+	// label definitions
+	HTTP_STATUS_CODE_LABEL = "http_status_code"
+	INTEL_ERROR_CODE_LABEL = "intel_error_code"
+)
+
+// Define a custom type for status codes
+type StatusCode int
+
+type StatusCodeDetails struct {
+	RequiresHTTPStatusCode bool
+	AllowsIntelErrCode     bool
+}
+
+const (
+	PENDING                      StatusCode = iota // 0
+	SGX_UEFI_UNAVAILABLE         StatusCode = 1
+	RETRY_NEEDED                 StatusCode = 2
+	SGX_RESET_NEEDED             StatusCode = 3
+	UEFI_PERSIST_FAILED          StatusCode = 4
+	PLATFORM_REBOOT_NEEDED       StatusCode = 5
+	PLATFORM_DIRECTLY_REGISTERED StatusCode = 9
+	INTEL_CONNECT_FAILED         StatusCode = 10
+	INVALID_REGISTRATION_REQUEST StatusCode = 11
+	INTEL_RS_REQUEST_FAILED      StatusCode = 12
+	UNKNOWN_ERROR                StatusCode = 99
+)
+
+func (s StatusCode) GetDetails() StatusCodeDetails {
+	switch s {
+	case INVALID_REGISTRATION_REQUEST, INTEL_RS_REQUEST_FAILED, SGX_RESET_NEEDED:
+		return StatusCodeDetails{
+			RequiresHTTPStatusCode: true,
+			AllowsIntelErrCode:     false,
+		}
+	default:
+		return StatusCodeDetails{
+			RequiresHTTPStatusCode: false,
+			AllowsIntelErrCode:     false,
+		}
+	}
+
+}
+
+func (s StatusCode) toInt() int {
+	return int(s)
+}
+
+// Add a String() method for easy conversion to string
+func (s StatusCode) String() string {
+	switch s {
+	case PENDING:
+		return "PENDING: pending execution"
+	case SGX_UEFI_UNAVAILABLE:
+		return "SGX_UEFI_UNAVAILABLE: SGX UEFI variables not available"
+	case RETRY_NEEDED:
+		return "RETRY_NEEDED: impossible to determine the registration status; please reattempt"
+	case SGX_RESET_NEEDED:
+		return "SGX_RESET_NEEDED: impossible to determine the registration status; please reset the SGX"
+	case PLATFORM_REBOOT_NEEDED:
+		return "PLATFORM_REBOOT_NEEDED: platform registered successfully and a reboot is required"
+	case UEFI_PERSIST_FAILED:
+		return "UEFI_PERSIST_FAILED: failed to persist the UEFI variable content"
+	case PLATFORM_DIRECTLY_REGISTERED:
+		return "PLATFORM_DIRECTLY_REGISTERED: platform directly registered"
+	case INTEL_CONNECT_FAILED:
+		return "INTEL_CONNECT_FAILED: failed to connect to Intel RS"
+	case INVALID_REGISTRATION_REQUEST:
+		return "INVALID_REGISTRATION_REQUEST: invalid registration request"
+	case INTEL_RS_REQUEST_FAILED:
+		return "INTEL_RS_REQUEST_FAILED: intel RS could not process the request"
+	default:
+		return "UNKNOWN_ERROR"
+	}
+}
+
+type StatusCodeMetric struct {
+	Status         StatusCode
+	HttpStatusCode string
+	IntelError     string
+}
+
+type RegistrationServiceMetricsRegistry struct {
+	metrics map[string]prometheus.Collector
+	log     *slog.Logger
+}
+
+func NewRegistrationServiceMetricsRegistry(logger *slog.Logger) *RegistrationServiceMetricsRegistry {
+	return &RegistrationServiceMetricsRegistry{
+		metrics: map[string]prometheus.Collector{
+			SERVICE_STATUS_CODE_METRIC: promauto.NewGaugeVec(
path: pkg/metrics/metrics.go
user: login: dandax123
body: Addressed
created_at: 2025-03-03T20:03:32Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
path: main.go
user: login: lukas016
body: pls create follow up issue for follow styleguide: https://google.github.io/styleguide/go/decisions.html#error-strings
created_at: 2025-03-04T10:07:06Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
path: main.go
user: login: lukas016
body: do you need logr and slog? cannot you use just logger?
created_at: 2025-03-04T10:07:59Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
+}
+
+// runService starts the registration service and HTTP server
+func runService(ctx context.Context, logger *slog.Logger) error {
+	// Log application startup information
+	logger.Info("Application starting",
+		slog.String("app", AppName),
+		slog.String("version", Version),
+		slog.String("buildDate", BuildDate))
+
+	intervalDuration := GetRegistrationServiceIntervalTime(logger)
+	registrationService := registration.NewRegistrationService(logger, intervalDuration)
+
+	// Create a context with cancel function for shutdown
+	ctx, cancelFunc := context.WithCancel(ctx)
+	g, ctx := errgroup.WithContext(ctx)
+
+	// Set up signal handling for graceful shutdown
+	signalChan := make(chan os.Signal, 1)
+	signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
path: main.go
user: login: lukas016
body: optional: you can use https://pkg.go.dev/os/signal#NotifyContext with context. In this case you don't need extra goroutines for handling signals.
created_at: 2025-03-04T10:11:04Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
path: main.go
user: login: lukas016
body: what output is used here for logs? it is stdout or stderr?
created_at: 2025-03-04T10:13:57Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
path: main.go
user: login: dandax123
body: stderr
created_at: 2025-03-04T10:14:31Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
+}
+
+// runService starts the registration service and HTTP server
+func runService(ctx context.Context, logger *slog.Logger) error {
+	// Log application startup information
+	logger.Info("Application starting",
+		slog.String("app", AppName),
+		slog.String("version", Version),
+		slog.String("buildDate", BuildDate))
+
+	intervalDuration := GetRegistrationServiceIntervalTime(logger)
+	registrationService := registration.NewRegistrationService(logger, intervalDuration)
+
+	// Create a context with cancel function for shutdown
+	ctx, cancelFunc := context.WithCancel(ctx)
+	g, ctx := errgroup.WithContext(ctx)
+
+	// Set up signal handling for graceful shutdown
+	signalChan := make(chan os.Signal, 1)
+	signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
+
+	// Start signal handler goroutine
+	g.Go(func() error {
+		select {
+		case sig := <-signalChan:
+			logger.Info("Received shutdown signal", slog.String("signal", sig.String()))
+			cancelFunc()
+			return nil
+		case <-ctx.Done():
+			return ctx.Err()
+		}
+	})
+
+	// Start the registration service
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in registration service", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		return registrationService.Run(ctx)
+	})
+
+	// Setup HTTP server
+	mux := http.NewServeMux()
+	mux.Handle("/metrics", promhttp.Handler())
+	mux.HandleFunc("/live", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is healthy")
+	})
+	mux.HandleFunc("/ready", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is ready")
+	})
+
+	// Create server with timeout configuration
+	server := &http.Server{
+		Addr:    ":8080",
+		Handler: mux,
+	}
+
+	// Start the HTTP server in a goroutine
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
path: main.go
user: login: lukas016
body: i don't think this is good place for recovery handler. You should use instead of this recovery middleware. Current solution won't kill application but http server can be killed. It means one wrong request can kill whole http server what is correct. If you use middleware, panic will handle for specific request only and it won't afffect another requests/server
created_at: 2025-03-04T10:16:29Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
+}
+
+// runService starts the registration service and HTTP server
+func runService(ctx context.Context, logger *slog.Logger) error {
+	// Log application startup information
+	logger.Info("Application starting",
+		slog.String("app", AppName),
+		slog.String("version", Version),
+		slog.String("buildDate", BuildDate))
+
+	intervalDuration := GetRegistrationServiceIntervalTime(logger)
+	registrationService := registration.NewRegistrationService(logger, intervalDuration)
+
+	// Create a context with cancel function for shutdown
+	ctx, cancelFunc := context.WithCancel(ctx)
+	g, ctx := errgroup.WithContext(ctx)
+
+	// Set up signal handling for graceful shutdown
+	signalChan := make(chan os.Signal, 1)
+	signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
+
+	// Start signal handler goroutine
+	g.Go(func() error {
+		select {
+		case sig := <-signalChan:
+			logger.Info("Received shutdown signal", slog.String("signal", sig.String()))
+			cancelFunc()
+			return nil
+		case <-ctx.Done():
+			return ctx.Err()
+		}
+	})
+
+	// Start the registration service
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in registration service", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		return registrationService.Run(ctx)
+	})
+
+	// Setup HTTP server
+	mux := http.NewServeMux()
+	mux.Handle("/metrics", promhttp.Handler())
+	mux.HandleFunc("/live", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is healthy")
+	})
+	mux.HandleFunc("/ready", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is ready")
+	})
+
+	// Create server with timeout configuration
+	server := &http.Server{
+		Addr:    ":8080",
+		Handler: mux,
+	}
+
+	// Start the HTTP server in a goroutine
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in HTTP server", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		logger.Info("Starting HTTP server",
+			slog.String("address", server.Addr),
+			slog.Int("intervalMinutes", int(intervalDuration.Minutes())))
+
+		err := server.ListenAndServe()
+		if err != nil && err != http.ErrServerClosed {
path: main.go
user: login: lukas016
body: this isn't very secure way how to check type of error. Much better solution is use errors.Is(err, http.ErrServerClosed).
created_at: 2025-03-04T10:17:14Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
+}
+
+// runService starts the registration service and HTTP server
+func runService(ctx context.Context, logger *slog.Logger) error {
+	// Log application startup information
+	logger.Info("Application starting",
+		slog.String("app", AppName),
+		slog.String("version", Version),
+		slog.String("buildDate", BuildDate))
+
+	intervalDuration := GetRegistrationServiceIntervalTime(logger)
+	registrationService := registration.NewRegistrationService(logger, intervalDuration)
+
+	// Create a context with cancel function for shutdown
+	ctx, cancelFunc := context.WithCancel(ctx)
+	g, ctx := errgroup.WithContext(ctx)
+
+	// Set up signal handling for graceful shutdown
+	signalChan := make(chan os.Signal, 1)
+	signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
+
+	// Start signal handler goroutine
+	g.Go(func() error {
+		select {
+		case sig := <-signalChan:
+			logger.Info("Received shutdown signal", slog.String("signal", sig.String()))
+			cancelFunc()
+			return nil
+		case <-ctx.Done():
+			return ctx.Err()
+		}
+	})
+
+	// Start the registration service
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in registration service", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		return registrationService.Run(ctx)
+	})
+
+	// Setup HTTP server
+	mux := http.NewServeMux()
+	mux.Handle("/metrics", promhttp.Handler())
+	mux.HandleFunc("/live", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is healthy")
+	})
+	mux.HandleFunc("/ready", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is ready")
+	})
+
+	// Create server with timeout configuration
+	server := &http.Server{
+		Addr:    ":8080",
+		Handler: mux,
+	}
+
+	// Start the HTTP server in a goroutine
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in HTTP server", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		logger.Info("Starting HTTP server",
+			slog.String("address", server.Addr),
+			slog.Int("intervalMinutes", int(intervalDuration.Minutes())))
+
+		err := server.ListenAndServe()
+		if err != nil && err != http.ErrServerClosed {
+			logger.Error("HTTP server failed", slog.String("err", err.Error()))
+			return err
+		}
+		return nil
+	})
+
+	// Add server shutdown handler
+	g.Go(func() error {
+		<-ctx.Done()
+		logger.Info("Shutting down HTTP server")
+
+		// Create a timeout context for shutdown
+		shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 15*time.Second)
+		defer shutdownCancel()
+
+		if err := server.Shutdown(shutdownCtx); err != nil {
+			logger.Error("HTTP server shutdown error", slog.String("err", err.Error()))
+			return err
+		}
+
+		logger.Info("HTTP server shutdown completed")
+		return nil
+	})
+
+	// Wait for all goroutines to complete
+	err := g.Wait()
+	if err != nil && err != context.Canceled {
path: main.go
user: login: lukas016
body: errors.Is is much better.
created_at: 2025-03-04T10:17:44Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
+}
+
+// runService starts the registration service and HTTP server
+func runService(ctx context.Context, logger *slog.Logger) error {
+	// Log application startup information
+	logger.Info("Application starting",
+		slog.String("app", AppName),
+		slog.String("version", Version),
+		slog.String("buildDate", BuildDate))
+
+	intervalDuration := GetRegistrationServiceIntervalTime(logger)
+	registrationService := registration.NewRegistrationService(logger, intervalDuration)
+
+	// Create a context with cancel function for shutdown
+	ctx, cancelFunc := context.WithCancel(ctx)
+	g, ctx := errgroup.WithContext(ctx)
+
+	// Set up signal handling for graceful shutdown
+	signalChan := make(chan os.Signal, 1)
+	signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
+
+	// Start signal handler goroutine
+	g.Go(func() error {
+		select {
+		case sig := <-signalChan:
+			logger.Info("Received shutdown signal", slog.String("signal", sig.String()))
+			cancelFunc()
+			return nil
+		case <-ctx.Done():
+			return ctx.Err()
+		}
+	})
+
+	// Start the registration service
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in registration service", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		return registrationService.Run(ctx)
+	})
+
+	// Setup HTTP server
+	mux := http.NewServeMux()
+	mux.Handle("/metrics", promhttp.Handler())
+	mux.HandleFunc("/live", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is healthy")
+	})
+	mux.HandleFunc("/ready", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is ready")
+	})
+
+	// Create server with timeout configuration
+	server := &http.Server{
+		Addr:    ":8080",
path: main.go
user: login: lukas016
body: this should be configurable. It can be problematic use this software with another application in the same pod.
created_at: 2025-03-04T10:24:42Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
+}
+
+// runService starts the registration service and HTTP server
+func runService(ctx context.Context, logger *slog.Logger) error {
+	// Log application startup information
+	logger.Info("Application starting",
+		slog.String("app", AppName),
+		slog.String("version", Version),
+		slog.String("buildDate", BuildDate))
+
+	intervalDuration := GetRegistrationServiceIntervalTime(logger)
+	registrationService := registration.NewRegistrationService(logger, intervalDuration)
+
+	// Create a context with cancel function for shutdown
+	ctx, cancelFunc := context.WithCancel(ctx)
+	g, ctx := errgroup.WithContext(ctx)
+
+	// Set up signal handling for graceful shutdown
+	signalChan := make(chan os.Signal, 1)
+	signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
+
+	// Start signal handler goroutine
+	g.Go(func() error {
+		select {
+		case sig := <-signalChan:
+			logger.Info("Received shutdown signal", slog.String("signal", sig.String()))
+			cancelFunc()
+			return nil
+		case <-ctx.Done():
+			return ctx.Err()
+		}
+	})
+
+	// Start the registration service
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in registration service", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		return registrationService.Run(ctx)
+	})
+
+	// Setup HTTP server
+	mux := http.NewServeMux()
+	mux.Handle("/metrics", promhttp.Handler())
+	mux.HandleFunc("/live", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is healthy")
+	})
+	mux.HandleFunc("/ready", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is ready")
+	})
+
+	// Create server with timeout configuration
+	server := &http.Server{
+		Addr:    ":8080",
+		Handler: mux,
+	}
+
+	// Start the HTTP server in a goroutine
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in HTTP server", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		logger.Info("Starting HTTP server",
+			slog.String("address", server.Addr),
+			slog.Int("intervalMinutes", int(intervalDuration.Minutes())))
+
+		err := server.ListenAndServe()
+		if err != nil && err != http.ErrServerClosed {
+			logger.Error("HTTP server failed", slog.String("err", err.Error()))
+			return err
+		}
+		return nil
+	})
+
+	// Add server shutdown handler
+	g.Go(func() error {
+		<-ctx.Done()
+		logger.Info("Shutting down HTTP server")
+
+		// Create a timeout context for shutdown
+		shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 15*time.Second)
+		defer shutdownCancel()
+
+		if err := server.Shutdown(shutdownCtx); err != nil {
+			logger.Error("HTTP server shutdown error", slog.String("err", err.Error()))
+			return err
+		}
+
+		logger.Info("HTTP server shutdown completed")
+		return nil
+	})
+
+	// Wait for all goroutines to complete
+	err := g.Wait()
+	if err != nil && err != context.Canceled {
+		logger.Error("Service error", slog.String("err", err.Error()))
+		return err
+	}
+
+	logger.Info("Service shutdown complete")
+	return nil
+}
+
+func main() {
+	// Define command line flags using pflag
+	logLevel := pflag.String("zap-log-level", "", "Log level (debug, info, warn, error)")
+	encoder := pflag.String("zap-encoder", "json", "Log encoder (json, console)")
+	timeEncoding := pflag.String("zap-time-encoding", "rfc3339nano", "Time encoding (rfc3339, rfc3339nano, iso8601, millis, nanos)")
+
+	// Add help flag
+	help := pflag.BoolP("help", "h", false, "Display help information")
+
+	// Parse flags
+	pflag.Parse()
+
+	// Display help if requested
+	if *help {
+		fmt.Printf("Usage of %s:\n", AppName)
+		pflag.PrintDefaults()
+		os.Exit(0)
+	}
+
+	// Setup panic handler
+	defer func() {
+		if r := recover(); r != nil {
+			// Create a basic logger for panic case
+			logger, _ := createLogger("error", "json", "rfc3339nano")
+			if logger != nil {
+				logger.Error("Application panic", slog.Any("panic", r))
+
path: main.go
user: login: lukas016
body: pls remove empty line
created_at: 2025-03-04T10:28:11Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
+}
+
+// runService starts the registration service and HTTP server
+func runService(ctx context.Context, logger *slog.Logger) error {
+	// Log application startup information
+	logger.Info("Application starting",
+		slog.String("app", AppName),
+		slog.String("version", Version),
+		slog.String("buildDate", BuildDate))
+
+	intervalDuration := GetRegistrationServiceIntervalTime(logger)
+	registrationService := registration.NewRegistrationService(logger, intervalDuration)
+
+	// Create a context with cancel function for shutdown
+	ctx, cancelFunc := context.WithCancel(ctx)
+	g, ctx := errgroup.WithContext(ctx)
+
+	// Set up signal handling for graceful shutdown
+	signalChan := make(chan os.Signal, 1)
+	signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
+
+	// Start signal handler goroutine
+	g.Go(func() error {
+		select {
+		case sig := <-signalChan:
+			logger.Info("Received shutdown signal", slog.String("signal", sig.String()))
+			cancelFunc()
+			return nil
+		case <-ctx.Done():
+			return ctx.Err()
+		}
+	})
+
+	// Start the registration service
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in registration service", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		return registrationService.Run(ctx)
+	})
+
+	// Setup HTTP server
+	mux := http.NewServeMux()
+	mux.Handle("/metrics", promhttp.Handler())
+	mux.HandleFunc("/live", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is healthy")
+	})
+	mux.HandleFunc("/ready", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is ready")
+	})
+
+	// Create server with timeout configuration
+	server := &http.Server{
+		Addr:    ":8080",
+		Handler: mux,
+	}
+
+	// Start the HTTP server in a goroutine
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in HTTP server", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		logger.Info("Starting HTTP server",
+			slog.String("address", server.Addr),
+			slog.Int("intervalMinutes", int(intervalDuration.Minutes())))
+
+		err := server.ListenAndServe()
+		if err != nil && err != http.ErrServerClosed {
+			logger.Error("HTTP server failed", slog.String("err", err.Error()))
+			return err
+		}
+		return nil
+	})
+
+	// Add server shutdown handler
+	g.Go(func() error {
+		<-ctx.Done()
+		logger.Info("Shutting down HTTP server")
+
+		// Create a timeout context for shutdown
+		shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 15*time.Second)
+		defer shutdownCancel()
+
+		if err := server.Shutdown(shutdownCtx); err != nil {
+			logger.Error("HTTP server shutdown error", slog.String("err", err.Error()))
+			return err
+		}
+
+		logger.Info("HTTP server shutdown completed")
+		return nil
+	})
+
+	// Wait for all goroutines to complete
+	err := g.Wait()
+	if err != nil && err != context.Canceled {
path: main.go
user: login: lukas016
body: errors.Is is more secure
created_at: 2025-03-04T10:28:30Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
path: main.go
user: login: lukas016
body: optional: unexported variables are more secure
created_at: 2025-03-04T10:30:04Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
path: main.go
user: login: lukas016
body: isn't better put this into default state in switch block? You have splitted logic on 2 places now.
created_at: 2025-03-04T10:38:05Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,6 @@
+package constants
+
+const DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES = 60
path: pkg/constants/constants.go
user: login: lukas016
body: it doesn't follow go style: https://google.github.io/styleguide/go/guide#mixedcaps

Do you have any special reason why it use more BASH environment format?
created_at: 2025-03-04T10:44:36Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,164 @@
+package metrics
+
+import (
+	"fmt"
+	"log/slog"
+
+	"github.com/prometheus/client_golang/prometheus"
+	"github.com/prometheus/client_golang/prometheus/promauto"
+)
+
+const (
+	// metrics definitions
+	SERVICE_STATUS_CODE_METRIC_VALUE  = "service_status_code"
+	SERVICE_PANIC_COUNTS_METRIC_VALUE = "application_panics_total"
+
+	// label definitions
+	HTTP_STATUS_CODE_LABEL = "http_status_code"
+	INTEL_ERROR_CODE_LABEL = "intel_error_code"
+)
+
+// Define a custom type for status codes
+type StatusCode int
+
+type StatusCodeDetails struct {
+	RequiresHTTPStatusCode bool
+	AllowsIntelErrCode     bool
+}
+
+const (
+	PENDING                      StatusCode = iota // 0
+	SGX_UEFI_UNAVAILABLE         StatusCode = 1
+	RETRY_NEEDED                 StatusCode = 2
+	SGX_RESET_NEEDED             StatusCode = 3
+	UEFI_PERSIST_FAILED          StatusCode = 4
+	PLATFORM_REBOOT_NEEDED       StatusCode = 5
+	PLATFORM_DIRECTLY_REGISTERED StatusCode = 9
+	INTEL_CONNECT_FAILED         StatusCode = 10
+	INVALID_REGISTRATION_REQUEST StatusCode = 11
+	INTEL_RS_REQUEST_FAILED      StatusCode = 12
+	UNKNOWN_ERROR                StatusCode = 99
+)
+
+func (s StatusCode) GetDetails() StatusCodeDetails {
+	switch s {
+	case INVALID_REGISTRATION_REQUEST, INTEL_RS_REQUEST_FAILED, SGX_RESET_NEEDED:
+		return StatusCodeDetails{
+			RequiresHTTPStatusCode: true,
+			AllowsIntelErrCode:     false,
+		}
+	default:
+		return StatusCodeDetails{
+			RequiresHTTPStatusCode: false,
+			AllowsIntelErrCode:     false,
+		}
+	}
+
+}
+
+func (s StatusCode) toInt() int {
+	return int(s)
+}
+
+// Add a String() method for easy conversion to string
+func (s StatusCode) String() string {
+	switch s {
+	case PENDING:
+		return "PENDING: pending execution"
+	case SGX_UEFI_UNAVAILABLE:
+		return "SGX_UEFI_UNAVAILABLE: SGX UEFI variables not available"
+	case RETRY_NEEDED:
+		return "RETRY_NEEDED: impossible to determine the registration status; please reattempt"
+	case SGX_RESET_NEEDED:
+		return "SGX_RESET_NEEDED: impossible to determine the registration status; please reset the SGX"
+	case PLATFORM_REBOOT_NEEDED:
+		return "PLATFORM_REBOOT_NEEDED: platform registered successfully and a reboot is required"
+	case UEFI_PERSIST_FAILED:
+		return "UEFI_PERSIST_FAILED: failed to persist the UEFI variable content"
+	case PLATFORM_DIRECTLY_REGISTERED:
+		return "PLATFORM_DIRECTLY_REGISTERED: platform directly registered"
+	case INTEL_CONNECT_FAILED:
+		return "INTEL_CONNECT_FAILED: failed to connect to Intel RS"
+	case INVALID_REGISTRATION_REQUEST:
+		return "INVALID_REGISTRATION_REQUEST: invalid registration request"
+	case INTEL_RS_REQUEST_FAILED:
+		return "INTEL_RS_REQUEST_FAILED: intel RS could not process the request"
+	default:
+		return "UNKNOWN_ERROR"
+	}
+}
+
+type StatusCodeMetric struct {
+	Status         StatusCode
+	HttpStatusCode string
+	IntelError     string
+}
+
+type RegistrationServiceMetricsRegistry struct {
+	log *slog.Logger
+}
+
+func NewRegistrationServiceMetricsRegistry(logger *slog.Logger) *RegistrationServiceMetricsRegistry {
+	return &RegistrationServiceMetricsRegistry{
+		log: logger,
+	}
+}
+
+var (
+	SERVICE_STATUS_CODE_METRIC = promauto.NewGaugeVec(
+		prometheus.GaugeOpts{
+			Name: SERVICE_STATUS_CODE_METRIC_VALUE,
+			Help: "Current status code of the registration service",
+		},
+		[]string{HTTP_STATUS_CODE_LABEL, INTEL_ERROR_CODE_LABEL},
+	)
+
+	SERVICE_PANIC_COUNTS_METRIC = promauto.NewCounter(prometheus.CounterOpts{
+		Name: SERVICE_PANIC_COUNTS_METRIC_VALUE,
+		Help: "Total number of go routines panics",
+	})
+)
+
+// helper function to service status code to pending
+func IncrementPanicCounts() {
+	SERVICE_PANIC_COUNTS_METRIC.Inc()
+}
+
+// helper function to service status code to pending
+func (s *RegistrationServiceMetricsRegistry) SetServiceStatusCodeToPending() error {
+	metric_value := StatusCodeMetric{
+		Status:         PENDING,
+		HttpStatusCode: "0",
+		IntelError:     "",
+	}
+	return s.UpdateServiceStatusCodeMetric(metric_value)
+}
+
+func (s *RegistrationServiceMetricsRegistry) UpdateServiceStatusCodeMetric(metric_value StatusCodeMetric) error {
+	// Validate required labels
+	status_details := metric_value.Status.GetDetails()
path: pkg/metrics/metrics.go
user: login: lukas016
body: this doesn't follow go style: https://google.github.io/styleguide/go/guide#mixedcaps

you have more of this stuff in the code. It can be better create follow issue for renaming variables
created_at: 2025-03-04T10:45:40Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
+}
+
+// runService starts the registration service and HTTP server
+func runService(ctx context.Context, logger *slog.Logger) error {
+	// Log application startup information
+	logger.Info("Application starting",
+		slog.String("app", AppName),
+		slog.String("version", Version),
+		slog.String("buildDate", BuildDate))
+
+	intervalDuration := GetRegistrationServiceIntervalTime(logger)
+	registrationService := registration.NewRegistrationService(logger, intervalDuration)
+
+	// Create a context with cancel function for shutdown
+	ctx, cancelFunc := context.WithCancel(ctx)
+	g, ctx := errgroup.WithContext(ctx)
+
+	// Set up signal handling for graceful shutdown
+	signalChan := make(chan os.Signal, 1)
+	signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
+
+	// Start signal handler goroutine
+	g.Go(func() error {
+		select {
+		case sig := <-signalChan:
+			logger.Info("Received shutdown signal", slog.String("signal", sig.String()))
+			cancelFunc()
+			return nil
+		case <-ctx.Done():
+			return ctx.Err()
+		}
+	})
+
+	// Start the registration service
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in registration service", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		return registrationService.Run(ctx)
+	})
+
+	// Setup HTTP server
+	mux := http.NewServeMux()
+	mux.Handle("/metrics", promhttp.Handler())
+	mux.HandleFunc("/live", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is healthy")
+	})
+	mux.HandleFunc("/ready", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is ready")
+	})
+
+	// Create server with timeout configuration
+	server := &http.Server{
+		Addr:    ":8080",
+		Handler: mux,
+	}
+
+	// Start the HTTP server in a goroutine
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in HTTP server", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		logger.Info("Starting HTTP server",
+			slog.String("address", server.Addr),
+			slog.Int("intervalMinutes", int(intervalDuration.Minutes())))
+
+		err := server.ListenAndServe()
+		if err != nil && err != http.ErrServerClosed {
+			logger.Error("HTTP server failed", slog.String("err", err.Error()))
+			return err
+		}
+		return nil
+	})
+
+	// Add server shutdown handler
+	g.Go(func() error {
+		<-ctx.Done()
+		logger.Info("Shutting down HTTP server")
+
+		// Create a timeout context for shutdown
+		shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 15*time.Second)
+		defer shutdownCancel()
+
+		if err := server.Shutdown(shutdownCtx); err != nil {
+			logger.Error("HTTP server shutdown error", slog.String("err", err.Error()))
+			return err
+		}
+
+		logger.Info("HTTP server shutdown completed")
+		return nil
+	})
+
+	// Wait for all goroutines to complete
+	err := g.Wait()
+	if err != nil && err != context.Canceled {
path: main.go
user: login: dandax123
body: addressed
created_at: 2025-03-04T11:17:38Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
path: main.go
user: login: dandax123
body: addressed
created_at: 2025-03-04T11:17:43Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,6 @@
+package constants
+
+const DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES = 60
path: pkg/constants/constants.go
user: login: dandax123
body: addressed
created_at: 2025-03-04T11:17:48Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,164 @@
+package metrics
+
+import (
+	"fmt"
+	"log/slog"
+
+	"github.com/prometheus/client_golang/prometheus"
+	"github.com/prometheus/client_golang/prometheus/promauto"
+)
+
+const (
+	// metrics definitions
+	SERVICE_STATUS_CODE_METRIC_VALUE  = "service_status_code"
+	SERVICE_PANIC_COUNTS_METRIC_VALUE = "application_panics_total"
+
+	// label definitions
+	HTTP_STATUS_CODE_LABEL = "http_status_code"
+	INTEL_ERROR_CODE_LABEL = "intel_error_code"
+)
+
+// Define a custom type for status codes
+type StatusCode int
+
+type StatusCodeDetails struct {
+	RequiresHTTPStatusCode bool
+	AllowsIntelErrCode     bool
+}
+
+const (
+	PENDING                      StatusCode = iota // 0
+	SGX_UEFI_UNAVAILABLE         StatusCode = 1
+	RETRY_NEEDED                 StatusCode = 2
+	SGX_RESET_NEEDED             StatusCode = 3
+	UEFI_PERSIST_FAILED          StatusCode = 4
+	PLATFORM_REBOOT_NEEDED       StatusCode = 5
+	PLATFORM_DIRECTLY_REGISTERED StatusCode = 9
+	INTEL_CONNECT_FAILED         StatusCode = 10
+	INVALID_REGISTRATION_REQUEST StatusCode = 11
+	INTEL_RS_REQUEST_FAILED      StatusCode = 12
+	UNKNOWN_ERROR                StatusCode = 99
+)
+
+func (s StatusCode) GetDetails() StatusCodeDetails {
+	switch s {
+	case INVALID_REGISTRATION_REQUEST, INTEL_RS_REQUEST_FAILED, SGX_RESET_NEEDED:
+		return StatusCodeDetails{
+			RequiresHTTPStatusCode: true,
+			AllowsIntelErrCode:     false,
+		}
+	default:
+		return StatusCodeDetails{
+			RequiresHTTPStatusCode: false,
+			AllowsIntelErrCode:     false,
+		}
+	}
+
+}
+
+func (s StatusCode) toInt() int {
+	return int(s)
+}
+
+// Add a String() method for easy conversion to string
+func (s StatusCode) String() string {
+	switch s {
+	case PENDING:
+		return "PENDING: pending execution"
+	case SGX_UEFI_UNAVAILABLE:
+		return "SGX_UEFI_UNAVAILABLE: SGX UEFI variables not available"
+	case RETRY_NEEDED:
+		return "RETRY_NEEDED: impossible to determine the registration status; please reattempt"
+	case SGX_RESET_NEEDED:
+		return "SGX_RESET_NEEDED: impossible to determine the registration status; please reset the SGX"
+	case PLATFORM_REBOOT_NEEDED:
+		return "PLATFORM_REBOOT_NEEDED: platform registered successfully and a reboot is required"
+	case UEFI_PERSIST_FAILED:
+		return "UEFI_PERSIST_FAILED: failed to persist the UEFI variable content"
+	case PLATFORM_DIRECTLY_REGISTERED:
+		return "PLATFORM_DIRECTLY_REGISTERED: platform directly registered"
+	case INTEL_CONNECT_FAILED:
+		return "INTEL_CONNECT_FAILED: failed to connect to Intel RS"
+	case INVALID_REGISTRATION_REQUEST:
+		return "INVALID_REGISTRATION_REQUEST: invalid registration request"
+	case INTEL_RS_REQUEST_FAILED:
+		return "INTEL_RS_REQUEST_FAILED: intel RS could not process the request"
+	default:
+		return "UNKNOWN_ERROR"
+	}
+}
+
+type StatusCodeMetric struct {
+	Status         StatusCode
+	HttpStatusCode string
+	IntelError     string
+}
+
+type RegistrationServiceMetricsRegistry struct {
+	log *slog.Logger
+}
+
+func NewRegistrationServiceMetricsRegistry(logger *slog.Logger) *RegistrationServiceMetricsRegistry {
+	return &RegistrationServiceMetricsRegistry{
+		log: logger,
+	}
+}
+
+var (
+	SERVICE_STATUS_CODE_METRIC = promauto.NewGaugeVec(
+		prometheus.GaugeOpts{
+			Name: SERVICE_STATUS_CODE_METRIC_VALUE,
+			Help: "Current status code of the registration service",
+		},
+		[]string{HTTP_STATUS_CODE_LABEL, INTEL_ERROR_CODE_LABEL},
+	)
+
+	SERVICE_PANIC_COUNTS_METRIC = promauto.NewCounter(prometheus.CounterOpts{
+		Name: SERVICE_PANIC_COUNTS_METRIC_VALUE,
+		Help: "Total number of go routines panics",
+	})
+)
+
+// helper function to service status code to pending
+func IncrementPanicCounts() {
+	SERVICE_PANIC_COUNTS_METRIC.Inc()
+}
+
+// helper function to service status code to pending
+func (s *RegistrationServiceMetricsRegistry) SetServiceStatusCodeToPending() error {
+	metric_value := StatusCodeMetric{
+		Status:         PENDING,
+		HttpStatusCode: "0",
+		IntelError:     "",
+	}
+	return s.UpdateServiceStatusCodeMetric(metric_value)
+}
+
+func (s *RegistrationServiceMetricsRegistry) UpdateServiceStatusCodeMetric(metric_value StatusCodeMetric) error {
+	// Validate required labels
+	status_details := metric_value.Status.GetDetails()
path: pkg/metrics/metrics.go
user: login: dandax123
body: addressed
created_at: 2025-03-04T11:17:54Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
+}
+
+// runService starts the registration service and HTTP server
+func runService(ctx context.Context, logger *slog.Logger) error {
+	// Log application startup information
+	logger.Info("Application starting",
+		slog.String("app", AppName),
+		slog.String("version", Version),
+		slog.String("buildDate", BuildDate))
+
+	intervalDuration := GetRegistrationServiceIntervalTime(logger)
+	registrationService := registration.NewRegistrationService(logger, intervalDuration)
+
+	// Create a context with cancel function for shutdown
+	ctx, cancelFunc := context.WithCancel(ctx)
+	g, ctx := errgroup.WithContext(ctx)
+
+	// Set up signal handling for graceful shutdown
+	signalChan := make(chan os.Signal, 1)
+	signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
+
+	// Start signal handler goroutine
+	g.Go(func() error {
+		select {
+		case sig := <-signalChan:
+			logger.Info("Received shutdown signal", slog.String("signal", sig.String()))
+			cancelFunc()
+			return nil
+		case <-ctx.Done():
+			return ctx.Err()
+		}
+	})
+
+	// Start the registration service
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in registration service", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		return registrationService.Run(ctx)
+	})
+
+	// Setup HTTP server
+	mux := http.NewServeMux()
+	mux.Handle("/metrics", promhttp.Handler())
+	mux.HandleFunc("/live", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is healthy")
+	})
+	mux.HandleFunc("/ready", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is ready")
+	})
+
+	// Create server with timeout configuration
+	server := &http.Server{
+		Addr:    ":8080",
+		Handler: mux,
+	}
+
+	// Start the HTTP server in a goroutine
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in HTTP server", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		logger.Info("Starting HTTP server",
+			slog.String("address", server.Addr),
+			slog.Int("intervalMinutes", int(intervalDuration.Minutes())))
+
+		err := server.ListenAndServe()
+		if err != nil && err != http.ErrServerClosed {
+			logger.Error("HTTP server failed", slog.String("err", err.Error()))
+			return err
+		}
+		return nil
+	})
+
+	// Add server shutdown handler
+	g.Go(func() error {
+		<-ctx.Done()
+		logger.Info("Shutting down HTTP server")
+
+		// Create a timeout context for shutdown
+		shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 15*time.Second)
+		defer shutdownCancel()
+
+		if err := server.Shutdown(shutdownCtx); err != nil {
+			logger.Error("HTTP server shutdown error", slog.String("err", err.Error()))
+			return err
+		}
+
+		logger.Info("HTTP server shutdown completed")
+		return nil
+	})
+
+	// Wait for all goroutines to complete
+	err := g.Wait()
+	if err != nil && err != context.Canceled {
+		logger.Error("Service error", slog.String("err", err.Error()))
+		return err
+	}
+
+	logger.Info("Service shutdown complete")
+	return nil
+}
+
+func main() {
+	// Define command line flags using pflag
+	logLevel := pflag.String("zap-log-level", "", "Log level (debug, info, warn, error)")
+	encoder := pflag.String("zap-encoder", "json", "Log encoder (json, console)")
+	timeEncoding := pflag.String("zap-time-encoding", "rfc3339nano", "Time encoding (rfc3339, rfc3339nano, iso8601, millis, nanos)")
+
+	// Add help flag
+	help := pflag.BoolP("help", "h", false, "Display help information")
+
+	// Parse flags
+	pflag.Parse()
+
+	// Display help if requested
+	if *help {
+		fmt.Printf("Usage of %s:\n", AppName)
+		pflag.PrintDefaults()
+		os.Exit(0)
+	}
+
+	// Setup panic handler
+	defer func() {
+		if r := recover(); r != nil {
+			// Create a basic logger for panic case
+			logger, _ := createLogger("error", "json", "rfc3339nano")
+			if logger != nil {
+				logger.Error("Application panic", slog.Any("panic", r))
+
path: main.go
user: login: dandax123
body: addressed
created_at: 2025-03-04T11:18:09Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
+}
+
+// runService starts the registration service and HTTP server
+func runService(ctx context.Context, logger *slog.Logger) error {
+	// Log application startup information
+	logger.Info("Application starting",
+		slog.String("app", AppName),
+		slog.String("version", Version),
+		slog.String("buildDate", BuildDate))
+
+	intervalDuration := GetRegistrationServiceIntervalTime(logger)
+	registrationService := registration.NewRegistrationService(logger, intervalDuration)
+
+	// Create a context with cancel function for shutdown
+	ctx, cancelFunc := context.WithCancel(ctx)
+	g, ctx := errgroup.WithContext(ctx)
+
+	// Set up signal handling for graceful shutdown
+	signalChan := make(chan os.Signal, 1)
+	signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
+
+	// Start signal handler goroutine
+	g.Go(func() error {
+		select {
+		case sig := <-signalChan:
+			logger.Info("Received shutdown signal", slog.String("signal", sig.String()))
+			cancelFunc()
+			return nil
+		case <-ctx.Done():
+			return ctx.Err()
+		}
+	})
+
+	// Start the registration service
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in registration service", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		return registrationService.Run(ctx)
+	})
+
+	// Setup HTTP server
+	mux := http.NewServeMux()
+	mux.Handle("/metrics", promhttp.Handler())
+	mux.HandleFunc("/live", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is healthy")
+	})
+	mux.HandleFunc("/ready", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is ready")
+	})
+
+	// Create server with timeout configuration
+	server := &http.Server{
+		Addr:    ":8080",
+		Handler: mux,
+	}
+
+	// Start the HTTP server in a goroutine
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in HTTP server", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		logger.Info("Starting HTTP server",
+			slog.String("address", server.Addr),
+			slog.Int("intervalMinutes", int(intervalDuration.Minutes())))
+
+		err := server.ListenAndServe()
+		if err != nil && err != http.ErrServerClosed {
+			logger.Error("HTTP server failed", slog.String("err", err.Error()))
+			return err
+		}
+		return nil
+	})
+
+	// Add server shutdown handler
+	g.Go(func() error {
+		<-ctx.Done()
+		logger.Info("Shutting down HTTP server")
+
+		// Create a timeout context for shutdown
+		shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 15*time.Second)
+		defer shutdownCancel()
+
+		if err := server.Shutdown(shutdownCtx); err != nil {
+			logger.Error("HTTP server shutdown error", slog.String("err", err.Error()))
+			return err
+		}
+
+		logger.Info("HTTP server shutdown completed")
+		return nil
+	})
+
+	// Wait for all goroutines to complete
+	err := g.Wait()
+	if err != nil && err != context.Canceled {
path: main.go
user: login: dandax123
body: addressed
created_at: 2025-03-04T11:18:15Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
+}
+
+// runService starts the registration service and HTTP server
+func runService(ctx context.Context, logger *slog.Logger) error {
+	// Log application startup information
+	logger.Info("Application starting",
+		slog.String("app", AppName),
+		slog.String("version", Version),
+		slog.String("buildDate", BuildDate))
+
+	intervalDuration := GetRegistrationServiceIntervalTime(logger)
+	registrationService := registration.NewRegistrationService(logger, intervalDuration)
+
+	// Create a context with cancel function for shutdown
+	ctx, cancelFunc := context.WithCancel(ctx)
+	g, ctx := errgroup.WithContext(ctx)
+
+	// Set up signal handling for graceful shutdown
+	signalChan := make(chan os.Signal, 1)
+	signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
+
+	// Start signal handler goroutine
+	g.Go(func() error {
+		select {
+		case sig := <-signalChan:
+			logger.Info("Received shutdown signal", slog.String("signal", sig.String()))
+			cancelFunc()
+			return nil
+		case <-ctx.Done():
+			return ctx.Err()
+		}
+	})
+
+	// Start the registration service
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in registration service", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		return registrationService.Run(ctx)
+	})
+
+	// Setup HTTP server
+	mux := http.NewServeMux()
+	mux.Handle("/metrics", promhttp.Handler())
+	mux.HandleFunc("/live", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is healthy")
+	})
+	mux.HandleFunc("/ready", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is ready")
+	})
+
+	// Create server with timeout configuration
+	server := &http.Server{
+		Addr:    ":8080",
path: main.go
user: login: dandax123
body: addressed
created_at: 2025-03-04T11:18:19Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
+}
+
+// runService starts the registration service and HTTP server
+func runService(ctx context.Context, logger *slog.Logger) error {
+	// Log application startup information
+	logger.Info("Application starting",
+		slog.String("app", AppName),
+		slog.String("version", Version),
+		slog.String("buildDate", BuildDate))
+
+	intervalDuration := GetRegistrationServiceIntervalTime(logger)
+	registrationService := registration.NewRegistrationService(logger, intervalDuration)
+
+	// Create a context with cancel function for shutdown
+	ctx, cancelFunc := context.WithCancel(ctx)
+	g, ctx := errgroup.WithContext(ctx)
+
+	// Set up signal handling for graceful shutdown
+	signalChan := make(chan os.Signal, 1)
+	signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
+
+	// Start signal handler goroutine
+	g.Go(func() error {
+		select {
+		case sig := <-signalChan:
+			logger.Info("Received shutdown signal", slog.String("signal", sig.String()))
+			cancelFunc()
+			return nil
+		case <-ctx.Done():
+			return ctx.Err()
+		}
+	})
+
+	// Start the registration service
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in registration service", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		return registrationService.Run(ctx)
+	})
+
+	// Setup HTTP server
+	mux := http.NewServeMux()
+	mux.Handle("/metrics", promhttp.Handler())
+	mux.HandleFunc("/live", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is healthy")
+	})
+	mux.HandleFunc("/ready", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is ready")
+	})
+
+	// Create server with timeout configuration
+	server := &http.Server{
+		Addr:    ":8080",
+		Handler: mux,
+	}
+
+	// Start the HTTP server in a goroutine
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in HTTP server", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		logger.Info("Starting HTTP server",
+			slog.String("address", server.Addr),
+			slog.Int("intervalMinutes", int(intervalDuration.Minutes())))
+
+		err := server.ListenAndServe()
+		if err != nil && err != http.ErrServerClosed {
path: main.go
user: login: dandax123
body: addressed
created_at: 2025-03-04T11:18:24Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
+}
+
+// runService starts the registration service and HTTP server
+func runService(ctx context.Context, logger *slog.Logger) error {
+	// Log application startup information
+	logger.Info("Application starting",
+		slog.String("app", AppName),
+		slog.String("version", Version),
+		slog.String("buildDate", BuildDate))
+
+	intervalDuration := GetRegistrationServiceIntervalTime(logger)
+	registrationService := registration.NewRegistrationService(logger, intervalDuration)
+
+	// Create a context with cancel function for shutdown
+	ctx, cancelFunc := context.WithCancel(ctx)
+	g, ctx := errgroup.WithContext(ctx)
+
+	// Set up signal handling for graceful shutdown
+	signalChan := make(chan os.Signal, 1)
+	signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
+
+	// Start signal handler goroutine
+	g.Go(func() error {
+		select {
+		case sig := <-signalChan:
+			logger.Info("Received shutdown signal", slog.String("signal", sig.String()))
+			cancelFunc()
+			return nil
+		case <-ctx.Done():
+			return ctx.Err()
+		}
+	})
+
+	// Start the registration service
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
+			if r := recover(); r != nil {
+				logger.Error("Panic in registration service", slog.Any("panic", r))
+				metrics.IncrementPanicCounts()
+				logger.Info("Incremented the application Panic count metric")
+
+			}
+		}()
+
+		return registrationService.Run(ctx)
+	})
+
+	// Setup HTTP server
+	mux := http.NewServeMux()
+	mux.Handle("/metrics", promhttp.Handler())
+	mux.HandleFunc("/live", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is healthy")
+	})
+	mux.HandleFunc("/ready", func(w http.ResponseWriter, r *http.Request) {
+		w.WriteHeader(http.StatusOK)
+		fmt.Fprintf(w, "Service is ready")
+	})
+
+	// Create server with timeout configuration
+	server := &http.Server{
+		Addr:    ":8080",
+		Handler: mux,
+	}
+
+	// Start the HTTP server in a goroutine
+	g.Go(func() error {
+		// Add panic recovery with metrics
+		defer func() {
path: main.go
user: login: dandax123
body: addressed
created_at: 2025-03-04T11:18:29Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
+}
+
+// runService starts the registration service and HTTP server
+func runService(ctx context.Context, logger *slog.Logger) error {
+	// Log application startup information
+	logger.Info("Application starting",
+		slog.String("app", AppName),
+		slog.String("version", Version),
+		slog.String("buildDate", BuildDate))
+
+	intervalDuration := GetRegistrationServiceIntervalTime(logger)
+	registrationService := registration.NewRegistrationService(logger, intervalDuration)
+
+	// Create a context with cancel function for shutdown
+	ctx, cancelFunc := context.WithCancel(ctx)
+	g, ctx := errgroup.WithContext(ctx)
+
+	// Set up signal handling for graceful shutdown
+	signalChan := make(chan os.Signal, 1)
+	signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
path: main.go
user: login: dandax123
body: addressed
created_at: 2025-03-04T11:18:35Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
path: main.go
user: login: dandax123
body: addressed
created_at: 2025-03-04T11:18:45Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
path: main.go
user: login: dandax123
body: No preference. Just decided to use slog and logr. Should I change it ?
created_at: 2025-03-04T11:21:01Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
path: main.go
user: login: lukas016
body: pls put link here for new issue. thx
created_at: 2025-03-04T11:37:07Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
path: main.go
user: login: lukas016
body: do you need some another abstraction above zap?
Or does it some advantages?
Because if not, i prefer follow KISS principle.


created_at: 2025-03-04T11:39:05Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
path: main.go
user: login: lukas016
body: @dandax123 what do you think?
created_at: 2025-03-04T11:47:20Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
path: main.go
user: login: dandax123
body: I changed the error strings,  no need for new issue
created_at: 2025-03-04T11:57:37Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,283 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log/slog"
+	"net/http"
+	"os"
+	"os/signal"
+	"strconv"
+	"syscall"
+	"time"
+
+	"github.com/go-logr/logr"
+	"github.com/go-logr/zapr"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/constants"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/metrics"
+	"github.com/opensovereigncloud/cc-intel-platform-registration/pkg/registration"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/spf13/pflag"
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"golang.org/x/sync/errgroup"
+)
+
+// Version information
+var (
+	AppName   = "cc-intel-platform-registration"
+	Version   = "dev"
+	BuildDate = "unknown"
+)
+
+// GetRegistrationServiceIntervalTime retrieves the registration service interval from environment variables
+func GetRegistrationServiceIntervalTime(logger *slog.Logger) time.Duration {
+	intervalStr := os.Getenv(constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV)
+	interval := constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES
+	if intervalStr != "" {
+		parsedInterval, err := strconv.Atoi(intervalStr)
+		if err != nil {
+			logger.Error("Failed to parse registration service interval",
+				slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+				slog.String("err", err.Error()),
+				slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+			// Continue with default value
+		} else {
+			interval = parsedInterval
+		}
+	} else {
+		logger.Info("Registration service interval not set, using default",
+			slog.String("env_var", constants.REGISTRATION_SERVICE_INTERVAL_IN_MINUTES_ENV),
+			slog.Int("default_value", constants.DEFAULT_REGISTRATION_SERVICE_INTERVAL_IN_MINUTES))
+	}
+	return time.Duration(interval) * time.Minute
+}
+
+// createLogger creates a new zap.Logger with the specified configuration
+func createLogger(level string, encoder string, timeEncoding string) (*slog.Logger, error) {
+	// Set defaults if not specified
+	if level == "" {
+		level = "info"
+	}
+	if encoder == "" {
+		encoder = "json"
+	}
+	if timeEncoding == "" {
+		timeEncoding = "rfc3339nano"
+	}
+
+	// Parse the level
+	zapLevel, err := zap.ParseAtomicLevel(level)
+
+	if err != nil {
+		// Default to info on error
+		zapLevel = zap.NewAtomicLevelAt(zap.InfoLevel)
+	}
+
+	// Configure encoder
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "" // omit the caller
+
+	// Override time encoder if specified
+	switch timeEncoding {
+	case "rfc3339":
+		encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder
+	case "rfc3339nano":
+		encoderConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder
+	case "iso8601":
+		encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	case "millis":
+		encoderConfig.EncodeTime = zapcore.EpochMillisTimeEncoder
+	case "nanos":
+		encoderConfig.EncodeTime = zapcore.EpochNanosTimeEncoder
+	}
+
+	cfg := zap.NewProductionConfig()
+	cfg.DisableCaller = true
+	cfg.EncoderConfig = encoderConfig
+	cfg.Level = zapLevel
+
+	if encoder == "json" {
+		cfg.Encoding = "json"
+	} else {
+		cfg.Encoding = "console"
+	}
+
+	// Build the logger
+	zapLogger, err := cfg.Build()
+
+	if err != nil {
+		return nil, err
+	}
+
+	logger := zapr.NewLogger(zapLogger)
+	return slog.New(logr.ToSlogHandler(logger)), nil
path: main.go
user: login: dandax123
body: only positive, is that using slogr forces to use `slog.String("err', err.Error())` instead of using `zap.Error(err)` which doesn't follow the `{"err": "error string"}` standard as the output of that is` {"error": 'xxxxx"}` 
created_at: 2025-03-04T12:00:36Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,155 @@
+package metrics
+
+import (
+	"fmt"
+	"log/slog"
+
+	"github.com/prometheus/client_golang/prometheus"
+	"github.com/prometheus/client_golang/prometheus/promauto"
+)
+
+const (
+	// metrics definitions
+	SERVICE_STATUS_CODE_METRIC = "service_status_code"
+
+	// label definitions
+	HTTP_STATUS_CODE_LABEL = "http_status_code"
+	INTEL_ERROR_CODE_LABEL = "intel_error_code"
+)
+
+// Define a custom type for status codes
+type StatusCode int
+
+type StatusCodeDetails struct {
+	RequiresHTTPStatusCode bool
+	AllowsIntelErrCode     bool
+}
+
+const (
+	PENDING                      StatusCode = iota // 0
+	SGX_UEFI_UNAVAILABLE         StatusCode = 1
+	RETRY_NEEDED                 StatusCode = 2
+	SGX_RESET_NEEDED             StatusCode = 3
+	UEFI_PERSIST_FAILED          StatusCode = 4
+	PLATFORM_REBOOT_NEEDED       StatusCode = 5
+	PLATFORM_DIRECTLY_REGISTERED StatusCode = 9
+	INTEL_CONNECT_FAILED         StatusCode = 10
+	INVALID_REGISTRATION_REQUEST StatusCode = 11
+	INTEL_RS_REQUEST_FAILED      StatusCode = 12
+	UNKNOWN_ERROR                StatusCode = 99
+)
+
+func (s StatusCode) GetDetails() StatusCodeDetails {
+	switch s {
+	case INVALID_REGISTRATION_REQUEST, INTEL_RS_REQUEST_FAILED, SGX_RESET_NEEDED:
+		return StatusCodeDetails{
+			RequiresHTTPStatusCode: true,
+			AllowsIntelErrCode:     false,
+		}
+	default:
+		return StatusCodeDetails{
+			RequiresHTTPStatusCode: false,
+			AllowsIntelErrCode:     false,
+		}
+	}
+
+}
+
+func (s StatusCode) toInt() int {
+	return int(s)
+}
+
+// Add a String() method for easy conversion to string
+func (s StatusCode) String() string {
+	switch s {
+	case PENDING:
+		return "PENDING: pending execution"
+	case SGX_UEFI_UNAVAILABLE:
+		return "SGX_UEFI_UNAVAILABLE: SGX UEFI variables not available"
+	case RETRY_NEEDED:
+		return "RETRY_NEEDED: impossible to determine the registration status; please reattempt"
+	case SGX_RESET_NEEDED:
+		return "SGX_RESET_NEEDED: impossible to determine the registration status; please reset the SGX"
+	case PLATFORM_REBOOT_NEEDED:
+		return "PLATFORM_REBOOT_NEEDED: platform registered successfully and a reboot is required"
+	case UEFI_PERSIST_FAILED:
+		return "UEFI_PERSIST_FAILED: failed to persist the UEFI variable content"
+	case PLATFORM_DIRECTLY_REGISTERED:
+		return "PLATFORM_DIRECTLY_REGISTERED: platform directly registered"
+	case INTEL_CONNECT_FAILED:
+		return "INTEL_CONNECT_FAILED: failed to connect to Intel RS"
+	case INVALID_REGISTRATION_REQUEST:
+		return "INVALID_REGISTRATION_REQUEST: invalid registration request"
+	case INTEL_RS_REQUEST_FAILED:
+		return "INTEL_RS_REQUEST_FAILED: intel RS could not process the request"
+	default:
+		return "UNKNOWN_ERROR"
+	}
+}
+
+type StatusCodeMetric struct {
+	Status         StatusCode
+	HttpStatusCode string
+	IntelError     string
+}
+
+type RegistrationServiceMetricsRegistry struct {
+	metrics map[string]prometheus.Collector
+	log     *slog.Logger
+}
+
+func NewRegistrationServiceMetricsRegistry(logger *slog.Logger) *RegistrationServiceMetricsRegistry {
+	return &RegistrationServiceMetricsRegistry{
+		metrics: map[string]prometheus.Collector{
+			SERVICE_STATUS_CODE_METRIC: promauto.NewGaugeVec(
path: pkg/metrics/metrics.go
user: login: SilvaMatteus
body: Now that @dandax123  is using the following instead of the metrics map, I think there is no need for a follow up issue anymore. @lukas016 , do you agree?

```
var (
 	RegistrationServiceStatusCodeMetric = promauto.NewGaugeVec(
 		prometheus.GaugeOpts{
 			Name: RegistrationServiceStatusCodeMetricValue,
 			Help: "Current status code of the registration service",
 		},
 		[]string{HttpStatusCodeLabel, IntelErrorCodeLabel},
 	)

 	RegistrationServicePanicCountsMetric = promauto.NewCounter(prometheus.CounterOpts{
 		Name: RegistrationServicePanicCountsMetricValue,
 		Help: "Total number of go routines panics",
 	})
 )
```
created_at: 2025-03-04T12:11:01Z
author_association: CONTRIBUTOR

PR comments:
user: login: SilvaMatteus
created_at: 2025-02-07T10:20:34Z
body: @dandax123, Volker already have some comments about the Makefile (he put it in https://github.com/opensovereigncloud/cc-intel-platform-registration/pull/8). Could you have a look?
author_association: CONTRIBUTOR
user: login: dandax123
created_at: 2025-03-04T09:48:38Z
body: @lukas016  I think you can review this PR again. 
author_association: COLLABORATOR
user: login: lukas016
created_at: 2025-03-04T10:51:26Z
body: @dandax123 i finished review. hopefully i found everything.
author_association: CONTRIBUTOR
user: login: dandax123
created_at: 2025-03-04T11:23:11Z
body: @lukas016 I think you can give it a final look, I think , hopefully, I've addressed all the concerns
author_association: COLLABORATOR