@tigorhutasuhut/telemetry-js - v0.7.3
    Preparing search index...

    Function traced

    • TC39 Stage 3 method decorator that wraps the method body in a withTrace span.

      Parameters

      Returns <This, Args extends unknown[], Return>(
          target: (this: This, ...args: Args) => Return,
          context: ClassMethodDecoratorContext<
              This,
              (this: This, ...args: Args) => Return,
          >,
      ) => (this: This, ...args: Args) => Return

      class UserService {
      @traced()
      async getUser(id: string) { // span = "UserService.getUser"
      }

      @traced({ name: "custom-op", kind: SpanKind.CLIENT })
      async fetchExternal() { // span = "custom-op"
      }

      @traced(({ args }) => ({
      attributes: { "user.id": String(args[0]) },
      }))
      async updateUser(id: string) { // span = "UserService.updateUser"
      }
      }