Using Signoz and OpenTelemetry as an alternative to DataDog

 Datadog is an essential tool for monitoring large applications, but for hobby projects Sigmoz is a great open source alternative that provides similar functionality. It's also free and easy to setup using docker-compose.

Start off by cloning the signoz github repo.

git clone https://github.com/SigNoz/signoz
cd signoz/deploy
If you already have docker and docker-compose installed than you can skip this, but otherwise run the install script.

./install.sh
Launch the Sigmoz service. The docker-compose setup includes clickhouse database, Zookeeper service, and a sample application called hotrod. This will bring up everything.

docker-compose -f docker/clickhouse-setup/docker-compose.yaml up
Then navigate to http://localhost:3301/ and you'll be prompted to setup an account and admin password. Then you'll be able to see the Sigmoz homepage with some example metrics.
We can then start on integrating the opentelemetry metrics with our java app. Open telemetry automatically ingests metrics from the following frameworks by default. 
  • Akka HTTP 10.0+ 
  • Apache HttpClient 2.0+ 
  • AWS Lambda 1.0+ 
  • AWS SDK 1.11.x and 2.2.0+ 
  • Cassandra Driver 3.0+ 
  • Elasticsearch API 5.0+ 
  • Elasticsearch REST Client 5.0+ 
  • gRPC 1.6+ 
  • JDBC 
  • Java 8+ 
  • Jedis 1.4+ 
  • Kafka 0.11+ 
  • Kubernetes Client 7.0+ 
  • MongoDB Driver 3.1+ 
  • OkHttp 3.0+ 
  • RabbitMQ Client 2.7+ 
  • Spark Web Framework 2.3+ 
  • Spring Web Services 2.0+ 
  • Vert.x 3.0+  
So all we need to do is include the opentelemetry java agent when starting up our app and provide the below environment variables.

# Get the opentelemetry agent
wget -q 'https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar' -O /opt/opentelemetry/opentelemetry-javaagent.jar

# Start the application using this java agent
java -jar -javaagent:/opt/opentelemetry/opentelemetry-javaagent.jar signoz_poc.jar

# Set the following env variables on application start, to point to our docker-compose running Signoz
- OTEL_TRACES_EXPORTER=otlp
- OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
- OTEL_RESOURCE_ATTRIBUTES="service.name=signoz-poc"

Comments

Popular posts from this blog

Using Selenium Testing for Electron (Atom shell) Applications

Packaging Electron Applications for OSX

Installing Influxdb and Grafana on EMR