<p>So I am trying to instrument a FastAPI python server with Open Telemetry. I installed the dependencies needed through poetry:</p>
<pre><code>opentelemetry-api = &quot;^1.11.1&quot;
opentelemetry-distro = {extras = [&quot;otlp&quot;], version = &quot;^0.31b0&quot;}
opentelemetry-instrumentation-fastapi = &quot;^0.31b0&quot;
</code></pre>
<p>When running the server locally, with <code>opentelemetry-instrument --traces_exporter console uvicorn src.main:app --host 0.0.0.0 --port 5000</code> I can see the traces printed out to my console whenever I call any of my endpoints.</p>
<p>The main issue I face, is when running the app in k8s I see no logs in the collector.</p>
<p>I have added cert-manager <code>kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.8.0/cert-manager.yaml</code> (needed by the OTel Operator) and the OTel Operator itself <code>install the operator kubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/latest/download/opentelemetry-operator.yaml</code>.</p>
<p>Then, I added a collector with the following config:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
  name: otel
spec:
  config: |
    receivers:
      otlp:
        protocols:
          grpc:
          http:
    processors:

    exporters:
      logging:

    service:
      pipelines:
        traces:
          receivers: [otlp]
          processors: []
          exporters: [logging]
</code></pre>
<p>And finally, an Instrumentation CR to enable auto-instrumentation:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
  name: my-instrumentation
spec:
  exporter:
    endpoint: http://otel-collector:4317
  propagators:
    - tracecontext
    - baggage
  sampler:
    type: parentbased_traceidratio
    argument: &quot;0.25&quot;
</code></pre>
<p>My app's deployment contains:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert -f docker-compose-run-local-with-aws.yml -c
    kompose.version: 1.26.1 (HEAD)
  creationTimestamp: null
  labels:
    io.kompose.service: api
  name: api
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: api
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        kompose.cmd: kompose convert -f docker-compose-run-local-with-aws.yml -c
        kompose.version: 1.26.1 (HEAD)
        sidecar.opentelemetry.io/inject: &quot;true&quot;
        instrumentation.opentelemetry.io/inject-python: &quot;true&quot;
      creationTimestamp: null
      labels:
        io.kompose.network/backend: &quot;true&quot;
        io.kompose.service: api
        app: api
    spec:
      containers:
        - env:
            - name: APP_ENV
              value: docker
            - name: RELEASE_VERSION
              value: &quot;1.0.0&quot;
            - name: OTEL_RESOURCE_ATTRIBUTES
              value: &quot;service.name=fastapiApp&quot;
            - name: OTEL_LOG_LEVEL
              value: &quot;debug&quot;
            - name: OTEL_TRACES_EXPORTER
              value: otlp_proto_http
            - name: OTEL_EXPORTER_OTLP_ENDPOINT
              value: http://otel-collector:4317
          image: my_org/api:1.0.0
          name: api
          ports:
            - containerPort: 5000
          resources: {}
          imagePullPolicy: IfNotPresent
      restartPolicy: Always
</code></pre>
<p>What am I missing? I have double checked everything a thousand times and cannot figure out what might be wrong</p>

ebarti
<p>You have incorrectly configured the exporter endpoint setting <code>OTEL_EXPORTER_OTLP_ENDPOINT</code>. Endpoint value for OTLP over HTTP exporter should have port number 4318. The 4317 port number should be used for OTLP/gRPC exporters.</p>
