-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add kind enum type for aggregation_temporality that only allow t…
…wo types
- Loading branch information
1 parent
08b1130
commit 5b73728
Showing
14 changed files
with
228 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
metrics_sdk/lib/opentelemetry/sdk/metrics/aggregation/aggregation_temporality.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright The OpenTelemetry Authors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
module OpenTelemetry | ||
module SDK | ||
module Metrics | ||
module Aggregation | ||
# Status represents the status of a finished {Span}. It is composed of a | ||
# status code in conjunction with an optional descriptive message. | ||
class AggregationTemporality | ||
class << self | ||
private :new | ||
|
||
# Returns a newly created {Status} with code == UNSET and an optional | ||
# description. | ||
# | ||
# @param [String] description | ||
# @return [Status] | ||
def delta | ||
new(DELTA) | ||
end | ||
|
||
# Returns a newly created {Status} with code == OK and an optional | ||
# description. | ||
# | ||
# @param [String] description | ||
# @return [Status] | ||
def cumulative | ||
new(CUMULATIVE) | ||
end | ||
end | ||
|
||
attr_reader :temporality | ||
|
||
# @api private | ||
# The constructor is private and only for use internally by the class. | ||
# Users should use the {unset}, {error}, or {ok} factory methods to | ||
# obtain a {Status} instance. | ||
# | ||
# @param [Integer] code One of the status codes below | ||
# @param [String] description | ||
def initialize(temporality) | ||
@temporality = temporality | ||
end | ||
|
||
def delta? | ||
@temporality == :delta | ||
end | ||
|
||
def cumulative? | ||
@temporality == :cumulative | ||
end | ||
|
||
# The following represents the set of status codes of a | ||
# finished {Span} | ||
|
||
# The operation completed successfully. | ||
DELTA = :delta | ||
|
||
# The default status. | ||
CUMULATIVE = :cumulative | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.