How to auto instrument my Spring Boot web api call tracing and send to Google Cloud Trace - spring-boot

I am trying to figure out how to auto instrument my Spring Boot web api call tracing to Google Cloud Trace. (My Spring Boot app is in GKE).
I did similar thing for my Node service, which could use OpenTememetry js package auto instrument express calls and use Google Cloud Trace exporter.
But for my Spring Boot app, I tried a few ways, but I guess due to lack of knowledge I am not able to achieve what I want.
I try to use OpenTelemetry java lib, it mentioned it can auto instrument spring boot, but I don't know how to achieve it and I didn't find an export to Google Cloud Trace(stackdriver) neither
I try to use OpenCensus, It has a Google Cloud Trace export, but I didn't see any document mentioned how to auto instrument spring boot.
I try to use OpenTelmetry and instead of use an export, I deployed an OpenTelemtry Collector, but I don't know how the config the collector and the SDK to let the auto instrumented tracing spans got to the OpenTelemetry collector.
Does anyone has experiences using OpenCensus/OpenTelemetry to generate tracing information and forward it to Google Cloud Trace(StackDrivers).

take a look of this link, you will have to use an otel extension and set the GOOGLE_CLOUD_PROJECT and GOOGLE_APPLICATION_CREDENTIALS env vars

Related

Micrometer Rest API

I have a non boot spring application with micrometer integrated. Right now we are pushing these metrics to the logging file using LoggingRegistry.
We want to enhance this project to expose these metrics in the Rest API(we cannot use actuator as turning ON auto configuration is causing issues in our non boot application).Is there any way to expose these metrics which are automatically provided by the micrometer in the Rest API?
Any example will be appreciated?
You can add PrometheusMeterRegistry, it is for this use case, see the docs: https://micrometer.io/docs/registry/prometheus

Access remote Camunda service programmatically

I have a remote server installation of the Camunda BPM Platform (installed using the Camunda BPM Platform Helm Chart - https://github.com/camunda-community-hub/camunda-helm/tree/main/charts/camunda-bpm-platform). It is working as expected and, while new to BPM, I have been able to try out some workflows and examples successfully.
I am now trying to connect to it remotely and register for thrown events. I've been following https://docs.camunda.org/manual/7.15/reference/bpmn20/events/signal-events/ however I am stumped as to how I can get a handle to runtimeService. Other than using the REST API is there another way to connect to a remote Camunda service? I've tried using the camunda-bpm-spring-boot-starter-external-task-client but no RuntimeService gets initialized. Perhaps I'm missing some remote-specific configuration but I have not found anything in the documentation so far. Based on https://camunda.com/best-practices/deciding-about-your-stack/ I understand that this should be possible - however, all examples I've found deal with an embedded service. Any help is appreciated!
CAMUNDA offers a Java API and a REST API. In addition there are official or community client libraries, which all rely on the REST API. The Java API is only available to code which gets deployed inside the CAMUNDA JVM.
To interact with the engine from outside the JVM you have to use the REST API. The endpoints are named after the resources, not after the Java API services. Hence you You will not find a RuntimeService endpoint on the REST API, but you will find all the functionality the RuntimeService offers, e.g. start via process-definition.
If you do not want to deploy code in the CAMUNDA JVM, then service integration is done preferably using the external task pattern. If you want to use Java, especially the new Spring Boot Starter for external task clients is fun to work with. If you prefer other languages, check out https://github.com/camunda/awesome-camunda-external-clients.
Unfortunately there currently is no implementation type external for signal events so far. Ootb you can work with signal events for 1:n communication between different BPMN processes on the same environment. If you want to send the signal to an external event bus, then you need to add this functionality to the same JVM as a one-time effort. Here is an example for Azure event bus: https://github.com/camunda-consulting/code/tree/master/snippets/engine-plugin-signal-to-azure-eventhub. The implementation would look very similar for SQS or other alternatives.
If you need to modify the container image to include custom code then you can either just add own jars to e.g. the CAMUNDA RUN Docker image as shown here: https://github.com/rob2universe/bpmrun-add-to-dockerimg
or you could build your own image based on the Spring Boot Starter as shown here: https://github.com/rob2universe/camunda-aks

confusion about Spring Data Flow Server

I'm confused about Spring Cloud Data Flow Server deployment...
We are planning to run it on cloudfoundry, and the instructions say one should download the final server artifact (a jar) and deploy it.
On the other hand another section in the documentation describes a way on how to customize the provisioning of roles to users with some custom code. But there is no explanation on how to embed the server in a custom application so I can provide my code (via #Bean).
On a very old blog post I found a mention of #EnableDataFlowServer but this annotation is not described in the official documentation anymore - is it still valid?
There is also no way described how I could use any other security then oauth, do I really need to use oauth? how about using my own security config or even only basic authentication?
I kind of expected the same flexibility as spring cloud config server provides...
You can check the Spring Cloud Data Flow site on how to install SCDF on Cloud Foundry. The instructions in this site have the correct information set up SCDF on CF.
The #EnableDataFlowServer is intended for customizing Spring Cloud Data Flow server using/overriding the existing DataFlowServerAutoConfiguration and DataFlowControllerAutoConfiguration. This is not specific to CF though.

Existing Spring Application to Cloud Foundry

We are planning to move a Spring based application to Cloud Foundry.
The application currently uses WAS server and access data sources using JNDI lookup.
We are using spring features like MVC, AOP etc.
I have certain questions in mind :
Is it possible to switch to Tomcat and configure dataSources using Spring-cloud-connectors and possible conflicts we might run into ?
Currently , datasources are configured in XML files, Should I use the same XML files or switch to annotations.
Can anyone please provide some clarity over this and other known issues with this approach?
Spring Cloud Connectors are by far the easiest way to bind to data sources in Cloud Foundry. I would recommend converting your JNDI lookups to use these service connections as described here:
http://docs.cloudfoundry.org/buildpacks/java/spring-service-bindings.html
cloud foundry automatically reconfigures your datasource when it find a database service attached the cloud app. its super coooool....

Spring XD REST Service

I would like to have a REST service to expose the data read and processed from Spring XD. Similar to the one in the Analytics Server.
For example I would like my own functions which can be exposed similar to Counters and be able to access the data from a web browser.
Is there any tutorial? I have searched and found that Spring Boot is the one but I am looking for help on how I integrate it with Spring XD.
Would be very helpful if someone can point me to the instructions on how I can achieve this.
You can use trigger as a source with http-client as a processor processor to access any web browsers info regardless if it is a web service URL or not.
Moha.

Resources