Search in sources :

Example 51 with Endpoint

use of com.google.cloud.aiplatform.v1.Endpoint in project zipkin by openzipkin.

the class V2SpanConverter method convert.

public V1Span convert(Span value) {
    md.parse(value);
    result.clear().traceId(value.traceId()).parentId(value.parentId()).id(value.id()).name(value.name()).debug(value.debug());
    // Don't report timestamp and duration on shared spans (should be server, but not necessarily)
    if (!Boolean.TRUE.equals(value.shared())) {
        result.timestamp(value.timestampAsLong());
        result.duration(value.durationAsLong());
    }
    boolean beginAnnotation = md.startTs != 0L && md.begin != null;
    boolean endAnnotation = md.endTs != 0L && md.end != null;
    Endpoint ep = value.localEndpoint();
    int annotationCount = value.annotations().size();
    if (beginAnnotation) {
        annotationCount++;
        result.addAnnotation(md.startTs, md.begin, ep);
    }
    for (int i = 0, length = value.annotations().size(); i < length; i++) {
        Annotation a = value.annotations().get(i);
        if (beginAnnotation && a.value().equals(md.begin))
            continue;
        if (endAnnotation && a.value().equals(md.end))
            continue;
        result.addAnnotation(a.timestamp(), a.value(), ep);
    }
    if (endAnnotation) {
        annotationCount++;
        result.addAnnotation(md.endTs, md.end, ep);
    }
    for (Map.Entry<String, String> b : value.tags().entrySet()) {
        result.addBinaryAnnotation(b.getKey(), b.getValue(), ep);
    }
    boolean writeLocalComponent = annotationCount == 0 && ep != null && value.tags().isEmpty();
    boolean hasRemoteEndpoint = md.addr != null && value.remoteEndpoint() != null;
    // write an empty "lc" annotation to avoid missing the localEndpoint in an in-process span
    if (writeLocalComponent)
        result.addBinaryAnnotation("lc", "", ep);
    if (hasRemoteEndpoint)
        result.addBinaryAnnotation(md.addr, value.remoteEndpoint());
    return result.build();
}
Also used : Endpoint(zipkin2.Endpoint) Map(java.util.Map) Endpoint(zipkin2.Endpoint) Annotation(zipkin2.Annotation)

Example 52 with Endpoint

use of com.google.cloud.aiplatform.v1.Endpoint in project carbon-apimgt by wso2.

the class WSDL20ProcessorImpl method getEndpoints.

/**
 * Get endpoints defined in the provided WSDL description.
 *
 * @param description WSDL 2.0 description
 * @return a Map of endpoint names and their URIs.
 * @throws APIMgtWSDLException if error occurs while reading endpoints
 */
private Map<String, String> getEndpoints(Description description) throws APIMgtWSDLException {
    Service[] services = description.getServices();
    Map<String, String> serviceEndpointMap = new HashMap<>();
    for (Service service : services) {
        Endpoint[] endpoints = service.getEndpoints();
        for (Endpoint endpoint : endpoints) {
            serviceEndpointMap.put(endpoint.getName().toString(), endpoint.getAddress().toString());
        }
    }
    return serviceEndpointMap;
}
Also used : Endpoint(org.apache.woden.wsdl20.Endpoint) HashMap(java.util.HashMap) Service(org.apache.woden.wsdl20.Service)

Example 53 with Endpoint

use of com.google.cloud.aiplatform.v1.Endpoint in project brave by openzipkin.

the class Platform method produceEndpoint.

Endpoint produceEndpoint() {
    Endpoint.Builder builder = Endpoint.newBuilder().serviceName("unknown");
    try {
        Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces();
        if (nics == null)
            return builder.build();
        while (nics.hasMoreElements()) {
            NetworkInterface nic = nics.nextElement();
            Enumeration<InetAddress> addresses = nic.getInetAddresses();
            while (addresses.hasMoreElements()) {
                InetAddress address = addresses.nextElement();
                if (address.isSiteLocalAddress()) {
                    builder.ip(address);
                    break;
                }
            }
        }
    } catch (Exception e) {
        // don't crash the caller if there was a problem reading nics.
        if (logger.isLoggable(Level.FINE)) {
            logger.log(Level.FINE, "error reading nics", e);
        }
    }
    return builder.build();
}
Also used : Endpoint(zipkin2.Endpoint) NetworkInterface(java.net.NetworkInterface) InetAddress(java.net.InetAddress)

