From c1c65fce18a448076e4c2666e51885aaf5351d64 Mon Sep 17 00:00:00 2001 From: Adnan Rahic Date: Tue, 15 Oct 2024 12:55:54 +0200 Subject: [PATCH] docs(getstarted): added otel operator --- .../configure-trace-ingestion.mdx | 114 ++++++++++++++++- docs/docs/getting-started/no-otel.mdx | 115 ------------------ 2 files changed, 111 insertions(+), 118 deletions(-) diff --git a/docs/docs/getting-started/configure-trace-ingestion.mdx b/docs/docs/getting-started/configure-trace-ingestion.mdx index 0d42e3ae03..e9e2762b5b 100644 --- a/docs/docs/getting-started/configure-trace-ingestion.mdx +++ b/docs/docs/getting-started/configure-trace-ingestion.mdx @@ -102,7 +102,7 @@ OpenTelemetry auto-instrumentation allows you to send basic data quickly using t -1. Install Dependecies +1. Install Dependencies ```bash title="Terminal" npm install --save @opentelemetry/auto-instrumentations-node @@ -187,7 +187,7 @@ opentelemetry-instrument python app.py -1. Install Dependecies +1. Install Dependencies ```bash title="Terminal" go get \ @@ -389,7 +389,115 @@ rails server -p 8080 ::: - + + +1. Install [`cert-manager`](https://cert-manager.io/) + +```bash +kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.11.0/cert-manager.yaml +``` + +2. Install the [OpenTelemetry Operator](https://opentelemetry.io/docs/k8s-operator/) to inject automatic instrumentation in Kubernetes + +Traces will be generated and collected automatically. + +```bash +kubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/latest/download/opentelemetry-operator.yaml +``` + +3. Create a file named `otel-collector.yaml` for the OpenTelemetry config + +```yaml title="otel-collector.yaml" +apiVersion: opentelemetry.io/v1alpha1 +kind: Instrumentation +metadata: +name: otel-instrumentation +spec: +exporter: + endpoint: http://otel-collector:4317 +propagators: + - tracecontext + - baggage + - b3 + +--- +apiVersion: opentelemetry.io/v1alpha1 +kind: OpenTelemetryCollector +metadata: +name: otel +spec: +config: | + receivers: + otlp: + protocols: + grpc: + http: + processors: + batch: + timeout: 100ms + exporters: + otlp/tracetest: + endpoint: :4317 + # headers: + # "x-tracetest-token": "" + tls: + insecure: true + service: + pipelines: + traces: + receivers: [otlp] + processors: [batch] + exporters: [otlp/tracetest] +``` + +You configure 2 separate things: + +- The Instrumentation, which is an init-container that will run on any pod you explictly mark (see step 5). +- The OpenTelemetry collector, which will collect the traces from the init-container and send them to Tracetest. + +4. Apply the `otel-collector.yaml` config file + +```bash title="Terminal" +kubectl apply -f otel-collector.yaml +``` + +5. Update any service you want to instrument + +Use the [following annotations as seen in the OpenTelemetry docs](https://opentelemetry.io/docs/k8s-operator/automatic/): + +- **.NET**: `instrumentation.opentelemetry.io/inject-dotnet: "true"` +- **Java**: `instrumentation.opentelemetry.io/inject-java: "true"` +- **Node.js**: `instrumentation.opentelemetry.io/inject-nodejs: "true"` +- **Python**: `instrumentation.opentelemetry.io/inject-python: "true"` + +:::note +Add an environment variable named `SERVICE_NAME` to your service so that you can +later identify it in the tests. +::: + +```yaml +apiVersion: apps/v1 +kind: Deployment +metadata: +name: your-service +spec: +replicas: 1 +template: + annotations: + instrumentation.opentelemetry.io/inject-nodejs: 'true' +spec: + containers: + var: + - name: SERVICE_NAME + value: 'your-service' +``` + +This will automatically instrument your service with OpenTelemetry and send the traces to the OpenTelemetry collector. + + + + +You can configure OpenTelemetry SDKs to export traces to an [OpenTelemetry Collector](https://opentelemetry.io/docs/collector/) first. Then, configure an exporter and service pipeline to forward traces to Tracetest. 1. Configure Exporters diff --git a/docs/docs/getting-started/no-otel.mdx b/docs/docs/getting-started/no-otel.mdx index 15ee7a33f1..dd8286023d 100644 --- a/docs/docs/getting-started/no-otel.mdx +++ b/docs/docs/getting-started/no-otel.mdx @@ -44,121 +44,6 @@ Below we provide quick links to all key docs and samples. | **Python** | https://opentelemetry.io/docs/zero-code/python/ | | **Go** | https://opentelemetry.io/docs/zero-code/go/ | - - - -You can install the OpenTelemetry Operator in any existing Kubernetes environment in under 5 minutes by running the following set of commands. - -## 1. Install [`cert-manager`](https://cert-manager.io/) -#### This is required for the OpenTelemetry Operator to work. - -```bash -kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.11.0/cert-manager.yaml -``` - -## 2. Install the [OpenTelemetry Operator](https://opentelemetry.io/docs/k8s-operator/) -#### Traces will be generated and collected automatically. - -```bash -kubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/latest/download/opentelemetry-operator.yaml -``` - -## 3. Create a file named `otel-collector.yaml` for the OpenTelemetry config - -```yaml title="otel-collector.yaml" -apiVersion: opentelemetry.io/v1alpha1 -kind: Instrumentation -metadata: -name: otel-instrumentation -spec: -exporter: - endpoint: http://otel-collector:4317 -propagators: - - tracecontext - - baggage - - b3 - ---- -apiVersion: opentelemetry.io/v1alpha1 -kind: OpenTelemetryCollector -metadata: -name: otel -spec: -config: | - receivers: - otlp: - protocols: - grpc: - http: - processors: - batch: - timeout: 100ms - exporters: - otlp/tracetest: - endpoint: tracetest:4317 - tls: - insecure: true - service: - pipelines: - traces: - receivers: [otlp] - processors: [batch] - exporters: [otlp/tracetest] -``` - -You configure 2 separate things: - -#### 1. The Instrumentation, which is an init-container that will run on any pod you explictly mark (see step 5). - -#### 2. The OpenTelemetry collector, which will collect the traces from the init-container and send them to Tracetest, and/or your trace data store. - -What's amazing here is that you can add other exporters to this config file to [send the traces to other services as explained here](../configuration/overview.mdx). - -## 4. Apply the `otel-collector.yaml` config file - -```bash title="Terminal" -kubectl apply -f otel-collector.yaml -``` - -## 5. Update any service you want to instrument - -Use the [following annotations as seen in the OpenTelemetry docs](https://opentelemetry.io/docs/k8s-operator/automatic/): - -- **.NET**: `instrumentation.opentelemetry.io/inject-dotnet: "true"` -- **Java**: `instrumentation.opentelemetry.io/inject-java: "true"` -- **Node.js**: `instrumentation.opentelemetry.io/inject-nodejs: "true"` -- **Python**: `instrumentation.opentelemetry.io/inject-python: "true"` - -:::note -Add an environment variable named `SERVICE_NAME` to your service so that you can -later identify it in the tests. -::: - -```yaml -apiVersion: apps/v1 -kind: Deployment -metadata: -name: your-service -spec: -replicas: 1 -template: - annotations: - instrumentation.opentelemetry.io/inject-nodejs: 'true' -spec: - containers: - var: - - name: SERVICE_NAME - value: 'your-service' -``` - -This will automatically instrument your service with OpenTelemetry and send the traces to the OpenTelemetry collector. - -Apply the changes and you're ready! You can start writing integration and end-to-end tests with trace-based testing! - -:::note -Check the [official OpenTelemetry docs](https://opentelemetry.io/docs/k8s-operator/automatic/) explaining how to use the OpenTelemetry Operator. -::: -