</code></pre></div></p><p>To enable or disable instrumentation for a single Ingress, use the <code>enable-opentelemetry</code> annotation: <divclass=highlight><pre><span></span><code><spanclass=nt>kind</span><spanclass=p>:</span><spanclass="l l-Scalar l-Scalar-Plain">Ingress</span>
</code></pre></div></p><p>We must also set the host to use when uploading traces:</p><p><divclass=highlight><pre><span></span><code><spanclass=nt>otlp-collector-host</span><spanclass=p>:</span><spanclass=s>"otel-coll-collector.otel.svc"</span>
</code></pre></div> NOTE: While the option is called <code>otlp-collector-host</code>, you will need to point this to any backend that receives otlp-grpc.</p><p>Next you will need to deploy a distributed telemetry system which uses OpenTelemetry. <ahref=https://github.com/open-telemetry/opentelemetry-collector>opentelemetry-collector</a>, <ahref=https://www.jaegertracing.io/>Jaeger</a><ahref=https://github.com/grafana/tempo>Tempo</a>, and <ahref=https://zipkin.io/>zipkin</a> have been tested.</p><p>Other optional configuration options: <divclass=highlight><pre><span></span><code><spanclass=c1># specifies the name to use for the server span</span>
<spanclass="l l-Scalar l-Scalar-Plain"># specifies the port to use when uploading traces, Default</span><spanclass="p p-Indicator">:</span><spanclass="l l-Scalar l-Scalar-Plain">4317</span>
</code></pre></div></p><p>Note that you can also set whether to trust incoming spans (global default is true) per-location using annotations like the following: <divclass=highlight><pre><span></span><code><spanclass=nt>kind</span><spanclass=p>:</span><spanclass="l l-Scalar l-Scalar-Plain">Ingress</span>
</code></pre></div></p><h2id=examples>Examples<aclass=headerlinkhref=#examplestitle="Permanent link"> ¶</a></h2><p>The following examples show how to deploy and test different distributed telemetry systems. These example can be performed using Docker Desktop.</p><p>In the <ahref=https://github.com/esigo/nginx-example>esigo/nginx-example</a> GitHub repository is an example of a simple hello service:</p><preclass=mermaid><code>graph TB
subgraph Browser
start["http://esigo.dev/hello/nginx"]
end
subgraph app
sa[service-a]
sb[service-b]
sa --> |name: nginx| sb
sb --> |hello nginx!| sa
end
subgraph otel
otc["Otel Collector"]
end
subgraph observability
tempo["Tempo"]
grafana["Grafana"]
backend["Jaeger"]
zipkin["Zipkin"]
end
subgraph ingress-nginx
ngx[nginx]
end
subgraph ngx[nginx]
ng[nginx]
om[OpenTelemetry module]
end
subgraph Node
app
otel
observability
ingress-nginx
om --> |otlp-gRPC| otc --> |jaeger| backend
otc --> |zipkin| zipkin
otc --> |otlp-gRPC| tempo --> grafana
sa --> |otlp-gRPC| otc
sb --> |otlp-gRPC| otc
start --> ng --> sa
end</code></pre><p>To install the example and collectors run:</p><ol><li><p>Enable Ingress addon with:</p><divclass=highlight><pre><span></span><code><spanclass=nt>opentelemetry</span><spanclass=p>:</span>
</code></pre></div></li><li><p>Enable OpenTelemetry and set the otlp-collector-host:</p><divclass=highlight><pre><span></span><code><spanclass="l l-Scalar l-Scalar-Plain">$ echo '</span>
</code></pre></div></li><li><p>Deploy otel-collector, grafana and Jaeger backend:</p><divclass=highlight><pre><span></span><code><spanclass=c1># add helm charts needed for grafana and OpenTelemetry collector</span>
</code></pre></div></li><li><p>Build and deploy demo app:</p><divclass=highlight><pre><span></span><code><spanclass=c1># build images</span>
make images
<spanclass=c1># deploy demo app:</span>
make deploy-app
</code></pre></div></li><li><p>Make a few requests to the Service:</p><divclass=highlight><pre><span></span><code>kubectl port-forward --namespace<spanclass=o>=</span>ingress-nginx service/ingress-nginx-controller <spanclass=m>8090</span>:80
Mon, <spanclass=m>10</span> Oct <spanclass=m>2022</span><spanclass=m>17</span>:43:33 GMT<spanclass=o>]}</span>
Images : <spanclass=o>{}</span>
InputFields : <spanclass=o>{}</span>
Links : <spanclass=o>{}</span>
ParsedHtml : System.__ComObject
RawContentLength : <spanclass=m>21</span>
</code></pre></div></li><li><p>View the Grafana UI:</p><p><divclass=highlight><pre><span></span><code>kubectl port-forward --namespace<spanclass=o>=</span>observability service/grafana <spanclass=m>3000</span>:80
</code></pre></div> In the Grafana interface we can see the details: <imgalt="grafana screenshot"src=../../../images/otel-grafana-demo.pngtitle="grafana screenshot"></p></li><li><p>View the Jaeger UI:</p><p><divclass=highlight><pre><span></span><code>kubectl port-forward --namespace<spanclass=o>=</span>observability service/jaeger-all-in-one-query <spanclass=m>16686</span>:16686
</code></pre></div> In the Jaeger interface we can see the details: <imgalt="Jaeger screenshot"src=../../../images/otel-jaeger-demo.pngtitle="Jaeger screenshot"></p></li><li><p>View the Zipkin UI:</p><p><divclass=highlight><pre><span></span><code>kubectl port-forward --namespace<spanclass=o>=</span>observability service/zipkin <spanclass=m>9411</span>:9411
</code></pre></div> In the Zipkin interface we can see the details: <imgalt="zipkin screenshot"src=../../../images/otel-zipkin-demo.pngtitle="zipkin screenshot"></p></li></ol></article></div></div></main><footerclass=md-footer><divclass=md-footer-nav><navclass="md-footer-nav__inner md-grid"aria-label=Footer><ahref=../opentracing/class="md-footer-nav__link md-footer-nav__link--prev"rel=prev><divclass="md-footer-nav__button md-icon"><svgxmlns=http://www.w3.org/2000/svgviewbox="0 0 24 24"><pathd="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg></div><divclass=md-footer-nav__title><divclass=md-ellipsis><spanclass=md-footer-nav__direction> Previous </span> OpenTracing </div></div></a><ahref=../../../examples/class="md-footer-nav__link md-footer-nav__link--next"rel=next><divclass=md-footer-nav__title><divclass=md-ellipsis><spanclass=md-footer-nav__direction> Next </span> Introduction </div></div><divclass="md-footer-nav__button md-icon"><svgxmlns=http://www.w3.org/2000/svgviewbox="0 0 24 24"><pathd="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg></div></a></nav></div><divclass="md-footer-meta md-typeset"><divclass="md-footer-meta__inner md-grid"><divclass=md-footer-copyright> Made with <ahref=https://squidfunk.github.io/mkdocs-material/target=_blankrel=noopener> Material for MkDocs </a></div></div></div></footer></div><scriptsrc=../../../assets/javascripts/vendor.93c04032.min.js></script><scriptsrc=../../../assets/javascripts/bundle.83e5331e.min.js></script><scriptid=__langtype=application/json>{"clipboard.copy":"Copy to clipboard","clipboard.copied":"Copied to clipboard","search.config.lang":"en","search.config.pipeline":"trimmer, stopWordFilter","search.config.separator":"[\\s\\-]+","search.placeholder":"Search","search.result.placeholder":"Type to start searching","search.result.none":"No matching documents","search.result.one":"1 matching document","search.result.other":"# matching documents","search.result.more.one":"1 more on this page","search.result.more.other":"# more on this page","search.result.term.missing":"Missing"}</script><script>