Example 54 with Endpoint

use of com.google.cloud.aiplatform.v1.Endpoint in project brave by openzipkin.

the class PlatformTest method localEndpoint_provisionsOnce.

/**
 * Getting an endpoint is expensive. This tests it is provisioned only once.
 *
 * test inspired by dagger.internal.DoubleCheckTest
 */
@Test
public void localEndpoint_provisionsOnce() throws Exception {
    // create all the tasks up front so that they are executed with no delay
    List<Callable<Endpoint>> tasks = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
        tasks.add(() -> platform.endpoint());
    }
    ExecutorService executor = Executors.newFixedThreadPool(tasks.size());
    List<Future<Endpoint>> futures = executor.invokeAll(tasks);
    // check there's only a single unique endpoint returned
    Set<Object> results = Sets.newIdentityHashSet();
    for (Future<Endpoint> future : futures) {
        results.add(future.get());
    }
    assertThat(results).hasSize(1);
    executor.shutdownNow();
}
Also used : Endpoint(zipkin2.Endpoint) ArrayList(java.util.ArrayList) ExecutorService(java.util.concurrent.ExecutorService) Future(java.util.concurrent.Future) Callable(java.util.concurrent.Callable) Endpoint(zipkin2.Endpoint) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 55 with Endpoint

use of com.google.cloud.aiplatform.v1.Endpoint in project openstack4j by ContainX.

the class DefaultEndpointURLResolver method resolveV2.

private String resolveV2(URLResolverParams p) {
    SortedSetMultimap<String, ? extends Access.Service> catalog = p.access.getAggregatedCatalog();
    SortedSet<? extends Access.Service> services = catalog.get(p.type.getServiceName());
    if (services.isEmpty()) {
        services = catalog.get(p.type.getType());
    }
    if (!services.isEmpty()) {
        Access.Service sc = p.getV2Resolver().resolveV2(p.type, services);
        for (org.openstack4j.model.identity.v2.Endpoint ep : sc.getEndpoints()) {
            if (p.region != null && !p.region.equalsIgnoreCase(ep.getRegion()))
                continue;
            if (sc.getServiceType() == ServiceType.NETWORK) {
                sc.getEndpoints().get(0).toBuilder().type(sc.getServiceType().name());
            }
            if (p.perspective == null)
                return getEndpointURL(p.access, ep);
            switch(p.perspective) {
                case ADMIN:
                    return ep.getAdminURL().toString();
                case INTERNAL:
                    return ep.getInternalURL().toString();
                case PUBLIC:
                default:
                    return ep.getPublicURL().toString();
            }
        }
    } else {
        // if no catalog returned, if is identity service, just return endpoint
        if (ServiceType.IDENTITY.equals(p.type)) {
            return p.access.getEndpoint();
        }
    }
    return null;
}
Also used : Endpoint(org.openstack4j.model.identity.v2.Endpoint) Access(org.openstack4j.model.identity.v2.Access)

Aggregations

Endpoint (zipkin2.Endpoint)73 Span (zipkin2.Span)33 Test (org.junit.Test)28 Endpoint (org.jboss.remoting3.Endpoint)22 Test (org.junit.jupiter.api.Test)20 V1Span (zipkin2.v1.V1Span)16 NoopHealthCheckManager (com.wavefront.agent.channel.NoopHealthCheckManager)10 SpanSampler (com.wavefront.agent.sampler.SpanSampler)10 ByteBuf (io.netty.buffer.ByteBuf)10 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)10 DefaultFullHttpRequest (io.netty.handler.codec.http.DefaultFullHttpRequest)10 FullHttpRequest (io.netty.handler.codec.http.FullHttpRequest)10 Span (wavefront.report.Span)10 IOException (java.io.IOException)8 URI (java.net.URI)8 HashMap (java.util.HashMap)8 Annotation (wavefront.report.Annotation)8 ServiceName (org.jboss.msc.service.ServiceName)7 RateSampler (com.wavefront.sdk.entities.tracing.sampling.RateSampler)6 SaslAuthenticationFactory (org.wildfly.security.auth.server.SaslAuthenticationFactory)6