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

Add metrics semantic conventions for timed operations #657

Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions specification/metrics/semantic_conventions/metric-general.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# General

The conventions described in this section are generic; they are not specific to a
particular operation.

## Summarizing timed operations

Timed operations that may be more fully described by Spans can be summarized by three
metrics: `throughput`, `duration`, and `errors`.
The name of these metrics should be namespaced with the Span category and the Span
kind.

| Name | Type |
| ---- | ---- |
|`{category}.{span.kind}.throughput` | `Counter` |
|`{category}.{span.kind}.duration` | `ValueRecorder` |
|`{category}.{span.kind}.errors` | `Counter` |
justinfoote marked this conversation as resolved.
Show resolved Hide resolved

### throughput

The throughput metric represents the total number of operations that occur.
For each timed operation that occurs, the value of the `throughput` metric should be
incremented by 1.

### duration
jmacd marked this conversation as resolved.
Show resolved Hide resolved

The duration metric represents the total duration of all operations that occur.
For each timed operation, the value of the `duration` metric should be incremented by
the duration of the operation in milliseconds.

### errors

The `errors` metric represents the total number of operations that failed.
For each timed operation that failed, the value of the `errors` metric should be
incremented by 1.

### Naming examples

A simple HTTP service would create three metrics:

* `http.server.throughput`
* `http.server.duration`
justinfoote marked this conversation as resolved.
Show resolved Hide resolved
* `http.server.errors`

If this service also calls out to other HTTP services, it would create three additional metrics:

* `http.client.throughput`
* `http.client.duration`
* `http.client.errors`

If this service also queries one or more databases, it would create three additional metrics:

* `db.client.throughput`
* `db.client.duration`
* `db.client.errors`
justinfoote marked this conversation as resolved.
Show resolved Hide resolved