Skip to content

Commit

Permalink
Deprecate LogRecord.Name(), it was deprecated in the data model (#5054)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu authored Mar 21, 2022
1 parent d95d0d6 commit 510dbab
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- `pdata.AttributeValueType` type is deprecated in favor of `pdata.ValueType`
- `pdata.AttributeValueType...` constants are deprecated in favor of `pdata.ValueType...`
- `pdata.NewAttributeValue...` funcs are deprecated in favor of `pdata.NewValue...`
- Deprecate LogRecord.Name(), it was deprecated in the data model (#5054)

## v0.47.0 Beta

Expand Down
8 changes: 7 additions & 1 deletion model/internal/cmd/pdatagen/internal/base_fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const accessorsMessageValueTestTemplate = `func Test${structName}_${fieldName}(t
}`

const accessorsPrimitiveTemplate = `// ${fieldName} returns the ${lowerFieldName} associated with this ${structName}.
func (ms ${structName}) ${fieldName}() ${returnType} {
${extraComment}func (ms ${structName}) ${fieldName}() ${returnType} {
return (*ms.orig).${originFieldName}
}
Expand Down Expand Up @@ -239,6 +239,7 @@ func (mf *messageValueField) generateCopyToValue(sb *strings.Builder) {
var _ baseField = (*messageValueField)(nil)

type primitiveField struct {
extraComment string
fieldName string
originFieldName string
returnType string
Expand All @@ -251,6 +252,11 @@ func (pf *primitiveField) generateAccessors(ms baseStruct, sb *strings.Builder)
switch name {
case "structName":
return ms.getName()
case "extraComment":
if pf.extraComment != "" {
return "//\n// " + pf.extraComment + "\n"
}
return ""
case "fieldName":
return pf.fieldName
case "lowerFieldName":
Expand Down
1 change: 1 addition & 0 deletions model/internal/cmd/pdatagen/internal/log_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ var logRecord = &messageValueStruct{
testVal: `SeverityNumberINFO`,
},
&primitiveField{
extraComment: "Deprecated: [v0.48.0] it was removed from the data model.",
fieldName: "Name",
originFieldName: "Name",
returnType: "string",
Expand Down
2 changes: 2 additions & 0 deletions model/internal/pdata/generated_log.go

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

0 comments on commit 510dbab

Please sign in to comment.