diff --git a/CHANGELOG.md b/CHANGELOG.md index 9841b1a40bf..13b92151835 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ - Deprecates `LogRecord.Flags()` and `LogRecord.SetFlags()` in favor of `LogRecord.FlagsStruct()`. (#5866) - Deprecate `exporterhelper.New[Traces|Metrics|Logs]ExporterWithContext` in favor of `exporterhelper.New[Traces|Metrics|Logs]Exporter` (#5914) - Deprecate `component.NewExtensionFactoryWithStabilityLevel` in favor of `component.NewExtensionFactory` (#5917) +- Deprecate `plog.SeverityNumber[UPPERCASE]` constants (#5927) ### 💡 Enhancements 💡 diff --git a/internal/testdata/log.go b/internal/testdata/log.go index b2633fafb13..3d1f8473822 100644 --- a/internal/testdata/log.go +++ b/internal/testdata/log.go @@ -44,7 +44,7 @@ func GenerateLogs(count int) plog.Logs { func fillLogOne(log plog.LogRecord) { log.SetTimestamp(logTimestamp) log.SetDroppedAttributesCount(1) - log.SetSeverityNumber(plog.SeverityNumberINFO) + log.SetSeverityNumber(plog.SeverityNumberInfo) log.SetSeverityText("Info") log.SetSpanID(pcommon.NewSpanID([8]byte{0x01, 0x02, 0x04, 0x08})) log.SetTraceID(pcommon.NewTraceID([16]byte{0x08, 0x04, 0x02, 0x01})) @@ -59,7 +59,7 @@ func fillLogOne(log plog.LogRecord) { func fillLogTwo(log plog.LogRecord) { log.SetTimestamp(logTimestamp) log.SetDroppedAttributesCount(1) - log.SetSeverityNumber(plog.SeverityNumberINFO) + log.SetSeverityNumber(plog.SeverityNumberInfo) log.SetSeverityText("Info") attrs := log.Attributes() diff --git a/pdata/internal/cmd/pdatagen/internal/log_structs.go b/pdata/internal/cmd/pdatagen/internal/log_structs.go index 918762ecb1c..f52c75f0b93 100644 --- a/pdata/internal/cmd/pdatagen/internal/log_structs.go +++ b/pdata/internal/cmd/pdatagen/internal/log_structs.go @@ -126,8 +126,8 @@ var logRecord = &messageValueStruct{ originFieldName: "SeverityNumber", returnType: "SeverityNumber", rawType: "otlplogs.SeverityNumber", - defaultVal: `SeverityNumberUNDEFINED`, - testVal: `SeverityNumberINFO`, + defaultVal: `SeverityNumberUndefined`, + testVal: `SeverityNumberInfo`, }, bodyField, attributes, diff --git a/pdata/internal/generated_plog_test.go b/pdata/internal/generated_plog_test.go index 00fb4ad69ed..9950f7b1b1b 100644 --- a/pdata/internal/generated_plog_test.go +++ b/pdata/internal/generated_plog_test.go @@ -501,8 +501,8 @@ func TestLogRecord_SeverityText(t *testing.T) { func TestLogRecord_SeverityNumber(t *testing.T) { ms := NewLogRecord() - assert.EqualValues(t, SeverityNumberUNDEFINED, ms.SeverityNumber()) - testValSeverityNumber := SeverityNumberINFO + assert.EqualValues(t, SeverityNumberUndefined, ms.SeverityNumber()) + testValSeverityNumber := SeverityNumberInfo ms.SetSeverityNumber(testValSeverityNumber) assert.EqualValues(t, testValSeverityNumber, ms.SeverityNumber()) } @@ -608,7 +608,7 @@ func fillTestLogRecord(tv LogRecord) { tv.SetSpanID(NewSpanID([8]byte{1, 2, 3, 4, 5, 6, 7, 8})) fillTestLogRecordFlags(tv.FlagsStruct()) tv.SetSeverityText("INFO") - tv.SetSeverityNumber(SeverityNumberINFO) + tv.SetSeverityNumber(SeverityNumberInfo) fillTestValue(tv.Body()) fillTestMap(tv.Attributes()) tv.SetDroppedAttributesCount(uint32(17)) diff --git a/pdata/internal/logs.go b/pdata/internal/logs.go index f36659900d9..170affb92b3 100644 --- a/pdata/internal/logs.go +++ b/pdata/internal/logs.go @@ -92,31 +92,31 @@ func (ld Logs) ResourceLogs() ResourceLogsSlice { type SeverityNumber int32 const ( - SeverityNumberUNDEFINED = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_UNSPECIFIED) - SeverityNumberTRACE = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_TRACE) - SeverityNumberTRACE2 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_TRACE2) - SeverityNumberTRACE3 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_TRACE3) - SeverityNumberTRACE4 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_TRACE4) - SeverityNumberDEBUG = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_DEBUG) - SeverityNumberDEBUG2 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_DEBUG2) - SeverityNumberDEBUG3 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_DEBUG3) - SeverityNumberDEBUG4 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_DEBUG4) - SeverityNumberINFO = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_INFO) - SeverityNumberINFO2 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_INFO2) - SeverityNumberINFO3 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_INFO3) - SeverityNumberINFO4 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_INFO4) - SeverityNumberWARN = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_WARN) - SeverityNumberWARN2 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_WARN2) - SeverityNumberWARN3 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_WARN3) - SeverityNumberWARN4 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_WARN4) - SeverityNumberERROR = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_ERROR) - SeverityNumberERROR2 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_ERROR2) - SeverityNumberERROR3 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_ERROR3) - SeverityNumberERROR4 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_ERROR4) - SeverityNumberFATAL = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_FATAL) - SeverityNumberFATAL2 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_FATAL2) - SeverityNumberFATAL3 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_FATAL3) - SeverityNumberFATAL4 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_FATAL4) + SeverityNumberUndefined = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_UNSPECIFIED) + SeverityNumberTrace = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_TRACE) + SeverityNumberTrace2 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_TRACE2) + SeverityNumberTrace3 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_TRACE3) + SeverityNumberTrace4 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_TRACE4) + SeverityNumberDebug = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_DEBUG) + SeverityNumberDebug2 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_DEBUG2) + SeverityNumberDebug3 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_DEBUG3) + SeverityNumberDebug4 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_DEBUG4) + SeverityNumberInfo = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_INFO) + SeverityNumberInfo2 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_INFO2) + SeverityNumberInfo3 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_INFO3) + SeverityNumberInfo4 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_INFO4) + SeverityNumberWarn = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_WARN) + SeverityNumberWarn2 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_WARN2) + SeverityNumberWarn3 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_WARN3) + SeverityNumberWarn4 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_WARN4) + SeverityNumberError = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_ERROR) + SeverityNumberError2 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_ERROR2) + SeverityNumberError3 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_ERROR3) + SeverityNumberError4 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_ERROR4) + SeverityNumberFatal = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_FATAL) + SeverityNumberFatal2 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_FATAL2) + SeverityNumberFatal3 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_FATAL3) + SeverityNumberFatal4 = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_FATAL4) ) // String returns the string representation of the SeverityNumber. diff --git a/pdata/plog/alias.go b/pdata/plog/alias.go index 7b989979e6f..90aed13bc09 100644 --- a/pdata/plog/alias.go +++ b/pdata/plog/alias.go @@ -29,29 +29,106 @@ var NewLogs = internal.NewLogs type SeverityNumber = internal.SeverityNumber const ( - SeverityNumberUNDEFINED = internal.SeverityNumberUNDEFINED - SeverityNumberTRACE = internal.SeverityNumberTRACE - SeverityNumberTRACE2 = internal.SeverityNumberTRACE2 - SeverityNumberTRACE3 = internal.SeverityNumberTRACE3 - SeverityNumberTRACE4 = internal.SeverityNumberTRACE4 - SeverityNumberDEBUG = internal.SeverityNumberDEBUG - SeverityNumberDEBUG2 = internal.SeverityNumberDEBUG2 - SeverityNumberDEBUG3 = internal.SeverityNumberDEBUG3 - SeverityNumberDEBUG4 = internal.SeverityNumberDEBUG4 - SeverityNumberINFO = internal.SeverityNumberINFO - SeverityNumberINFO2 = internal.SeverityNumberINFO2 - SeverityNumberINFO3 = internal.SeverityNumberINFO3 - SeverityNumberINFO4 = internal.SeverityNumberINFO4 - SeverityNumberWARN = internal.SeverityNumberWARN - SeverityNumberWARN2 = internal.SeverityNumberWARN2 - SeverityNumberWARN3 = internal.SeverityNumberWARN3 - SeverityNumberWARN4 = internal.SeverityNumberWARN4 - SeverityNumberERROR = internal.SeverityNumberERROR - SeverityNumberERROR2 = internal.SeverityNumberERROR2 - SeverityNumberERROR3 = internal.SeverityNumberERROR3 - SeverityNumberERROR4 = internal.SeverityNumberERROR4 - SeverityNumberFATAL = internal.SeverityNumberFATAL - SeverityNumberFATAL2 = internal.SeverityNumberFATAL2 - SeverityNumberFATAL3 = internal.SeverityNumberFATAL3 - SeverityNumberFATAL4 = internal.SeverityNumberFATAL4 + SeverityNumberUndefined = internal.SeverityNumberUndefined + SeverityNumberTrace = internal.SeverityNumberTrace + SeverityNumberTrace2 = internal.SeverityNumberTrace2 + SeverityNumberTrace3 = internal.SeverityNumberTrace3 + SeverityNumberTrace4 = internal.SeverityNumberTrace4 + SeverityNumberDebug = internal.SeverityNumberDebug + SeverityNumberDebug2 = internal.SeverityNumberDebug2 + SeverityNumberDebug3 = internal.SeverityNumberDebug3 + SeverityNumberDebug4 = internal.SeverityNumberDebug4 + SeverityNumberInfo = internal.SeverityNumberInfo + SeverityNumberInfo2 = internal.SeverityNumberInfo2 + SeverityNumberInfo3 = internal.SeverityNumberInfo3 + SeverityNumberInfo4 = internal.SeverityNumberInfo4 + SeverityNumberWarn = internal.SeverityNumberWarn + SeverityNumberWarn2 = internal.SeverityNumberWarn2 + SeverityNumberWarn3 = internal.SeverityNumberWarn3 + SeverityNumberWarn4 = internal.SeverityNumberWarn4 + SeverityNumberError = internal.SeverityNumberError + SeverityNumberError2 = internal.SeverityNumberError2 + SeverityNumberError3 = internal.SeverityNumberError3 + SeverityNumberError4 = internal.SeverityNumberError4 + SeverityNumberFatal = internal.SeverityNumberFatal + SeverityNumberFatal2 = internal.SeverityNumberFatal2 + SeverityNumberFatal3 = internal.SeverityNumberFatal3 + SeverityNumberFatal4 = internal.SeverityNumberFatal4 +) + +const ( + // Deprecated: [0.59.0] Use SeverityNumberUndefined instead + SeverityNumberUNDEFINED = SeverityNumberUndefined + + // Deprecated: [0.59.0] Use SeverityNumberTrace instead + SeverityNumberTRACE = SeverityNumberTrace + + // Deprecated: [0.59.0] Use SeverityNumberTrace2 instead + SeverityNumberTRACE2 = SeverityNumberTrace2 + + // Deprecated: [0.59.0] Use SeverityNumberTrace3 instead + SeverityNumberTRACE3 = SeverityNumberTrace3 + + // Deprecated: [0.59.0] Use SeverityNumberTrace4 instead + SeverityNumberTRACE4 = SeverityNumberTrace4 + + // Deprecated: [0.59.0] Use SeverityNumberDebug instead + SeverityNumberDEBUG = SeverityNumberDebug + + // Deprecated: [0.59.0] Use SeverityNumberDebug2 instead + SeverityNumberDEBUG2 = SeverityNumberDebug2 + + // Deprecated: [0.59.0] Use SeverityNumberDebug3 instead + SeverityNumberDEBUG3 = SeverityNumberDebug3 + + // Deprecated: [0.59.0] Use SeverityNumberDebug4 instead + SeverityNumberDEBUG4 = SeverityNumberDebug4 + + // Deprecated: [0.59.0] Use SeverityNumberInfo instead + SeverityNumberINFO = SeverityNumberInfo + + // Deprecated: [0.59.0] Use SeverityNumberInfo2 instead + SeverityNumberINFO2 = SeverityNumberInfo2 + + // Deprecated: [0.59.0] Use SeverityNumberInfo3 instead + SeverityNumberINFO3 = SeverityNumberInfo3 + + // Deprecated: [0.59.0] Use SeverityNumberInfo4 instead + SeverityNumberINFO4 = SeverityNumberInfo4 + + // Deprecated: [0.59.0] Use SeverityNumberWarn instead + SeverityNumberWARN = SeverityNumberWarn + + // Deprecated: [0.59.0] Use SeverityNumberWarn2 instead + SeverityNumberWARN2 = SeverityNumberWarn2 + + // Deprecated: [0.59.0] Use SeverityNumberWarn3 instead + SeverityNumberWARN3 = SeverityNumberWarn3 + + // Deprecated: [0.59.0] Use SeverityNumberWarn4 instead + SeverityNumberWARN4 = SeverityNumberWarn4 + + // Deprecated: [0.59.0] Use SeverityNumberError instead + SeverityNumberERROR = SeverityNumberError + + // Deprecated: [0.59.0] Use SeverityNumberError2 instead + SeverityNumberERROR2 = SeverityNumberError2 + + // Deprecated: [0.59.0] Use SeverityNumberError3 instead + SeverityNumberERROR3 = SeverityNumberError3 + + // Deprecated: [0.59.0] Use SeverityNumberError4 instead + SeverityNumberERROR4 = SeverityNumberError4 + + // Deprecated: [0.59.0] Use SeverityNumberFatal instead + SeverityNumberFATAL = SeverityNumberFatal + + // Deprecated: [0.59.0] Use SeverityNumberFatal2 instead + SeverityNumberFATAL2 = SeverityNumberFatal2 + + // Deprecated: [0.59.0] Use SeverityNumberFatal3 instead + SeverityNumberFATAL3 = SeverityNumberFatal3 + + // Deprecated: [0.59.0] Use SeverityNumberFatal4 instead + SeverityNumberFATAL4 = SeverityNumberFatal4 )