The main aim in this exercise is to expose the tracing information of Data Virtualization service that was deployed in the previous steps using OpenTracing and Jaeger.
the Teiid Operator will NOT automatically find a Jaeger instance to be used with the tracing. Teiid Operator expects the user to configure a Jaeger instance, and then provide the name of the instance to the Data Virtualization service. Currently the expectation is that the Jaeger instance is also running in the same Namespace. This information is provided in Custom Resource of Virtual Database. Installing the Jaeger instance is beyond the scope of this document, however one can refer to documentation for Jaeger Operator
The following shows the changes required to the Custom Resource file of the Virtual Database to enable the Jaeger based tracing.
apiVersion: teiid.io/v1alpha1
kind: VirtualDatabase
metadata:
name: dv-customer
spec:
jaeger: simplest (1)
-
Name of the Jaeger Server instance in the Namespace.
During the deployment, the Teiid Operator will verify the existence of the Jaeger instance, if instance is found it will inject a Jaeger agent as sidecar into the same pod where the Virtual Database is running and configure the VDB service to talk to the agent to participate in active tracing spans. Active spans are supported over JDBC, OData, and OpenAPi interfaces.
It is expected that user is already have OpenShift environment and Teiid Operator running before running this example. If not please take look at instructions at README
To show data virtualization service working with Open Tracing one need to install a Jaeger Operator first. If you are working with OpenShift 4.x install the Operator first from Operator Hub. Then create a instance of Jaeger server by executing the following snippet
kubectl apply -f - <<EOF
apiVersion: jaegertracing.io/v1
kind: Jaeger
metadata:
name: simplest
EOF
This will install the default AllInOne strategy, which deploys the “all-in-one” image (agent, collector, query, ingestor, Jaeger UI) in a single pod, using in-memory storage by default.
Now, continuing with previous examples as one shown here Virtual Database defined in DDL add the following to the YAML file to configure Jaeger instance.
apiVersion: teiid.io/v1alpha1
kind: VirtualDatabase
metadata:
name: dv-customer
spec:
replicas: 1
jaeger: simplest (1)
env:
- name: ORG_TEIID_TRACING_WITH_ACTIVE_SPAN_ONLY (2)
value: "false"
-
Name of the Jaeger instance from above, note this could be different for your instance.
-
Enable all tracing, not just active spans. i.e this will report if in coming requests do not have span information even then Data Virtualization will report as a independent span. Good for easy testing. Note this is not required if your client program is sending in a active span into the Data Virtualization. Active spans are supported over JDBC, OData, and OpenAPI interfaces.
Deploy the YAML using
oc create -f dv-customer.yaml
Once you deploy the above custom resource then OpenTracing is setup for Data Virtualization service. Make sure the service is up and running without any issues.
User can now issue queries into Data Virtualization system using JDBC protocol (using Teiid Driver) or over OData (REST calls) or OpenAPI (REST calls), if these requests have active span information defined then those spans will be carried through the Data Virtualization system and reported accordingly to the Jaeger system. See how to setup spans here
Now user can go to the Jaeger web console and look up the traces for spans they created and/or with service name. For example in this test you can use dv-customer
as service and find out the traces that occurred.