We are moving from Zipkin 1 to Zipkin 2 as part of our plan to use Spring Cloud Edgware. We are also moving away from having our own custom ZipKin server to openzipkin as support for custom servers has been deprecated and is apparently planned for removal under Spring Cloud Finchley.
We run all our apps on PCF, prior to moving to Edgware and ZipKin 2 our integration was via RabbitMQ. using the following dependencies:
compile('org.springframework.cloud:spring-cloud-sleuth-zipkin-stream')
compile('org.springframework.cloud:spring-cloud-starter-sleuth')
compile('org.springframework.cloud:spring-cloud-stream-binder-rabbit')
RabbitMQ runs as a service on PCF which is bound to each app when it is deployed. Both the ZipKin 1 clients and server auto configured themselves to use RabbitMQ if an instance of RabbitMQ was found at run-time. This feature is supported on the client if you add the following dependencies:
compile "org.springframework.cloud:spring-cloud-starter-zipkin"
compile "org.springframework.amqp:spring-rabbit"
....... but it does not seem to exist in openzipkin! openzipkin requires a url, username/password or a amgp:// uri to connect to RabbitMQ. As we do not have direct control of the Rabbit instance and the hosts and credentials can change on PCF, we cannot hard code them into the server properties.
To provide support for PCF, can openzipkin be updated to use Cloud Connectors to discover and use any bound instances of RabbitMQ, instead of needing to be given the connection information ?
@shakuzen @marcingrzejszczak can you help vet this issue. I'm concerned about adding more core dependencies to the base server. I thought there were people who are already using PCF with zipkin and rabbit
I can take a closer look tomorrow as it is already late here. I believe Marcin and Reshmi already have run Zipkin on PCF. I have easy access to a CF instance but not PCF (no rabbit service for me).
In general, though, you can use placeholders for variables provided by bound CF services, which is how I would try to do this now. So you should be able to use the URI provided by the bound service as the rabbit uri for the Zipkin server.
I've confirmed that things are working.
applications:
- name: docssleuth-zipkin-server
memory: 1024M
instances: 1
host: docssleuth-zipkin-server
path: build/zipkin.jar
services:
- docssleuth-rabbitmq
- docssleuth-mysql
env:
SPRING_PROFILES_ACTIVE: cloud
DEBUG: "true"
RABBIT_URI: ${vcap.services.docssleuth-rabbitmq.credentials.uri}
Trace:
https://docssleuth-zipkin-server.cfapps.io/zipkin/traces/1473953b3f9b37e5
Example to run:
https://github.com/spring-cloud-samples/sleuth-documentation-apps#running-acceptance-tests-of-cf
NOTE: The spans were sent via HTTP but Zipkin has managed to connect to rabbit. Remember to user RABBIT_URI not RABBIT_ADDRESSES
I have just tried it and that works! Thanks for the very quick response and resolution. Would it be a good idea to add this to the RabbitMQ Documentation as another configuration example ?
I'm assuming the important part is below.. the other variables like SPRING_PROFILES_ACTIVE are not needed?
services:
- your-rabbitmq
env:
RABBIT_URI: ${vcap.services.your-rabbitmq.credentials.uri}
We should likely prefix any special instructions with how to provision "your-rabbitmq" and put them in the autoconfigure/collector-rabbitmq README with that section linked from the rabbitmq section of the normal server README I guess?
@adriancole sounds reasonable for the most part. My only concern is that the provisioning command (e.g. available plans) and properties the provisioned service will expose depend on the service provider (though there tends to be something of a convention for using uri). Here's the general documentation on CF services: https://docs.cloudfoundry.org/devguide/services/managing-services.html
For PCF, it looks like this is the official RabbitMQ service: http://docs.pivotal.io/rabbitmq-cf/1-11/index.html
And here's the Spring Boot documentation that explains it will make available the bound service properties to the Spring environment: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#cloud-deployment-cloud-foundry-services
this is pretty old issue so I'm closing it as it is ranking on github's auto-generated list but there are more pressing things to rank.
Most helpful comment
I've confirmed that things are working.
manifest - https://github.com/spring-cloud-samples/sleuth-documentation-apps/blob/master/zipkin-server/manifest.yml
Trace:
https://docssleuth-zipkin-server.cfapps.io/zipkin/traces/1473953b3f9b37e5
Example to run:
https://github.com/spring-cloud-samples/sleuth-documentation-apps#running-acceptance-tests-of-cf
NOTE: The spans were sent via HTTP but Zipkin has managed to connect to rabbit. Remember to user
RABBIT_URInotRABBIT_ADDRESSES