-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add example for sync gauge in Go #4610
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -534,6 +534,34 @@ func removeItem() { | |||||||
} | ||||||||
``` | ||||||||
|
||||||||
### Using Gauges | ||||||||
|
||||||||
Gauges are used to measure non-additive values when changes occur. | ||||||||
|
||||||||
For example, here's how you report the speed of a CPU fan: | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
||||||||
```go | ||||||||
import ( | ||||||||
"net/http" | ||||||||
|
||||||||
"go.opentelemetry.io/otel/metric" | ||||||||
) | ||||||||
|
||||||||
func init() { | ||||||||
speedGauge, err := meter.Int64Gauge( | ||||||||
"cpu.fan.speed", | ||||||||
metric.WithDescription("Speed of CPU fan"), | ||||||||
metric.WithUnit("RPM"), | ||||||||
) | ||||||||
if err != nil { | ||||||||
panic(err) | ||||||||
} | ||||||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { | ||||||||
speedGauge.Record(r.Context(), 1500) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the suggestion. Applied and pushed. |
||||||||
}) | ||||||||
} | ||||||||
``` | ||||||||
|
||||||||
### Using Histograms | ||||||||
|
||||||||
Histograms are used to measure a distribution of values over time. | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use sentence case in titles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the feedback. I noticed that other titles like 'Using Histograms' also start with capital letters. Could you give me more detail on which part i should fix?