Giter VIP home page Giter VIP logo

orders's People

Contributors

eeemil avatar errordeveloper avatar frankscholten avatar jasonrichardsmith avatar morancj avatar moretea avatar nustiueudinastea avatar ottovsky avatar philwinder avatar pidster avatar vlal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

orders's Issues

Updated docker image for catalog

Is there a newer or an updated docker image available for the weaveworksdemos/catalogue with different images that can be used and incorporated with the existing yaml file to bring out new catalog items?

Can you help me with Jaeger tracing?

Hi everybody, i am an informatic student who is trying to use jaeger to trace the interaction between the two microservices "ORDERS" and "SHIPPING" . This is the code i put in AsyncGetService inside the Order repository : i put a change in "postResource" which is the point of connection with Shipping.


@async
public <T, B> Future postResource(URI uri, B body, ParameterizedTypeReference returnType) {
Span span = tracer.buildSpan("Sono Orders").start();

	 try (Scope scope = tracer.scopeManager().activate(span)) {

         Span activeSpan = tracer.activeSpan();
  
         Tags.SPAN_KIND.set(activeSpan, Tags.SPAN_KIND_CLIENT);
         Tags.HTTP_METHOD.set(activeSpan, "POST");
         Tags.HTTP_URL.set(activeSpan, uri.toString());
         
	 RequestEntity<B> request = RequestEntity.post(uri).contentType(MediaType.APPLICATION_JSON).accept(MediaType
            .APPLICATION_JSON).body(body); 

	 TextMapAdapter adapter = new  TextMapAdapter(request.getHeaders().toSingleValueMap());
	 System.out.println("HEADERS "+request.getHeaders().toSingleValueMap().toString());

	 Tags.COMPONENT.set(activeSpan,  request.getHeaders().toSingleValueMap().toString());

    tracer.inject(activeSpan.context(), Format.Builtin.HTTP_HEADERS, adapter); //INJECTION
          
    LOG.debug("Requesting: " + request.toString());
    T responseBody = restProxyTemplate.getRestTemplate().exchange(request, returnType).getBody();
    Tags.HTTP_STATUS.set(activeSpan, responseBody.hashCode());
    
    LOG.debug("Received: " + responseBody);
    return new AsyncResult<>(responseBody);
	  }
	  finally {
          span.finish();
      }
}
}
-------------------------------------------------------------------------------

In ShippingController inside the "Shipping" repository i change the other method linked with Order , which is "postShipping" :


@ResponseStatus(HttpStatus.CREATED)
@RequestMapping(value = "/shipping", method = RequestMethod.POST)
public
@responsebody
Shipment postShipping(@requestbody Shipment shipment, @RequestHeader Map<String, String> headers) {

	Tracer.SpanBuilder spanBuilder;   
	System.out.println("HEADERS RICEVUTI\n"+headers.toString());

	TextMapAdapter tx =  new TextMapAdapter(headers);
	 
 
	try {
           SpanContext parentSpanCtx = tracer.extract(Format.Builtin.HTTP_HEADERS, tx);
           if (parentSpanCtx == null) {
               spanBuilder = tracer.buildSpan("Span VUOTO").asChildOf(parentSpanCtx);
           } else {
               spanBuilder = tracer.buildSpan("Span FIGLIO").asChildOf(parentSpanCtx);
           }
       } catch (IllegalArgumentException e) {
           spanBuilder = tracer.buildSpan("Span sbagliato");
       }
	Span span =spanBuilder.start();
	System.out.println("Adding shipment to queue...");
    try (Scope scope = tracer.scopeManager().activate(span)) {
	try  {
        rabbitTemplate.convertAndSend("shipping-task", shipment);
    
	} catch (Exception e) {
        System.out.println("Unable to add to queue (the queue is probably down). Accepting anyway. Don't do this " +
                "for real!");
    }   
    span.log(ImmutableMap.of("event", "shipment", "value",shipment ));

	return shipment;
    }
	finally {
        span.finish();
    }
 
}

