Skip to content

Conversation

@jsumners-nr
Copy link
Contributor

WIP

@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

❌ Patch coverage is 95.14768% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.62%. Comparing base (3b3ab72) to head (09e5d06).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
lib/subscribers/subscriber.js 88.70% 14 Missing ⚠️
lib/subscribers/tracing-channel-subscriber.js 97.53% 5 Missing ⚠️
lib/subscribers/platformatic-kafka/index.js 97.61% 3 Missing ⚠️
lib/subscribers/dc-base.js 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3486      +/-   ##
==========================================
- Coverage   97.75%   97.62%   -0.14%     
==========================================
  Files         414      427      +13     
  Lines       55577    56363     +786     
  Branches        1        1              
==========================================
+ Hits        54330    55025     +695     
- Misses       1247     1338      +91     
Flag Coverage Δ
integration-tests-cjs-20.x 73.86% <79.11%> (+0.51%) ⬆️
integration-tests-cjs-22.x 74.01% <79.11%> (?)
integration-tests-cjs-24.x 74.65% <79.11%> (?)
integration-tests-esm-20.x 52.70% <79.11%> (+0.86%) ⬆️
integration-tests-esm-22.x 52.75% <79.11%> (+0.86%) ⬆️
integration-tests-esm-24.x 53.94% <79.11%> (+0.84%) ⬆️
unit-tests-20.x 88.62% <79.11%> (-0.15%) ⬇️
unit-tests-22.x 88.66% <79.11%> (?)
unit-tests-24.x 88.66% <79.11%> (?)
versioned-tests-20.x 81.15% <95.14%> (-0.29%) ⬇️
versioned-tests-22.x 81.15% <95.14%> (-0.29%) ⬇️
versioned-tests-24.x 81.10% <95.14%> (-0.28%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

* @private
* @interface
*/
class Subscriber {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming this interface class is meant to be the true parent of all three subscribers: Subscriber (base.js), DiagnosticsChannelSubscriber (dc-base.js) and now TracingChannelSubscriber?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly. The intention is to figure out the commonality once I figure out how all of the details here.

* Update the current context's timing tracker.
*/
touch() {
const context = this.agent.tracer.getContext()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't the segment you created above. it's already into the net library. I'm unclear why you created an entirely new subscriber. All that logic to bind the segment to tracing channel event, etc lives in our base subscriber. The only thing that had to be edited there was to change the id it subscribes to events. But this is your issue why you see Truncated names because the segment that's being created isn't getting touched. Doing this fixes your name though:

diff --git a/lib/subscribers/platformatic-kafka/index.js b/lib/subscribers/platformatic-kafka/index.js
index 851018df9..ec630fc9a 100644
--- a/lib/subscribers/platformatic-kafka/index.js
+++ b/lib/subscribers/platformatic-kafka/index.js
@@ -54,6 +54,7 @@ const connectsSub = new TracingChannelSubscription({
 const producerSendsSub = new TracingChannelSubscription({
   channel: 'tracing:plt:kafka:producer:sends',
   start(event) {
+    debugger
     const context = this.agent.tracer.getContext()
     const { segment, transaction } = context
 
@@ -88,20 +89,23 @@ const producerSendsSub = new TracingChannelSubscription({
     externalSegment.type = 'message'
     externalSegment.start()
 
+    event.segment = externalSegment
     return context.enterSegment({ segment: externalSegment })
   },
-  end() {
-    this.touch()
+  end(data) {
+    this.touch(data)
   },
 
-  asyncStart() {
+  asyncStart(data) {
+    debugger
     // TODO: are we getting the correct context? Do we need to do the crazy
     // `isActiveTx` context propagation as we had to do in other cases?
-    this.touch()
+    this.touch(data)
   },
 
-  asyncEnd() {
-    this.touch()
+  asyncEnd(data) {
+    debugger
+    this.touch(data)
   }
 })
 
@@ -117,9 +121,13 @@ class PlatformaticKafkaSubscriber extends TracingChannelSubscriber {
   /**
    * Update the current context's timing tracker.
    */
-  touch() {
-    const context = this.agent.tracer.getContext()
-    context?.segment?.touch()
+  touch(data) {
+    if (data.segment) {
+      data?.segment?.touch()
+    } else {
+      const context = this.agent.tracer.getContext()
+      context?.segment?.touch()
+    }
   }
 }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unclear why you created an entirely new subscriber.

Because the existing code is all either tied to Orchestrion based channels or to baseline diagnostics channel. This module exports baseline tracing channel stuff. So we need something that handles that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right but the only thing tied to orchestrion is

this.id = `${this.prefix}${this.packageName}:${this.channelName}`


const connectsSub = new TracingChannelSubscription({
channel: 'tracing:plt:kafka:connections:connects',
start(event) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This segment is getting named as Truncated/connect as well because segment is never touched

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs PR Review

Development

Successfully merging this pull request may close these issues.

3 participants