bitfab 0.57.3 → 0.57.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bitfab/labels.rb +16 -2
- data/lib/bitfab/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ba510678769346664b90c514ef3f2bf4f062f4d50cbdc84563247224715795f6
|
|
4
|
+
data.tar.gz: 4e1acdbd642f6a49359354f1942c09b4559c75b035f43ed44c8aae5f9076f669
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 69af59d763069101a1bdc3eb026789fe1cb66bf8967b39f08368e75cae2ceb3301ce2007ffe0e746fe8a74913ca93b07609f42786c1a333762d6da77df30bc73
|
|
7
|
+
data.tar.gz: ffaeadd367ec46fd26506fcfe5b39692fcc7e86b1248c8d1eceb4ecc1da00cb0b87ad4bba671c372cfc3fdd12e7d89be37fb6430af4bac9c49f30c8923c95c64
|
data/lib/bitfab/labels.rb
CHANGED
|
@@ -6,17 +6,22 @@ module Bitfab
|
|
|
6
6
|
class Labels
|
|
7
7
|
LABELS_PATH = "/api/sdk/traces/labels"
|
|
8
8
|
HUMAN_LABELS_PATH = "#{LABELS_PATH}/human"
|
|
9
|
+
LABEL_EVIDENCE_PATH = "#{LABELS_PATH}/label-evidence"
|
|
10
|
+
EVIDENCE_UNSET = Object.new.freeze
|
|
11
|
+
|
|
12
|
+
private_constant :EVIDENCE_UNSET
|
|
9
13
|
|
|
10
14
|
def initialize(http_client)
|
|
11
15
|
@http_client = http_client
|
|
12
16
|
end
|
|
13
17
|
|
|
14
18
|
def save(label:, annotation:, trace_id: nil, original_trace_id: nil, attempt: nil,
|
|
15
|
-
confidence: nil, test_run_id: nil, assertion_id: nil)
|
|
19
|
+
confidence: nil, test_run_id: nil, assertion_id: nil, evidence: EVIDENCE_UNSET)
|
|
16
20
|
update = label_target(trace_id:, original_trace_id:, attempt:, assertion_id:)
|
|
17
21
|
update["label"] = label
|
|
18
22
|
update["annotation"] = annotation
|
|
19
23
|
update["confidence"] = confidence unless confidence.nil?
|
|
24
|
+
update["evidence"] = evidence unless evidence.equal?(EVIDENCE_UNSET)
|
|
20
25
|
save_all([update], test_run_id:).first
|
|
21
26
|
end
|
|
22
27
|
|
|
@@ -36,10 +41,12 @@ module Bitfab
|
|
|
36
41
|
save_all([update.merge("archive" => true)], test_run_id:).first
|
|
37
42
|
end
|
|
38
43
|
|
|
39
|
-
def save_human(label:, annotation:, trace_id:, confidence: nil, assertion_id: nil
|
|
44
|
+
def save_human(label:, annotation:, trace_id:, confidence: nil, assertion_id: nil,
|
|
45
|
+
evidence: EVIDENCE_UNSET)
|
|
40
46
|
update = {"traceId" => trace_id, "label" => label, "annotation" => annotation}
|
|
41
47
|
update["assertionId"] = assertion_id unless assertion_id.nil?
|
|
42
48
|
update["confidence"] = confidence unless confidence.nil?
|
|
49
|
+
update["evidence"] = evidence unless evidence.equal?(EVIDENCE_UNSET)
|
|
43
50
|
save_human_all([update]).first
|
|
44
51
|
end
|
|
45
52
|
|
|
@@ -58,6 +65,13 @@ module Bitfab
|
|
|
58
65
|
@http_client.get("#{LABELS_PATH}?#{query}")["labels"]
|
|
59
66
|
end
|
|
60
67
|
|
|
68
|
+
def get_label_evidence(trace_id, assertion_id: nil)
|
|
69
|
+
params = {"traceId" => trace_id}
|
|
70
|
+
params["assertionId"] = assertion_id unless assertion_id.nil?
|
|
71
|
+
query = URI.encode_www_form(params)
|
|
72
|
+
@http_client.get("#{LABEL_EVIDENCE_PATH}?#{query}")["evidence"]
|
|
73
|
+
end
|
|
74
|
+
|
|
61
75
|
private
|
|
62
76
|
|
|
63
77
|
def label_target(trace_id:, original_trace_id:, attempt:, assertion_id:)
|
data/lib/bitfab/version.rb
CHANGED