The problem is that there are Async invocations and i think that for this reason in jaeger i have the 2 span separated and not a son span (from postShipping -> Shipping ) which is linked to the father one (from postResource -> Orders). I cannot use a classic RequestBuilderCarrier because my request is a RequestEntity , and i cannot use TextMapExtractAdapter/TextMapInjectAdapter. If you can help me i really thank you !

Added OpenAPI spec

  • Add spec under api-spec file
  • Add fixtures (hooks.js) file if needed
  • Implement API test

Fix python tests

Running

COMMIT=test test/test.sh container.py gives

requests.exceptions.InvalidURL: Invalid URL 'http://:80/orders': No host supplied

----------------------------------------------------------------------
Ran 1 test in 11.549s

FAILED (errors=1)

Not able to access /order by get?

I build docker image from scratch by source code.
But not able to access /order by get. There is "TODO: Add link to shipping", which is for get /orders. Because the offical website offers the way to access /order, the code is out of date. Please update~~~

Fix Docker build script

  • Build currently fails. Copy Docker context into target/docker/orders
  • Run Docker with -u 1000 so it created the jar as a non-privileged user.

Dependency org.apache.tomcat.embed:tomcat-embed-core, leading to CVE problem

Hi, In orders,there is a dependency org.apache.tomcat.embed:tomcat-embed-core:8.5.11 that calls the risk method.

CVE-2019-10072

The scope of this CVE affected version is [8.5.0, 8.5.40),[9.0.0.M1, 9.0.20)

After further analysis, in this project, the main Api called is <org.apache.coyote.http2.Http2UpgradeHandler: void close()>

Risk method repair link : GitHub

CVE Bug Invocation Path--

Path Length : 9

<org.apache.coyote.http2.Http2UpgradeHandler: void close()>
at <org.apache.coyote.http2.Http2UpgradeHandler: void handleAppInitiatedIOException(java.io.IOException)> (org.apache.coyote.http2.Http2UpgradeHandler.java:[693]) in /.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.11/tomcat-embed-core-8.5.11.jar
at <org.apache.coyote.http2.Http2UpgradeHandler: void writeHeaders(org.apache.coyote.http2.Stream,org.apache.coyote.Response,int)> (org.apache.coyote.http2.Http2UpgradeHandler.java:[564]) in /.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.11/tomcat-embed-core-8.5.11.jar
at <org.apache.coyote.http2.Stream: void writeAck()> (org.apache.coyote.http2.Stream.java:[352]) in /.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.11/tomcat-embed-core-8.5.11.jar
at <org.apache.coyote.http2.StreamProcessor: void ack()> (org.apache.coyote.http2.StreamProcessor.java:[114]) in /.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.11/tomcat-embed-core-8.5.11.jar
at <org.apache.coyote.AbstractProcessor: void action(org.apache.coyote.ActionCode,java.lang.Object)> (org.apache.coyote.AbstractProcessor.java:[273]) in /.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.11/tomcat-embed-core-8.5.11.jar
at <org.apache.coyote.Request: void action(org.apache.coyote.ActionCode,java.lang.Object)> (org.apache.coyote.Request.java:[391, 393]) in /.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.11/tomcat-embed-core-8.5.11.jar
at <org.apache.catalina.connector.Request: java.lang.Object getAttribute(java.lang.String)> (org.apache.catalina.connector.Request.java:[900]) in /.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.11/tomcat-embed-core-8.5.11.jar
at <works.weave.socks.orders.middleware.HTTPMonitoringInterceptor: void postHandle(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,java.lang.Object,org.springframework.web.servlet.ModelAndView)> (works.weave.socks.orders.middleware.HTTPMonitoringInterceptor.java:[53]) in /detect/unzip/orders-0.4.7/target/classes

Dependency tree--

