Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Otel integration and test workflow fixes #399

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e8c5d51
changes for integration of otel (#64)
rasamala83 Jul 4, 2024
c3a15a2
Otel integration changes (#73)
rasamala83 Jul 5, 2024
ec7d852
go module changes for otel (#74)
rasamala83 Jul 8, 2024
688ca39
making changes updating port for metric and traces (#84)
rasamala83 Jul 11, 2024
13fc522
Otel integration changes latest 2 (#85)
rasamala83 Jul 12, 2024
05eec9c
changes for adding dimension occ_worker at source (#89)
rasamala83 Jul 18, 2024
a00254f
changes for renaming metrics (#90)
rasamala83 Jul 23, 2024
025c25f
resolve merge conflicts
rajesh-1983 Jul 23, 2024
629c290
Occ config logging (#394) (#91)
rasamala83 Jul 23, 2024
6986769
Merge branch 'otel' of github.paypal.com:AppDataServices/hera into otel
rajesh-1983 Jul 24, 2024
db14446
Otel changes for adding host dimension (#93)
rasamala83 Jul 25, 2024
0a2fdaa
Merge branch 'otel' of github.paypal.com:AppDataServices/hera into otel
rajesh-1983 Jul 27, 2024
16789da
Otel dist metrics change (#96)
rasamala83 Jul 31, 2024
0755b59
Merge remote-tracking branch 'origin_upstream/otel' into otel
rajesh-1983 Aug 2, 2024
be68655
Otel incorporate review comments and uts (#98)
rasamala83 Aug 2, 2024
47cbf45
Merge remote-tracking branch 'origin_upstream/otel' into otel
rajesh-1983 Aug 2, 2024
982ef64
changes to fix test failures in opensource
rajesh-1983 Aug 26, 2024
3f22341
updating workflow file
rajesh-1983 Aug 26, 2024
6b66a80
updating workflow file
rajesh-1983 Aug 26, 2024
196bfaa
deleted test which is not applicable
rajesh-1983 Aug 26, 2024
e4fa204
deleted test which is not applicable
rajesh-1983 Aug 26, 2024
f85148d
deleted test which is not applicable
rajesh-1983 Aug 26, 2024
2e4f933
deleted test which is not applicable
rajesh-1983 Aug 26, 2024
a579bc6
deleted test which is not applicable
rajesh-1983 Aug 26, 2024
aa1bbb9
changes for adding docker depedency as part test container
rajesh-1983 Aug 27, 2024
bcd48a5
changes for workflow
rajesh-1983 Aug 27, 2024
90be8f2
changes for fixing unit test errors
rajesh-1983 Aug 27, 2024
47e0ae1
changes for fixing unit test errors
rajesh-1983 Aug 27, 2024
333ba59
changes for fixing unit test errors
rajesh-1983 Aug 28, 2024
ae430ff
changes for updating dimension value added new testcase to validate s…
rajesh-1983 Aug 30, 2024
98fb154
workflow check
rajesh-1983 Aug 30, 2024
a4a920c
install docker and check docker version
rajesh-1983 Aug 30, 2024
8583752
install docker and check docker version
rajesh-1983 Aug 30, 2024
935ba1e
install docker and check docker version
rajesh-1983 Aug 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
branches: [ main ]

jobs:

build:
runs-on: ubuntu-latest
steps:
Expand All @@ -16,7 +15,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18.2
go-version: 1.20.14
- name: Install GO Modules
run: |
go mod tidy
Expand All @@ -37,17 +36,28 @@ jobs:
- 3306:3306
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18.2
go-version: 1.20.14
- name: Install GO Modules
run: |
go mod tidy
go mod download github.com/godror/godror
- name: Give Full Permissions to Work Directory
run: sudo chmod -R 777 /home/runner/work/
- name: Build worker
run: go install github.com/paypal/hera/worker/mysqlworker
- name: Check docker version
run: |
docker version
- name: Install Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose

- name: Verify Docker Compose Installation
run: docker-compose --version
- name: System Test
run: |
export GOPATH="/home/runner/go"
Expand Down
23 changes: 21 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
module github.com/paypal/hera

go 1.18
go 1.20

require (
github.com/go-sql-driver/mysql v1.7.1
github.com/godror/godror v0.26.3
github.com/lib/pq v1.10.3
go.opentelemetry.io/otel v1.24.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.24.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.24.0
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.24.0
go.opentelemetry.io/otel/metric v1.24.0
go.opentelemetry.io/otel/sdk v1.24.0
go.opentelemetry.io/otel/sdk/metric v1.24.0
go.opentelemetry.io/proto/otlp v1.2.0
google.golang.org/protobuf v1.34.1
)

require (
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/go-logfmt/logfmt v0.5.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect
google.golang.org/grpc v1.64.0 // indirect
)
52 changes: 47 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,19 +1,61 @@
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
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/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/godror/godror v0.26.3 h1:V+z+Q/OBGgmmYzuAwyJzpcn4LsPF4Ev0xHAea68V00c=
github.com/godror/godror v0.26.3/go.mod h1:1QCn6oXh3r+IlB3DLE8V6qkHXLSHd18a3Hw7szQ9/3Y=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k=
github.com/lib/pq v1.10.3 h1:v9QZf2Sn6AmjXtQeFpdoq/eaNtYP6IN+7lcrygsIAtg=
github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo=
go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo=
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.24.0 h1:f2jriWfOdldanBwS9jNBdeOKAQN7b4ugAMaNu1/1k9g=
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.24.0/go.mod h1:B+bcQI1yTY+N0vqMpoZbEN7+XU4tNM0DmUiOwebFJWI=
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.24.0 h1:mM8nKi6/iFQ0iqst80wDHU2ge198Ye/TfN0WBS5U24Y=
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.24.0/go.mod h1:0PrIIzDteLSmNyxqcGYRL4mDIo8OTuBAOI/Bn1URxac=
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.24.0 h1:JYE2HM7pZbOt5Jhk8ndWZTUWYOVift2cHjXVMkPdmdc=
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.24.0/go.mod h1:yMb/8c6hVsnma0RpsBMNo0fEiQKeclawtgaIaOp2MLY=
go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI=
go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco=
go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw=
go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg=
go.opentelemetry.io/otel/sdk/metric v1.24.0 h1:yyMQrPzF+k88/DbH7o4FMAs80puqd+9osbiBrJrz/w8=
go.opentelemetry.io/otel/sdk/metric v1.24.0/go.mod h1:I6Y5FjH6rvEnTTAYQz3Mmv2kl6Ek5IIrmwTLqMrrOE0=
go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI=
go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU=
go.opentelemetry.io/proto/otlp v1.2.0 h1:pVeZGk7nXDC9O2hncA6nHldxEjm6LByfA2aN8IOkz94=
go.opentelemetry.io/proto/otlp v1.2.0/go.mod h1:gGpR8txAl5M03pDhMC79G6SdqNV26naRm/KDsgaHD8A=
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5 h1:P8OJ/WCl/Xo4E4zoe4/bifHpSmmKwARqyqE4nW6J2GQ=
google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5/go.mod h1:RGnPtTG7r4i8sPlNyDeikXF99hMM+hN6QMm4ooG9g2g=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 h1:AgADTJarZTBqgjiUzRgfaBchgYB3/WFTC80GPwsMcRI=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY=
google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
53 changes: 50 additions & 3 deletions lib/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ import (
"github.com/paypal/hera/cal"
"github.com/paypal/hera/config"
"github.com/paypal/hera/utility/logger"
otelconfig "github.com/paypal/hera/utility/logger/otel/config"

"os"
"path/filepath"
"strings"
"sync/atomic"
)

//The Config contains all the static configuration
// The Config contains all the static configuration
type Config struct {
CertChainFile string
KeyFile string // leave blank for no SSL
Expand Down Expand Up @@ -222,7 +224,7 @@ func parseMapStrStr(encoded string) map[string]string {
}

// InitConfig initializes the configuration, both the static configuration (from hera.txt) and the dynamic configuration
func InitConfig() error {
func InitConfig(poolName string) error {
currentDir, abserr := filepath.Abs(filepath.Dir(os.Args[0]))

if abserr != nil {
Expand Down Expand Up @@ -465,9 +467,39 @@ func InitConfig() error {
gAppConfig.MaxDesiredHealthyWorkerPct = 90
}

//Initialize OTEL configs
initializeOTELConfigs(cdb, poolName)
if logger.GetLogger().V(logger.Info) {
otelconfig.OTelConfigData.Dump()
}
return nil
}

// This function takes care of initialize OTEL configuration
func initializeOTELConfigs(cdb config.Config, poolName string) {
otelconfig.OTelConfigData = &otelconfig.OTelConfig{}
//TODO initialize the values
otelconfig.OTelConfigData.Enabled = cdb.GetOrDefaultBool("enable_otel", false)
otelconfig.OTelConfigData.SkipCalStateLog = cdb.GetOrDefaultBool("skip_cal_statelog", false)
otelconfig.OTelConfigData.MetricNamePrefix = cdb.GetOrDefaultString("otel_metric_prefix", "pp.occ")
otelconfig.OTelConfigData.Host = cdb.GetOrDefaultString("otel_agent_host", "localhost")
otelconfig.OTelConfigData.MetricsPort = cdb.GetOrDefaultInt("otel_agent_metrics_port", 4318)
otelconfig.OTelConfigData.TracePort = cdb.GetOrDefaultInt("otel_agent_trace_port", 4318)
otelconfig.OTelConfigData.OtelMetricGRPC = cdb.GetOrDefaultBool("otel_agent_use_grpc_metric", false)
otelconfig.OTelConfigData.OtelTraceGRPC = cdb.GetOrDefaultBool("otel_agent_use_grpc_trace", false)
otelconfig.OTelConfigData.MetricsURLPath = cdb.GetOrDefaultString("otel_agent_metrics_uri", "")
otelconfig.OTelConfigData.TraceURLPath = cdb.GetOrDefaultString("otel_agent_trace_uri", "")
otelconfig.OTelConfigData.PoolName = poolName
otelconfig.OTelConfigData.UseTls = cdb.GetOrDefaultBool("otel_use_tls", false)
otelconfig.OTelConfigData.TLSCertPath = cdb.GetOrDefaultString("otel_tls_cert_path", "")
otelconfig.OTelConfigData.ResolutionTimeInSec = cdb.GetOrDefaultInt("otel_resolution_time_in_sec", 1)
otelconfig.OTelConfigData.ExporterTimeout = cdb.GetOrDefaultInt("otel_exporter_time_in_sec", 30)
otelconfig.OTelConfigData.EnableRetry = cdb.GetOrDefaultBool("otel_enable_exporter_retry", false)
otelconfig.OTelConfigData.ResourceType = gAppConfig.StateLogPrefix
otelconfig.OTelConfigData.OTelErrorReportingInterval = cdb.GetOrDefaultInt("otel_error_reporting_interval_in_sec", 60)
otelconfig.SetOTelIngestToken(cdb.GetOrDefaultString("otel_ingest_token", ""))
}

func LogOccConfigs() {
whiteListConfigs := map[string]map[string]interface{}{
"BACKLOG": {
Expand All @@ -480,6 +512,18 @@ func LogOccConfigs() {
"bouncer_startup_delay": gAppConfig.BouncerStartupDelay,
"bouncer_poll_interval_ms": gAppConfig.BouncerPollInterval,
},
"OTEL": {
"enable_otel": otelconfig.OTelConfigData.Enabled,
"otel_use_tls": otelconfig.OTelConfigData.UseTls,
"skip_cal_statelog": otelconfig.OTelConfigData.SkipCalStateLog,
"otel_agent_host": otelconfig.OTelConfigData.Host,
"otel_agent_metrics_port": otelconfig.OTelConfigData.MetricsPort,
"otel_agent_trace_port": otelconfig.OTelConfigData.TracePort,
"otel_agent_metrics_uri": otelconfig.OTelConfigData.MetricsURLPath,
"otel_agent_trace_uri": otelconfig.OTelConfigData.TraceURLPath,
"otel_resolution_time_in_sec": otelconfig.OTelConfigData.ResolutionTimeInSec,
"otel_error_reporting_interval_in_sec": otelconfig.OTelConfigData.OTelErrorReportingInterval,
},
"PROFILE": {
"enable_profile": gAppConfig.EnableProfile,
"profile_http_port": gAppConfig.ProfileHTTPPort,
Expand Down Expand Up @@ -579,6 +623,10 @@ func LogOccConfigs() {
if !gAppConfig.BouncerEnabled {
continue
}
case "OTEL":
if !otelconfig.OTelConfigData.Enabled {
continue
}
case "PROFILE":
if !gAppConfig.EnableProfile {
continue
Expand Down Expand Up @@ -612,7 +660,6 @@ func LogOccConfigs() {
}
evt.Completed()
}

}

// CheckOpsConfigChange checks if the ops config file needs to be reloaded and reloads it if necessary.
Expand Down
24 changes: 22 additions & 2 deletions lib/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
package lib

import (
"context"
"flag"
"fmt"
otellogger "github.com/paypal/hera/utility/logger/otel"
otelconfig "github.com/paypal/hera/utility/logger/otel/config"
"math/rand"
"os"
"os/signal"
Expand Down Expand Up @@ -50,7 +53,7 @@ func Run() {

rand.Seed(time.Now().Unix())

err := InitConfig()
err := InitConfig(*namePtr)
if err != nil {
if logger.GetLogger().V(logger.Alert) {
logger.GetLogger().Log(logger.Alert, "failed to initialize configuration:", err.Error())
Expand Down Expand Up @@ -106,7 +109,24 @@ func Run() {
caltxn.SetCorrelationID("runtxn")
caltxn.Completed()

GetStateLog().SetStartTime(time.Now())
//Initialize OTEL
if otelconfig.OTelConfigData.Enabled {
shutdownFunc, err := otellogger.Init(context.Background())
if err != nil {
logger.GetLogger().Log(logger.Alert, fmt.Sprintf("failed to initialize OTEL, err: %v", err))
evt := cal.NewCalEvent("OTEL_INIT", *namePtr, "2", fmt.Sprintf("erro: %v", err))
evt.Completed()
if otelconfig.OTelConfigData.SkipCalStateLog {
logger.GetLogger().Log(logger.Alert, fmt.Sprintf("OTEL initialization failed. Only the OTEL state-log has been enabled. It is not safe to start the server"))
FullShutdown()
}
}
GetStateLog().SetStartTime(time.Now())
defer otellogger.StopMetricCollection() //Stop sending metrics data
defer shutdownFunc(context.Background()) //During exit from mux, this will takecare of OTEL providers clean-up
} else {
GetStateLog().SetStartTime(time.Now())
}

go func() {
sleep := time.Duration(GetConfig().ConfigReloadTimeMs)
Expand Down
Loading