Skip to content

Commit 054cd20

Browse files
committed
fix: header keys
1 parent 8a5470e commit 054cd20

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pkg/cmd/log.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/agoda-com/opentelemetry-go/otelslog"
1414
)
1515

16-
// ExporterFactory - Create log handler according to given params
16+
// HandlerFactory - Create log handler according to given params
1717
func HandlerFactory(name string, endpoint string, insecure bool, urlpath string, headers map[string]string, protocol string, level slog.Leveler) (slog.Handler, error) {
1818
switch name {
1919
case "otlp", "otlp-http", "otlp-grpc":
@@ -44,8 +44,8 @@ func NewOTLPHandler(endpoint string, insecure bool, urlPath string, headers map[
4444

4545
func NewGCPHandler(headers map[string]string, level slog.Leveler) (slog.Handler, error) {
4646
// Retrieve Google Cloud credentials from headers
47-
creds := headers["GOOGLE_APPLICATION_CREDENTIALS"]
48-
projectId := headers["GOOGLE_CLOUD_PROJECT"]
47+
creds := headers["google-application-credentials"]
48+
projectId := headers["google-cloud-project"]
4949

5050
if projectId == "" {
5151
return nil, errors.New("missing GOOGLE_CLOUD_PROJECT in headers")
@@ -61,6 +61,5 @@ func NewGCPHandler(headers map[string]string, level slog.Leveler) (slog.Handler,
6161
gcpHandler := sloggcp.NewGoogleCloudSlogHandler(context.Background(), projectId, logName, &slog.HandlerOptions{
6262
Level: level,
6363
})
64-
6564
return gcpHandler, nil
6665
}

0 commit comments

Comments
 (0)