[INFO] works.weave.microservices-demo:orders:jar:1.4.4.RELEASE
[INFO] +- org.springframework.boot:spring-boot-starter-data-rest:jar:1.4.4.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.4.4.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.4.4.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.4.4.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.4.4.RELEASE:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.1.9:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.1.9:compile
[INFO] |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.22:compile
[INFO] |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.22:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] |  +- org.springframework.boot:spring-boot-starter-web:jar:1.4.4.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.4.4.RELEASE:compile
[INFO] |  |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.11:compile
[INFO] |  |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.11:compile
[INFO] |  |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.11:compile
[INFO] |  |  +- org.hibernate:hibernate-validator:jar:5.2.4.Final:compile
[INFO] |  |  |  +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] |  |  |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] |  |  |  \- com.fasterxml:classmate:jar:1.3.3:compile
[INFO] |  |  \- org.springframework:spring-webmvc:jar:4.3.6.RELEASE:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.6:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.6:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.6:compile
[INFO] |  \- org.springframework.data:spring-data-rest-webmvc:jar:2.5.7.RELEASE:compile
[INFO] |     \- org.springframework.data:spring-data-rest-core:jar:2.5.7.RELEASE:compile
[INFO] |        +- org.springframework.hateoas:spring-hateoas:jar:0.20.0.RELEASE:compile
[INFO] |        +- org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile
[INFO] |        \- org.atteo:evo-inflector:jar:1.2.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-mongodb:jar:1.4.4.RELEASE:compile
[INFO] |  +- org.mongodb:mongodb-driver:jar:3.2.2:compile
[INFO] |  |  +- org.mongodb:mongodb-driver-core:jar:3.2.2:compile
[INFO] |  |  \- org.mongodb:bson:jar:3.2.2:compile
[INFO] |  \- org.springframework.data:spring-data-mongodb:jar:1.9.7.RELEASE:compile
[INFO] |     +- org.springframework:spring-tx:jar:4.3.6.RELEASE:compile
[INFO] |     +- org.springframework:spring-context:jar:4.3.6.RELEASE:compile
[INFO] |     +- org.springframework:spring-beans:jar:4.3.6.RELEASE:compile
[INFO] |     +- org.springframework:spring-expression:jar:4.3.6.RELEASE:compile
[INFO] |     \- org.springframework.data:spring-data-commons:jar:1.12.7.RELEASE:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-zipkin:jar:1.1.0.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-starter-sleuth:jar:1.1.0.RELEASE:compile
[INFO] |  |  +- org.springframework.cloud:spring-cloud-starter:jar:1.1.6.RELEASE:compile
[INFO] |  |  |  +- org.springframework.cloud:spring-cloud-context:jar:1.1.6.RELEASE:compile
[INFO] |  |  |  |  \- org.springframework.security:spring-security-crypto:jar:4.1.4.RELEASE:compile
[INFO] |  |  |  +- org.springframework.cloud:spring-cloud-commons:jar:1.1.6.RELEASE:compile
[INFO] |  |  |  \- org.springframework.security:spring-security-rsa:jar:1.0.3.RELEASE:compile
[INFO] |  |  |     \- org.bouncycastle:bcpkix-jdk15on:jar:1.55:compile
[INFO] |  |  |        \- org.bouncycastle:bcprov-jdk15on:jar:1.55:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-actuator:jar:1.4.4.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-aop:jar:1.4.4.RELEASE:compile
[INFO] |  |  |  \- org.aspectj:aspectjweaver:jar:1.8.9:compile
[INFO] |  |  \- org.springframework.cloud:spring-cloud-sleuth-core:jar:1.1.0.RELEASE:compile
[INFO] |  |     \- org.aspectj:aspectjrt:jar:1.8.9:compile
[INFO] |  \- org.springframework.cloud:spring-cloud-sleuth-zipkin:jar:1.1.0.RELEASE:compile
[INFO] |     +- io.zipkin.java:zipkin:jar:1.16.2:compile
[INFO] |     +- io.zipkin.reporter:zipkin-reporter:jar:0.6.9:compile
[INFO] |     \- io.zipkin.reporter:zipkin-sender-urlconnection:jar:0.6.9:compile
[INFO] +- io.prometheus:simpleclient_spring_boot:jar:0.0.21:compile
[INFO] |  +- io.prometheus:simpleclient:jar:0.0.21:compile
[INFO] |  +- io.prometheus:simpleclient_common:jar:0.0.21:compile
[INFO] |  +- org.springframework:spring-web:jar:4.3.6.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-aop:jar:4.3.6.RELEASE:compile
[INFO] |  \- org.springframework.boot:spring-boot-actuator:jar:1.4.4.RELEASE:compile
[INFO] +- io.prometheus:simpleclient_hotspot:jar:0.0.21:compile
[INFO] +- io.prometheus:simpleclient_servlet:jar:0.0.21:compile
[INFO] +- org.springframework.data:spring-data-rest-hal-browser:jar:2.5.7.RELEASE:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.22:compile
[INFO] |  \- org.slf4j:jcl-over-slf4j:jar:1.7.22:compile
[INFO] |  +- org.springframework:spring-core:jar:4.3.6.RELEASE:compile

Suggested solutions:

Update dependency version

Thank you very much.

Multistep checkout

Note

This documentation was moved from the README.md file to this issue so it does not distract from the core documentation of this service.

Redesign

This microservices will shortly go through a redesign to allow for
multi-step checkouts. A rough sketch of the flow is below:

Orders flow

Orders service throws exception, returns 500 when param is missing/null

Should handle gracefully and return 400 level error

orders_1        | 2016-08-02 09:19:13.816 ERROR 1 --- [p-nio-80-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: Unable to create order due to unspecified IO error.] with root cause

java.lang.IllegalArgumentException: 'url' must not be null
orders_1        |   at org.springframework.util.Assert.notNull(Assert.java:115) ~[spring-core-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
orders_1        |   at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:588) ~[spring-web-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
orders_1        |   at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:572) ~[spring-web-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
orders_1        |   at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:546) ~[spring-web-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
orders_1        |   at works.weave.socks.orders.services.AsyncGetService.getResource(AsyncGetService.java:58) ~[app.jar!/:0.0.1-SNAPSHOT]
orders_1        |   at works.weave.socks.orders.services.AsyncGetService$$FastClassBySpringCGLIB$$2bee767d.invoke(<generated>) ~[app.jar!/:0.0.1-SNAPSHOT]
orders_1        |   at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
orders_1        |   at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720) ~[spring-aop-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
orders_1        |   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
orders_1        |   at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:115) ~[spring-aop-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
orders_1        |   at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_92-internal]
orders_1        |   at java.lang.Thread.run(Thread.java:745) [na:1.8.0_92-internal]

Require docker image for ARM64

I was trying to use the weaveworksdemos/orders image in ARM64 platform, but it seems it is not available for ARM64 platform.

I have tried building the image for the ARM64 platform but the base image msd-java is not available for ARM64 platform and it's source Dockerfile is no longer available, and repo is unmaintained.

I am happy to help in adding ARM64 support for the development of docker image for this package but for this we need to use any alternative of the base image which supports ARM64 platform, and it would be very helpful if I could get any suggestions on this.

Zipkin trace lacks information regarding destiny server when communicating with non-Java services

After cart checkout, the orders service traces interactions with user, carts, payment and shipping services. Spans regarding remote calls to the Java services (carts & shipping) seem complete. For instance:

selection_004

But spans regarding calls to non-Java services don't present Service Receive and Service Send annotations. E.g.:

selection_005

I'm investigating how instrumentation is currently implemented in order to try enhancing the tracing with the missing info. Any advices about this will be appreciated.

This issue relates to #32

Change java options of socks shop

Hi,

Would it be possible to change the java options for the java-based microservices?

I would like to experiment with the various memory settings (i.e. -Xmx etc.).

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.