Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace List log value kind with Slice #4919

Closed
MrAlias opened this issue Feb 12, 2024 · 3 comments · Fixed by #4936
Closed

Replace List log value kind with Slice #4919

MrAlias opened this issue Feb 12, 2024 · 3 comments · Fixed by #4936
Assignees
Labels
area:logs Part of OpenTelemetry logs

Comments

@MrAlias
Copy link
Contributor

MrAlias commented Feb 12, 2024

The specification states this type as ...

An array (a list) of any values

We currently use the term "List" for these value types in the logs bridge API design.

Given Go does not use this term, it seems fitting to call it something more native. Use Slice instead:

const (
	KindEmpty Kind = iota
	// ..
	KindSlice
	// ...
)

// Value factory:

func SliceValue(vs ...Value) Value

// Value accessor:

func (v Value) AsSlice() []Value

// KeyValue factory:

func Slice(key string, args ...Value) KeyValue

Alternatives

  • We could also use the term "Array"
  • Leave it as "List"
@MrAlias MrAlias added the area:logs Part of OpenTelemetry logs label Feb 12, 2024
@pellared
Copy link
Member

pellared commented Feb 12, 2024

I support the proposal. For what I remember the only reasons I decided to call it List were:

  • the term exists is spec and I thought it might be easier by TC when reviewing
  • the name is shorter (by 1 character 😆) than Slice

I find Slice more accurate and idiomatic

@MrAlias
Copy link
Contributor Author

MrAlias commented Feb 15, 2024

Plan is to wait for #4907 to merge prior to addressing.

@MrAlias MrAlias self-assigned this Feb 16, 2024
@MrAlias MrAlias moved this from Todo to In Progress in Go: Logs (GA) Feb 16, 2024
@XSAM
Copy link
Member

XSAM commented Feb 16, 2024

I also support the proposal, as we already use the slice term in our kv.go. Using slice can keep consistency.

// BoolSlice creates a KeyValue with a BOOLSLICE Value type.
func BoolSlice(k string, v []bool) KeyValue {
return Key(k).BoolSlice(v)
}

@github-project-automation github-project-automation bot moved this from In Progress to Done in Go: Logs (GA) Feb 18, 2024
@MrAlias MrAlias added this to the v1.24.0 milestone Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:logs Part of OpenTelemetry logs
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants