Unverified Commit 6685aa78 authored by Hong Minhee's avatar Hong Minhee
Browse files

Consistent span names

parent 5bf5a53c
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -117,14 +117,14 @@ Instrumented spans
Fedify automatically instruments the following operations with OpenTelemetry
spans:

| Operation            | [Span kind] | Description                           |
|----------------------|-------------|---------------------------------------|
| `Federation.fetch()` | Server      | Serves the incoming HTTP request.     |
| `lookupObject()`     | Client      | Looks up the Activity Streams object. |
| `getActorHandle()`   | Client      | Resolves the actor handle.            |
| `lookupWebFinger()`  | Client      | Looks up the WebFinger resource.      |
| `handleWebFinger()`  | Server      | Handles the WebFinger request.        |
| `verifyRequest()`    | Internal    | Verifies the HTTP request signature.  |
| Span name                      | [Span kind] | Description                           |
|--------------------------------|-------------|---------------------------------------|
| `{method} {template}`          | Server      | Serves the incoming HTTP request.     |
| `activitypub.lookup_object`    | Client      | Looks up the Activity Streams object. |
| `activitypub.get_actor_handle` | Client      | Resolves the actor handle.            |
| `webfinger.lookup`             | Client      | Looks up the WebFinger resource.      |
| `webfinger.handle`             | Server      | Handles the WebFinger request.        |
| `http_signatures.verify`       | Internal    | Verifies the HTTP request signature.  |

More operations will be instrumented in the future releases.

+16 −13
Original line number Diff line number Diff line
@@ -141,7 +141,9 @@ export async function verifyRequest(
    metadata.name,
    metadata.version,
  );
  return await tracer.startActiveSpan("VerifyRequest", async (span) => {
  return await tracer.startActiveSpan(
    "http_signatures.verify",
    async (span) => {
      if (span.isRecording()) {
        span.setAttribute(ATTR_HTTP_REQUEST_METHOD, request.method);
        span.setAttribute(ATTR_URL_FULL, request.url);
@@ -154,7 +156,8 @@ export async function verifyRequest(
      } finally {
        span.end();
      }
  });
    },
  );
}

async function verifyRequestInternal(
+21 −18
Original line number Diff line number Diff line
@@ -136,7 +136,9 @@ export async function getActorHandle(
    metadata.name,
    metadata.version,
  );
  return await tracer.startActiveSpan("GetActorHandle", async (span) => {
  return await tracer.startActiveSpan(
    "activitypub.get_actor_handle",
    async (span) => {
      if (isActor(actor)) {
        if (actor.id != null) {
          span.setAttribute("activitypub.actor.id", actor.id.href);
@@ -154,7 +156,8 @@ export async function getActorHandle(
      } finally {
        span.end();
      }
  });
    },
  );
}

async function getActorHandleInternal(
+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ export async function lookupObject(
    metadata.version,
  );
  return await tracer.startActiveSpan(
    "LookupObject",
    "activitypub.lookup_object",
    async (span) => {
      try {
        const result = await lookupObjectInternal(identifier, options);
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ export async function handleWebFinger<TContextData>(
    return await handleWebFingerInternal(request, options);
  }
  return await options.tracer.startActiveSpan(
    "WebFinger",
    "webfinger.handle",
    { kind: SpanKind.SERVER },
    async (span) => {
      try {
Loading