brainzlab 0.1.4 → 0.1.5
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/brainzlab/flux.rb +10 -0
- data/lib/brainzlab/pulse/client.rb +6 -0
- data/lib/brainzlab/pulse.rb +27 -0
- data/lib/brainzlab/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: 612fc535ff22f4fb1edb3d986ca4200f6fbbcb32e82718619a6f711d11e0d98b
|
|
4
|
+
data.tar.gz: 665fefbcba13cfb7c14395b37dc8157c0938c3cc52935fe5fd7767b7cff3a3f5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 06e2a33185951e80bd102e6aee4d4e8417750be993949822983ceb66fd807394924e0546a3769ab6ffd0f30d1055c0f213fdc7458a66304bea89b9d304ad34a0
|
|
7
|
+
data.tar.gz: 4675a166a98ed230885fae6926d7949c235ca1ab75c129702a643955089a130dddbe445351bfac0331247204083b0ce7223c7b1f1b9c4759ca2e73482f2c06b6
|
data/lib/brainzlab/flux.rb
CHANGED
|
@@ -100,6 +100,16 @@ module BrainzLab
|
|
|
100
100
|
buffer.add(:metric, metric)
|
|
101
101
|
end
|
|
102
102
|
|
|
103
|
+
# Histogram: Alias for distribution (for compatibility with brainzlab-rails)
|
|
104
|
+
def histogram(name, value, tags: {})
|
|
105
|
+
distribution(name, value, tags: tags)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Timing: Record duration in milliseconds (alias for distribution)
|
|
109
|
+
def timing(name, value_ms, tags: {})
|
|
110
|
+
distribution(name, value_ms, tags: tags.merge(unit: 'ms'))
|
|
111
|
+
end
|
|
112
|
+
|
|
103
113
|
# Set: Unique count (cardinality)
|
|
104
114
|
def set(name, value, tags: {})
|
|
105
115
|
return unless enabled?
|
data/lib/brainzlab/pulse.rb
CHANGED
|
@@ -85,6 +85,33 @@ module BrainzLab
|
|
|
85
85
|
record_metric(name, value: value, kind: 'histogram', tags: tags)
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
+
# Record a standalone span (used by brainzlab-rails for Rails instrumentation)
|
|
89
|
+
# @param name [String] span name (e.g., "sql.SELECT", "cache.read")
|
|
90
|
+
# @param duration_ms [Float] span duration in milliseconds
|
|
91
|
+
# @param category [String] span category (e.g., "db.sql", "cache.read", "http.request")
|
|
92
|
+
# @param attributes [Hash] additional span attributes
|
|
93
|
+
# @param timestamp [String] ISO8601 timestamp
|
|
94
|
+
def record_span(name:, duration_ms:, category:, attributes: {}, timestamp: nil)
|
|
95
|
+
return unless enabled?
|
|
96
|
+
|
|
97
|
+
ensure_provisioned!
|
|
98
|
+
return unless BrainzLab.configuration.pulse_valid?
|
|
99
|
+
|
|
100
|
+
span_data = {
|
|
101
|
+
name: name,
|
|
102
|
+
category: category,
|
|
103
|
+
duration_ms: duration_ms,
|
|
104
|
+
timestamp: timestamp || Time.now.utc.iso8601(3),
|
|
105
|
+
attributes: attributes,
|
|
106
|
+
environment: BrainzLab.configuration.environment,
|
|
107
|
+
service: BrainzLab.configuration.service,
|
|
108
|
+
host: BrainzLab.configuration.host,
|
|
109
|
+
request_id: Context.current.request_id
|
|
110
|
+
}.compact
|
|
111
|
+
|
|
112
|
+
client.send_span(span_data)
|
|
113
|
+
end
|
|
114
|
+
|
|
88
115
|
def ensure_provisioned!
|
|
89
116
|
return if @provisioned
|
|
90
117
|
|
data/lib/brainzlab/version.rb
CHANGED