appmetrics-zipkin1.1.1 • Public • Published
appmetrics-zipkin provides Zipkin instrumentation of Node.js applications using a single line:
Unlike other zipkin instrumentation packages, appmetrics-zipkin will automatically inject missing trace header information into any inbound request and use the same value for the outbound request without any user intervention. This gives you a full trace across the http message with out any extra code.
Configure Zipkin Endpoint
Connecting to a Zipkin endpoint is done by adding the desired hostname and port to
Alternatively, the hostname, port and service name (used by Zipkin to identify your application) can be added when including appmetrics-zipkin into your application:
var appzip =host: 'localhost'port: 9411serviceName:'frontend'sampleRate: 10;
Note: The properties file has precedence over the inline settings
If no configuration details are provided, the endpoint will be localhost:9411, the serviceName will be set to the program name that requires appmetrics-zipkin and the sample rate will be 1.0 (100% of requests).
var appzip = ;var express = ;var app = ;app;app;
require('appmetrics-zipkin') must be included before requiring other packages to ensure those packages are correctly instrumented. Failure to do can result in spans not being sent to the Zipkin server.
Using Zipkin with Node.js and Kubernetes
Deploy the Zipkin service with a given service name and exposure type, for example, naming the service
zipkin and choosing to expose the service via the
Your Node.js code to send Zipkin traffic to the discovered server would be as follows:
var zipkinHost = "localhost"var zipkinPort = 9411if processenvZIPKIN_SERVICE_HOST && processenvZIPKIN_SERVICE_PORTconsolezipkinHost = processenvZIPKIN_SERVICE_HOSTzipkinPort = processenvZIPKIN_SERVICE_PORTelseconsolevar appzip =host: zipkinHostport: zipkinPortserviceName:'my-kube-frontend'sampleRate: 10;
You can see if the environment variables are present with the following commands.
kubectl get pods to discover the pod of your Zipkin deployment.
kubectl exec -it <the pod name from above> printenv | grep SERVICE to determine the environment variables present for the Zipkin service.
[Node.js@IBM icp-nodejs-sample]$ kubectl exec -it test-zipkin-289126497-pjf5b printenv | grep SERVICE ZIPKIN_SERVICE_HOST=10.0.0.105 ZIPKIN_SERVICE_PORT=9411
Module Long Term Support Policy
This module adopts the Module Long Term Support (LTS) policy, with the following End Of Life (EOL) dates:
|Module Version||Release Date||Minimum EOL||EOL With||Status|
|V1.x.x||Oct 2017||Dec 2019||Current|