Skip to content

Latest commit

History

History
194 lines (150 loc) 路 6.7 KB

no-otel.mdx

File metadata and controls

194 lines (150 loc) 路 6.7 KB
id title hide_table_of_contents description keywords image
no-otel
What if I don't have OpenTelemetry installed?
true
Tracetest allows you to quickly build integration and end-to-end tests, powered by your OpenTelemetry traces. Learn how to install OpenTelemetry in less than 5 minutes.
tracetest
trace-based testing
observability
distributed tracing
testing

What if I don't have OpenTelemetry installed?

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

No worries! You can get started with no code changes at all!

This page will explain getting started with OpenTelemetry:

  • Injecting auto instrumentation with no code changes.
  • Auto instrumentation with limited code changes.
  • Manual instrumentation with code changes.

You can also find more ways to instrument OpenTelemetry in their documentation.

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

This is required for the OpenTelemetry Operator to work.

kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.11.0/cert-manager.yaml

2. Install the OpenTelemetry Operator

Traces will be generated and collected automatically.

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

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.

4. Apply the otel-collector.yaml config file

kubectl apply -f otel-collector.yaml

5. Update any service you want to instrument

Use the following annotations as seen in the OpenTelemetry docs:

  • .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. :::

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 explaining how to use the OpenTelemetry Operator. :::

Odigos, is a new open source project that can do this for you without a single line of code.

Below we provide quick links to all key docs and samples.

Language Docs GitHub
C#/.NET https://opentelemetry.io/docs/instrumentation/net/automatic/ https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation
Java https://opentelemetry.io/docs/instrumentation/java/automatic/ https://github.com/open-telemetry/opentelemetry-java-instrumentation
JavaScript https://opentelemetry.io/docs/instrumentation/js/automatic/ https://github.com/open-telemetry/opentelemetry-js
PHP https://opentelemetry.io/docs/instrumentation/php/automatic/ https://github.com/open-telemetry/opentelemetry-php-instrumentation
Python https://opentelemetry.io/docs/instrumentation/python/automatic/ https://github.com/open-telemetry/opentelemetry-python-contrib
Ruby https://opentelemetry.io/docs/instrumentation/ruby/automatic/ https://github.com/open-telemetry/opentelemetry-ruby

Below we provide quick links to all key docs.

Language Docs
C++ https://opentelemetry.io/docs/instrumentation/cpp/
C#/.NET https://opentelemetry.io/docs/instrumentation/net/
Erlang/Elixir https://opentelemetry.io/docs/instrumentation/erlang/
Go https://opentelemetry.io/docs/instrumentation/go/
Java https://opentelemetry.io/docs/instrumentation/java/
JavaScript https://opentelemetry.io/docs/instrumentation/js/
PHP https://opentelemetry.io/docs/instrumentation/php/
Python https://opentelemetry.io/docs/instrumentation/python/
Ruby https://opentelemetry.io/docs/instrumentation/ruby/
Rust https://opentelemetry.io/docs/instrumentation/rust/
Swift https://opentelemetry.io/docs/instrumentation/swift/
Other https://opentelemetry.io/docs/instrumentation/other/

:::tip We suggest you go back to and install Tracetest! Jump back to the installation guide once you have OpenTelemetry installed. :::