-
Notifications
You must be signed in to change notification settings - Fork 381
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Internal:Add span events native serialization
- Loading branch information
Showing
7 changed files
with
328 additions
and
51 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,47 @@ | ||
module Datadog | ||
module Tracing | ||
# SpanEvent represents an annotation on a span. | ||
# @public_api | ||
class SpanEvent | ||
@name: untyped | ||
type attributes = Hash[String,attributeValue] | ||
type attributeValue = String | Integer | Float | bool | Array[String] | Array[Integer] | Array[Float] | Array[bool] | ||
|
||
@attributes: untyped | ||
MIN_INT64_SIGNED: Integer | ||
MAX_INT64_SIGNED: Integer | ||
STRING_TYPE: Integer | ||
BOOLEAN_TYPE: Integer | ||
INTEGER_TYPE: Integer | ||
DOUBLE_TYPE: Integer | ||
ARRAY_TYPE: Integer | ||
|
||
@time_unix_nano: untyped | ||
attr_reader name: untyped # TODO: Typing this makes to_hash internal typecheck fail | ||
attr_reader attributes: attributes | ||
attr_reader time_unix_nano: untyped # TODO: Typing this also makes to_hash internal typecheck fail | ||
|
||
# @!attribute [r] name | ||
# @return [String] | ||
attr_reader name: untyped | ||
def initialize: (String name, ?attributes: attributes, ?time_unix_nano: Integer) -> void | ||
|
||
# @!attribute [r] attributes | ||
# @return [Hash<String,String>] | ||
attr_reader attributes: untyped | ||
def to_hash: -> Hash[String, untyped] | ||
# TODO: Steep does not track Hash keys when they are added with `hash[:key] = val`. | ||
# { | ||
# name: String, | ||
# time_unix_nano: Integer, | ||
# ?attributes: attributes, | ||
# } | ||
|
||
# @!attribute [r] time_unix_nano | ||
# @return [Integer] | ||
attr_reader time_unix_nano: untyped | ||
def to_native_format: -> Hash[String, untyped] | ||
# TODO: Steep does not track Hash keys when they are added with `hash[:key] = val`. | ||
# { | ||
# name: String, | ||
# time_unix_nano: Integer, | ||
# ?attributes: Hash[String, nativeAttributeValue], | ||
# } | ||
# type nativeAttributeValue = { type: Integer, string_value: String } | { type: Integer, int_value: Integer } | { type: Integer, double_value: Float } | { type: Integer, bool_value: bool } | { type: Integer, string_array_value: Array[String] } | { type: Integer, int_array_value: Array[Integer] } | { type: Integer, double_array_value: Array[Float] } | { type: Integer, bool_array_value: Array[bool] } | ||
|
||
def initialize: (untyped name, ?attributes: untyped?, ?time_unix_nano: untyped?) -> void | ||
private | ||
|
||
def serialize_native_attribute: (attributeValue value)-> ({ type: Integer, string_value: String } | { type: Integer, int_value: Integer } | { type: Integer, double_value: Float } | { type: Integer, bool_value: bool }) | ||
|
||
def validate_attributes!: (attributes attributes)-> void | ||
|
||
def validate_scalar_attribute!: (String key, attributeValue value)-> bool | ||
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
Oops, something went wrong.