-
Notifications
You must be signed in to change notification settings - Fork 175
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
Custom attribute support #586
Labels
Comments
Merged
echlebek
added a commit
that referenced
this issue
Nov 22, 2017
echlebek
added a commit
that referenced
this issue
Nov 22, 2017
Add tests for json Marshal/Unmarshal. Refs #586
echlebek
added a commit
that referenced
this issue
Nov 22, 2017
echlebek
added a commit
that referenced
this issue
Nov 22, 2017
Refs #586 goos: linux goarch: amd64 pkg: github.com/sensu/sensu-go/types/dynamic BenchmarkQueryGovaluateSimple-4 500000 2069 ns/op 992 B/op 25 allocs/op BenchmarkQueryGovaluateComplex-4 200000 6212 ns/op 2544 B/op 75 allocs/op BenchmarkUnmarshal-4 200000 6492 ns/op 6568 B/op 57 allocs/op BenchmarkMarshal-4 300000 4556 ns/op 6512 B/op 40 allocs/op PASS ok github.com/sensu/sensu-go/types/dynamic 6.172s
echlebek
added a commit
that referenced
this issue
Nov 22, 2017
This change makes the package significantly easier to use, and also presents a greater symmetry between its types and functions. This comes at a cost of additional reflection, which can be seen in the benchmark for Unmarshal. Old: BenchmarkUnmarshal-4 6492 ns/op 6568 B/op 57 allocs/op New: BenchmarkUnmarshal-4 9244 ns/op 7592 B/op 77 allocs/op Refs #586
echlebek
added a commit
that referenced
this issue
Nov 22, 2017
echlebek
added a commit
that referenced
this issue
Nov 22, 2017
Add tests for json Marshal/Unmarshal. Refs #586
echlebek
added a commit
that referenced
this issue
Nov 22, 2017
echlebek
added a commit
that referenced
this issue
Nov 22, 2017
Refs #586 goos: linux goarch: amd64 pkg: github.com/sensu/sensu-go/types/dynamic BenchmarkQueryGovaluateSimple-4 500000 2069 ns/op 992 B/op 25 allocs/op BenchmarkQueryGovaluateComplex-4 200000 6212 ns/op 2544 B/op 75 allocs/op BenchmarkUnmarshal-4 200000 6492 ns/op 6568 B/op 57 allocs/op BenchmarkMarshal-4 300000 4556 ns/op 6512 B/op 40 allocs/op PASS ok github.com/sensu/sensu-go/types/dynamic 6.172s
echlebek
added a commit
that referenced
this issue
Nov 22, 2017
This change makes the package significantly easier to use, and also presents a greater symmetry between its types and functions. This comes at a cost of additional reflection, which can be seen in the benchmark for Unmarshal. Old: BenchmarkUnmarshal-4 6492 ns/op 6568 B/op 57 allocs/op New: BenchmarkUnmarshal-4 9244 ns/op 7592 B/op 77 allocs/op Refs #586
I've opened Knetic/govaluate#84 in support of this work. |
echlebek
added a commit
that referenced
this issue
Nov 23, 2017
Now that govaluate has been modified to recursively query Parameters, we can return a lazy tree of AnyParameters instead of dynamically generating structs. This saves quite a bit of code, CPU time, and memory allocations. Old struct generation BenchmarkQueryGovaluateSimple-4 2069 ns/op 992 B/op 25 allocs/op BenchmarkQueryGovaluateComplex-4 6212 ns/op 2544 B/op 75 allocs/op New lazy json parsing BenchmarkQueryGovaluateSimple-4 1404 ns/op 320 B/op 18 allocs/op BenchmarkQueryGovaluateComplex-4 2617 ns/op 512 B/op 30 allocs/op Refs #586
echlebek
added a commit
that referenced
this issue
Nov 23, 2017
echlebek
added a commit
that referenced
this issue
Nov 23, 2017
echlebek
added a commit
that referenced
this issue
Nov 23, 2017
Reduces cost of querying in the most common case. Refs #586
echlebek
added a commit
that referenced
this issue
Nov 23, 2017
* Break up Attributer interface into AttrGetter and AttrSetter. * Get rid of the Attributes type in favour of simple []byte. * Make AttrGetter method set match what protobuf might generate. * When returning struct fields from GetField, use reflect.Indirect so that pointers are never returned. * Make sure that extended attributes are never returned by GetField and never marshaled by Marshal. Refs #586
echlebek
added a commit
that referenced
this issue
Nov 23, 2017
echlebek
added a commit
that referenced
this issue
Nov 23, 2017
Add tests for json Marshal/Unmarshal. Refs #586
echlebek
added a commit
that referenced
this issue
Nov 23, 2017
echlebek
added a commit
that referenced
this issue
Nov 23, 2017
Refs #586 goos: linux goarch: amd64 pkg: github.com/sensu/sensu-go/types/dynamic BenchmarkQueryGovaluateSimple-4 500000 2069 ns/op 992 B/op 25 allocs/op BenchmarkQueryGovaluateComplex-4 200000 6212 ns/op 2544 B/op 75 allocs/op BenchmarkUnmarshal-4 200000 6492 ns/op 6568 B/op 57 allocs/op BenchmarkMarshal-4 300000 4556 ns/op 6512 B/op 40 allocs/op PASS ok github.com/sensu/sensu-go/types/dynamic 6.172s
echlebek
added a commit
that referenced
this issue
Nov 23, 2017
This change makes the package significantly easier to use, and also presents a greater symmetry between its types and functions. This comes at a cost of additional reflection, which can be seen in the benchmark for Unmarshal. Old: BenchmarkUnmarshal-4 6492 ns/op 6568 B/op 57 allocs/op New: BenchmarkUnmarshal-4 9244 ns/op 7592 B/op 77 allocs/op Refs #586
echlebek
added a commit
that referenced
this issue
Nov 23, 2017
Now that govaluate has been modified to recursively query Parameters, we can return a lazy tree of AnyParameters instead of dynamically generating structs. This saves quite a bit of code, CPU time, and memory allocations. Old struct generation BenchmarkQueryGovaluateSimple-4 2069 ns/op 992 B/op 25 allocs/op BenchmarkQueryGovaluateComplex-4 6212 ns/op 2544 B/op 75 allocs/op New lazy json parsing BenchmarkQueryGovaluateSimple-4 1404 ns/op 320 B/op 18 allocs/op BenchmarkQueryGovaluateComplex-4 2617 ns/op 512 B/op 30 allocs/op Refs #586
echlebek
added a commit
that referenced
this issue
Nov 23, 2017
echlebek
added a commit
that referenced
this issue
Nov 23, 2017
echlebek
added a commit
that referenced
this issue
Nov 23, 2017
Reduces cost of querying in the most common case. Refs #586
echlebek
added a commit
that referenced
this issue
Nov 23, 2017
* Break up Attributer interface into AttrGetter and AttrSetter. * Get rid of the Attributes type in favour of simple []byte. * Make AttrGetter method set match what protobuf might generate. * When returning struct fields from GetField, use reflect.Indirect so that pointers are never returned. * Make sure that extended attributes are never returned by GetField and never marshaled by Marshal. Refs #586
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In #458, the need for setting custom attributes in the CLI is identified. In this issue, I'll lay out a proposal for dynamic behaviour based on dynamic attributes in Sensu entities.
The text was updated successfully, but these errors were encountered: