GithubHelp home page GithubHelp logo

blueswen / fastapi-jaeger Goto Github PK

View Code? Open in Web Editor NEW
59.0 59.0 18.0 4.96 MB

Trace FastAPI with Jaeger through OpenTelemetry Python API and SDK.

Dockerfile 2.32% Python 86.61% Shell 11.08%
fastapi jaeger opentelemetry

fastapi-jaeger's Introduction

Hello there ๐Ÿ‘‹

Hi, I am @Blueswen (Yi-Wei, Liu), a Software Engineer focus on Web Application, DevOps, Cloud Native and Developer Experience.

Want to be a full stack developer, but just a stack overflow developer right now.

My Tech Stack

Vue.js Python Docker K8s

Blueswen's GitHub stats

fastapi-jaeger's People

Contributors

blueswen avatar npuichigo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

fastapi-jaeger's Issues

Error decoding 'jaeger' for 'exporters' in otel-collector-config.yaml

2023-11-17 16:31:29 * error decoding 'exporters': unknown type: "jaeger" for id: "jaeger" (valid values: [pulsar skywalking sumologic alibabacloud_logservice instana mezmo opencensus elasticsearch googlecloud prometheusremotewrite logging awsemf clickhouse dataset azuremonitor datadog dynatrace googlecloudpubsub kafka otlp otlphttp awscloudwatchlogs awsxray sapm tanzuobservability azuredataexplorer file tencentcloud_logservice zipkin sentry debug awss3 logicmonitor prometheus logzio signalfx splunk_hec coralogix f5cloud influxdb loadbalancing loki awskinesis carbon cassandra googlemanagedprometheus])
2023-11-17 16:32:30 Error: failed to get config: cannot unmarshal the configuration: 1 error(s) decoding:

[question] container names for compose from `app_b` -> `fastapi-jaeger_app-b_1`

Don't know what's the wrong with my env? I use podman-compose @ Mac, but it shall be the same.

forget how to fix it, I got the container name is fastapi-jaeger_app-a_1 with extra prefix fastapi-jaeger and suffix _1.

I have to change in all related areas to make it work as expected

  • main.py like TARGET_ONE_HOST = os.environ.get("TARGET_ONE_HOST", "fastapi-jaeger_app-b_1") // from app_b
  • docker-compose.yaml for naming
  • config under etc

But I think it shall not work like this, what's wrong with my env? I use podman-compose @ Mac, but it shall be the same

Can you paste your console out in the readme, I got it like below.

$ podman ps
CONTAINER ID  IMAGE                                                   COMMAND               CREATED         STATUS                 PORTS                                                                       NAMES
645c7459b3f8  localhost/fastapi-jaeger_app-a:latest                   uvicorn main:app ...  25 seconds ago  Up 14 seconds          0.0.0.0:8000->8000/tcp                                                      fastapi-jaeger_app-a_1
ffd1e27990ee  localhost/fastapi-jaeger_app-b:latest                   uvicorn main:app ...  24 seconds ago  Up 13 seconds          0.0.0.0:8001->8000/tcp                                                      fastapi-jaeger_app-b_1
3334db65abff  localhost/fastapi-jaeger_app-c:latest                   uvicorn main:app ...  23 seconds ago  Up 12 seconds          0.0.0.0:8002->8000/tcp                                                      fastapi-jaeger_app-c_1
08caf128b172  localhost/fastapi-jaeger_app-d:latest                   uvicorn main:app ...  21 seconds ago  Up 11 seconds          0.0.0.0:8003->8000/tcp                                                      fastapi-jaeger_app-d_1
b9c68f04cbfd  docker.io/library/cassandra:4.1.2                       cassandra -f          20 seconds ago  Up 10 seconds                                                                                      fastapi-jaeger_cassandra_1
eea4cb843e23  docker.io/jaegertracing/jaeger-cassandra-schema:1.47.0                        19 seconds ago  Up 9 seconds                                                                                       fastapi-jaeger_cassandra-schema_1
c8592793aee5  docker.io/jaegertracing/jaeger-collector:1.47.0         --cassandra.keysp...  17 seconds ago  Up Less than a second  0.0.0.0:39969->4317/tcp, 0.0.0.0:41079->4318/tcp, 0.0.0.0:39891->14250/tcp  fastapi-jaeger_jaeger-collector_1
20075f5cf1a8  docker.io/otel/opentelemetry-collector-contrib:0.81.0   --config=/conf/co...  15 seconds ago  Up 6 seconds           0.0.0.0:39077->4317/tcp, 0.0.0.0:44199->4318/tcp                            fastapi-jaeger_otel-collector_1

inject `TARGET_ONE_HOST` in `app_a` for customization

services:
  app-a:
    build: .
    ports:
      - "8000:8000"
    volumes:
      - ./src/fastapi_jaeger:/app
    environment:
      TARGET_ONE_HOST: "fastapi-jaeger_app-b_1"
      TARGET_TWO_HOST: "fastapi-jaeger_app-c_1"

In the docker-composer.yaml, it is better to inject above configurations (TARGET_ONE_HOST & TARGET_TWO_HOST

related with #2 (app_b could be good enough)

Getting "Overriding of current TracerProvider is not allowed" error

Overriding of current TracerProvider is not allowed.

Traceback (most recent call last):
  File "/Users/jaydeepcheruku/git-repos/mfgot-asset-services/assets-api/app/main.py", line 173, in <module>
    setting_otel(app)
  File "/Users/jaydeepcheruku/git-repos/mfgot-asset-services/assets-api/app/main.py", line 164, in setting_otel
    tracer.add_span_processor(BatchSpanProcessor(OTLPSpanExporterHTTP(endpoint=OTLP_DYNATRACE_ENDPOINT, headers=OTEL_EXPORTER_OTLP_HEADERS)))
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaydeepcheruku/git-repos/mfgot-asset-services/assets-api/venv/lib/python3.12/site-packages/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py", line 96, in __init__
    self._session.headers.update(self._headers)
  File "<frozen _collections_abc>", line 987, in update
ValueError: not enough values to unpack (expected 2, got 1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.