Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Add gauges example.#1107

Merged
rghetia merged 2 commits intocensus-instrumentation:devfrom
rghetia:gauge_example
Apr 15, 2019
Merged

Add gauges example.#1107
rghetia merged 2 commits intocensus-instrumentation:devfrom
rghetia:gauge_example

Conversation

@rghetia
Copy link
Copy Markdown
Contributor

@rghetia rghetia commented Apr 15, 2019

fixes #1035 partially

@rghetia rghetia requested review from a team and rakyll as code owners April 15, 2019 19:22
@rghetia rghetia requested a review from songy23 April 15, 2019 19:22

[embedmd]:# (gauge.go record)
```go
allocEntry.Set(int64(getAlloc())) // int64 gauge
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: indentation seems to be off.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is auto generated.

[embedmd]:# (gauge.go alloc)
```go
allocGauge, err := r.AddInt64Gauge(
"process/heap/alloc",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Prometheus doesn't allow '/', consider replacing with '_' instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prometheus exporter replaces '/' with ''.
Should we '/' or '
' be based on exporter? or based on what is more appropriate generically?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this example I'm inclined to be consistent with the exporter, since it will be confusing if users see the '/' characters being swapped on Prometheus endpoint. In addition the readme suggests the metric names use '_' ("process_heap_alloc"): https://github.com/census-instrumentation/opencensus-go/pull/1107/files#diff-2b3521dd2010161fca962a345a4eaddeR21.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SG

@rghetia rghetia merged commit e53f09a into census-instrumentation:dev Apr 15, 2019
@rghetia rghetia deleted the gauge_example branch April 15, 2019 22:25
@rghetia rghetia mentioned this pull request Apr 24, 2019
2 tasks
rghetia added a commit to rghetia/opencensus-go that referenced this pull request Apr 25, 2019
* Add gauges example.

* use _ instead of /
rghetia added a commit that referenced this pull request Apr 25, 2019
* Add gauges example.

* use _ instead of /
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants