Skip to content
Open
Changes from all commits
Commits
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
37 changes: 37 additions & 0 deletions exporters/otlp/otlplog/otlploggrpc/internal/semconvutil.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright The OpenTelemetry Authors

Check failure on line 1 in exporters/otlp/otlplog/otlploggrpc/internal/semconvutil.go

View workflow job for this annotation

GitHub Actions / lint

package-comments: package comment should be of the form "Package internal ..." (revive)
// SPDX-License-Identifier: Apache-2.0
package internal

import (
"os"
"strings"
)

func GetStabilityMode() (emitOld, emitNew bool) {
optIn := os.Getenv("OTEL_SEMCONV_STABILITY_OPT_IN")

// Default: Only old conventions
if optIn == "" {
return true, false
}

modes := strings.Split(optIn, ",")
hasRPC := false
hasRPCDup := false
for _, m := range modes {
switch strings.TrimSpace(m) {
case "rpc/dup":
hasRPCDup = true
case "rpc":
hasRPC = true
}
}
switch {
case hasRPCDup:
return true, true // Emit BOTH (transition phase)
case hasRPC:
return false, true // Emit ONLY new
default:
return true, false // Only old conventions
}
}
Loading