Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data SpanData = SpanData [Annotation]
- data Annotation
- data AnnotationValue
- empty :: SpanData
- listAnnotation :: ToJSON a => Text -> [a] -> Annotation
- listValue :: ToJSON a => [a] -> AnnotationValue
- merge :: Annotation -> SpanData -> SpanData
- nullAnnotation :: Text -> Annotation
- objectAnnotation :: Text -> [Annotation] -> Annotation
- optionalAnnotation :: ToJSON a => Text -> Maybe a -> Annotation
- optionalValue :: ToJSON a => Maybe a -> AnnotationValue
- simpleAnnotation :: ToJSON a => Text -> a -> Annotation
- simpleValue :: ToJSON a => a -> AnnotationValue
- singleAnnotation :: Text -> AnnotationValue -> Annotation
Documentation
Represents span.data, that is, the tree of free-form annotatiations for a span.
Instances
Eq SpanData Source # | |
Show SpanData Source # | |
Generic SpanData Source # | |
ToJSON SpanData Source # | |
Defined in Instana.SDK.Span.SpanData | |
type Rep SpanData Source # | |
Defined in Instana.SDK.Span.SpanData type Rep SpanData = D1 ('MetaData "SpanData" "Instana.SDK.Span.SpanData" "instana-haskell-trace-sdk-0.8.0.0-inplace" 'False) (C1 ('MetaCons "SpanData" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Annotation]))) |
data Annotation Source #
Represents a single item in span.data, either an object with child annotations or a single annotation (String, Int, Boolean, List, Maybe etc.)
Object Text [Annotation] | Similar to the type Data.Aeson.Types.Object, an object annotation can hold multiple child annotations. In { "http": { "url": "http://localhost:8080" , "method": GET , "headers": [("X-Header-1", "value 1), ("X-Header-2", "value 2)] } } the "http" key would be an Object annotation. |
Single Text AnnotationValue | Somewhat similar to Data.Aeson.Types.Pair, a single annotation holds one single value (String, Number, Boolean, List, Maybe etc.). In the example above, "url", "method" and headers would be Single annotations. |
Instances
data AnnotationValue Source #
Represents the value of a span.data item.
Simple Value | |
List [Value] | For list annotations consecutive merges with the same key will add to the list instead of overwriting previous values. |
Optional (Maybe Value) | If an annotation is marked as optional, it will be ommitted from the encoded JSON if it is Nothing. |
Instances
listAnnotation :: ToJSON a => Text -> [a] -> Annotation Source #
Creates a list annotation, which holds a list of items. For list annotations, consecutive merges with the same key will add to the list instead of overwriting previous values.
listValue :: ToJSON a => [a] -> AnnotationValue Source #
Creates the value part of a list annotation. You might want to use listAnnotation directly instead of creating the list value beforehand.
merge :: Annotation -> SpanData -> SpanData Source #
Merges the given annotation into the given span data. If there is a conflict between existing annotations and a new annotation (that is, both are at the same path of keys), this will be resolved as follows: - If both the existing and the new annotation are list annotations, they will be merged. Duplicates are allowed (that is, duplicate values will not be removed). - Otherwise, if the existing annotation or the new annotation is a single annotation, the new annotation will overwrite the existing one. - If both the existing and the new annotation are object annotations, they will be merged by applying these rules recursively.
nullAnnotation :: Text -> Annotation Source #
A convenience function to create an optional annotation that holds a Nothing.
objectAnnotation :: Text -> [Annotation] -> Annotation Source #
Creates a new object annotation. Similar to the type Data.Aeson.Types.Object, an object annotation can hold multiple child annotations. In { "http": { "url": "http://localhost:8080" , "method": GET } } the "http" key would be an Object annotation.
optionalAnnotation :: ToJSON a => Text -> Maybe a -> Annotation Source #
Creates an optional annotation, which holds a Maybe. If an optional annotation holds a Nothing value, it will be ommitted when SpanData is encoded to JSON.
optionalValue :: ToJSON a => Maybe a -> AnnotationValue Source #
Creates the value part of an optional annotation. You might want to use optionalAnnotation directly instead of creating the optional value beforehand.
simpleAnnotation :: ToJSON a => Text -> a -> Annotation Source #
Creates a simple annotation, which holds one primitive value (String, Number, Boolean, etc.).
simpleValue :: ToJSON a => a -> AnnotationValue Source #
Creates the value part of a simple annotation, that is, a primitive value (String, Number, Boolean, etc.). You might want to use simpleAnnotation directly instead of creating the simple value beforehand.
singleAnnotation :: Text -> AnnotationValue -> Annotation Source #
Creates a single annotation. Somewhat similar to Data.Aeson.Types.Pair, a single annotation holds one value (String, Number, Boolean, List, Maybe etc.).
The convenience functions simpleAnnotation, listAnnotation, and optionalAnnotation allow creating a single annotation without creating the AnnotationValue explicitly.