lib/opentelemetry/trace/status.rb in opentelemetry-api-0.2.0 vs lib/opentelemetry/trace/status.rb in opentelemetry-api-0.3.0
- old
+ new
@@ -2,15 +2,20 @@
# Copyright 2019 OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0
+require 'opentelemetry/trace/util/http_to_status'
+
module OpenTelemetry
module Trace
# Status represents the status of a finished {Span}. It is composed of a
# canonical code in conjunction with an optional descriptive message.
class Status
+ # Convenience utility, not in API spec:
+ extend Util::HttpToStatus
+
# Retrieve the canonical code of this Status.
#
# @return [Integer]
attr_reader :canonical_code
@@ -19,11 +24,11 @@
# @return [String]
attr_reader :description
# Initialize a Status.
#
- # @param [Integer] canonical_code One of the standard GRPC codes: https://github.com/grpc/grpc/blob/master/doc/statuscodes.md
+ # @param [Integer] canonical_code One of the standard gRPC codes: https://github.com/grpc/grpc/blob/master/doc/statuscodes.md
# @param [String] description
def initialize(canonical_code, description: '')
@canonical_code = canonical_code
@description = description
end
@@ -34,10 +39,10 @@
def ok?
@canonical_code == OK
end
# The following represents the canonical set of status codes of a
- # finished {Span}, following the standard GRPC codes:
+ # finished {Span}, following the standard gRPC codes:
# https://github.com/grpc/grpc/blob/master/doc/statuscodes.md
# The operation completed successfully.
OK = 0