Skip to content

Commit bb03d95

Browse files
committed
Align delivery telemetry attributes
Record delivery success on delivery duration metrics so successful and failed attempts can be separated in histograms, and remove the stale sent activity JSON attribute from the OpenTelemetry docs. #755 (comment) #755 (comment) Assisted-by: gpt-5.5
1 parent 166150d commit bb03d95

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

docs/manual/opentelemetry.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ Each span event includes attributes with detailed information:
263263

264264
**`activitypub.activity.sent` event attributes:**
265265

266-
- `activitypub.activity.json`: The complete activity JSON being sent
267266
- `activitypub.inbox.url`: The inbox URL where the activity was delivered
268267
- `activitypub.activity.id`: The activity ID
269268

@@ -307,7 +306,7 @@ Fedify records the following OpenTelemetry metrics:
307306
: `activitypub.remote.host` and `http.response.status_code`.
308307

309308
`activitypub.delivery.duration`
310-
: `activitypub.remote.host`.
309+
: `activitypub.remote.host` and `activitypub.delivery.success`.
311310

312311
`activitypub.inbox.processing_duration`
313312
: `activitypub.activity.type`.

packages/fedify/src/federation/metrics.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class FederationMetrics {
6666
this.deliverySent.add(1, deliveryAttributes);
6767
this.deliveryDuration.record(durationMs, {
6868
"activitypub.remote.host": getRemoteHost(inbox),
69+
"activitypub.delivery.success": success,
6970
});
7071
}
7172

packages/fedify/src/federation/send.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,10 @@ test("sendActivity() records OpenTelemetry delivery metrics", async (t) => {
554554
durations[0].attributes["activitypub.remote.host"],
555555
"metrics.example",
556556
);
557+
assertEquals(
558+
durations[0].attributes["activitypub.delivery.success"],
559+
true,
560+
);
557561

558562
recorder.clear();
559563
fetchMock.hardReset();
@@ -607,6 +611,10 @@ test("sendActivity() records OpenTelemetry delivery metrics", async (t) => {
607611
durations[0].attributes["activitypub.remote.host"],
608612
"metrics.example",
609613
);
614+
assertEquals(
615+
durations[0].attributes["activitypub.delivery.success"],
616+
false,
617+
);
610618

611619
recorder.clear();
612620
fetchMock.hardReset();

0 commit comments

Comments
 (0)