yes-core 2.4.2 → 2.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afba475575e06d43283aa409e9a1669e34e1b4844b89705c5366aa623a4f28b8
4
- data.tar.gz: 4e9d3bf236e962dbcd8bdf34eb75965600a6f837b9b2e4084a8ace4b022bd2c5
3
+ metadata.gz: d9fb1cb54a16eac6310fbbe1bc287d705c4fa0c92cbcb3ec55ae8e763efafaea
4
+ data.tar.gz: 7e218f6cbbb4fc56c1b067e0c1b00cae090bf932692b04ed1a8b5f5255c0236d
5
5
  SHA512:
6
- metadata.gz: 93762a015f86506b49070ebe32691fa27f90ba40bd89eb99ca6bf141a4937638b582e92996a18644019b57327c7951b0072c6d6a37ce83d5fa354ab4800dbe93
7
- data.tar.gz: 7030a6dbcce7208dc3bc46b4c30789b2ca9361e97c8164d710d3cad9210d886793a96ce01a6eb377b2f8e53541a766bc8ddb109e734dbce62bcc13e827b98878
6
+ metadata.gz: 17517ccd7d18cb454bd165631f13ed66c1632c7202336ccd4c0a7595fc016633e9723efccd78936470ebc0376da38d388577c22f46a2eb7c5f1029e4c7b4ad6f
7
+ data.tar.gz: a871ad9ce20b63befd0215e9d170fc2d8c7d6a9abec352bd9e7e00ca3df58b7b5f29978e04aff42e8c84e96dd9a87af7cd4afe00d254e7f373d2c18eac18d1d4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.4.4] - 2026-09-15
4
+ - See root CHANGELOG.md for details.
5
+
6
+ ## [2.4.3] - 2026-09-15
7
+ - See root CHANGELOG.md for details.
8
+
3
9
  ## [2.4.2] - 2026-09-15
4
10
  - See root CHANGELOG.md for details.
5
11
 
@@ -35,6 +35,7 @@ module Yes
35
35
  def call(group_name, payload, guards: true, metadata: nil)
36
36
  prepared = prepare_payload(payload, metadata)
37
37
  cmd = command_utilities.build_group_command(group_name, prepared)
38
+ otl_record_command(cmd)
38
39
  guard_evaluator_class = command_utilities.fetch_guard_evaluator_class_for_group(group_name)
39
40
 
40
41
  ReadModelRecoveryService.check_and_recover_with_retries(read_model, aggregate:) if aggregate.class.read_model_enabled?
@@ -49,6 +50,17 @@ module Yes
49
50
 
50
51
  attr_reader :aggregate, :command_utilities, :read_model
51
52
 
53
+ # Records which command group the span ran; see CommandHandler#otl_record_command.
54
+ #
55
+ # @param cmd [Object] the built command group
56
+ # @return [void]
57
+ def otl_record_command(cmd)
58
+ name = cmd.class.name
59
+ return if name.nil?
60
+
61
+ self.class.current_span&.add_attributes({ CommandHandler::COMMAND_ATTRIBUTE => name })
62
+ end
63
+
52
64
  # Prepares the payload before constructing the group command.
53
65
  # Mirrors the metadata-injection logic in {CommandHandler#prepare_payload}.
54
66
  #
@@ -11,6 +11,14 @@ module Yes
11
11
  # response = handler.call(:approve_documents, { document_ids: '123', another: 'value' })
12
12
  #
13
13
  class CommandHandler
14
+ # Span attribute naming the command that ran. The span keeps a fixed name so its
15
+ # latency histogram stays one series per service; this is how the command is identified.
16
+ #
17
+ # Not the bare `command`: CommandCerbosAuthorizer already puts the serialised command
18
+ # on an attribute of that name, and a metrics pipeline that exports span attributes by
19
+ # name cannot tell the two apart. It would export the payload, one series per payload.
20
+ COMMAND_ATTRIBUTE = 'command.name'
21
+
14
22
  include Yes::Core::OpenTelemetry::Trackable
15
23
 
16
24
  # Initializes a new CommandHandler
@@ -32,6 +40,7 @@ module Yes
32
40
  def call(command_name, payload, guards: true, metadata: nil)
33
41
  prepared_payload = prepare_payload(command_name, payload, metadata)
34
42
  cmd = command_utilities.build_command(command_name, prepared_payload)
43
+ otl_record_command(cmd)
35
44
 
36
45
  guard_evaluator_class = command_utilities.fetch_guard_evaluator_class(command_name)
37
46
 
@@ -51,6 +60,18 @@ module Yes
51
60
 
52
61
  attr_reader :aggregate, :command_utilities, :read_model
53
62
 
63
+ # Records which command the span ran. The span itself keeps a fixed name so its latency
64
+ # histogram stays a single series per service; the command goes on an attribute instead.
65
+ #
66
+ # @param cmd [Object] the built command
67
+ # @return [void]
68
+ def otl_record_command(cmd)
69
+ name = cmd.class.name
70
+ return if name.nil?
71
+
72
+ self.class.current_span&.add_attributes({ COMMAND_ATTRIBUTE => name })
73
+ end
74
+
54
75
  # Prepares the command payload
55
76
  #
56
77
  # @param command_name [Symbol] The command name
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yes
4
4
  module Core
5
- VERSION = '2.4.2'
5
+ VERSION = '2.4.4'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yes-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nico Ritsche