Skip to content

Commit

Permalink
[pdata/plog] Rename severity number constant
Browse files Browse the repository at this point in the history
Do not use uppercase in severity number constants for consistency with other pdata constants. Old constants are deprecated.
  • Loading branch information
dmitryax committed Aug 17, 2022
1 parent 8cb6af9 commit d8beb25
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 57 deletions.
4 changes: 2 additions & 2 deletions internal/testdata/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}))
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions pdata/internal/cmd/pdatagen/internal/log_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ var logRecord = &messageValueStruct{
originFieldName: "SeverityNumber",
returnType: "SeverityNumber",
rawType: "otlplogs.SeverityNumber",
defaultVal: `SeverityNumberUNDEFINED`,
testVal: `SeverityNumberINFO`,
defaultVal: `SeverityNumberUndefined`,
testVal: `SeverityNumberInfo`,
},
bodyField,
attributes,
Expand Down
6 changes: 3 additions & 3 deletions pdata/internal/generated_plog_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 25 additions & 25 deletions pdata/internal/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
127 changes: 102 additions & 25 deletions pdata/plog/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

0 comments on commit d8beb25

Please sign in to comment.