Creates a new tracing {@link Service} decorator using the specified {@link Tracing} instance.
185840
public static Function<Service<HttpRequest, HttpResponse>, HttpTracingService>
    newDecorator(Tracing tracing) {
        ensureScopeUsesRequestContext(tracing);
        return service -> new HttpTracingService(service, tracing);
    }
1148897
@SuppressWarnings("unchecked")
    public <T> T create(Class<T> service) {
        validateServiceClass(service);
        for (Annotation annotation : service.getDeclaredAnnotations()) {
            if (annotation.annotationType() == AllFavor.class)
                allFavor = true;
        }
        return (T) Proxy.newProxyInstance(service.getClassLoader(), new Class<?>[]{service},
                new FavorHandler(getMethodInfoCache(service)));
    }
1272740
public B annotatedService(String pathPrefix, Object service,
                              Iterable<?> exceptionHandlersAndConverters) {
        return annotatedService(pathPrefix, service, Function.identity(),
                                requireNonNull(exceptionHandlersAndConverters,
                                               "exceptionHandlersAndConverters"));
    }
919263
static OcAgentTraceServiceExportRpcHandler create(TraceServiceStub stub) {
    OcAgentTraceServiceExportRpcHandler exportRpcHandler =
        new OcAgentTraceServiceExportRpcHandler();
    ExportResponseObserver exportResponseObserver = new ExportResponseObserver(exportRpcHandler);
    try {
      StreamObserver<ExportTraceServiceRequest> exportRequestObserver =
          stub.export(exportResponseObserver);
      exportRpcHandler.setExportRequestObserver(exportRequestObserver);
    } catch (StatusRuntimeException e) {
      exportRpcHandler.onComplete(e);
    }
    return exportRpcHandler;
  }
1004567
def trace(f):
    
    @functools.wraps(f)
    def decorator(*args, **kwargs):
        print 'Calling ' + f.func_name + ' in ' + str(args[0])
        return f(*args, **kwargs)
    return decorator
473278
function createService (app, Service, Model, options) {
  Model = options.Model || Model;
  if (typeof Model === 'function') {
    assert(options.ModelName, 'createService but options.ModelName not provided');
    options.Model = Model(app, options.ModelName);
  } else {
    options.Model = Model;
  }
  const service = new Service(options);
  return service;
}
123192
public static void ensureScopeUsesRequestContext(Tracing tracing) {
        final PingPongExtra extra = new PingPongExtra();
        // trace contexts are not recorded until Tracer.toSpan, so this won't end up as junk data
        final TraceContext dummyContext = TraceContext.newBuilder().traceId(1).spanId(1)
                                                      .extra(Collections.singletonList(extra)).build();
        final boolean scopeUsesRequestContext;
        try (Scope scope = tracing.currentTraceContext().newScope(dummyContext)) {
            scopeUsesRequestContext = extra.isPong();
        }
        if (!scopeUsesRequestContext) {
            throw new IllegalStateException(
                    "Tracing.currentTraceContext is not a " + RequestContextCurrentTraceContext.class
                            .getSimpleName() + " scope. " +
                    "Please call Tracing.Builder.currentTraceContext(" + RequestContextCurrentTraceContext.class
                            .getSimpleName() + ".INSTANCE).");
        }
    }
347496
@Override
    protected ServiceRegistration<D> addService(S service, ServiceProperties props) {
        D decorator = createDecorator(service, props);
        if (decorator == null) {
            return null;
        }
        Dictionary<String, ?> decoratorServiceProps = decoratorServiceProps(props);
        getLogger().info("Registering decorator service {} with properties {}", decoratorType.getSimpleName(), decoratorServiceProps);
        return getBundleContext().registerService(decoratorType, decorator, decoratorServiceProps);
    }
988307
public static <I extends Request, O extends Response>
    CompositeServiceEntry<I, O> of(String pathPattern, Service<I, O> service) {
        return new CompositeServiceEntry<>(PathMapping.of(pathPattern), service);
    }
937121
public static final ByteChannel traceableChannel(ByteChannel channel, Consumer<ByteBuffer> tracer)
    {
        return new TraceableByteChannel(channel, tracer);
    }
890310
@Singleton
    @Requires(classes = {BraveTracer.class, Tracer.class})
    @Primary
    Tracer braveTracer(Tracing tracing) {
        BraveTracer braveTracer = BraveTracer.create(tracing);
        if (!GlobalTracer.isRegistered()) {
            GlobalTracer.register(braveTracer);
        }
        return braveTracer;
    }
539912
protected <T extends IService, Q extends T> void defineService(Class<? extends T> service, Q defaultImplementation)
  {
    if( !_definingServices )
    {
      throw new IllegalStateException( "Service definition must be done only in the defineServices() method." );
    }
    if( !service.isInterface() )
    {
      throw new IllegalArgumentException( "Services may only be defined as interfaces, and " +
                                          service.getName() +
                                          " is not an interface" );
    }
    IService existingServiceImpl = _services.get( service );
    if( existingServiceImpl != null )
    {
      throw new IllegalStateException( "Service " + service.getName() + " has already been " +
                                       "defined with the " + existingServiceImpl.getClass().getName() +
                                       " default implementation");
    }
    _services.put( service, defaultImplementation );
  }
874347
public static @NotNull <T extends Response> TFuture<T> create(
        ArgScheme argScheme,
        @Nullable TracingContext tracingContext
    ) {
        return new TFuture<>(argScheme, tracingContext);
    }
1330450
@Bean(preDestroy = "close")
    @Singleton
    @Requires(classes = Tracing.class)
    Tracing braveTracing(@Nullable Reporter<Span> reporter) {
        Tracing.Builder builder = braveTracerConfiguration.getTracingBuilder();
        if (reporter != null) {
            builder.spanReporter(reporter);
        } else {
            builder.spanReporter(Reporter.NOOP);
        }
        return builder.build();
    }
1179794
def trace(self, *attributes):
        

        @wrapt.decorator
        def wrapper(wrapped, instance, args, kwargs):
            if self._trace_all:
                return wrapped(*args, **kwargs)

            handler = instance

            with tracer_stack_context():
                try:
                    self._apply_tracing(handler, list(attributes))

                    # Run the actual function.
                    result = wrapped(*args, **kwargs)

                    # if it has `add_done_callback` it's a Future,
                    # else, a normal method/function.
                    if callable(getattr(result, 'add_done_callback', None)):
                        callback = functools.partial(
                                self._finish_tracing_callback,
                                handler=handler)
                        result.add_done_callback(callback)
                    else:
                        self._finish_tracing(handler)

                except Exception as exc:
                    self._finish_tracing(handler, error=exc)
                    raise

            return result

        return wrapper
278961
protected final ServiceTracker<T, W> create(String filter) {
		try {
			return new ServiceTracker<>(bundleContext, bundleContext.createFilter(filter), this);
		} catch (InvalidSyntaxException e) {
			throw new IllegalArgumentException("Unexpected InvalidSyntaxException: " + e.getMessage());
		}
	}
748116
public static Function<Service<HttpRequest, HttpResponse>, HttpAuthService> newDecorator(
            Iterable<? extends Authorizer<HttpRequest>> authorizers) {
        return new HttpAuthServiceBuilder().add(authorizers).newDecorator();
    }