Skip to content

isItObservable/nginx-instrumentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Is it Observable

Is It observable Logo

Episode : Nginx Instrumentation

This repository contains the files utilized during the tutorial presented in the dedicated IsItObservable episode related to Nginx Instrumentation.

nginx Logo

this tutorial will also utilize the OpenTelemetry Operator with:

  • the OpenTelemetry Demo

  • the hipster-shop

  • nginx

  • All the observability data generated by the environment would be sent to Dynatrace.

Prerequisite

The following tools need to be install on your machine :

  • jq
  • kubectl
  • git
  • gcloud ( if you are using GKE)
  • Helm

1.Create a Google Cloud Platform Project

PROJECT_ID="<your-project-id>"
gcloud services enable container.googleapis.com --project ${PROJECT_ID}
gcloud services enable monitoring.googleapis.com \
cloudtrace.googleapis.com \
clouddebugger.googleapis.com \
cloudprofiler.googleapis.com \
--project ${PROJECT_ID}

2.Create a GKE cluster

ZONE=europe-west3-a
NAME=isitobservable-nginx-instrumentation
gcloud container clusters create ${NAME} --zone=${ZONE} --machine-type=e2-standard-4 --num-nodes=2

3. Clone Github repo

git clone  https://github.com/isitobservable/nginx-instrumentation
cd nginx-instrumentation

Getting started

Dynatrace Tenant

1. Dynatrace Tenant - start a trial

If you don't have any Dynatrace tenant , then I suggest to create a trial using the following link : Dynatrace Trial Once you have your Tenant save the Dynatrace tenant url in the variable DT_TENANT_URL (for example : https://dedededfrf.live.dynatrace.com)

DT_TENANT_URL=<YOUR TENANT Host>
2. Create the Dynatrace API Tokens

The dynatrace operator will require to have several tokens:

  • Token to deploy and configure the various components
  • Token to ingest metrics and Traces
Operator Token

One for the operator having the following scope:

  • Create ActiveGate tokens
  • Read entities
  • Read Settings
  • Write Settings
  • Access problem and event feed, metrics and topology
  • Read configuration
  • Write configuration
  • Paas integration - installer downloader

operator token

Save the value of the token . We will use it later to store in a k8S secret

API_TOKEN=<YOUR TOKEN VALUE>
Ingest data token

Create a Dynatrace token with the following scope:

  • Ingest metrics (metrics.ingest)
  • Ingest logs (logs.ingest)
  • Ingest events (events.ingest)
  • Ingest OpenTelemetry
  • Read metrics

data token

Save the value of the token . We will use it later to store in a k8S secret
DATA_INGEST_TOKEN=<YOUR TOKEN VALUE>

Deploy most of the components

The application will deploy the entire environment:

chmod 777 deployment.sh
./deployment.sh  --clustername "${NAME}" --dturl "${DT_TENANT_URL}" --dtingesttoken "${DATA_INGEST_TOKEN}" --dtoperatortoken "${API_TOKEN}" 

Tutorial Steps

Nginx Ingress controller

The deployment script of this tutorial has already:

  • enabled the tracing on the ingress
  • added the right annotations to the ingress rules

If you open your Dynatrace Tenant, and open The Services application , you should find a dedicated service for our ingress controller

services

And if you open this service you will find all the various application using this ingress:

nginx

You can select one of the distributes traces, in my case I clicked on the Checkout transaction

trace

Nginx Web Server instrumentation

Now let's instrument a traditionnal nginx webserver. To do so we will first need to create a specific namespace:

kubectl create ns nginx-example
kubectl label namespace  nginx-example oneagent=false

Then we want to configure the instrumentation that would be applied on our future nginx deployment:

kubect apply -f opentelemetry/Instrumentation.yaml -n nginx-example

Once the instrumentation object is deployed you can deploy your nginx deployments:

kubect apply -f  nginx/basic_web1.yaml -n nginx-example
kubect apply -f nginx/nginx_deploy.yaml -n nginx-example
IP=$(kubectl get svc ingress-nginx-controller -n ingress-nginx -ojson | jq -j '.status.loadBalancer.ingress[].ip')

if now you open your browser on the url : http://nginx1.$IP.nip.io and wait few seconds

You can open your Dynatrace Tenant, and open The Services application , you should find a dedicated service for our nginx1 webserver

nginx1

And if you open this service you will find all the various application using this ingress:

webserver_service

You can select one of the distributes traces available in this screen you will see the trace produced by the auto-instrumentation :

traces

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages