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

Update metric types to not use pointer receivers #462

Merged
merged 2 commits into from
Feb 4, 2020

Conversation

MrAlias
Copy link
Contributor

@MrAlias MrAlias commented Feb 3, 2020

The methods on the Float64Gauge, Int64Gauge, Float64Counter, Int64Counter, Float64Measure, and Int64Measure structs do not need to mutate the internal state of the struct and can therefore be defined instead to have value receivers. This aligns closer to the function signatures of each instruments constructor function (which return values). Additionally, this change means calls to these methods do not need an allocation to the heap.

Resolves #440

The methods on the `Float64Gauge`, `Int64Gauge`, `Float64Counter`,
`Int64Counter`, `Float64Measure`, and `Int64Measure` `struct`s do not
need to mutate the internal state of the `struct` and can therefore be
defined with value receivers instead. This aligns closer to the function
signatures of each instruments constructor function. Additionally, this
change means calls to these methods do not need an allocation to the
heap.

Resolves #440
@rghetia rghetia merged commit 493e13f into open-telemetry:master Feb 4, 2020
@MrAlias MrAlias deleted the change-metric-receivers branch February 4, 2020 18:46
@MrAlias MrAlias mentioned this pull request Feb 11, 2020
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Counters, Gauges and Measures return bare structs when methods have pointer recievers
3 participants