Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
Add support for Summary type and value.
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdandrutu committed Sep 16, 2018
1 parent d3b7200 commit c492e59
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/opencensus/proto/metrics/v1/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ proto_library(
srcs = ["metrics.proto"],
deps = [
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:wrappers_proto",
],
)

Expand Down
53 changes: 49 additions & 4 deletions src/opencensus/proto/metrics/v1/metrics.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ syntax = "proto3";
package opencensus.proto.metrics.v1;

import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";

option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1";

Expand Down Expand Up @@ -91,6 +92,13 @@ message MetricDescriptor {
// Distribution cumulative measurement. The count can only go up, if resets
// then the start_time should also be reset.
CUMULATIVE_DISTRIBUTION = 5;

// Old libraries implemented Histograms as a summary samples observations
// (usually things like request durations and response sizes). While it
// also provides a total count of observations and a sum of all observed
// values, it calculates configurable quantiles over a sliding time window.
// This is not recommended, since cannot be aggregated.
SUMMARY = 7;
}
Type type = 4;

Expand Down Expand Up @@ -151,10 +159,8 @@ message Point {
// A distribution value.
DistributionValue distribution_value = 4;

// TODO: Add support for Summary type. This is an aggregation that produces
// percentiles directly.
//
// See also: https://prometheus.io/docs/concepts/metric_types/#summary
// A summary value.
SummaryValue summary_value = 5;
}
}

Expand Down Expand Up @@ -234,3 +240,42 @@ message DistributionValue {
map<string, string> attachments = 3;
}
}

// The start_timestamp only applies to the count and sum in the SummaryValue.
message SummaryValue {
// The total number of recorded values from the beginning. Optional since
// some systems don't expose this.
UInt64Value count = 1;

// The total sum of recorded values from the beginning. Optional since some
// systems don't expose this. If count is zero then this field must be zero
// or not set (if not supported).
DoubleValue sum = 2;

// The values in this message can be reset at arbitrary unknown times, with
// the requirement that all of them are reset at the same time.
message Snapshot {
// The number of values in the snapshot. Optional since some systems don't
// expose this.
UInt64Value count = 1;

// The sum of values in the snapshot. Optional since some systems don't
// expose this. If count is zero then this field must be zero or not set
// (if not supported).
DoubleValue sum = 2;

repeated Quantile quantiles = 3;

message Quantile {
// Must be in the interval (0.0, 1.0]
required double quantile = 1;

// The value of the quantile.
required double value = 2;
}
}

// Values calculated from over a sliding time window.
Snapshot snapshot = 3;
}

0 comments on commit c492e59

Please sign in to comment.