diff --git a/otelcollector/build/windows/Dockerfile b/otelcollector/build/windows/Dockerfile index 408e407c..d1f1fafb 100644 --- a/otelcollector/build/windows/Dockerfile +++ b/otelcollector/build/windows/Dockerfile @@ -35,7 +35,7 @@ COPY ./fluent-bit/fluent-bit-windows.conf $tmpdir/fluent-bit/ COPY ./fluent-bit/fluent-bit-parsers.conf $tmpdir/fluent-bit/ COPY ./fluent-bit/src/out_appinsights.so $tmpdir/fluent-bit/bin/ COPY ./main/main.exe $tmpdir/microsoft -COPY ./react /Users/ContainerAdministrator/Documents/static/react +COPY ./react /static/react COPY ./LICENSE $tmpdir/microsoft COPY ./NOTICE $tmpdir/microsoft diff --git a/otelcollector/build/windows/scripts/setup.ps1 b/otelcollector/build/windows/scripts/setup.ps1 index 75299e2e..6a069553 100644 --- a/otelcollector/build/windows/scripts/setup.ps1 +++ b/otelcollector/build/windows/scripts/setup.ps1 @@ -12,6 +12,7 @@ New-Item -Type Directory -Path /opt/microsoft/liveness -ErrorAction SilentlyCont New-Item -Type Directory -Path /opt/genevamonitoringagent -ErrorAction SilentlyContinue New-Item -Type Directory -Path /opt/genevamonitoringagent/datadirectory -ErrorAction SilentlyContinue New-Item -Type Directory -Path /etc/genevamonitoringagent +New-Item -Type Directory -Path /static/react -Force -ErrorAction SilentlyContinue ############################################################################################ Write-Host ('Installing Metrics Extension'); try { diff --git a/otelcollector/shared/telemetry.go b/otelcollector/shared/telemetry.go index 50814517..db039dea 100644 --- a/otelcollector/shared/telemetry.go +++ b/otelcollector/shared/telemetry.go @@ -51,30 +51,12 @@ func SetupTelemetry(customEnvironment string) { return } - // Append export commands to .bashrc file - bashrcPath := os.Getenv("HOME") + "/.bashrc" - bashrcFile, err := os.OpenFile(bashrcPath, os.O_APPEND|os.O_WRONLY, 0644) + // Export APPLICATIONINSIGHTS_ENDPOINT + err = SetEnvAndSourceBashrcOrPowershell("APPLICATIONINSIGHTS_ENDPOINT", aiEndpoint , false) if err != nil { - fmt.Println("Error opening .bashrc file:", err) + fmt.Println("Error setting APPLICATIONINSIGHTS_ENDPOINT environment variable:", err) return } - defer bashrcFile.Close() - - exportAIKeyCommand := fmt.Sprintf("export APPLICATIONINSIGHTS_AUTH=%s\n", encodedAIKey) - _, err = bashrcFile.WriteString(exportAIKeyCommand) - if err != nil { - fmt.Println("Error writing to .bashrc file:", err) - return - } - - if aiEndpoint != "" { - exportEndpointCommand := fmt.Sprintf("export APPLICATIONINSIGHTS_ENDPOINT=\"%s\"\n", aiEndpoint) - _, err = bashrcFile.WriteString(exportEndpointCommand) - if err != nil { - fmt.Println("Error writing to .bashrc file:", err) - return - } - } // Setting TELEMETRY_APPLICATIONINSIGHTS_KEY aiKeyBytes, err := base64.StdEncoding.DecodeString(encodedAIKey) @@ -90,10 +72,4 @@ func SetupTelemetry(customEnvironment string) { return } - exportTelegrafCommand := fmt.Sprintf("export TELEMETRY_APPLICATIONINSIGHTS_KEY=%s\n", aiKey) - _, err = bashrcFile.WriteString(exportTelegrafCommand) - if err != nil { - fmt.Println("Error writing to .bashrc file:", err) - return - } }