├── .gitignore ├── LICENSE ├── README ├── distributed-tracing └── api-gateway │ ├── README.md │ ├── apigateway │ ├── Dockerfile │ ├── dd-config.json │ ├── install-dd-opentracing-cpp │ └── nginx.conf │ ├── docker-compose.yml │ ├── frontend-go │ ├── Dockerfile │ ├── index.html.tmpl │ └── main.go │ ├── quotes-db │ ├── Dockerfile-postgres │ └── sql │ │ ├── README.md │ │ ├── create_table.sql │ │ ├── import_quotes.sql │ │ └── quotes_data.txt │ ├── quotes-go │ ├── Dockerfile │ └── main.go │ ├── trace_detail.png │ └── trace_list.png ├── go ├── aws │ └── aws-trace-test │ │ └── main.go ├── goa-basic │ ├── README.md │ ├── calc.go │ ├── cmd │ │ ├── calc-cli │ │ │ ├── grpc.go │ │ │ ├── http.go │ │ │ └── main.go │ │ └── calc │ │ │ ├── grpc.go │ │ │ ├── http.go │ │ │ └── main.go │ ├── design │ │ └── design.go │ ├── gen │ │ ├── calc │ │ │ ├── client.go │ │ │ ├── endpoints.go │ │ │ └── service.go │ │ ├── grpc │ │ │ ├── calc │ │ │ │ ├── client │ │ │ │ │ ├── cli.go │ │ │ │ │ ├── client.go │ │ │ │ │ ├── encode_decode.go │ │ │ │ │ └── types.go │ │ │ │ ├── pb │ │ │ │ │ ├── calc.pb.go │ │ │ │ │ └── calc.proto │ │ │ │ └── server │ │ │ │ │ ├── encode_decode.go │ │ │ │ │ ├── server.go │ │ │ │ │ └── types.go │ │ │ └── cli │ │ │ │ └── calc │ │ │ │ └── cli.go │ │ └── http │ │ │ ├── calc │ │ │ ├── client │ │ │ │ ├── cli.go │ │ │ │ ├── client.go │ │ │ │ ├── encode_decode.go │ │ │ │ ├── paths.go │ │ │ │ └── types.go │ │ │ └── server │ │ │ │ ├── encode_decode.go │ │ │ │ ├── paths.go │ │ │ │ ├── server.go │ │ │ │ └── types.go │ │ │ ├── cli │ │ │ └── calc │ │ │ │ └── cli.go │ │ │ ├── openapi.json │ │ │ └── openapi.yaml │ ├── go.mod │ └── go.sum ├── graphql │ └── graphql-trace-test │ │ └── main.go ├── grpc │ ├── grpc-db │ │ ├── README.md │ │ ├── cmd │ │ │ ├── grpc-db-client │ │ │ │ └── main.go │ │ │ ├── grpc-dbsql-server │ │ │ │ └── main.go │ │ │ └── grpc-gorm-server │ │ │ │ └── main.go │ │ ├── docker-compose.yml │ │ ├── docker │ │ │ ├── Dockerfile.grpc-db-client │ │ │ ├── Dockerfile.grpc-dbsql-server │ │ │ └── Dockerfile.grpc-gorm-server │ │ ├── proto │ │ │ └── crud │ │ │ │ ├── crud.go │ │ │ │ ├── crud.pb.go │ │ │ │ └── crud.proto │ │ ├── trace_detail.png │ │ └── trace_list.png │ └── grpc-trace-test │ │ ├── example.proto │ │ ├── example │ │ └── example.pb.go │ │ └── main.go ├── heartbeat │ └── main.go └── sql │ └── mattn │ └── go-sqlite3 │ ├── README.md │ └── main.go ├── javascript ├── .editorconfig ├── .gitignore ├── browser │ └── http │ │ ├── README.md │ │ ├── app │ │ ├── dd_icon_white.svg │ │ ├── index.html │ │ └── style.css │ │ ├── package.json │ │ └── yarn.lock └── node │ └── microservices │ ├── README.md │ ├── api-gateway │ ├── Dockerfile │ ├── package.json │ ├── server.js │ ├── src │ │ ├── app.js │ │ └── logger.js │ └── yarn.lock │ ├── auth │ ├── Dockerfile │ ├── package.json │ ├── server.js │ ├── src │ │ ├── app.js │ │ ├── cache.js │ │ └── logger.js │ └── yarn.lock │ ├── docker-compose.yml │ └── user │ ├── Dockerfile │ ├── package.json │ ├── server.js │ ├── src │ ├── app.js │ ├── db.js │ ├── logger.js │ └── user_repository.js │ └── yarn.lock ├── opentelemetry ├── README.md ├── build.sh ├── docker-compose.yml ├── fluent-bit │ ├── fluent-bit.conf │ └── parsers.conf ├── k8s-collector.yml ├── node-microservice │ ├── .gitignore │ ├── Dockerfile │ ├── index.js │ ├── logger.js │ ├── package.json │ └── tracer.js ├── otel-collector-config.yml ├── python-microservice │ ├── Dockerfile │ ├── __init__.py │ ├── app.py │ ├── ddlogging │ │ └── injection.py │ └── requirements.txt ├── ruby-microservice │ ├── Dockerfile │ ├── Gemfile │ ├── Gemfile.lock │ ├── app.rb │ ├── config.ru │ ├── puma.rb │ ├── redis.yml │ └── views │ │ └── next_launch.erb └── run.sh ├── php ├── .dockerignore ├── .env ├── .gitignore ├── Laravel42 │ ├── .gitattributes │ ├── .gitignore │ ├── Dockerfiles │ │ ├── Dockerfile_php56_apache │ │ ├── Dockerfile_php71_nginx_fpm │ │ ├── Dockerfile_php72_apache_fpm │ │ ├── Dockerfile_php72_nginx_fpm │ │ ├── acpu.ini │ │ ├── apache2-virtualhost.conf │ │ ├── apache2.conf │ │ ├── opcache-extra.ini │ │ ├── opcache.ini │ │ ├── php-dd-ext.ini │ │ ├── php_nginx_default.conf │ │ └── supervisord-nginx-fpm.conf │ ├── README.md │ ├── app │ │ ├── .gitattributes │ │ ├── commands │ │ │ └── .gitkeep │ │ ├── config │ │ │ ├── app.php │ │ │ ├── auth.php │ │ │ ├── cache.php │ │ │ ├── compile.php │ │ │ ├── database.php │ │ │ ├── local │ │ │ │ ├── app.php │ │ │ │ └── database.php │ │ │ ├── mail.php │ │ │ ├── packages │ │ │ │ └── .gitkeep │ │ │ ├── queue.php │ │ │ ├── remote.php │ │ │ ├── services.php │ │ │ ├── session.php │ │ │ ├── testing │ │ │ │ ├── cache.php │ │ │ │ └── session.php │ │ │ ├── view.php │ │ │ └── workbench.php │ │ ├── controllers │ │ │ ├── .gitkeep │ │ │ ├── BaseController.php │ │ │ └── HomeController.php │ │ ├── database │ │ │ ├── migrations │ │ │ │ └── .gitkeep │ │ │ ├── production.sqlite │ │ │ └── seeds │ │ │ │ ├── .gitkeep │ │ │ │ └── DatabaseSeeder.php │ │ ├── filters.php │ │ ├── lang │ │ │ └── en │ │ │ │ ├── pagination.php │ │ │ │ ├── reminders.php │ │ │ │ └── validation.php │ │ ├── models │ │ │ └── User.php │ │ ├── routes.php │ │ ├── start │ │ │ ├── artisan.php │ │ │ ├── global.php │ │ │ └── local.php │ │ ├── storage │ │ │ ├── .gitignore │ │ │ ├── cache │ │ │ │ └── .gitignore │ │ │ ├── logs │ │ │ │ └── .gitignore │ │ │ ├── meta │ │ │ │ └── .gitignore │ │ │ ├── sessions │ │ │ │ └── .gitignore │ │ │ └── views │ │ │ │ └── .gitignore │ │ └── views │ │ │ ├── emails │ │ │ └── auth │ │ │ │ └── reminder.blade.php │ │ │ └── hello.php │ ├── artisan │ ├── bootstrap │ │ ├── autoload.php │ │ ├── paths.php │ │ └── start.php │ ├── composer.json │ ├── docker-compose.yml │ ├── public │ │ ├── .htaccess │ │ ├── favicon.ico │ │ ├── index.php │ │ ├── packages │ │ │ └── .gitkeep │ │ └── robots.txt │ └── server.php ├── Laravel57 │ ├── .editorconfig │ ├── .env.example │ ├── .gitattributes │ ├── .gitignore │ ├── Dockerfiles │ │ ├── Dockerfile_php56_apache │ │ ├── Dockerfile_php71_nginx_fpm │ │ ├── Dockerfile_php72_apache_fpm │ │ ├── Dockerfile_php72_nginx_fpm │ │ ├── acpu.ini │ │ ├── apache2-virtualhost.conf │ │ ├── apache2.conf │ │ ├── opcache-extra.ini │ │ ├── opcache.ini │ │ ├── php-dd-ext.ini │ │ ├── php_nginx_default.conf │ │ └── supervisord-nginx-fpm.conf │ ├── app │ │ ├── .gitattributes │ │ ├── Comment.php │ │ ├── Console │ │ │ └── Kernel.php │ │ ├── Custom │ │ │ ├── AddTen.php │ │ │ └── MultiplyByTwo.php │ │ ├── Exceptions │ │ │ └── Handler.php │ │ ├── Http │ │ │ ├── Controllers │ │ │ │ ├── PdoController.php │ │ │ │ └── SampleController.php │ │ │ └── Kernel.php │ │ ├── Post.php │ │ ├── Providers │ │ │ ├── AppServiceProvider.php │ │ │ ├── AuthServiceProvider.php │ │ │ ├── BroadcastServiceProvider.php │ │ │ ├── EventServiceProvider.php │ │ │ └── RouteServiceProvider.php │ │ └── User.php │ ├── artisan │ ├── bootstrap │ │ ├── app.php │ │ └── cache │ │ │ └── .gitignore │ ├── composer.json │ ├── composer.lock │ ├── config │ │ ├── app.php │ │ ├── auth.php │ │ ├── broadcasting.php │ │ ├── cache.php │ │ ├── database.php │ │ ├── filesystems.php │ │ ├── graphql-playground.php │ │ ├── hashing.php │ │ ├── lighthouse.php │ │ ├── logging.php │ │ ├── mail.php │ │ ├── queue.php │ │ ├── services.php │ │ ├── session.php │ │ └── view.php │ ├── database │ │ ├── .gitignore │ │ ├── factories │ │ │ └── UserFactory.php │ │ ├── migrations │ │ │ ├── 2014_10_12_000000_create_users_table.php │ │ │ ├── 2014_10_12_100000_create_password_resets_table.php │ │ │ ├── 2019_02_19_133634_create_posts_table.php │ │ │ └── 2019_02_19_133739_create_comments_table.php │ │ └── seeds │ │ │ └── DatabaseSeeder.php │ ├── docker-compose.yml │ ├── html │ │ └── index.html │ ├── libapache2-mod-fastcgi_2.4.7~0910052141-1.2_amd64.deb │ ├── package.json │ ├── public │ │ ├── .htaccess │ │ ├── css │ │ │ └── app.css │ │ ├── favicon.ico │ │ ├── index.php │ │ ├── js │ │ │ └── app.js │ │ ├── robots.txt │ │ ├── svg │ │ │ ├── 403.svg │ │ │ ├── 404.svg │ │ │ ├── 500.svg │ │ │ └── 503.svg │ │ └── web.config │ ├── readme.md │ ├── resources │ │ ├── js │ │ │ ├── app.js │ │ │ ├── bootstrap.js │ │ │ └── components │ │ │ │ └── ExampleComponent.vue │ │ ├── lang │ │ │ └── en │ │ │ │ ├── auth.php │ │ │ │ ├── pagination.php │ │ │ │ ├── passwords.php │ │ │ │ └── validation.php │ │ ├── sass │ │ │ ├── _variables.scss │ │ │ └── app.scss │ │ └── views │ │ │ └── welcome.blade.php │ ├── routes │ │ ├── api.php │ │ ├── channels.php │ │ ├── console.php │ │ ├── graphql │ │ │ └── schema.graphql │ │ └── web.php │ ├── server.php │ ├── storage │ │ ├── app │ │ │ ├── .gitignore │ │ │ └── public │ │ │ │ └── .gitignore │ │ ├── framework │ │ │ ├── .gitignore │ │ │ ├── cache │ │ │ │ ├── .gitignore │ │ │ │ └── data │ │ │ │ │ └── .gitignore │ │ │ ├── sessions │ │ │ │ └── .gitignore │ │ │ ├── testing │ │ │ │ └── .gitignore │ │ │ └── views │ │ │ │ └── .gitignore │ │ └── logs │ │ │ └── .gitignore │ └── webpack.mix.js ├── Slim4OtelDropIn │ ├── Dockerfile │ ├── README.md │ ├── collector │ │ └── config.yaml │ ├── docker-compose.yml │ ├── screenshots │ │ ├── distributed-dd-trace.png │ │ ├── distributed-otel-dd-trace.png │ │ └── distributed-otel-trace.png │ └── src │ │ ├── composer.json │ │ ├── composer.lock │ │ └── index.php └── Symfony34 │ ├── .gitattributes │ ├── .gitignore │ ├── Dockerfiles │ ├── Dockerfile_php56_apache │ ├── Dockerfile_php71_nginx_fpm │ ├── Dockerfile_php72_apache_fpm │ ├── Dockerfile_php72_nginx_fpm │ ├── acpu.ini │ ├── apache2-virtualhost.conf │ ├── apache2.conf │ ├── opcache-extra.ini │ ├── opcache.ini │ ├── php-dd-ext.ini │ ├── php_nginx_default.conf │ └── supervisord-nginx-fpm.conf │ ├── LICENSE │ ├── app │ ├── .htaccess │ ├── AppCache.php │ ├── AppKernel.php │ ├── Resources │ │ └── views │ │ │ ├── base.html.twig │ │ │ └── default │ │ │ └── index.html.twig │ └── config │ │ ├── config.yml │ │ ├── config_dev.yml │ │ ├── config_prod.yml │ │ ├── config_test.yml │ │ ├── parameters.yml.dist │ │ ├── routing.yml │ │ ├── routing_dev.yml │ │ ├── security.yml │ │ └── services.yml │ ├── bin │ ├── console │ └── symfony_requirements │ ├── composer.json │ ├── composer.lock │ ├── docker-compose.yml │ ├── public │ ├── .htaccess │ ├── apple-touch-icon.png │ ├── config.php │ ├── favicon.ico │ ├── index.php │ └── robots.txt │ ├── src │ ├── .htaccess │ └── AppBundle │ │ ├── AppBundle.php │ │ └── Controller │ │ └── DefaultController.php │ └── var │ ├── SymfonyRequirements.php │ ├── cache │ └── .gitkeep │ ├── logs │ └── .gitkeep │ └── sessions │ └── .gitkeep ├── python ├── .gitignore ├── README.md ├── aiohttp │ ├── LICENSE │ ├── polls │ │ ├── aiohttpdemo_polls │ │ │ ├── __init__.py │ │ │ ├── __main__.py │ │ │ ├── db.py │ │ │ ├── main.py │ │ │ ├── middlewares.py │ │ │ ├── routes.py │ │ │ ├── static │ │ │ │ └── style.css │ │ │ ├── templates │ │ │ │ ├── 404.html │ │ │ │ ├── 500.html │ │ │ │ ├── base.html │ │ │ │ ├── detail.html │ │ │ │ ├── index.html │ │ │ │ └── results.html │ │ │ ├── utils.py │ │ │ └── views.py │ │ ├── config │ │ │ └── polls.yaml │ │ ├── docker-compose.yml │ │ ├── requirements.txt │ │ ├── setup.py │ │ └── sql │ │ │ ├── create_db.sh │ │ │ ├── create_tables.sql │ │ │ └── sample_data.sql │ └── simple_app │ │ ├── Procfile │ │ ├── README.md │ │ ├── requirements.txt │ │ ├── runtime.txt │ │ ├── server.py │ │ └── statics │ │ └── empty.txt ├── aiopg │ ├── README.md │ ├── aiopg_example.py │ ├── docker-compose.yml │ └── requirements.txt ├── asgi │ ├── README.md │ ├── app.py │ └── images │ │ └── image1.png ├── async │ └── README.rst ├── asyncio │ ├── Procfile │ ├── README.md │ ├── docker-compose.yml │ ├── http_async_server.py │ ├── requirements.txt │ └── runtime.txt ├── bottle │ ├── README.md │ ├── bottle_example.py │ └── requirements.txt ├── celery4.1 │ ├── .gitignore │ ├── Pipfile │ ├── Pipfile.lock │ ├── README.md │ ├── consumer.py │ ├── docker-compose.yml │ └── producer.py ├── cyclone │ ├── Dockerfile │ ├── app.py │ ├── docker-compose.yml │ ├── hello.html │ ├── post.html │ ├── posts.html │ └── requirements.txt ├── django │ ├── django-realworld │ │ ├── README.md │ │ ├── django-realworld-example-app │ │ │ ├── .gitignore │ │ │ ├── Dockerfile │ │ │ ├── README.md │ │ │ ├── conduit │ │ │ │ ├── __init__.py │ │ │ │ ├── apps │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── articles │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── migrations │ │ │ │ │ │ │ ├── 0001_initial.py │ │ │ │ │ │ │ ├── 0002_comment.py │ │ │ │ │ │ │ ├── 0003_auto_20160828_1656.py │ │ │ │ │ │ │ └── __init__.py │ │ │ │ │ │ ├── models.py │ │ │ │ │ │ ├── relations.py │ │ │ │ │ │ ├── renderers.py │ │ │ │ │ │ ├── serializers.py │ │ │ │ │ │ ├── signals.py │ │ │ │ │ │ ├── urls.py │ │ │ │ │ │ └── views.py │ │ │ │ │ ├── authentication │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── backends.py │ │ │ │ │ │ ├── migrations │ │ │ │ │ │ │ ├── 0001_initial.py │ │ │ │ │ │ │ └── __init__.py │ │ │ │ │ │ ├── models.py │ │ │ │ │ │ ├── renderers.py │ │ │ │ │ │ ├── serializers.py │ │ │ │ │ │ ├── signals.py │ │ │ │ │ │ ├── urls.py │ │ │ │ │ │ └── views.py │ │ │ │ │ ├── core │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── exceptions.py │ │ │ │ │ │ ├── models.py │ │ │ │ │ │ ├── renderers.py │ │ │ │ │ │ └── utils.py │ │ │ │ │ └── profiles │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── exceptions.py │ │ │ │ │ │ ├── migrations │ │ │ │ │ │ ├── 0001_initial.py │ │ │ │ │ │ ├── 0002_profile_follows.py │ │ │ │ │ │ ├── 0003_profile_favorites.py │ │ │ │ │ │ └── __init__.py │ │ │ │ │ │ ├── models.py │ │ │ │ │ │ ├── renderers.py │ │ │ │ │ │ ├── serializers.py │ │ │ │ │ │ ├── urls.py │ │ │ │ │ │ └── views.py │ │ │ │ ├── settings.py │ │ │ │ ├── urls.py │ │ │ │ └── wsgi.py │ │ │ ├── manage.py │ │ │ ├── project-logo.png │ │ │ └── requirements.txt │ │ ├── docker-compose.yml │ │ └── realworld │ │ │ └── Dockerfile │ └── django-tutorial │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── docker-compose.yml │ │ ├── mysite │ │ ├── manage.py │ │ ├── mysite │ │ │ ├── __init__.py │ │ │ ├── settings.py │ │ │ ├── urls.py │ │ │ └── wsgi.py │ │ └── polls │ │ │ ├── __init__.py │ │ │ ├── admin.py │ │ │ ├── apps.py │ │ │ ├── migrations │ │ │ └── __init__.py │ │ │ ├── models.py │ │ │ ├── templates │ │ │ └── polls │ │ │ │ ├── detail.html │ │ │ │ ├── index.html │ │ │ │ └── results.html │ │ │ ├── tests.py │ │ │ ├── urls.py │ │ │ └── views.py │ │ └── requirements.txt ├── docker-compose.yml ├── falcon │ ├── Rakefile │ ├── demo.py │ └── requirements.txt ├── fastapi │ ├── Dockerfile │ ├── README.md │ ├── app.py │ ├── images │ │ ├── image1.png │ │ └── image2.png │ └── requirements.txt ├── flask-baggage │ ├── Pipfile │ ├── Pipfile.lock │ ├── README.md │ └── app.py ├── flask │ ├── Pipfile │ ├── Pipfile.lock │ ├── README.md │ ├── app │ │ ├── __init__.py │ │ ├── app.py │ │ ├── blueprint.py │ │ ├── config.py │ │ ├── exceptions.py │ │ ├── limiter.py │ │ ├── signals.py │ │ ├── static │ │ │ ├── bulma.min.css │ │ │ └── test.txt │ │ └── templates │ │ │ ├── index.jinja2 │ │ │ └── layout.jinja2 │ └── run.py ├── grpc │ ├── README.md │ ├── demo_grpc.py │ ├── hello.proto │ ├── hello_pb2.py │ ├── hello_pb2_grpc.py │ ├── requirements.txt │ └── server_grpc.py ├── kombu │ ├── .gitignore │ ├── Pipfile │ ├── Pipfile.lock │ ├── README.md │ ├── consume.py │ ├── consumer.py │ ├── docker-compose.yml │ └── producer.py ├── mysql │ ├── demo_mysqlconnector.py │ └── demo_mysqldb.py ├── opentracing │ ├── README.md │ ├── django │ │ ├── README.md │ │ ├── client │ │ │ ├── __init__.py │ │ │ ├── apps.py │ │ │ ├── tests.py │ │ │ ├── urls.py │ │ │ └── views.py │ │ ├── example_site │ │ │ ├── __init__.py │ │ │ ├── settings.py │ │ │ ├── urls.py │ │ │ ├── views.py │ │ │ └── wsgi.py │ │ ├── manage.py │ │ ├── requirements.txt │ │ └── server │ │ │ ├── __init__.py │ │ │ ├── apps.py │ │ │ ├── tests.py │ │ │ ├── urls.py │ │ │ └── views.py │ ├── laundry │ │ ├── .gitignore │ │ ├── README.md │ │ ├── laundry.py │ │ ├── requirements.txt │ │ └── resources │ │ │ └── trace.png │ └── walkthrough │ │ ├── .gitignore │ │ ├── 1_first_trace.py │ │ ├── README.md │ │ ├── requirements.txt │ │ └── resources │ │ ├── first_trace.png │ │ └── first_trace_listing.png ├── pylibmc │ ├── README.md │ ├── docker-compose.yml │ ├── pylibmc_example.py │ └── requirements.txt ├── pymemcache │ ├── .gitignore │ ├── README.md │ ├── docker-compose.yml │ ├── requirements.txt │ └── simple_manual.py ├── pymongo │ └── demo.py ├── pynamodb │ ├── Dockerfile │ ├── README.md │ ├── docker-compose.yml │ ├── images │ │ └── example_get_item.png │ └── pynamodb-test │ │ ├── blog.py │ │ └── index.py ├── pyramid │ ├── .gitignore │ ├── README.md │ ├── requirements.txt │ ├── schema.sql │ ├── static │ │ └── style.css │ ├── tasks.py │ └── templates │ │ ├── layout.mako │ │ ├── list.mako │ │ ├── new.mako │ │ └── notfound.mako ├── rq │ ├── .gitignore │ ├── README.md │ ├── app.py │ ├── docker-compose.yml │ ├── jobs.py │ └── requirements.txt ├── sample_app.py ├── sanic │ ├── Dockerfile │ ├── README.md │ ├── app.py │ ├── docker-compose.yml │ ├── images │ │ ├── image1.png │ │ └── image2.png │ ├── requirements.txt │ └── templates │ │ └── index.html ├── starlette │ ├── README.md │ ├── app.py │ ├── docs │ │ ├── 404.png │ │ ├── 500.png │ │ └── index.png │ ├── requirements.txt │ ├── statics │ │ ├── css │ │ │ ├── bootstrap.min.css │ │ │ └── jumbotron.css │ │ └── js │ │ │ ├── bootstrap.min.js │ │ │ ├── jquery-3.3.1.slim.min.js │ │ │ └── popper.min.js │ └── templates │ │ ├── 200.html │ │ ├── 404.html │ │ ├── 500.html │ │ ├── base.html │ │ └── index.html ├── tornado4 │ ├── Procfile │ ├── README.md │ ├── docker-compose.yml │ ├── requirements.in │ ├── requirements.txt │ ├── runtime.txt │ ├── server.py │ └── statics │ │ └── empty.txt ├── tornado6-blog │ ├── Dockerfile │ ├── README │ ├── README.md │ ├── blog.py │ ├── docker-compose.yml │ ├── requirements.txt │ ├── schema.sql │ ├── static │ │ └── blog.css │ └── templates │ │ ├── archive.html │ │ ├── base.html │ │ ├── compose.html │ │ ├── create_author.html │ │ ├── entry.html │ │ ├── feed.xml │ │ ├── home.html │ │ ├── login.html │ │ └── modules │ │ └── entry.html ├── tornado6 │ ├── Procfile │ ├── README.md │ ├── docker-compose.yml │ ├── requirements.in │ ├── requirements.txt │ ├── runtime.txt │ ├── server.py │ └── statics │ │ └── empty.txt └── vertica │ ├── .gitignore │ ├── README.md │ ├── docker-compose.yml │ ├── requirements.txt │ └── vertica_example.py ├── ruby ├── dalli │ ├── .envrc.sample │ ├── .gitignore │ ├── Dockerfile │ ├── Gemfile │ ├── Gemfile.lock │ ├── Procfile │ ├── README.md │ ├── Rakefile │ ├── app │ │ ├── api │ │ │ └── api.rb │ │ ├── assets │ │ │ ├── images │ │ │ │ └── rails.png │ │ │ ├── javascripts │ │ │ │ ├── application.js │ │ │ │ ├── comments.js.coffee │ │ │ │ ├── home.js.coffee │ │ │ │ └── posts.js.coffee │ │ │ └── stylesheets │ │ │ │ ├── application.css │ │ │ │ ├── comments.css.scss │ │ │ │ ├── home.css.scss │ │ │ │ ├── posts.css.scss │ │ │ │ └── scaffolds.css.scss │ │ ├── controllers │ │ │ ├── application_controller.rb │ │ │ ├── comments_controller.rb │ │ │ ├── home_controller.rb │ │ │ └── posts_controller.rb │ │ ├── helpers │ │ │ ├── application_helper.rb │ │ │ ├── comments_helper.rb │ │ │ ├── home_helper.rb │ │ │ └── posts_helper.rb │ │ ├── mailers │ │ │ └── .gitkeep │ │ ├── models │ │ │ ├── .gitkeep │ │ │ ├── comment.rb │ │ │ └── post.rb │ │ └── views │ │ │ ├── comments │ │ │ ├── _comment.html.erb │ │ │ └── _form.html.erb │ │ │ ├── home │ │ │ └── index.html.erb │ │ │ ├── layouts │ │ │ └── application.html.erb │ │ │ └── posts │ │ │ ├── _form.html.erb │ │ │ ├── edit.html.erb │ │ │ ├── index.html.erb │ │ │ ├── new.html.erb │ │ │ └── show.html.erb │ ├── config.ru │ ├── config │ │ ├── application.rb │ │ ├── boot.rb │ │ ├── database.yml │ │ ├── environment.rb │ │ ├── environments │ │ │ ├── development.rb │ │ │ ├── production.rb │ │ │ └── test.rb │ │ ├── initializers │ │ │ ├── backtrace_silencers.rb │ │ │ ├── datadog.rb │ │ │ ├── inflections.rb │ │ │ ├── mime_types.rb │ │ │ ├── session_store.rb │ │ │ └── wrap_parameters.rb │ │ ├── locales │ │ │ └── en.yml │ │ ├── routes.rb │ │ └── unicorn.rb │ ├── db │ │ ├── migrate │ │ │ ├── 20161030175305_create_posts.rb │ │ │ ├── 20161030181809_create_comments.rb │ │ │ ├── 20161123151236_create_delayed_jobs.rb │ │ │ └── 20170316112735_add_sessions_table.rb │ │ ├── schema.rb │ │ └── seeds.rb │ ├── docker-compose.yml │ ├── lib │ │ ├── assets │ │ │ └── .gitkeep │ │ └── tasks │ │ │ └── .gitkeep │ ├── public │ │ ├── 404.html │ │ ├── 422.html │ │ ├── 500.html │ │ ├── favicon.ico │ │ └── robots.txt │ ├── script │ │ ├── delayed_job │ │ └── rails │ ├── test │ │ ├── fixtures │ │ │ ├── .gitkeep │ │ │ ├── comments.yml │ │ │ └── posts.yml │ │ ├── functional │ │ │ ├── .gitkeep │ │ │ ├── comments_controller_test.rb │ │ │ ├── home_controller_test.rb │ │ │ └── posts_controller_test.rb │ │ ├── integration │ │ │ └── .gitkeep │ │ ├── performance │ │ │ └── browsing_test.rb │ │ ├── test_helper.rb │ │ └── unit │ │ │ ├── .gitkeep │ │ │ ├── comment_test.rb │ │ │ ├── helpers │ │ │ ├── comments_helper_test.rb │ │ │ ├── home_helper_test.rb │ │ │ └── posts_helper_test.rb │ │ │ └── post_test.rb │ └── vendor │ │ ├── assets │ │ ├── javascripts │ │ │ └── .gitkeep │ │ └── stylesheets │ │ │ └── .gitkeep │ │ └── plugins │ │ └── .gitkeep ├── mongoid │ ├── .envrc.sample │ ├── .gitignore │ ├── Dockerfile │ ├── Gemfile │ ├── Gemfile.lock │ ├── README.md │ ├── Rakefile │ ├── app │ │ ├── controllers │ │ │ ├── application_controller.rb │ │ │ └── document_controller.rb │ │ ├── models │ │ │ └── person.rb │ │ └── views │ │ │ ├── document │ │ │ ├── add.html.erb │ │ │ └── index.html.erb │ │ │ └── layouts │ │ │ └── application.html.erb │ ├── bin │ │ ├── bundle │ │ ├── rails │ │ ├── rake │ │ ├── setup │ │ └── spring │ ├── config.ru │ ├── config │ │ ├── application.rb │ │ ├── boot.rb │ │ ├── environment.rb │ │ ├── environments │ │ │ └── development.rb │ │ ├── initializers │ │ │ ├── cookies_serializer.rb │ │ │ ├── datadog.rb │ │ │ ├── filter_parameter_logging.rb │ │ │ ├── session_store.rb │ │ │ ├── to_time_preserves_timezone.rb │ │ │ └── wrap_parameters.rb │ │ ├── mongoid.yml │ │ ├── routes.rb │ │ ├── secrets.yml │ │ └── unicorn.rb │ └── docker-compose.yml ├── rails │ ├── .envrc.sample │ ├── .gitignore │ ├── Dockerfile │ ├── Gemfile │ ├── Gemfile.lock │ ├── Procfile │ ├── README.md │ ├── Rakefile │ ├── app │ │ ├── api │ │ │ └── api.rb │ │ ├── assets │ │ │ ├── images │ │ │ │ └── rails.png │ │ │ ├── javascripts │ │ │ │ ├── application.js │ │ │ │ ├── comments.js.coffee │ │ │ │ ├── home.js.coffee │ │ │ │ └── posts.js.coffee │ │ │ └── stylesheets │ │ │ │ ├── application.css │ │ │ │ ├── comments.css.scss │ │ │ │ ├── home.css.scss │ │ │ │ ├── posts.css.scss │ │ │ │ └── scaffolds.css.scss │ │ ├── controllers │ │ │ ├── application_controller.rb │ │ │ ├── comments_controller.rb │ │ │ ├── home_controller.rb │ │ │ └── posts_controller.rb │ │ ├── helpers │ │ │ ├── application_helper.rb │ │ │ ├── comments_helper.rb │ │ │ ├── home_helper.rb │ │ │ └── posts_helper.rb │ │ ├── mailers │ │ │ └── .gitkeep │ │ ├── models │ │ │ ├── .gitkeep │ │ │ ├── comment.rb │ │ │ └── post.rb │ │ └── views │ │ │ ├── comments │ │ │ ├── _comment.html.erb │ │ │ └── _form.html.erb │ │ │ ├── home │ │ │ └── index.html.erb │ │ │ ├── layouts │ │ │ └── application.html.erb │ │ │ └── posts │ │ │ ├── _form.html.erb │ │ │ ├── edit.html.erb │ │ │ ├── index.html.erb │ │ │ ├── new.html.erb │ │ │ └── show.html.erb │ ├── config.ru │ ├── config │ │ ├── application.rb │ │ ├── boot.rb │ │ ├── database.yml │ │ ├── environment.rb │ │ ├── environments │ │ │ ├── development.rb │ │ │ ├── production.rb │ │ │ └── test.rb │ │ ├── initializers │ │ │ ├── backtrace_silencers.rb │ │ │ ├── datadog.rb │ │ │ ├── inflections.rb │ │ │ ├── mime_types.rb │ │ │ ├── session_store.rb │ │ │ └── wrap_parameters.rb │ │ ├── locales │ │ │ └── en.yml │ │ ├── routes.rb │ │ └── unicorn.rb │ ├── db │ │ ├── migrate │ │ │ ├── 20161030175305_create_posts.rb │ │ │ ├── 20161030181809_create_comments.rb │ │ │ ├── 20161123151236_create_delayed_jobs.rb │ │ │ └── 20170316112735_add_sessions_table.rb │ │ ├── schema.rb │ │ └── seeds.rb │ ├── docker-compose.yml │ ├── lib │ │ ├── assets │ │ │ └── .gitkeep │ │ └── tasks │ │ │ └── .gitkeep │ ├── public │ │ ├── 404.html │ │ ├── 422.html │ │ ├── 500.html │ │ ├── favicon.ico │ │ └── robots.txt │ ├── script │ │ ├── delayed_job │ │ └── rails │ ├── test │ │ ├── fixtures │ │ │ ├── .gitkeep │ │ │ ├── comments.yml │ │ │ └── posts.yml │ │ ├── functional │ │ │ ├── .gitkeep │ │ │ ├── comments_controller_test.rb │ │ │ ├── home_controller_test.rb │ │ │ └── posts_controller_test.rb │ │ ├── integration │ │ │ └── .gitkeep │ │ ├── performance │ │ │ └── browsing_test.rb │ │ ├── test_helper.rb │ │ └── unit │ │ │ ├── .gitkeep │ │ │ ├── comment_test.rb │ │ │ ├── helpers │ │ │ ├── comments_helper_test.rb │ │ │ ├── home_helper_test.rb │ │ │ └── posts_helper_test.rb │ │ │ └── post_test.rb │ └── vendor │ │ ├── assets │ │ ├── javascripts │ │ │ └── .gitkeep │ │ └── stylesheets │ │ │ └── .gitkeep │ │ └── plugins │ │ └── .gitkeep ├── sample_app.rb ├── sidekiq │ ├── .envrc.sample │ ├── .gitignore │ ├── Dockerfile │ ├── Gemfile │ ├── Gemfile.lock │ ├── Procfile │ ├── README.md │ ├── app.rb │ ├── docker-compose.yml │ ├── job.rb │ ├── public │ │ └── js │ │ │ └── app.js │ └── views │ │ ├── jobs.erb │ │ ├── jobs_fragment.erb │ │ └── layout.erb └── sinatra │ ├── .envrc.sample │ ├── .gitignore │ ├── Dockerfile │ ├── Gemfile │ ├── Gemfile.lock │ ├── Procfile │ ├── README.md │ ├── app.rb │ ├── docker-compose.yml │ ├── post.rb │ ├── public │ └── js │ │ └── app.js │ └── views │ ├── layout.erb │ ├── posts.erb │ └── posts_fragment.erb └── rust ├── LICENSE ├── README.md ├── ddotelexporter-config.yml ├── ddotelexportertransformed-config.yml ├── docker-compose.yml └── rust-app ├── .dockerignore ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── Dockerfile ├── LICENSE-3rdparty.yml ├── rust-toolchain.toml └── src ├── main.rs ├── otel.rs └── tracing.rs /README: -------------------------------------------------------------------------------- 1 | A collection of Datadog tracing (APM) examples. 2 | 3 | Install Guide: https://app.datadoghq.com/apm/service-setup 4 | -------------------------------------------------------------------------------- /distributed-tracing/api-gateway/apigateway/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM opentracing/nginx-opentracing 2 | RUN apt update && apt -y install curl jq 3 | COPY install-dd-opentracing-cpp / 4 | RUN /install-dd-opentracing-cpp 5 | -------------------------------------------------------------------------------- /distributed-tracing/api-gateway/apigateway/dd-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "service": "api", 3 | "operation_name_override": "nginx.handle", 4 | "agent_host": "datadog-agent", 5 | "agent_port": 8126 6 | } 7 | -------------------------------------------------------------------------------- /distributed-tracing/api-gateway/apigateway/install-dd-opentracing-cpp: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if ! release_data=$(curl -fL https://api.github.com/repos/DataDog/dd-opentracing-cpp/releases/latest); then 3 | echo "error retrieving release info for dd-opentracing-cpp" 4 | exit 1 5 | fi 6 | if ! release_url=$(jq -r '.assets[] | select(.name == "linux-amd64-libdd_opentracing_plugin.so.gz") | .browser_download_url' <<< "$release_data"); then 7 | echo "error parsing release info for dd-opentracing-cpp" 8 | exit 1 9 | fi 10 | if ! curl -fL "$release_url" | gunzip -c > /usr/local/lib/libdd_opentracing_plugin.so; then 11 | echo "error installing dd-opentracing-cpp release from $release_url" 12 | exit 1 13 | fi 14 | -------------------------------------------------------------------------------- /distributed-tracing/api-gateway/frontend-go/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.12 AS build 2 | ADD *.go /go/src/frontend/ 3 | RUN go get -d frontend && go install frontend 4 | 5 | FROM debian:stretch-slim 6 | COPY --from=build /go/bin/frontend /bin/frontend 7 | ENTRYPOINT ["/bin/frontend"] 8 | -------------------------------------------------------------------------------- /distributed-tracing/api-gateway/frontend-go/index.html.tmpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Random Programming Quote 6 | 7 | 8 |
{{ . }}
9 | 10 | 11 | -------------------------------------------------------------------------------- /distributed-tracing/api-gateway/quotes-db/Dockerfile-postgres: -------------------------------------------------------------------------------- 1 | FROM postgres:11 2 | COPY sql/create_table.sql /docker-entrypoint-initdb.d/01_create_table.sql 3 | COPY sql/import_quotes.sql /docker-entrypoint-initdb.d/02_import_quotes.sql 4 | COPY sql/quotes_data.txt /quotes_data.txt 5 | -------------------------------------------------------------------------------- /distributed-tracing/api-gateway/quotes-db/sql/README.md: -------------------------------------------------------------------------------- 1 | # Attribution 2 | 3 | Quotes in this example webapp were sourced from 4 | https://github.com/AntJanus/programmers-proverbs/blob/48a5c7efdd45c2187bc3f7f924bcc228e9db7212/README.md#proverbs 5 | -------------------------------------------------------------------------------- /distributed-tracing/api-gateway/quotes-db/sql/create_table.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS quotes ( 2 | id BIGSERIAL PRIMARY KEY, 3 | text TEXT NOT NULL CHECK (text <> '') 4 | ); 5 | -------------------------------------------------------------------------------- /distributed-tracing/api-gateway/quotes-db/sql/import_quotes.sql: -------------------------------------------------------------------------------- 1 | COPY quotes(text) FROM '/quotes_data.txt'; 2 | -------------------------------------------------------------------------------- /distributed-tracing/api-gateway/quotes-go/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.12 AS build 2 | ADD *.go /go/src/quotes/ 3 | RUN go get -d quotes && go install quotes 4 | 5 | FROM debian:stretch-slim 6 | COPY --from=build /go/bin/quotes /bin/quotes 7 | ENTRYPOINT ["/bin/quotes"] 8 | -------------------------------------------------------------------------------- /distributed-tracing/api-gateway/trace_detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/distributed-tracing/api-gateway/trace_detail.png -------------------------------------------------------------------------------- /distributed-tracing/api-gateway/trace_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/distributed-tracing/api-gateway/trace_list.png -------------------------------------------------------------------------------- /go/goa-basic/calc.go: -------------------------------------------------------------------------------- 1 | package calc 2 | 3 | import ( 4 | "context" 5 | "log" 6 | 7 | calcsvc "github.com/DataDog/trace-examples/go/goa-basic/gen/calc" 8 | ) 9 | 10 | // calc service example implementation. 11 | // The example methods log the requests and return zero values. 12 | type calcSvc struct { 13 | logger *log.Logger 14 | } 15 | 16 | // NewCalc returns the calc service implementation. 17 | func NewCalc(logger *log.Logger) calcsvc.Service { 18 | return &calcSvc{logger} 19 | } 20 | 21 | // Add implements add. 22 | func (s *calcSvc) Add(ctx context.Context, p *calcsvc.AddPayload) (int, error) { 23 | return p.A + p.B, nil 24 | } 25 | -------------------------------------------------------------------------------- /go/goa-basic/gen/grpc/calc/pb/calc.proto: -------------------------------------------------------------------------------- 1 | // Code generated with goa v3.1.1, DO NOT EDIT. 2 | // 3 | // calc protocol buffer definition 4 | // 5 | // Command: 6 | // $ goa gen goa.design/examples/basic/design -o 7 | // $(GOPATH)/src/goa.design/examples/basic 8 | 9 | syntax = "proto3"; 10 | 11 | package calc; 12 | 13 | option go_package = "calcpb"; 14 | 15 | // The calc service performs operations on numbers 16 | service Calc { 17 | // Add implements add. 18 | rpc Add (AddRequest) returns (AddResponse); 19 | } 20 | 21 | message AddRequest { 22 | // Left operand 23 | sint32 a = 1; 24 | // Right operand 25 | sint32 b = 2; 26 | } 27 | 28 | message AddResponse { 29 | sint32 field = 1; 30 | } 31 | -------------------------------------------------------------------------------- /go/goa-basic/gen/http/calc/client/paths.go: -------------------------------------------------------------------------------- 1 | // Code generated by goa v3.1.1, DO NOT EDIT. 2 | // 3 | // HTTP request path constructors for the calc service. 4 | // 5 | // Command: 6 | // $ goa gen github.com/DataDog/trace-examples/go/goa-basic/design -o 7 | // $(GOPATH)/src/github.com/DataDog/trace-examples/go/goa-basic 8 | 9 | package client 10 | 11 | import ( 12 | "fmt" 13 | ) 14 | 15 | // AddCalcPath returns the URL path to the calc service add HTTP endpoint. 16 | func AddCalcPath(a int, b int) string { 17 | return fmt.Sprintf("/add/%v/%v", a, b) 18 | } 19 | -------------------------------------------------------------------------------- /go/goa-basic/gen/http/calc/client/types.go: -------------------------------------------------------------------------------- 1 | // Code generated by goa v3.1.1, DO NOT EDIT. 2 | // 3 | // calc HTTP client types 4 | // 5 | // Command: 6 | // $ goa gen github.com/DataDog/trace-examples/go/goa-basic/design -o 7 | // $(GOPATH)/src/github.com/DataDog/trace-examples/go/goa-basic 8 | 9 | package client 10 | -------------------------------------------------------------------------------- /go/goa-basic/gen/http/calc/server/paths.go: -------------------------------------------------------------------------------- 1 | // Code generated by goa v3.1.1, DO NOT EDIT. 2 | // 3 | // HTTP request path constructors for the calc service. 4 | // 5 | // Command: 6 | // $ goa gen github.com/DataDog/trace-examples/go/goa-basic/design -o 7 | // $(GOPATH)/src/github.com/DataDog/trace-examples/go/goa-basic 8 | 9 | package server 10 | 11 | import ( 12 | "fmt" 13 | ) 14 | 15 | // AddCalcPath returns the URL path to the calc service add HTTP endpoint. 16 | func AddCalcPath(a int, b int) string { 17 | return fmt.Sprintf("/add/%v/%v", a, b) 18 | } 19 | -------------------------------------------------------------------------------- /go/goa-basic/gen/http/calc/server/types.go: -------------------------------------------------------------------------------- 1 | // Code generated by goa v3.1.1, DO NOT EDIT. 2 | // 3 | // calc HTTP server types 4 | // 5 | // Command: 6 | // $ goa gen github.com/DataDog/trace-examples/go/goa-basic/design -o 7 | // $(GOPATH)/src/github.com/DataDog/trace-examples/go/goa-basic 8 | 9 | package server 10 | 11 | import ( 12 | calc "github.com/DataDog/trace-examples/go/goa-basic/gen/calc" 13 | ) 14 | 15 | // NewAddPayload builds a calc service add endpoint payload. 16 | func NewAddPayload(a int, b int) *calc.AddPayload { 17 | v := &calc.AddPayload{} 18 | v.A = a 19 | v.B = b 20 | 21 | return v 22 | } 23 | -------------------------------------------------------------------------------- /go/goa-basic/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/DataDog/trace-examples/go/goa-basic 2 | 3 | go 1.14 4 | 5 | require ( 6 | github.com/DataDog/datadog-go v3.5.0+incompatible // indirect 7 | github.com/dimfeld/httptreemux v5.0.1+incompatible // indirect 8 | github.com/golang/protobuf v1.3.4 9 | github.com/grpc-ecosystem/go-grpc-middleware v1.2.0 10 | github.com/philhofer/fwd v1.0.0 // indirect 11 | github.com/tinylib/msgp v1.1.2 // indirect 12 | goa.design/examples v2.1.1+incompatible 13 | goa.design/goa v2.1.1+incompatible // indirect 14 | goa.design/goa/v3 v3.1.1 15 | golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect 16 | google.golang.org/grpc v1.28.0 17 | gopkg.in/DataDog/dd-trace-go.v1 v1.22.0 18 | ) 19 | -------------------------------------------------------------------------------- /go/grpc/grpc-db/docker/Dockerfile.grpc-db-client: -------------------------------------------------------------------------------- 1 | FROM golang:1.12 AS build 2 | ADD cmd/grpc-db-client/ /go/src/github.com/DataDog/trace-examples/go/grpc/grpc-db/cmd/grpc-db-client/ 3 | ADD proto/ /go/src/github.com/DataDog/trace-examples/go/grpc/grpc-db/proto/ 4 | RUN go get -d github.com/DataDog/trace-examples/go/grpc/grpc-db/cmd/grpc-db-client && go install github.com/DataDog/trace-examples/go/grpc/grpc-db/cmd/grpc-db-client 5 | 6 | FROM debian:stretch-slim 7 | COPY --from=build /go/bin/grpc-db-client /grpc-db-client 8 | ENTRYPOINT ["/grpc-db-client"] 9 | -------------------------------------------------------------------------------- /go/grpc/grpc-db/docker/Dockerfile.grpc-dbsql-server: -------------------------------------------------------------------------------- 1 | FROM golang:1.12 AS build 2 | ADD cmd/grpc-dbsql-server/ /go/src/github.com/DataDog/trace-examples/go/grpc/grpc-db/cmd/grpc-dbsql-server/ 3 | ADD proto/ /go/src/github.com/DataDog/trace-examples/go/grpc/grpc-db/proto/ 4 | RUN go get -d github.com/DataDog/trace-examples/go/grpc/grpc-db/cmd/grpc-dbsql-server && go install github.com/DataDog/trace-examples/go/grpc/grpc-db/cmd/grpc-dbsql-server 5 | 6 | FROM debian:stretch-slim 7 | COPY --from=build /go/bin/grpc-dbsql-server /grpc-dbsql-server 8 | ENTRYPOINT ["/grpc-dbsql-server"] 9 | -------------------------------------------------------------------------------- /go/grpc/grpc-db/docker/Dockerfile.grpc-gorm-server: -------------------------------------------------------------------------------- 1 | FROM golang:1.12 AS build 2 | ADD cmd/grpc-gorm-server/ /go/src/github.com/DataDog/trace-examples/go/grpc/grpc-db/cmd/grpc-gorm-server/ 3 | ADD proto/ /go/src/github.com/DataDog/trace-examples/go/grpc/grpc-db/proto/ 4 | RUN go get -d github.com/DataDog/trace-examples/go/grpc/grpc-db/cmd/grpc-gorm-server && go install github.com/DataDog/trace-examples/go/grpc/grpc-db/cmd/grpc-gorm-server 5 | 6 | FROM debian:stretch-slim 7 | COPY --from=build /go/bin/grpc-gorm-server /grpc-gorm-server 8 | ENTRYPOINT ["/grpc-gorm-server"] 9 | -------------------------------------------------------------------------------- /go/grpc/grpc-db/proto/crud/crud.go: -------------------------------------------------------------------------------- 1 | //go:generate protoc --go_out=plugins=grpc:. crud.proto 2 | package crud 3 | -------------------------------------------------------------------------------- /go/grpc/grpc-db/trace_detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/go/grpc/grpc-db/trace_detail.png -------------------------------------------------------------------------------- /go/grpc/grpc-db/trace_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/go/grpc/grpc-db/trace_list.png -------------------------------------------------------------------------------- /go/grpc/grpc-trace-test/example.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | message Message { 4 | string data = 1; 5 | } 6 | 7 | service Example { 8 | rpc Echo(stream Message) returns (stream Message) {} 9 | } 10 | -------------------------------------------------------------------------------- /javascript/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | indent_style = space 7 | indent_size = 2 8 | end_of_line = lf 9 | charset = utf-8 10 | trim_trailing_whitespace = true 11 | insert_final_newline = true 12 | 13 | [*.md] 14 | trim_trailing_whitespace = false 15 | -------------------------------------------------------------------------------- /javascript/browser/http/README.md: -------------------------------------------------------------------------------- 1 | # Browser Example (prototype) 2 | 3 | **WARNING**: This is a proof of concept that is still a work in progress. Do not use for your applications. 4 | 5 | To run the prototype, checkout the repo, create a .env file with `DD_CLIENT_TOKEN` set to your client token, and run: 6 | 7 | ```bash 8 | npm install 9 | npm start 10 | ``` 11 | 12 | Requests are sent to `http://localhost:8080/users` and assume that the [microservices](/javascript/node/microservices) example is running. 13 | -------------------------------------------------------------------------------- /javascript/browser/http/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "web", 3 | "version": "1.0.0", 4 | "main": "server.js", 5 | "private": true, 6 | "scripts": { 7 | "start": "live-server app --port=3000 --mount=/dd-trace:./node_modules/dd-trace/dist --mount=/env:./.env" 8 | }, 9 | "dependencies": { 10 | "dd-trace": "^0.15.5", 11 | "live-server": "^1.2.1" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /javascript/node/microservices/README.md: -------------------------------------------------------------------------------- 1 | # Microservices example 2 | 3 | This example has all Node APM features enabled on 3 services. 4 | 5 | The following modules are automatically instrumented by our integrations: 6 | 7 | - express 8 | - graphql 9 | - http 10 | - mongodb-core 11 | - redis 12 | - winston 13 | 14 | ## Running 15 | 16 | ```sh 17 | DD_API_KEY= docker-compose up -d --build 18 | ``` 19 | 20 | ## Generating Traces 21 | 22 | Visit `http://localhost:8080/users` to generate traces. 23 | -------------------------------------------------------------------------------- /javascript/node/microservices/api-gateway/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:18-alpine 2 | 3 | RUN apk add --no-cache tini 4 | 5 | ENV NODE_ENV=production 6 | 7 | WORKDIR /usr/src/app 8 | 9 | COPY package.json yarn.lock /usr/src/app/ 10 | RUN yarn --pure-lockfile && yarn cache clean 11 | 12 | COPY src /usr/src/app/src/ 13 | COPY server.js /usr/src/app/ 14 | 15 | EXPOSE 8080 16 | USER node 17 | 18 | ENTRYPOINT ["/sbin/tini", "--"] 19 | CMD [ "node", "server" ] 20 | -------------------------------------------------------------------------------- /javascript/node/microservices/api-gateway/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "api-gateway", 3 | "version": "1.0.0", 4 | "main": "server.js", 5 | "private": true, 6 | "dependencies": { 7 | "axios": "^0.18.0", 8 | "cors": "^2.8.5", 9 | "dd-trace": "^5.9.0", 10 | "express": "^4.16.2", 11 | "express-winston": "^3.0.1", 12 | "winston": "^3.2.1" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /javascript/node/microservices/api-gateway/server.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const logger = require('./src/logger') 4 | require('dd-trace').init({ logger }) 5 | const app = require('./src/app') 6 | 7 | app.listen(8080) 8 | -------------------------------------------------------------------------------- /javascript/node/microservices/api-gateway/src/logger.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const winston = require('winston') 4 | 5 | module.exports = winston.createLogger({ 6 | level: 'debug', 7 | transports: new winston.transports.Console() 8 | }) 9 | -------------------------------------------------------------------------------- /javascript/node/microservices/auth/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:18-alpine 2 | 3 | RUN apk add --no-cache tini git 4 | 5 | ENV NODE_ENV=production 6 | 7 | WORKDIR /usr/src/app 8 | 9 | COPY package.json yarn.lock /usr/src/app/ 10 | RUN yarn --pure-lockfile && yarn cache clean 11 | 12 | COPY src /usr/src/app/src/ 13 | COPY server.js /usr/src/app/ 14 | 15 | EXPOSE 8080 16 | USER node 17 | 18 | ENTRYPOINT ["/sbin/tini", "--"] 19 | CMD [ "node", "server" ] 20 | -------------------------------------------------------------------------------- /javascript/node/microservices/auth/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "auth", 3 | "version": "1.0.0", 4 | "main": "server.js", 5 | "private": true, 6 | "dependencies": { 7 | "dd-trace": "^5.9.0", 8 | "express": "^4.16.2", 9 | "express-winston": "^3.1.0", 10 | "redis": "^2.8.0", 11 | "winston": "^3.2.1" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /javascript/node/microservices/auth/server.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const logger = require('./src/logger') 4 | require('dd-trace').init({ logger }) 5 | const app = require('./src/app') 6 | 7 | app.listen(8080) 8 | -------------------------------------------------------------------------------- /javascript/node/microservices/auth/src/app.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const express = require('express') 4 | const cache = require('./cache') 5 | const expressWinston = require('express-winston') 6 | const logger = require('./logger') 7 | 8 | const app = express() 9 | 10 | app.use(expressWinston.logger({ 11 | winstonInstance: logger 12 | })) 13 | 14 | app.get('/.well-known/jwks.json', (req, res) => { 15 | cache.get('jwks', (err, value) => { 16 | if (err) { 17 | return res.status(500).send() 18 | } 19 | 20 | res.status(200).send(value) 21 | }) 22 | }) 23 | 24 | app.use(expressWinston.errorLogger({ 25 | winstonInstance: logger 26 | })) 27 | 28 | module.exports = app 29 | -------------------------------------------------------------------------------- /javascript/node/microservices/auth/src/cache.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const redis = require('redis') 4 | const client = redis.createClient({ host: 'redis' }) 5 | 6 | client.on('error', () => {}) 7 | client.on('ready', () => { 8 | client.set('jwks', '{}') 9 | }) 10 | 11 | module.exports = client 12 | -------------------------------------------------------------------------------- /javascript/node/microservices/auth/src/logger.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const winston = require('winston') 4 | 5 | module.exports = winston.createLogger({ 6 | level: 'debug', 7 | transports: new winston.transports.Console() 8 | }) 9 | -------------------------------------------------------------------------------- /javascript/node/microservices/user/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:18-alpine 2 | 3 | RUN apk add --no-cache tini git 4 | 5 | ENV NODE_ENV=production 6 | 7 | WORKDIR /usr/src/app 8 | 9 | COPY package.json yarn.lock /usr/src/app/ 10 | RUN yarn --pure-lockfile && yarn cache clean 11 | 12 | COPY src /usr/src/app/src/ 13 | COPY server.js /usr/src/app/ 14 | 15 | EXPOSE 8080 16 | USER node 17 | 18 | ENTRYPOINT ["/sbin/tini", "--"] 19 | CMD [ "node", "server" ] 20 | -------------------------------------------------------------------------------- /javascript/node/microservices/user/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "user", 3 | "version": "1.0.0", 4 | "main": "server.js", 5 | "private": true, 6 | "dependencies": { 7 | "dd-trace": "^5.9.0", 8 | "express": "^4.16.2", 9 | "express-graphql": "^0.7.1", 10 | "express-winston": "^3.1.0", 11 | "graphql": "^14.1.1", 12 | "mongodb": "^3.1.1", 13 | "retry": "^0.12.0", 14 | "winston": "^3.2.1" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /javascript/node/microservices/user/server.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const logger = require('./src/logger') 4 | require('dd-trace').init({ logger }) 5 | const app = require('./src/app') 6 | 7 | app.listen(8080) 8 | -------------------------------------------------------------------------------- /javascript/node/microservices/user/src/logger.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const winston = require('winston') 4 | 5 | module.exports = winston.createLogger({ 6 | level: 'debug', 7 | transports: new winston.transports.Console() 8 | }) 9 | -------------------------------------------------------------------------------- /opentelemetry/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | minikube start 4 | eval $(minikube docker-env) 5 | 6 | docker build -t python-microservice ./python-microservice --no-cache 7 | docker build -t node-microservice ./node-microservice --no-cache 8 | docker build -t ruby-microservice ./ruby-microservice --no-cache 9 | -------------------------------------------------------------------------------- /opentelemetry/fluent-bit/fluent-bit.conf: -------------------------------------------------------------------------------- 1 | [SERVICE] 2 | Flush 5 3 | Daemon Off 4 | [INPUT] 5 | Name forward 6 | Listen 0.0.0.0 7 | Port 24224 8 | Parser docker 9 | [OUTPUT] 10 | Name datadog 11 | Match * 12 | Host http-intake.logs.datadoghq.com 13 | TLS off 14 | compress gzip 15 | apikey 16 | dd_source otel 17 | dd_message_key log -------------------------------------------------------------------------------- /opentelemetry/node-microservice/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:latest 2 | WORKDIR /app 3 | COPY package.json /app 4 | RUN npm install 5 | COPY . /app 6 | EXPOSE 3000 7 | RUN npm install -g nodemon 8 | CMD [ "nodemon","index.js" ] 9 | -------------------------------------------------------------------------------- /opentelemetry/node-microservice/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sample_otel_node_app", 3 | "version": "1.0.0", 4 | "description": "Demonstrating configuration options in opentelemetry-js", 5 | "main": "index.js", 6 | "private": true, 7 | "dependencies": { 8 | "@octokit/rest": "^18.0.6", 9 | "@opentelemetry/api": "^0.15.0", 10 | "@opentelemetry/exporter-collector": "^0.15.0", 11 | "@opentelemetry/node": "^0.15.0", 12 | "@opentelemetry/plugins-node-core-and-contrib": "^0.13.1", 13 | "@opentelemetry/tracing": "^0.15.0", 14 | "axios": "^0.21.0", 15 | "express": "^4.17.1", 16 | "mongodb": "^3.6.4", 17 | "signalfx-tracing": "^0.10.0", 18 | "winston": "^3.3.3" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /opentelemetry/python-microservice/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.7 2 | 3 | ENV PYTHONUNBUFFERED 1 4 | 5 | COPY ./requirements.txt /app/requirements.txt 6 | 7 | WORKDIR /app 8 | EXPOSE 5000 9 | RUN pip install -r requirements.txt 10 | 11 | COPY . /app 12 | 13 | ENTRYPOINT flask run --host=0.0.0.0 14 | -------------------------------------------------------------------------------- /opentelemetry/python-microservice/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/opentelemetry/python-microservice/__init__.py -------------------------------------------------------------------------------- /opentelemetry/ruby-microservice/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.6.3 2 | 3 | RUN gem install bundler 4 | ENV BUNDLE_PATH "/bundle" 5 | 6 | RUN mkdir -p /sinatra-multivac 7 | WORKDIR /sinatra-multivac 8 | 9 | COPY . /sinatra-multivac 10 | 11 | RUN bundle install --no-cache 12 | 13 | EXPOSE 3000 14 | 15 | CMD ["bundle", "exec", "puma", "config.ru", "-C", "puma.rb"] 16 | -------------------------------------------------------------------------------- /opentelemetry/ruby-microservice/Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source 'https://rubygems.org' 4 | 5 | ruby '2.6.3' 6 | 7 | # Use Puma as the app server 8 | 9 | gem 'puma', '~> 3.11' 10 | gem 'redis-sinatra' 11 | gem 'sinatra' 12 | gem 'sinatra-contrib' 13 | gem 'spacex' 14 | gem 'opentelemetry-instrumentation-all' 15 | gem 'opentelemetry-sdk' 16 | gem 'opentelemetry-api' 17 | gem 'opentelemetry-exporter-otlp' 18 | gem 'opentelemetry-exporter-jaeger' 19 | 20 | -------------------------------------------------------------------------------- /opentelemetry/ruby-microservice/redis.yml: -------------------------------------------------------------------------------- 1 | default: 2 | host: redis 3 | port: 6379 4 | db: 0 5 | development: 6 | db: 0 7 | test: 8 | db: 1 9 | -------------------------------------------------------------------------------- /opentelemetry/ruby-microservice/views/next_launch.erb: -------------------------------------------------------------------------------- 1 | 2 |

Next Launch: <%= name %>, <%= date %>

3 |
<%= data %>
4 | 5 | -------------------------------------------------------------------------------- /opentelemetry/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | usage() { echo "Usage: $0 [start/stop/update]" 1>&2; exit 1; } 4 | 5 | case "$1" in 6 | start) 7 | kubectl apply -f k8s-collector.yml 8 | ;; 9 | stop) 10 | kubectl delete -f k8s-collector.yml 11 | ;; 12 | update) 13 | kubectl replace --force -f ./k8s-collector.yml 14 | ;; 15 | *) 16 | usage 17 | ;; 18 | esac -------------------------------------------------------------------------------- /php/.dockerignore: -------------------------------------------------------------------------------- 1 | **/vendor/ 2 | -------------------------------------------------------------------------------- /php/.env: -------------------------------------------------------------------------------- 1 | DD_TRACE_VERSION=0.30.0 2 | -------------------------------------------------------------------------------- /php/.gitignore: -------------------------------------------------------------------------------- 1 | **/vendor/ 2 | **/supervisord.log 3 | **/supervisord.pid 4 | -------------------------------------------------------------------------------- /php/Laravel42/.gitattributes: -------------------------------------------------------------------------------- 1 | bootstrap/* linguist-generated 2 | public/* linguist-generated 3 | artisan linguist-generated 4 | composer.json linguist-generated 5 | composer.lock linguist-generated 6 | server.php linguist-generated 7 | -------------------------------------------------------------------------------- /php/Laravel42/.gitignore: -------------------------------------------------------------------------------- 1 | /bootstrap/compiled.php 2 | /vendor 3 | composer.phar 4 | composer.lock 5 | .env.*.php 6 | .env.php 7 | .DS_Store 8 | Thumbs.db 9 | -------------------------------------------------------------------------------- /php/Laravel42/Dockerfiles/acpu.ini: -------------------------------------------------------------------------------- 1 | extension=apcu.so 2 | -------------------------------------------------------------------------------- /php/Laravel42/Dockerfiles/apache2-virtualhost.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /php/Laravel42/Dockerfiles/opcache-extra.ini: -------------------------------------------------------------------------------- 1 | opcache.enable=1 2 | opcache.memory_consumption=513 3 | opcache.interned_strings_buffer=32 4 | opcache.max_accelerated_files=32531 5 | opcache.save_comments=1 6 | opcache.validate_timestamps=0 7 | opcache.revalidate_freq=0 8 | opcache.fast_shutdown=1 9 | -------------------------------------------------------------------------------- /php/Laravel42/Dockerfiles/opcache.ini: -------------------------------------------------------------------------------- 1 | ;zend_extension=opcache.so 2 | opcache.enable=1 3 | opcache.memory_consumption=512 4 | opcache.interned_strings_buffer=32 5 | opcache.max_accelerated_files=32531 6 | opcache.save_comments=1 7 | opcache.validate_timestamps=0 8 | opcache.revalidate_freq=0 9 | opcache.fast_shutdown=1 10 | -------------------------------------------------------------------------------- /php/Laravel42/Dockerfiles/php-dd-ext.ini: -------------------------------------------------------------------------------- 1 | date.timezone="UTC" 2 | -------------------------------------------------------------------------------- /php/Laravel42/Dockerfiles/php_nginx_default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | 4 | server_name localhost; 5 | 6 | root /var/www/public; 7 | index index.php; 8 | 9 | location / { 10 | try_files $uri $uri/ /index.php?$query_string; 11 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 12 | fastcgi_pass 127.0.0.1:9000; 13 | fastcgi_index index.php; 14 | include fastcgi_params; 15 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 16 | fastcgi_param PATH_INFO $fastcgi_path_info; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /php/Laravel42/app/.gitattributes: -------------------------------------------------------------------------------- 1 | # Directories 2 | commands/* linguist-generated 3 | config/* linguist-generated 4 | database/* linguist-generated 5 | lang/* linguist-generated 6 | models/* linguist-generated 7 | start/* linguist-generated 8 | storage/* linguist-generated 9 | views/* linguist-generated 10 | 11 | # Files 12 | filters.php linguist-generated 13 | -------------------------------------------------------------------------------- /php/Laravel42/app/commands/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/php/Laravel42/app/commands/.gitkeep -------------------------------------------------------------------------------- /php/Laravel42/app/config/compile.php: -------------------------------------------------------------------------------- 1 | true, 17 | 18 | ); 19 | -------------------------------------------------------------------------------- /php/Laravel42/app/config/packages/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/php/Laravel42/app/config/packages/.gitkeep -------------------------------------------------------------------------------- /php/Laravel42/app/config/testing/cache.php: -------------------------------------------------------------------------------- 1 | 'array', 19 | 20 | ); 21 | -------------------------------------------------------------------------------- /php/Laravel42/app/config/testing/session.php: -------------------------------------------------------------------------------- 1 | 'array', 20 | 21 | ); 22 | -------------------------------------------------------------------------------- /php/Laravel42/app/controllers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/php/Laravel42/app/controllers/.gitkeep -------------------------------------------------------------------------------- /php/Laravel42/app/controllers/BaseController.php: -------------------------------------------------------------------------------- 1 | layout)) 13 | { 14 | $this->layout = View::make($this->layout); 15 | } 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /php/Laravel42/app/database/migrations/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/php/Laravel42/app/database/migrations/.gitkeep -------------------------------------------------------------------------------- /php/Laravel42/app/database/production.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/php/Laravel42/app/database/production.sqlite -------------------------------------------------------------------------------- /php/Laravel42/app/database/seeds/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/php/Laravel42/app/database/seeds/.gitkeep -------------------------------------------------------------------------------- /php/Laravel42/app/database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call('UserTableSeeder'); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /php/Laravel42/app/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 18 | 'next' => 'Next »', 19 | 20 | ); 21 | -------------------------------------------------------------------------------- /php/Laravel42/app/models/User.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Password Reset

8 | 9 |
10 | To reset your password, complete this form: {{ URL::to('password/reset', array($token)) }}.
11 | This link will expire in {{ Config::get('auth.reminder.expire', 60) }} minutes. 12 |
13 | 14 | 15 | -------------------------------------------------------------------------------- /php/Laravel42/public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Redirect Trailing Slashes... 9 | RewriteRule ^(.*)/$ /$1 [L,R=301] 10 | 11 | # Handle Front Controller... 12 | RewriteCond %{REQUEST_FILENAME} !-d 13 | RewriteCond %{REQUEST_FILENAME} !-f 14 | RewriteRule ^ index.php [L] 15 | 16 | -------------------------------------------------------------------------------- /php/Laravel42/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/php/Laravel42/public/favicon.ico -------------------------------------------------------------------------------- /php/Laravel42/public/packages/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/php/Laravel42/public/packages/.gitkeep -------------------------------------------------------------------------------- /php/Laravel42/public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /php/Laravel42/server.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /php/Laravel57/Dockerfiles/opcache-extra.ini: -------------------------------------------------------------------------------- 1 | opcache.enable=1 2 | opcache.memory_consumption=513 3 | opcache.interned_strings_buffer=32 4 | opcache.max_accelerated_files=32531 5 | opcache.save_comments=1 6 | opcache.validate_timestamps=0 7 | opcache.revalidate_freq=0 8 | opcache.fast_shutdown=1 9 | -------------------------------------------------------------------------------- /php/Laravel57/Dockerfiles/opcache.ini: -------------------------------------------------------------------------------- 1 | ;zend_extension=opcache.so 2 | opcache.enable=1 3 | opcache.memory_consumption=512 4 | opcache.interned_strings_buffer=32 5 | opcache.max_accelerated_files=32531 6 | opcache.save_comments=1 7 | opcache.validate_timestamps=0 8 | opcache.revalidate_freq=0 9 | opcache.fast_shutdown=1 10 | -------------------------------------------------------------------------------- /php/Laravel57/Dockerfiles/php-dd-ext.ini: -------------------------------------------------------------------------------- 1 | date.timezone="UTC" 2 | -------------------------------------------------------------------------------- /php/Laravel57/Dockerfiles/php_nginx_default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | 4 | server_name localhost; 5 | 6 | root /var/www/public; 7 | index index.php; 8 | 9 | location / { 10 | try_files $uri $uri/ /index.php?$query_string; 11 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 12 | fastcgi_pass 127.0.0.1:9000; 13 | fastcgi_index index.php; 14 | include fastcgi_params; 15 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 16 | fastcgi_param PATH_INFO $fastcgi_path_info; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /php/Laravel57/app/.gitattributes: -------------------------------------------------------------------------------- 1 | Console/* linguist-generated 2 | Exceptions/* linguist-generated 3 | Providers/* linguist-generated 4 | User.php/* linguist-generated 5 | -------------------------------------------------------------------------------- /php/Laravel57/app/Comment.php: -------------------------------------------------------------------------------- 1 | belongsTo(Post::class); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /php/Laravel57/app/Custom/AddTen.php: -------------------------------------------------------------------------------- 1 | belongsTo(User::class); 12 | } 13 | 14 | public function comments() 15 | { 16 | return $this->hasMany(Comment::class); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /php/Laravel57/app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | 'graphql-playground', 6 | 7 | // Which middleware to apply, if any 8 | 'middleware' => [ 9 | // 'web', 10 | ], 11 | 12 | // Route for the GraphQL endpoint 13 | 'endpoint' => 'graphql', 14 | 15 | // Control if the playground is accessible at all 16 | // This allows you to disable it completely in production 17 | 'enabled' => env('GRAPHQL_PLAYGROUND_ENABLED', true), 18 | ]; 19 | -------------------------------------------------------------------------------- /php/Laravel57/database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /php/Laravel57/database/migrations/2019_02_19_133634_create_posts_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 13 | $table->unsignedInteger('user_id'); 14 | $table->string('title'); 15 | $table->string('content'); 16 | $table->timestamps(); 17 | }); 18 | } 19 | 20 | public function down() 21 | { 22 | Schema::dropIfExists('posts'); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /php/Laravel57/database/migrations/2019_02_19_133739_create_comments_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 13 | $table->unsignedInteger('post_id'); 14 | $table->string('reply'); 15 | $table->timestamps(); 16 | }); 17 | } 18 | 19 | public function down() 20 | { 21 | Schema::dropIfExists('comments'); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /php/Laravel57/database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(UsersTableSeeder::class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /php/Laravel57/libapache2-mod-fastcgi_2.4.7~0910052141-1.2_amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/php/Laravel57/libapache2-mod-fastcgi_2.4.7~0910052141-1.2_amd64.deb -------------------------------------------------------------------------------- /php/Laravel57/public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Handle Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /php/Laravel57/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/php/Laravel57/public/favicon.ico -------------------------------------------------------------------------------- /php/Laravel57/public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /php/Laravel57/resources/js/components/ExampleComponent.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | -------------------------------------------------------------------------------- /php/Laravel57/resources/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /php/Laravel57/resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /php/Laravel57/resources/sass/_variables.scss: -------------------------------------------------------------------------------- 1 | 2 | // Body 3 | $body-bg: #f8fafc; 4 | 5 | // Typography 6 | $font-family-sans-serif: "Nunito", sans-serif; 7 | $font-size-base: 0.9rem; 8 | $line-height-base: 1.6; 9 | 10 | // Colors 11 | $blue: #3490dc; 12 | $indigo: #6574cd; 13 | $purple: #9561e2; 14 | $pink: #f66D9b; 15 | $red: #e3342f; 16 | $orange: #f6993f; 17 | $yellow: #ffed4a; 18 | $green: #38c172; 19 | $teal: #4dc0b5; 20 | $cyan: #6cb2eb; 21 | -------------------------------------------------------------------------------- /php/Laravel57/resources/sass/app.scss: -------------------------------------------------------------------------------- 1 | 2 | // Fonts 3 | @import url('https://fonts.googleapis.com/css?family=Nunito'); 4 | 5 | // Variables 6 | @import 'variables'; 7 | 8 | // Bootstrap 9 | @import '~bootstrap/scss/bootstrap'; 10 | 11 | .navbar-laravel { 12 | background-color: #fff; 13 | box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04); 14 | } 15 | -------------------------------------------------------------------------------- /php/Laravel57/routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 17 | return $request->user(); 18 | }); 19 | -------------------------------------------------------------------------------- /php/Laravel57/routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 16 | }); 17 | -------------------------------------------------------------------------------- /php/Laravel57/routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 18 | })->describe('Display an inspiring quote'); 19 | -------------------------------------------------------------------------------- /php/Laravel57/routes/web.php: -------------------------------------------------------------------------------- 1 | 'PdoController@pdoAction', 'as' => 'pdo.endpoint']); 19 | Route::get('/sample', ['uses' => 'SampleController@sampleAction', 'as' => 'laravel.sample.action']); 20 | -------------------------------------------------------------------------------- /php/Laravel57/server.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | $uri = urldecode( 11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 12 | ); 13 | 14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 15 | // built-in PHP web server. This provides a convenient way to test a Laravel 16 | // application without having installed a "real" web server software here. 17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { 18 | return false; 19 | } 20 | 21 | require_once __DIR__.'/public/index.php'; 22 | -------------------------------------------------------------------------------- /php/Laravel57/storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /php/Laravel57/storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /php/Laravel57/storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | schedule-* 4 | compiled.php 5 | services.json 6 | events.scanned.php 7 | routes.scanned.php 8 | down 9 | -------------------------------------------------------------------------------- /php/Laravel57/storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /php/Laravel57/storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /php/Laravel57/storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /php/Laravel57/storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /php/Laravel57/storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /php/Laravel57/storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /php/Laravel57/webpack.mix.js: -------------------------------------------------------------------------------- 1 | const mix = require('laravel-mix'); 2 | 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Mix Asset Management 6 | |-------------------------------------------------------------------------- 7 | | 8 | | Mix provides a clean, fluent API for defining some Webpack build steps 9 | | for your Laravel application. By default, we are compiling the Sass 10 | | file for the application as well as bundling up all the JS files. 11 | | 12 | */ 13 | 14 | mix.js('resources/js/app.js', 'public/js') 15 | .sass('resources/sass/app.scss', 'public/css'); 16 | -------------------------------------------------------------------------------- /php/Slim4OtelDropIn/Dockerfile: -------------------------------------------------------------------------------- 1 | # Extend the OpenTelemetry PHP base image 2 | FROM ghcr.io/open-telemetry/opentelemetry-php/opentelemetry-php-base:8.1 3 | 4 | # Install Datadog SDK 5 | USER root 6 | RUN curl -LO https://github.com/DataDog/dd-trace-php/releases/latest/download/datadog-setup.php 7 | RUN apk add libgcc 8 | RUN php datadog-setup.php --php-bin=all 9 | -------------------------------------------------------------------------------- /php/Slim4OtelDropIn/collector/config.yaml: -------------------------------------------------------------------------------- 1 | receivers: 2 | otlp: 3 | protocols: 4 | grpc: 5 | 6 | exporters: 7 | logging: 8 | logLevel: debug 9 | zipkin: 10 | endpoint: "http://zipkin:9411/api/v2/spans" 11 | jaeger: 12 | endpoint: jaeger:14250 13 | tls: 14 | insecure: true 15 | 16 | service: 17 | pipelines: 18 | traces: 19 | receivers: 20 | - otlp 21 | exporters: 22 | - logging 23 | - zipkin 24 | - jaeger 25 | -------------------------------------------------------------------------------- /php/Slim4OtelDropIn/screenshots/distributed-dd-trace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/php/Slim4OtelDropIn/screenshots/distributed-dd-trace.png -------------------------------------------------------------------------------- /php/Slim4OtelDropIn/screenshots/distributed-otel-dd-trace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/php/Slim4OtelDropIn/screenshots/distributed-otel-dd-trace.png -------------------------------------------------------------------------------- /php/Slim4OtelDropIn/screenshots/distributed-otel-trace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/php/Slim4OtelDropIn/screenshots/distributed-otel-trace.png -------------------------------------------------------------------------------- /php/Symfony34/.gitattributes: -------------------------------------------------------------------------------- 1 | app/* linguist-generated 2 | bin/* linguist-generated 3 | public/* linguist-generated 4 | var/* linguist-generated 5 | composer.json linguist-generated 6 | composer.lock linguist-generated 7 | LICENSE linguist-generated 8 | -------------------------------------------------------------------------------- /php/Symfony34/.gitignore: -------------------------------------------------------------------------------- 1 | /.web-server-pid 2 | /app/config/parameters.yml 3 | /build/ 4 | /phpunit.xml 5 | /var/* 6 | !/var/cache 7 | /var/cache/* 8 | !var/cache/.gitkeep 9 | !/var/logs 10 | /var/logs/* 11 | !var/logs/.gitkeep 12 | !/var/sessions 13 | /var/sessions/* 14 | !var/sessions/.gitkeep 15 | !var/SymfonyRequirements.php 16 | /vendor/ 17 | /web/bundles/ 18 | -------------------------------------------------------------------------------- /php/Symfony34/Dockerfiles/acpu.ini: -------------------------------------------------------------------------------- 1 | extension=apcu.so 2 | -------------------------------------------------------------------------------- /php/Symfony34/Dockerfiles/apache2-virtualhost.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /php/Symfony34/Dockerfiles/opcache-extra.ini: -------------------------------------------------------------------------------- 1 | opcache.enable=1 2 | opcache.memory_consumption=513 3 | opcache.interned_strings_buffer=32 4 | opcache.max_accelerated_files=32531 5 | opcache.save_comments=1 6 | opcache.validate_timestamps=0 7 | opcache.revalidate_freq=0 8 | opcache.fast_shutdown=1 9 | -------------------------------------------------------------------------------- /php/Symfony34/Dockerfiles/opcache.ini: -------------------------------------------------------------------------------- 1 | ;zend_extension=opcache.so 2 | opcache.enable=1 3 | opcache.memory_consumption=512 4 | opcache.interned_strings_buffer=32 5 | opcache.max_accelerated_files=32531 6 | opcache.save_comments=1 7 | opcache.validate_timestamps=0 8 | opcache.revalidate_freq=0 9 | opcache.fast_shutdown=1 10 | -------------------------------------------------------------------------------- /php/Symfony34/Dockerfiles/php-dd-ext.ini: -------------------------------------------------------------------------------- 1 | date.timezone="UTC" 2 | -------------------------------------------------------------------------------- /php/Symfony34/Dockerfiles/php_nginx_default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | 4 | server_name localhost; 5 | 6 | root /var/www/public; 7 | index index.php; 8 | 9 | location / { 10 | try_files $uri $uri/ /index.php?$query_string; 11 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 12 | fastcgi_pass 127.0.0.1:9000; 13 | fastcgi_index index.php; 14 | include fastcgi_params; 15 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 16 | fastcgi_param PATH_INFO $fastcgi_path_info; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /php/Symfony34/app/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Order deny,allow 6 | Deny from all 7 | 8 | -------------------------------------------------------------------------------- /php/Symfony34/app/AppCache.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {% block title %}Welcome!{% endblock %} 6 | {% block stylesheets %}{% endblock %} 7 | 8 | 9 | 10 | {% block body %}{% endblock %} 11 | {% block javascripts %}{% endblock %} 12 | 13 | 14 | -------------------------------------------------------------------------------- /php/Symfony34/app/config/config_prod.yml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: config.yml } 3 | 4 | #doctrine: 5 | # orm: 6 | # metadata_cache_driver: apc 7 | # result_cache_driver: apc 8 | # query_cache_driver: apc 9 | 10 | monolog: 11 | handlers: 12 | main: 13 | type: fingers_crossed 14 | action_level: error 15 | handler: nested 16 | nested: 17 | type: stream 18 | path: '%kernel.logs_dir%/%kernel.environment%.log' 19 | level: debug 20 | console: 21 | type: console 22 | process_psr_3_messages: false 23 | -------------------------------------------------------------------------------- /php/Symfony34/app/config/config_test.yml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: config_dev.yml } 3 | 4 | framework: 5 | test: ~ 6 | session: 7 | storage_id: session.storage.mock_file 8 | profiler: 9 | collect: false 10 | 11 | web_profiler: 12 | toolbar: false 13 | intercept_redirects: false 14 | 15 | swiftmailer: 16 | disable_delivery: true 17 | -------------------------------------------------------------------------------- /php/Symfony34/app/config/routing.yml: -------------------------------------------------------------------------------- 1 | app: 2 | resource: '@AppBundle/Controller/' 3 | type: annotation 4 | -------------------------------------------------------------------------------- /php/Symfony34/app/config/routing_dev.yml: -------------------------------------------------------------------------------- 1 | _wdt: 2 | resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml' 3 | prefix: /_wdt 4 | 5 | _profiler: 6 | resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml' 7 | prefix: /_profiler 8 | 9 | _errors: 10 | resource: '@TwigBundle/Resources/config/routing/errors.xml' 11 | prefix: /_error 12 | 13 | _main: 14 | resource: routing.yml 15 | -------------------------------------------------------------------------------- /php/Symfony34/public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/php/Symfony34/public/apple-touch-icon.png -------------------------------------------------------------------------------- /php/Symfony34/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/php/Symfony34/public/favicon.ico -------------------------------------------------------------------------------- /php/Symfony34/public/robots.txt: -------------------------------------------------------------------------------- 1 | # www.robotstxt.org/ 2 | # www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449 3 | 4 | User-agent: * 5 | Disallow: 6 | -------------------------------------------------------------------------------- /php/Symfony34/src/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Order deny,allow 6 | Deny from all 7 | 8 | -------------------------------------------------------------------------------- /php/Symfony34/src/AppBundle/AppBundle.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {% block head %} 5 | 7 | {{title}} 8 | {% endblock %} 9 | 10 | 11 |

{{title}}

12 |
13 | {% block content %} 14 | {% endblock %} 15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /python/aiohttp/polls/aiohttpdemo_polls/templates/detail.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% set title = question.question_text %} 4 | 5 | {% block content %} 6 | {% if error_message %}

{{ error_message }}

{% endif %} 7 | 8 |
9 | {% for choice in choices %} 10 | 11 |
12 | {% endfor %} 13 | 14 |
15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /python/aiohttp/polls/aiohttpdemo_polls/templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% set title = "Main" %} 4 | 5 | {% block content %} 6 | {% if questions %} 7 | 12 | {% else %} 13 |

No polls are available.

14 | {% endif %} 15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /python/aiohttp/polls/aiohttpdemo_polls/templates/results.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% set title = question.question_text %} 4 | 5 | {% block content %} 6 | 11 | 12 | Vote again? 13 | {% endblock %} 14 | -------------------------------------------------------------------------------- /python/aiohttp/polls/aiohttpdemo_polls/utils.py: -------------------------------------------------------------------------------- 1 | import trafaret as T 2 | 3 | primitive_ip_regexp = r'^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$' 4 | 5 | TRAFARET = T.Dict({ 6 | T.Key('postgres'): 7 | T.Dict({ 8 | 'database': T.String(), 9 | 'user': T.String(), 10 | 'password': T.String(), 11 | 'host': T.String(), 12 | 'port': T.Int(), 13 | 'minsize': T.Int(), 14 | 'maxsize': T.Int(), 15 | }), 16 | T.Key('host'): T.String(regex=primitive_ip_regexp), 17 | T.Key('port'): T.Int(), 18 | }) 19 | -------------------------------------------------------------------------------- /python/aiohttp/polls/config/polls.yaml: -------------------------------------------------------------------------------- 1 | postgres: 2 | database: aiohttpdemo_polls 3 | user: aiohttpdemo_user 4 | password: aiohttpdemo_user 5 | host: localhost 6 | port: 5432 7 | minsize: 1 8 | maxsize: 5 9 | 10 | host: 127.0.0.1 11 | port: 8000 12 | -------------------------------------------------------------------------------- /python/aiohttp/polls/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | 3 | services: 4 | postgres: 5 | image: postgres:9.6 6 | environment: 7 | - POSTGRES_PASSWORD=123456 8 | - POSTGRES_USER=postgres 9 | ports: 10 | - "127.0.0.1:5432:5432" 11 | -------------------------------------------------------------------------------- /python/aiohttp/polls/requirements.txt: -------------------------------------------------------------------------------- 1 | -e . 2 | docker-py==1.10.6 3 | pytest-aiohttp==0.1.3 4 | -------------------------------------------------------------------------------- /python/aiohttp/polls/sql/create_db.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # meant for testing 4 | export PGPASSWORD="123456" 5 | export PGHOST="127.0.0.1" 6 | 7 | psql -U postgres -c "DROP DATABASE IF EXISTS aiohttpdemo_polls" 8 | psql -U postgres -c "DROP ROLE IF EXISTS aiohttpdemo_user" 9 | psql -U postgres -c "CREATE USER aiohttpdemo_user WITH PASSWORD 'aiohttpdemo_user';" 10 | psql -U postgres -c "CREATE DATABASE aiohttpdemo_polls ENCODING 'UTF8';" 11 | psql -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE aiohttpdemo_polls TO aiohttpdemo_user;" 12 | 13 | cat sql/create_tables.sql | psql -U postgres -d aiohttpdemo_polls -a 14 | cat sql/sample_data.sql | psql -U postgres -d aiohttpdemo_polls -a 15 | -------------------------------------------------------------------------------- /python/aiohttp/simple_app/Procfile: -------------------------------------------------------------------------------- 1 | web: python server.py 2 | -------------------------------------------------------------------------------- /python/aiohttp/simple_app/README.md: -------------------------------------------------------------------------------- 1 | # aiohttp example 2 | 3 | Simple application that creates some traces using `aiohttp`. It uses 4 | multiple coroutines for the same handler and it serves a static file. 5 | 6 | ## Compatibility stack 7 | 8 | * Python 3.6.0 9 | * `asyncio` (built-in library in Python 3.4+) 10 | * `aiohttp` 1.2.0 11 | 12 | ## Backing services 13 | 14 | * No one 15 | 16 | ## Getting started 17 | 18 | Launch the application 19 | 20 | python server.py 21 | -------------------------------------------------------------------------------- /python/aiohttp/simple_app/requirements.txt: -------------------------------------------------------------------------------- 1 | # third party 2 | aiohttp==1.2.0 3 | 4 | # tracer 5 | ddtrace 6 | -------------------------------------------------------------------------------- /python/aiohttp/simple_app/runtime.txt: -------------------------------------------------------------------------------- 1 | python-3.6.0 2 | -------------------------------------------------------------------------------- /python/aiohttp/simple_app/statics/empty.txt: -------------------------------------------------------------------------------- 1 | This file is meant to be empty. 2 | -------------------------------------------------------------------------------- /python/aiopg/docker-compose.yml: -------------------------------------------------------------------------------- 1 | postgres: 2 | image: postgres:10.5-alpine 3 | environment: 4 | - POSTGRES_PASSWORD=postgres 5 | - POSTGRES_USER=postgres 6 | - POSTGRES_DB=postgres 7 | ports: 8 | - "127.0.0.1:5432:5432" 9 | -------------------------------------------------------------------------------- /python/aiopg/requirements.txt: -------------------------------------------------------------------------------- 1 | aiopg==0.15.0 2 | asyncio==3.4.3 3 | ddtrace 4 | -------------------------------------------------------------------------------- /python/asgi/app.py: -------------------------------------------------------------------------------- 1 | from starlette.applications import Starlette 2 | from starlette.responses import JSONResponse 3 | from starlette.routing import Route 4 | from ddtrace.contrib.asgi import TraceMiddleware # import the middleware 5 | 6 | 7 | async def homepage(request): 8 | return JSONResponse({'hello': 'world'}) 9 | 10 | routes = [ 11 | Route("/", endpoint=homepage) 12 | ] 13 | 14 | app = Starlette(debug=True, routes=routes) 15 | 16 | # wrap the app for tracing 17 | app = TraceMiddleware(app) 18 | -------------------------------------------------------------------------------- /python/asgi/images/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/asgi/images/image1.png -------------------------------------------------------------------------------- /python/async/README.rst: -------------------------------------------------------------------------------- 1 | ============= 2 | async support 3 | ============= 4 | 5 | Python tracing client examples, with async support. 6 | -------------------------------------------------------------------------------- /python/asyncio/Procfile: -------------------------------------------------------------------------------- 1 | web: python http_async_server.py 2 | -------------------------------------------------------------------------------- /python/asyncio/README.md: -------------------------------------------------------------------------------- 1 | # asyncio example 2 | 3 | Simple application that creates some traces using `asyncio`. It uses 4 | multiple coroutines to handle concurrent calls, while doing synchronous 5 | operations with Redis, just to test that the API is backward compatible. 6 | 7 | ## Compatibility stack 8 | 9 | * Python 3.6.0 10 | * `asyncio` (built-in library in Python 3.4+) 11 | 12 | ## Backing services 13 | 14 | * Redis 3.2 15 | 16 | ## Getting started 17 | 18 | Launch backing services: 19 | 20 | docker-compose up -d 21 | 22 | Launch the application 23 | 24 | python http_async_server.py 25 | -------------------------------------------------------------------------------- /python/asyncio/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | 3 | services: 4 | redis: 5 | image: redis:3.2 6 | ports: 7 | - "127.0.0.1:6379:6379" 8 | -------------------------------------------------------------------------------- /python/asyncio/requirements.txt: -------------------------------------------------------------------------------- 1 | # third party 2 | redis==2.10.5 3 | 4 | # tracer 5 | ddtrace 6 | -------------------------------------------------------------------------------- /python/asyncio/runtime.txt: -------------------------------------------------------------------------------- 1 | python-3.6.0 2 | -------------------------------------------------------------------------------- /python/bottle/bottle_example.py: -------------------------------------------------------------------------------- 1 | from bottle import route, run, template 2 | 3 | 4 | @route('/hello/') 5 | def index(name): 6 | return template('Hello {{name}}!', name=name) 7 | 8 | 9 | run(host='localhost', port=8080) 10 | -------------------------------------------------------------------------------- /python/bottle/requirements.txt: -------------------------------------------------------------------------------- 1 | bottle==0.12.13 2 | ddtrace 3 | -------------------------------------------------------------------------------- /python/celery4.1/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | -------------------------------------------------------------------------------- /python/celery4.1/Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | url = "https://pypi.org/simple" 3 | verify_ssl = true 4 | name = "pypi" 5 | 6 | [packages] 7 | ddtrace = "==0.39.0" 8 | celery = "==4.1" 9 | redis = "==2.10.6" 10 | kombu = "==4.1.0" 11 | 12 | [dev-packages] 13 | 14 | [requires] 15 | python_version = "3.6" 16 | -------------------------------------------------------------------------------- /python/celery4.1/consumer.py: -------------------------------------------------------------------------------- 1 | import time 2 | import random 3 | 4 | from celery import Celery, shared_task 5 | from ddtrace import tracer 6 | 7 | 8 | @shared_task 9 | def add(x, y): 10 | return x + y 11 | 12 | 13 | app = Celery('consumer', broker='redis://localhost') 14 | app.autodiscover_tasks() 15 | -------------------------------------------------------------------------------- /python/celery4.1/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | redis: 4 | image: redis:5.0.6-alpine 5 | ports: 6 | - "127.0.0.1:6380:6379" 7 | -------------------------------------------------------------------------------- /python/celery4.1/producer.py: -------------------------------------------------------------------------------- 1 | import time 2 | import random 3 | 4 | from celery import shared_task 5 | from ddtrace import tracer 6 | 7 | from consumer import add 8 | 9 | 10 | while True: 11 | add.delay(4, 4) 12 | time.sleep(0.2) 13 | -------------------------------------------------------------------------------- /python/cyclone/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:2.7 2 | WORKDIR /app 3 | ADD . /app 4 | RUN apt-get update && apt-get install -y python3-dev default-libmysqlclient-dev build-essential 5 | RUN pip install -r requirements.txt 6 | CMD ["ddtrace-run", "python", "app.py"] 7 | -------------------------------------------------------------------------------- /python/cyclone/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ title }} 4 | 5 | 6 |
    7 | {% for item in items %} 8 |
  • {{ escape(item) }}
  • 9 | {% end %} 10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /python/cyclone/post.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

{{ title }}

4 |
5 |
6 |

{{ body }}

7 |
8 |
9 | -------------------------------------------------------------------------------- /python/cyclone/posts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 |
9 | {% for title, body in posts %} 10 | {{ modules.Post(title, body) }} 11 | {% end %} 12 |
13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /python/cyclone/requirements.txt: -------------------------------------------------------------------------------- 1 | cyclone==1.1 2 | mysqlclient==1.3.12 3 | txredisapi==1.0 4 | git+https://github.com/datadog/dd-trace-py.git@kyle-verhoog/duo 5 | -------------------------------------------------------------------------------- /python/django/django-realworld/README.md: -------------------------------------------------------------------------------- 1 | # Django Realworld 2 | 3 | To run through the Realworld API tests against a Django backend with Datadog 4 | Tracing enabled: 5 | 6 | ``` sh 7 | DD_API_KEY=... docker-compose up --build 8 | ``` 9 | -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.7 2 | 3 | ENV VIRTUAL_ENV=/opt/venv 4 | RUN python -m venv $VIRTUAL_ENV 5 | ENV PATH="$VIRTUAL_ENV/bin:$PATH" 6 | 7 | COPY . /code 8 | WORKDIR /code 9 | 10 | RUN pip install --no-cache-dir -r requirements.txt 11 | 12 | CMD ddtrace-run python manage.py runserver 0.0.0.0:3000 13 | -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/django/django-realworld/django-realworld-example-app/conduit/__init__.py -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/apps/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/django/django-realworld/django-realworld-example-app/conduit/apps/__init__.py -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/apps/articles/__init__.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ArticlesAppConfig(AppConfig): 5 | name = 'conduit.apps.articles' 6 | label = 'articles' 7 | verbose_name = 'Articles' 8 | 9 | def ready(self): 10 | import conduit.apps.articles.signals 11 | 12 | default_app_config = 'conduit.apps.articles.ArticlesAppConfig' 13 | -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/apps/articles/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/django/django-realworld/django-realworld-example-app/conduit/apps/articles/migrations/__init__.py -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/apps/articles/relations.py: -------------------------------------------------------------------------------- 1 | from rest_framework import serializers 2 | 3 | from .models import Tag 4 | 5 | 6 | class TagRelatedField(serializers.RelatedField): 7 | def get_queryset(self): 8 | return Tag.objects.all() 9 | 10 | def to_internal_value(self, data): 11 | tag, created = Tag.objects.get_or_create(tag=data, slug=data.lower()) 12 | 13 | return tag 14 | 15 | def to_representation(self, value): 16 | return value.tag 17 | -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/apps/articles/renderers.py: -------------------------------------------------------------------------------- 1 | from conduit.apps.core.renderers import ConduitJSONRenderer 2 | 3 | 4 | class ArticleJSONRenderer(ConduitJSONRenderer): 5 | object_label = 'article' 6 | pagination_object_label = 'articles' 7 | pagination_count_label = 'articlesCount' 8 | 9 | 10 | class CommentJSONRenderer(ConduitJSONRenderer): 11 | object_label = 'comment' 12 | pagination_object_label = 'comments' 13 | pagination_count_label = 'commentsCount' 14 | -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/apps/authentication/__init__.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AuthenticationAppConfig(AppConfig): 5 | name = 'conduit.apps.authentication' 6 | label = 'authentication' 7 | verbose_name = 'Authentication' 8 | 9 | def ready(self): 10 | import conduit.apps.authentication.signals 11 | 12 | # This is how we register our custom app config with Django. Django is smart 13 | # enough to look for the `default_app_config` property of each registered app 14 | # and use the correct app config based on that value. 15 | default_app_config = 'conduit.apps.authentication.AuthenticationAppConfig' 16 | -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/apps/authentication/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/django/django-realworld/django-realworld-example-app/conduit/apps/authentication/migrations/__init__.py -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/apps/authentication/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | 3 | from .views import ( 4 | LoginAPIView, RegistrationAPIView, UserRetrieveUpdateAPIView 5 | ) 6 | 7 | urlpatterns = [ 8 | url(r'^user/?$', UserRetrieveUpdateAPIView.as_view()), 9 | url(r'^users/?$', RegistrationAPIView.as_view()), 10 | url(r'^users/login/?$', LoginAPIView.as_view()), 11 | ] 12 | -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/apps/core/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/django/django-realworld/django-realworld-example-app/conduit/apps/core/__init__.py -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/apps/core/utils.py: -------------------------------------------------------------------------------- 1 | import random 2 | import string 3 | 4 | DEFAULT_CHAR_STRING = string.ascii_lowercase + string.digits 5 | 6 | def generate_random_string(chars=DEFAULT_CHAR_STRING, size=6): 7 | return ''.join(random.choice(chars) for _ in range(size)) 8 | -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/apps/profiles/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/django/django-realworld/django-realworld-example-app/conduit/apps/profiles/__init__.py -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/apps/profiles/exceptions.py: -------------------------------------------------------------------------------- 1 | from rest_framework.exceptions import APIException 2 | 3 | 4 | class ProfileDoesNotExist(APIException): 5 | status_code = 400 6 | default_detail = 'The requested profile does not exist.' 7 | -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/apps/profiles/migrations/0002_profile_follows.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10 on 2016-08-28 16:09 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('profiles', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='profile', 17 | name='follows', 18 | field=models.ManyToManyField(related_name='followed_by', to='profiles.Profile'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/apps/profiles/migrations/0003_profile_favorites.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10 on 2016-08-28 16:24 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('articles', '0002_comment'), 12 | ('profiles', '0002_profile_follows'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AddField( 17 | model_name='profile', 18 | name='favorites', 19 | field=models.ManyToManyField(related_name='favorited_by', to='articles.Article'), 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/apps/profiles/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/django/django-realworld/django-realworld-example-app/conduit/apps/profiles/migrations/__init__.py -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/apps/profiles/renderers.py: -------------------------------------------------------------------------------- 1 | from conduit.apps.core.renderers import ConduitJSONRenderer 2 | 3 | 4 | class ProfileJSONRenderer(ConduitJSONRenderer): 5 | object_label = 'profile' 6 | pagination_object_label = 'profiles' 7 | pagination_count_label = 'profilesCount' 8 | -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/apps/profiles/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | 3 | from .views import ProfileRetrieveAPIView, ProfileFollowAPIView 4 | 5 | urlpatterns = [ 6 | url(r'^profiles/(?P\w+)/?$', ProfileRetrieveAPIView.as_view()), 7 | url(r'^profiles/(?P\w+)/follow/?$', 8 | ProfileFollowAPIView.as_view()), 9 | ] 10 | -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/conduit/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for conduit project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "conduit.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/project-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/django/django-realworld/django-realworld-example-app/project-logo.png -------------------------------------------------------------------------------- /python/django/django-realworld/django-realworld-example-app/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==1.10.5 2 | django-cors-middleware==1.3.1 3 | django-extensions==1.7.1 4 | djangorestframework==3.4.4 5 | PyJWT==1.4.2 6 | six==1.10.0 7 | ddtrace>=0.50.3 8 | -------------------------------------------------------------------------------- /python/django/django-realworld/realworld/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node 2 | 3 | RUN git clone https://github.com/gothinkster/realworld.git /code 4 | 5 | WORKDIR /code/api 6 | 7 | CMD ./run-api-tests.sh 8 | -------------------------------------------------------------------------------- /python/django/django-tutorial/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.7 2 | 3 | ENV VIRTUAL_ENV=/opt/venv 4 | RUN python -m venv $VIRTUAL_ENV 5 | ENV PATH="$VIRTUAL_ENV/bin:$PATH" 6 | 7 | RUN mkdir /code 8 | WORKDIR /code 9 | 10 | COPY requirements.txt . 11 | RUN pip install --no-cache-dir -r requirements.txt 12 | 13 | ADD mysite /code/mysite 14 | WORKDIR /code/mysite 15 | 16 | EXPOSE 8888 17 | -------------------------------------------------------------------------------- /python/django/django-tutorial/mysite/mysite/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/django/django-tutorial/mysite/mysite/__init__.py -------------------------------------------------------------------------------- /python/django/django-tutorial/mysite/mysite/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for mysite project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /python/django/django-tutorial/mysite/polls/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | -------------------------------------------------------------------------------- /python/django/django-tutorial/mysite/polls/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from .models import Choice, Question 4 | 5 | 6 | class ChoiceInline(admin.TabularInline): 7 | model = Choice 8 | extra = 3 9 | 10 | 11 | class QuestionAdmin(admin.ModelAdmin): 12 | fieldsets = [ 13 | (None, {'fields': ['question_text']}), 14 | ('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}), 15 | ] 16 | inlines = [ChoiceInline] 17 | list_display = ('question_text', 'pub_date', 'was_published_recently') 18 | list_filter = ['pub_date'] 19 | search_fields = ['question_text'] 20 | 21 | 22 | admin.site.register(Question, QuestionAdmin) 23 | -------------------------------------------------------------------------------- /python/django/django-tutorial/mysite/polls/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PollsConfig(AppConfig): 5 | name = 'polls' 6 | -------------------------------------------------------------------------------- /python/django/django-tutorial/mysite/polls/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/django/django-tutorial/mysite/polls/migrations/__init__.py -------------------------------------------------------------------------------- /python/django/django-tutorial/mysite/polls/templates/polls/detail.html: -------------------------------------------------------------------------------- 1 |

{{ question.question_text }}

2 | 3 | {% if error_message %}

{{ error_message }}

{% endif %} 4 | 5 |
6 | {% csrf_token %} 7 | {% for choice in question.choice_set.all %} 8 | 9 |
10 | {% endfor %} 11 | 12 |
13 | -------------------------------------------------------------------------------- /python/django/django-tutorial/mysite/polls/templates/polls/index.html: -------------------------------------------------------------------------------- 1 | {% if latest_question_list %} 2 | 7 | {% else %} 8 |

No polls are available.

9 | {% endif %} 10 | -------------------------------------------------------------------------------- /python/django/django-tutorial/mysite/polls/templates/polls/results.html: -------------------------------------------------------------------------------- 1 |

{{ question.question_text }}

2 | 3 |
    4 | {% for choice in question.choice_set.all %} 5 |
  • {{ choice.choice_text }} -- {{ choice.votes }} vote{{ choice.votes|pluralize }}
  • 6 | {% endfor %} 7 |
8 | 9 | Vote again? 10 | -------------------------------------------------------------------------------- /python/django/django-tutorial/mysite/polls/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /python/django/django-tutorial/mysite/polls/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | 3 | from . import views 4 | 5 | app_name = 'polls' 6 | urlpatterns = [ 7 | path('', views.IndexView.as_view(), name='index'), 8 | path('/', views.DetailView.as_view(), name='detail'), 9 | path('/results/', views.ResultsView.as_view(), name='results'), 10 | path('/vote/', views.vote, name='vote'), 11 | ] 12 | -------------------------------------------------------------------------------- /python/django/django-tutorial/requirements.txt: -------------------------------------------------------------------------------- 1 | Django 2 | psycopg2 3 | ddtrace>=0.50.3 4 | -------------------------------------------------------------------------------- /python/falcon/Rakefile: -------------------------------------------------------------------------------- 1 | 2 | task :install do 3 | sh 'pip install -r requirements.txt' 4 | end 5 | 6 | task :run do 7 | sh 'uwsgi -p 1 --http :9090 --mount /=demo:app --enable-threads' 8 | end 9 | 10 | task :default => [:install, :run] 11 | -------------------------------------------------------------------------------- /python/falcon/requirements.txt: -------------------------------------------------------------------------------- 1 | falcon==1.3.0 2 | uwsgi==2.0.15 3 | ddtrace 4 | -------------------------------------------------------------------------------- /python/fastapi/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.8.6 2 | USER root 3 | WORKDIR /app 4 | ADD . /app 5 | RUN pip install --trusted-host pypi.python.org -r requirements.txt 6 | CMD ["ddtrace-run", "uvicorn", "app:app"] 7 | -------------------------------------------------------------------------------- /python/fastapi/app.py: -------------------------------------------------------------------------------- 1 | from fastapi import FastAPI 2 | from pydantic import BaseModel 3 | 4 | app = FastAPI() 5 | 6 | 7 | class Item(BaseModel): 8 | id: int 9 | name: str 10 | description: str = None 11 | 12 | 13 | @app.get("/") 14 | async def read_root(): 15 | return {"Hello": "World"} 16 | 17 | 18 | @app.get("/items/{item_id}") 19 | async def read_item(item_id: int, q: str = None): 20 | return {"item_id": item_id, "query": q} 21 | 22 | 23 | @app.post("/items/", response_model=Item) 24 | async def create_item(item: Item): 25 | return item 26 | -------------------------------------------------------------------------------- /python/fastapi/images/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/fastapi/images/image1.png -------------------------------------------------------------------------------- /python/fastapi/images/image2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/fastapi/images/image2.png -------------------------------------------------------------------------------- /python/fastapi/requirements.txt: -------------------------------------------------------------------------------- 1 | fastapi 2 | ddtrace 3 | uvicorn -------------------------------------------------------------------------------- /python/flask-baggage/Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | url = "https://pypi.org/simple" 3 | verify_ssl = true 4 | name = "pypi" 5 | 6 | [packages] 7 | ddtrace = ">=2.16.0" 8 | flask = "*" 9 | requests = "*" 10 | 11 | [dev-packages] 12 | 13 | [requires] 14 | python_version = "3.9" 15 | -------------------------------------------------------------------------------- /python/flask-baggage/README.md: -------------------------------------------------------------------------------- 1 | # Flask Baggage Example App 2 | 3 | The goal of this `Flask` Baggage example app is to create a simple app to show usages of the Baggage API. 4 | 5 | The best way to get started is to clone this repo and run: 6 | 7 | ```bash 8 | cd trace-examples/python/flask-baggage/ 9 | pipenv install 10 | 11 | pipenv run python app.py 12 | ``` 13 | 14 | From there, your terminal will open two Flask apps on ports 5000 and 5001 and then send a request to the app on port 5000 to show Baggage being propagated to the app on port 5001. 15 | 16 | Afterward, you may cancel the app or make requests to the individual apps to test out baggage propagation. 17 | -------------------------------------------------------------------------------- /python/flask/Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | url = "https://pypi.org/simple" 3 | verify_ssl = true 4 | name = "pypi" 5 | 6 | [packages] 7 | blinker = "*" 8 | ddtrace = "*" 9 | flask = "*" 10 | requests = "*" 11 | flask-caching = "*" 12 | flask-cors = "*" 13 | flask-limiter = "*" 14 | 15 | [dev-packages] 16 | 17 | [requires] 18 | python_version = "3.7" 19 | -------------------------------------------------------------------------------- /python/flask/README.md: -------------------------------------------------------------------------------- 1 | # Flask Example App 2 | 3 | The goal of this [Flask]() example app is to create a simple app which utilizes as many features 4 | of Flask as possible so that multiple variable code flows can be tested. 5 | 6 | The best way to get started is to clone this repo and run: 7 | 8 | ```bash 9 | cd trace-examples/python/flask/ 10 | pipenv install 11 | 12 | pipenv run python run.py 13 | 14 | # OR 15 | 16 | pipenv run ddtrace-run python run.py 17 | ``` 18 | 19 | Then open your browser to http://127.0.0.1:5000/ 20 | 21 | The main index page of this application lists all the available endpoints for testing 22 | -------------------------------------------------------------------------------- /python/flask/app/__init__.py: -------------------------------------------------------------------------------- 1 | from .app import app 2 | 3 | __all__ = ['app'] 4 | -------------------------------------------------------------------------------- /python/flask/app/config.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | PIN_OVERRIDES = os.getenv('PIN_OVERRIDES', 'false').lower() == 'true' 4 | -------------------------------------------------------------------------------- /python/flask/app/exceptions.py: -------------------------------------------------------------------------------- 1 | class AppException(Exception): 2 | pass 3 | -------------------------------------------------------------------------------- /python/flask/app/limiter.py: -------------------------------------------------------------------------------- 1 | from flask_limiter import Limiter 2 | from flask_limiter.util import get_remote_address 3 | 4 | limiter = Limiter(key_func=get_remote_address, default_limits=['20 per minute', '10 per second']) 5 | -------------------------------------------------------------------------------- /python/flask/app/static/test.txt: -------------------------------------------------------------------------------- 1 | hello 0/ 2 | -------------------------------------------------------------------------------- /python/flask/app/templates/layout.jinja2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 |
11 |
12 | {% block content %}{% endblock %} 13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /python/flask/run.py: -------------------------------------------------------------------------------- 1 | from app import app 2 | 3 | app.run() 4 | -------------------------------------------------------------------------------- /python/grpc/README.md: -------------------------------------------------------------------------------- 1 | Sample app for grpc client integration 2 | 3 | # Install requirements 4 | 5 | ``` 6 | pip install -r requirements.txt 7 | ``` 8 | 9 | # Launching server 10 | 11 | The server is just a really basic server replying 'Hello!' to an incoming request. 12 | 13 | To launch it: 14 | ``` 15 | python server_grpc.py 16 | ``` 17 | 18 | This is a pre-requisite to be able to launch the sample client 19 | 20 | # Launching demo 21 | 22 | The sample client shows how to use Datadog integration and sends a basic request to the server we just launched. It also displays the response to show that it works. 23 | 24 | To run it: 25 | ``` 26 | python demo_grpc.py 27 | ``` 28 | -------------------------------------------------------------------------------- /python/grpc/demo_grpc.py: -------------------------------------------------------------------------------- 1 | from ddtrace import Pin, patch 2 | import grpc 3 | 4 | from hello_pb2 import HelloRequest 5 | from hello_pb2_grpc import HelloStub 6 | 7 | # Use a pin to specify metadata related to this connection 8 | Pin.override(grpc, service='demo.grpc') 9 | 10 | def run(): 11 | # If not patched yet, you can patch grpc specifically 12 | patch(grpc=True) 13 | with grpc.insecure_channel('localhost:50051') as channel: 14 | stub = HelloStub(channel) 15 | response = stub.SayHello(HelloRequest(name="test")) 16 | print(response) 17 | 18 | if __name__ == '__main__': 19 | run() 20 | -------------------------------------------------------------------------------- /python/grpc/hello.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | service Hello { 4 | // Sends a greeting 5 | rpc SayHello (HelloRequest) returns (HelloReply) {} 6 | } 7 | 8 | // The request message containing the user's name. 9 | message HelloRequest { 10 | string name = 1; 11 | } 12 | 13 | // The response message containing the greetings 14 | message HelloReply { 15 | string message = 1; 16 | } 17 | -------------------------------------------------------------------------------- /python/grpc/requirements.txt: -------------------------------------------------------------------------------- 1 | ddtrace 2 | futures 3 | googleapis-common-protos 4 | grpcio 5 | -------------------------------------------------------------------------------- /python/kombu/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | -------------------------------------------------------------------------------- /python/kombu/Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | url = "https://pypi.org/simple" 3 | verify_ssl = true 4 | name = "pypi" 5 | 6 | [packages] 7 | celery = {version = "*", extras = ["redis"]} 8 | ddtrace = "==0.16" 9 | kombu = "==4.2.1" 10 | 11 | [dev-packages] 12 | 13 | [requires] 14 | python_version = "3.6" 15 | -------------------------------------------------------------------------------- /python/kombu/consume.py: -------------------------------------------------------------------------------- 1 | import time 2 | import random 3 | 4 | from kombu import Connection 5 | 6 | with Connection('amqp://guest:guest@127.0.0.1:5672//') as conn: 7 | simple_queue = conn.SimpleQueue('simple_queue') 8 | while True: 9 | message = simple_queue.get(block=True, timeout=1) 10 | message.ack() 11 | print('Received: {0}'.format(message.payload)) 12 | 13 | simple_queue.close() 14 | -------------------------------------------------------------------------------- /python/kombu/consumer.py: -------------------------------------------------------------------------------- 1 | import time 2 | import random 3 | 4 | from ddtrace import tracer 5 | from kombu import Connection 6 | 7 | 8 | @tracer.wrap('process_message') 9 | def process_message(message): 10 | time.sleep(random.uniform(0.001, 0.01)) 11 | 12 | 13 | with Connection('amqp://guest:guest@127.0.0.1:5672//') as conn: 14 | simple_queue = conn.SimpleQueue('simple_queue') 15 | while True: 16 | with tracer.trace('consume', service='consumer'): 17 | message = simple_queue.get(block=True, timeout=2) 18 | message.ack() 19 | process_message(message) 20 | print('Received: {0}'.format(message.payload)) 21 | 22 | simple_queue.close() 23 | -------------------------------------------------------------------------------- /python/kombu/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | rabbitmq: 4 | image: rabbitmq:3.7-alpine 5 | ports: 6 | - "127.0.0.1:5672:5672" 7 | -------------------------------------------------------------------------------- /python/opentracing/django/client/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/opentracing/django/client/__init__.py -------------------------------------------------------------------------------- /python/opentracing/django/client/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class ClientConfig(AppConfig): 7 | name = "client" 8 | -------------------------------------------------------------------------------- /python/opentracing/django/client/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /python/opentracing/django/client/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | 3 | from . import views 4 | 5 | urlpatterns = [ 6 | url(r"^$", views.client_index, name="index"), 7 | url(r"^simple", views.client_simple, name="simple"), 8 | url(r"^log", views.client_log, name="log"), 9 | url(r"^childspan", views.client_child_span, name="childspan"), 10 | ] 11 | -------------------------------------------------------------------------------- /python/opentracing/django/example_site/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/opentracing/django/example_site/__init__.py -------------------------------------------------------------------------------- /python/opentracing/django/example_site/views.py: -------------------------------------------------------------------------------- 1 | from django.http import HttpResponse 2 | 3 | def index(request): 4 | return HttpResponse('Welcome to the Django OpenTracing example!') -------------------------------------------------------------------------------- /python/opentracing/django/example_site/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for opentracing_test_site project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example_site.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /python/opentracing/django/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example_site.settings") 7 | 8 | from django.core.management import execute_from_command_line 9 | 10 | execute_from_command_line(sys.argv) 11 | -------------------------------------------------------------------------------- /python/opentracing/django/requirements.txt: -------------------------------------------------------------------------------- 1 | ddtrace 2 | opentracing==2.0.0 3 | django_opentracing 4 | django 5 | -------------------------------------------------------------------------------- /python/opentracing/django/server/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/opentracing/django/server/__init__.py -------------------------------------------------------------------------------- /python/opentracing/django/server/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class PollsConfig(AppConfig): 7 | name = 'polls' 8 | -------------------------------------------------------------------------------- /python/opentracing/django/server/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /python/opentracing/django/server/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | 3 | from . import views 4 | 5 | urlpatterns = [ 6 | url(r'^$', views.server_index, name='index'), 7 | url(r'^simple', views.server_simple, name='simple'), 8 | url(r'^log', views.server_log, name='log'), 9 | url(r'^childspan', views.server_child_span, name='childspan') 10 | ] -------------------------------------------------------------------------------- /python/opentracing/laundry/.gitignore: -------------------------------------------------------------------------------- 1 | env/ 2 | src/ 3 | -------------------------------------------------------------------------------- /python/opentracing/laundry/requirements.txt: -------------------------------------------------------------------------------- 1 | ddtrace 2 | opentracing==2.0.0 3 | -------------------------------------------------------------------------------- /python/opentracing/laundry/resources/trace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/opentracing/laundry/resources/trace.png -------------------------------------------------------------------------------- /python/opentracing/walkthrough/.gitignore: -------------------------------------------------------------------------------- 1 | env/ 2 | -------------------------------------------------------------------------------- /python/opentracing/walkthrough/1_first_trace.py: -------------------------------------------------------------------------------- 1 | import opentracing 2 | from ddtrace.opentracer import Tracer, set_global_tracer 3 | 4 | 5 | # initialize our tracer 6 | def init_dd_tracer(): 7 | tracer = Tracer() 8 | set_global_tracer(tracer) 9 | 10 | 11 | if __name__ == '__main__': 12 | init_dd_tracer() 13 | with opentracing.tracer.start_span('simple') as span: 14 | pass 15 | -------------------------------------------------------------------------------- /python/opentracing/walkthrough/requirements.txt: -------------------------------------------------------------------------------- 1 | ddtrace[opentracing]==0.14.0 2 | -------------------------------------------------------------------------------- /python/opentracing/walkthrough/resources/first_trace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/opentracing/walkthrough/resources/first_trace.png -------------------------------------------------------------------------------- /python/opentracing/walkthrough/resources/first_trace_listing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/opentracing/walkthrough/resources/first_trace_listing.png -------------------------------------------------------------------------------- /python/pylibmc/docker-compose.yml: -------------------------------------------------------------------------------- 1 | memcached: 2 | image: memcached:1.5-alpine 3 | ports: 4 | - "127.0.0.1:11211:11211" 5 | -------------------------------------------------------------------------------- /python/pylibmc/pylibmc_example.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import pylibmc 4 | 5 | 6 | MEMCACHED_CONFIG = { 7 | 'host': os.getenv('TEST_MEMCACHED_HOST', '127.0.0.1'), 8 | 'port': int(os.getenv("TEST_MEMCACHED_PORT", 11211)), 9 | } 10 | 11 | 12 | mc = pylibmc.Client([MEMCACHED_CONFIG['host']]) 13 | 14 | mc.set('a', 1) 15 | mc.get('a') 16 | -------------------------------------------------------------------------------- /python/pylibmc/requirements.txt: -------------------------------------------------------------------------------- 1 | pylibmc==1.6.0 2 | ddtrace 3 | -------------------------------------------------------------------------------- /python/pymemcache/.gitignore: -------------------------------------------------------------------------------- 1 | env/ 2 | -------------------------------------------------------------------------------- /python/pymemcache/docker-compose.yml: -------------------------------------------------------------------------------- 1 | memcached: 2 | image: memcached 3 | ports: 4 | - "11211:11211" 5 | -------------------------------------------------------------------------------- /python/pymemcache/requirements.txt: -------------------------------------------------------------------------------- 1 | ddtrace 2 | pymemcache==1.4.4 3 | -------------------------------------------------------------------------------- /python/pynamodb/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.7.7 2 | 3 | RUN apt-get -y update 4 | 5 | 6 | RUN pip3 install pynamodb 7 | 8 | RUN pip3 install ddtrace 9 | 10 | ADD pynamodb-test /home/pynamodb-test 11 | 12 | WORKDIR /home/pynamodb-test 13 | -------------------------------------------------------------------------------- /python/pynamodb/images/example_get_item.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/pynamodb/images/example_get_item.png -------------------------------------------------------------------------------- /python/pynamodb/pynamodb-test/blog.py: -------------------------------------------------------------------------------- 1 | from pynamodb.models import Model 2 | from pynamodb.attributes import UnicodeAttribute 3 | 4 | class Blog(Model): 5 | class Meta: 6 | table_name='Blog' 7 | region = 'us-west-1' 8 | write_capacity_units = 1 9 | read_capacity_units = 1 10 | host = "http://dynamodb:8000" 11 | 12 | title = UnicodeAttribute(hash_key=True) 13 | content = UnicodeAttribute(range_key=True) 14 | memo = UnicodeAttribute() -------------------------------------------------------------------------------- /python/pyramid/.gitignore: -------------------------------------------------------------------------------- 1 | tasks.db 2 | -------------------------------------------------------------------------------- /python/pyramid/requirements.txt: -------------------------------------------------------------------------------- 1 | ddtrace 2 | pyramid==1.9.2 3 | pyramid_mako==1.0.2 4 | -------------------------------------------------------------------------------- /python/pyramid/schema.sql: -------------------------------------------------------------------------------- 1 | create table if not exists tasks ( 2 | id integer primary key autoincrement, 3 | name char(100) not null, 4 | closed bool not null 5 | ); 6 | 7 | insert or ignore into tasks (id, name, closed) values (0, 'Start learning Pyramid', 0); 8 | insert or ignore into tasks (id, name, closed) values (1, 'Do quick tutorial', 0); 9 | insert or ignore into tasks (id, name, closed) values (2, 'Have some beer!', 0); 10 | -------------------------------------------------------------------------------- /python/pyramid/templates/layout.mako: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | 4 | 5 | 6 | Pyramid Task List Tutorial 7 | 8 | 9 | 10 | 11 | 12 | 13 | % if request.session.peek_flash(): 14 |
15 | <% flash = request.session.pop_flash() %> 16 | % for message in flash: 17 | ${message}
18 | % endfor 19 |
20 | % endif 21 |
22 | ${next.body()} 23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /python/pyramid/templates/list.mako: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | <%inherit file="layout.mako"/> 3 | 4 |

Tasks List

5 | 6 |
    7 | % if tasks: 8 | % for task in tasks: 9 |
  • 10 | ${task['name']} 11 | 12 | [ close ] 13 | 14 |
  • 15 | % endfor 16 | % else: 17 |
  • There are no open tasks
  • 18 | % endif 19 |
  • 20 | Add a new task 21 |
  • 22 |
23 | -------------------------------------------------------------------------------- /python/pyramid/templates/new.mako: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | <%inherit file="layout.mako"/> 3 | 4 |

Add a new task

5 | 6 |
7 | 8 | 9 |
10 | -------------------------------------------------------------------------------- /python/pyramid/templates/notfound.mako: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | <%inherit file="layout.mako"/> 3 | 4 |
5 |

404 - PAGE NOT FOUND

6 | The page you're looking for isn't here. 7 |
8 | -------------------------------------------------------------------------------- /python/rq/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | -------------------------------------------------------------------------------- /python/rq/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | redis: 4 | image: redis:5.0.6-alpine 5 | ports: 6 | - "127.0.0.1:6379:6379" 7 | 8 | -------------------------------------------------------------------------------- /python/rq/requirements.txt: -------------------------------------------------------------------------------- 1 | rq==1.6 2 | redis==3.5 3 | -------------------------------------------------------------------------------- /python/sanic/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.8.0 2 | USER root 3 | WORKDIR /app 4 | ADD . /app 5 | RUN pip install --trusted-host pypi.python.org -r requirements.txt 6 | CMD ["ddtrace-run", "python", "app.py"] -------------------------------------------------------------------------------- /python/sanic/app.py: -------------------------------------------------------------------------------- 1 | from sanic import Sanic, request, response 2 | from sanic.response import json, html, text, HTTPResponse, json 3 | import os 4 | 5 | 6 | app = Sanic("Simple Sanic App") 7 | 8 | 9 | @app.route("/") 10 | async def test(request): 11 | return json({"hello": "world"}) 12 | 13 | 14 | @app.route("/html") 15 | async def test(request): 16 | template = open(os.getcwd() + "/templates/index.html") 17 | return html(template.read()) 18 | 19 | 20 | @app.route("/text") 21 | async def test(request): 22 | return text("This is Text Response.") 23 | 24 | 25 | if __name__ == "__main__": 26 | app.run(host="0.0.0.0") 27 | -------------------------------------------------------------------------------- /python/sanic/images/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/sanic/images/image1.png -------------------------------------------------------------------------------- /python/sanic/images/image2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/sanic/images/image2.png -------------------------------------------------------------------------------- /python/sanic/requirements.txt: -------------------------------------------------------------------------------- 1 | sanic 2 | ddtrace -------------------------------------------------------------------------------- /python/sanic/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Document 7 | 8 | 9 | Hi there! loading html response.. 10 | 11 | -------------------------------------------------------------------------------- /python/starlette/docs/404.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/starlette/docs/404.png -------------------------------------------------------------------------------- /python/starlette/docs/500.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/starlette/docs/500.png -------------------------------------------------------------------------------- /python/starlette/docs/index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/python/starlette/docs/index.png -------------------------------------------------------------------------------- /python/starlette/requirements.txt: -------------------------------------------------------------------------------- 1 | aiofiles 2 | jinja2 3 | starlette 4 | uvicorn 5 | sqlalchemy 6 | databases 7 | aiosqlite -------------------------------------------------------------------------------- /python/starlette/statics/css/jumbotron.css: -------------------------------------------------------------------------------- 1 | /* Move down content because we have a fixed navbar that is 3.5rem tall */ 2 | body { 3 | padding-top: 3.5rem; 4 | } 5 | -------------------------------------------------------------------------------- /python/starlette/templates/200.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 | 6 | 7 |
8 |
9 |

200

10 |

Success.

11 |
12 |
13 | 14 |
15 | {% endblock %} -------------------------------------------------------------------------------- /python/starlette/templates/404.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 | 6 | 7 |
8 |
9 |

404

10 |

Page not found.

11 |
12 |
13 | 14 |
15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /python/starlette/templates/500.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 | 6 | 7 |
8 |
9 |

500

10 |

Server error.

11 |
12 |
13 | 14 |
15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /python/tornado4/Procfile: -------------------------------------------------------------------------------- 1 | web: python server.py 2 | -------------------------------------------------------------------------------- /python/tornado4/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | 3 | services: 4 | redis: 5 | image: redis:3.2 6 | ports: 7 | - "127.0.0.1:6379:6379" 8 | -------------------------------------------------------------------------------- /python/tornado4/requirements.in: -------------------------------------------------------------------------------- 1 | # application 2 | futures 3 | tornado==4.5.3 4 | redis 5 | 6 | # tracing 7 | ddtrace 8 | -------------------------------------------------------------------------------- /python/tornado4/requirements.txt: -------------------------------------------------------------------------------- 1 | # 2 | # This file is autogenerated by pip-compile 3 | # To update, run: 4 | # 5 | # pip-compile --output-file=requirements.txt requirements.in 6 | # 7 | backports-abc==0.5 # via tornado 8 | certifi==2019.6.16 # via tornado 9 | ddtrace 10 | futures==3.3.0 11 | psutil==5.6.3 # via ddtrace 12 | redis==3.3.8 13 | singledispatch==3.4.0.3 # via tornado 14 | six==1.12.0 # via singledispatch 15 | tornado==4.5.3 16 | -------------------------------------------------------------------------------- /python/tornado4/runtime.txt: -------------------------------------------------------------------------------- 1 | python-2.7.12 2 | -------------------------------------------------------------------------------- /python/tornado4/statics/empty.txt: -------------------------------------------------------------------------------- 1 | Static file 2 | -------------------------------------------------------------------------------- /python/tornado6-blog/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.7 2 | 3 | ENV VIRTUAL_ENV=/opt/venv 4 | RUN python -m venv $VIRTUAL_ENV 5 | ENV PATH="$VIRTUAL_ENV/bin:$PATH" 6 | 7 | EXPOSE 8888 8 | 9 | RUN mkdir -p /usr/src/app 10 | WORKDIR /usr/src/app 11 | 12 | COPY . . 13 | RUN pip install --no-cache-dir -r requirements.txt 14 | 15 | CMD ["ddtrace-run", "python", "-m", "tornado.autoreload", "blog.py"] 16 | -------------------------------------------------------------------------------- /python/tornado6-blog/requirements.txt: -------------------------------------------------------------------------------- 1 | aiopg==0.16.0 2 | tornado==6.0.3 3 | git+https://github.com/datadog/dd-trace-py@v0.29.0#egg=ddtrace 4 | -------------------------------------------------------------------------------- /python/tornado6-blog/templates/create_author.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block body %} 4 |
5 | Email:
6 | Name:
7 | Password:
8 | {% module xsrf_form_html() %} 9 | 10 |
11 | {% end %} 12 | -------------------------------------------------------------------------------- /python/tornado6-blog/templates/entry.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block body %} 4 | {% module Entry(entry) %} 5 | {% end %} 6 | -------------------------------------------------------------------------------- /python/tornado6-blog/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block body %} 4 | {% for entry in entries %} 5 | {% module Entry(entry) %} 6 | {% end %} 7 | 8 | {% end %} 9 | -------------------------------------------------------------------------------- /python/tornado6-blog/templates/login.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block body %} 4 | {% if error %} 5 | Error: {{ error }}

6 | {% end %} 7 | 8 |

9 | Email:
10 | Password:
11 | {% module xsrf_form_html() %} 12 | 13 |
14 | {% end %} 15 | -------------------------------------------------------------------------------- /python/tornado6-blog/templates/modules/entry.html: -------------------------------------------------------------------------------- 1 |
2 |

{{ entry.title }}

3 |
{{ locale.format_date(entry.published, full_format=True, shorter=True) }}
4 |
{% raw entry.html %}
5 | {% if current_user %} 6 | 7 | {% end %} 8 |
9 | -------------------------------------------------------------------------------- /python/tornado6/Procfile: -------------------------------------------------------------------------------- 1 | web: python server.py 2 | -------------------------------------------------------------------------------- /python/tornado6/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | redis: 5 | image: redis:5 6 | ports: 7 | - "6379:6379" 8 | -------------------------------------------------------------------------------- /python/tornado6/requirements.in: -------------------------------------------------------------------------------- 1 | # application 2 | tornado==6.0.3 3 | redis 4 | 5 | # tracing 6 | git+https://github.com/datadog/dd-trace-py@v0.29.0#egg=ddtrace 7 | -------------------------------------------------------------------------------- /python/tornado6/requirements.txt: -------------------------------------------------------------------------------- 1 | # 2 | # This file is autogenerated by pip-compile 3 | # To update, run: 4 | # 5 | # pip-compile --output-file=requirements.txt requirements.in 6 | # 7 | git+https://github.com/datadog/dd-trace-py@v0.29.0#egg=ddtrace 8 | psutil==5.6.3 9 | redis==3.3.8 10 | tornado==6.0.3 11 | -------------------------------------------------------------------------------- /python/tornado6/runtime.txt: -------------------------------------------------------------------------------- 1 | python-2.7.12 2 | -------------------------------------------------------------------------------- /python/tornado6/statics/empty.txt: -------------------------------------------------------------------------------- 1 | Static file 2 | -------------------------------------------------------------------------------- /python/vertica/.gitignore: -------------------------------------------------------------------------------- 1 | env/ 2 | -------------------------------------------------------------------------------- /python/vertica/docker-compose.yml: -------------------------------------------------------------------------------- 1 | verticadb: 2 | image: sumitchawla/vertica 3 | environment: 4 | - VP_TEST_USER=dbadmin 5 | - VP_TEST_PASSWORD=abc123 6 | - VP_TEST_DATABASE=test 7 | ports: 8 | - "127.0.0.1:5433:5433" 9 | -------------------------------------------------------------------------------- /python/vertica/requirements.txt: -------------------------------------------------------------------------------- 1 | ddtrace 2 | vertica-python==0.7.3 3 | -------------------------------------------------------------------------------- /ruby/dalli/.envrc.sample: -------------------------------------------------------------------------------- 1 | export DD_API_KEY= 2 | -------------------------------------------------------------------------------- /ruby/dalli/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.5.1 2 | 3 | # install build-tools 4 | RUN apt-get update -qq \ 5 | && apt-get install -y \ 6 | build-essential \ 7 | libpq-dev \ 8 | nodejs 9 | 10 | # install application dependencies 11 | RUN mkdir /app 12 | WORKDIR /app 13 | COPY Gemfile /app 14 | COPY Gemfile.lock /app 15 | RUN bundle install 16 | 17 | CMD ["bundle", "exec", "unicorn", "-c", "config/unicorn.rb", "-l", "3000"] 18 | -------------------------------------------------------------------------------- /ruby/dalli/Procfile: -------------------------------------------------------------------------------- 1 | web: bundle exec unicorn -c config/unicorn.rb 2 | -------------------------------------------------------------------------------- /ruby/dalli/Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | # Add your own tasks in files placed in lib/tasks ending in .rake, 3 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 4 | 5 | require File.expand_path('../config/application', __FILE__) 6 | 7 | Blog::Application.load_tasks 8 | -------------------------------------------------------------------------------- /ruby/dalli/app/api/api.rb: -------------------------------------------------------------------------------- 1 | module FastAPI 2 | class Ping < Grape::API 3 | namespace :example_namespace 4 | desc 'Returns a pong' 5 | get :ping do 6 | { ping: params[:pong] || 'pong' } 7 | end 8 | end 9 | end 10 | 11 | module FastAPI 12 | class Cache < Grape::API 13 | desc 'Returns a value from the Rails cache' 14 | before do 15 | sleep 0.001 16 | end 17 | 18 | get :cache do 19 | { value: Rails.cache.fetch('custom_cache_key') } 20 | end 21 | end 22 | end 23 | 24 | class API < Grape::API 25 | prefix 'api' 26 | format :json 27 | mount FastAPI::Ping 28 | mount FastAPI::Cache 29 | end 30 | -------------------------------------------------------------------------------- /ruby/dalli/app/assets/images/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/dalli/app/assets/images/rails.png -------------------------------------------------------------------------------- /ruby/dalli/app/assets/javascripts/comments.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ 4 | -------------------------------------------------------------------------------- /ruby/dalli/app/assets/javascripts/home.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ 4 | -------------------------------------------------------------------------------- /ruby/dalli/app/assets/javascripts/posts.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ 4 | -------------------------------------------------------------------------------- /ruby/dalli/app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the top of the 9 | * compiled file, but it's generally better to create a new file per style scope. 10 | * 11 | *= require_self 12 | *= require_tree . 13 | */ 14 | -------------------------------------------------------------------------------- /ruby/dalli/app/assets/stylesheets/comments.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Comments controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /ruby/dalli/app/assets/stylesheets/home.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the home controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /ruby/dalli/app/assets/stylesheets/posts.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Posts controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /ruby/dalli/app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery 3 | end 4 | -------------------------------------------------------------------------------- /ruby/dalli/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /ruby/dalli/app/helpers/comments_helper.rb: -------------------------------------------------------------------------------- 1 | module CommentsHelper 2 | end 3 | -------------------------------------------------------------------------------- /ruby/dalli/app/helpers/home_helper.rb: -------------------------------------------------------------------------------- 1 | module HomeHelper 2 | end 3 | -------------------------------------------------------------------------------- /ruby/dalli/app/helpers/posts_helper.rb: -------------------------------------------------------------------------------- 1 | module PostsHelper 2 | end 3 | -------------------------------------------------------------------------------- /ruby/dalli/app/mailers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/dalli/app/mailers/.gitkeep -------------------------------------------------------------------------------- /ruby/dalli/app/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/dalli/app/models/.gitkeep -------------------------------------------------------------------------------- /ruby/dalli/app/models/comment.rb: -------------------------------------------------------------------------------- 1 | class Comment < ActiveRecord::Base 2 | belongs_to :post 3 | end 4 | -------------------------------------------------------------------------------- /ruby/dalli/app/models/post.rb: -------------------------------------------------------------------------------- 1 | class Post < ActiveRecord::Base 2 | validates :name, :presence => true 3 | validates :title, :presence => true, :length => { :minimum => 5 } 4 | 5 | has_many :comments, :dependent => :destroy 6 | end 7 | -------------------------------------------------------------------------------- /ruby/dalli/app/views/comments/_comment.html.erb: -------------------------------------------------------------------------------- 1 |

2 | Commenter: 3 | <%= comment.commenter %> 4 |

5 | 6 |

7 | Comment: 8 | <%= comment.body %> 9 |

10 | 11 |

12 | <%= link_to 'Destroy Comment', [comment.post, comment], 13 | :confirm => 'Are you sure?', 14 | :method => :delete %> 15 |

16 | -------------------------------------------------------------------------------- /ruby/dalli/app/views/comments/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for([@post, @post.comments.build]) do |f| %> 2 |   
3 |     <%= f.label :commenter %>
4 |     <%= f.text_field :commenter %> 5 |   
6 |   
7 |     <%= f.label :body %>
8 |     <%= f.text_area :body %> 9 |   
10 |   
11 |     <%= f.submit %> 12 |   
13 | <% end %> 14 | -------------------------------------------------------------------------------- /ruby/dalli/app/views/home/index.html.erb: -------------------------------------------------------------------------------- 1 |

Hello from rails!

2 | <%= link_to "My Blog", posts_path %> 3 | -------------------------------------------------------------------------------- /ruby/dalli/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Blog 5 | <%= stylesheet_link_tag "application", :media => "all" %> 6 | <%= javascript_include_tag "application" %> 7 | <%= csrf_meta_tags %> 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /ruby/dalli/app/views/posts/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Editing post

2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Show', @post %> | 6 | <%= link_to 'Back', posts_path %> 7 | -------------------------------------------------------------------------------- /ruby/dalli/app/views/posts/index.html.erb: -------------------------------------------------------------------------------- 1 |

Listing posts

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | <% @posts.each do |post| %> 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | <% end %> 23 |
NameTitleContent
<%= post.name %><%= post.title %><%= post.content %><%= link_to 'Show', post %><%= link_to 'Edit', edit_post_path(post) %><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' } %>
24 | 25 |
26 | 27 | <%= link_to 'New Post', new_post_path %> 28 | -------------------------------------------------------------------------------- /ruby/dalli/app/views/posts/new.html.erb: -------------------------------------------------------------------------------- 1 |

New post

2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Back', posts_path %> 6 | -------------------------------------------------------------------------------- /ruby/dalli/app/views/posts/show.html.erb: -------------------------------------------------------------------------------- 1 |

<%= notice %>

2 | 3 | <%= @cached_value %> <%= @secret_post.length %> 4 | 5 |
6 | 7 |

8 | Name: 9 | <%= @post.name %> 10 |

11 | 12 |

13 | Title: 14 | <%= @post.title %> 15 |

16 | 17 |

18 | Content: 19 | <%= @post.content %> 20 |

21 | 22 |
23 | 24 |

Comments

25 | <%= render @post.comments %> 26 | 27 |

Add a comment:

28 | <%= render "comments/form" %> 29 | 30 |
31 | 32 | <%= link_to 'Edit Post', edit_post_path(@post) %> | 33 | <%= link_to 'Back to Posts', posts_path %> | 34 | -------------------------------------------------------------------------------- /ruby/dalli/config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Blog::Application 5 | -------------------------------------------------------------------------------- /ruby/dalli/config/boot.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | # Set up gems listed in the Gemfile. 4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 5 | 6 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) 7 | -------------------------------------------------------------------------------- /ruby/dalli/config/database.yml: -------------------------------------------------------------------------------- 1 | # MySQL demo 2 | 3 | default: &default 4 | host: mysql 5 | adapter: mysql2 6 | username: root 7 | password: 123456 8 | 9 | development: 10 | <<: *default 11 | database: myblog-dev 12 | 13 | test: 14 | <<: *default 15 | database: myblog-test 16 | 17 | production: 18 | url: <%= ENV['DATABASE_URL'] %> 19 | -------------------------------------------------------------------------------- /ruby/dalli/config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the rails application 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the rails application 5 | Blog::Application.initialize! 6 | -------------------------------------------------------------------------------- /ruby/dalli/config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /ruby/dalli/config/initializers/datadog.rb: -------------------------------------------------------------------------------- 1 | require 'ddtrace' 2 | 3 | Datadog.configure do |c| 4 | # Configure tracer settings 5 | c.tracer hostname: ENV['DATADOG_TRACER'] || 'datadog' 6 | 7 | # Activate and configure integrations 8 | c.use :rails, 9 | service_name: ENV['RAILS_SERVICE'] || 'rails-local', 10 | database_service: ENV['RAILS_MYSQL_SERVICE'] || 'db-local', 11 | cache_service: ENV['RAILS_CACHE_SERVICE'] || 'cache-local', 12 | controller_service: ENV['RAILS_CONTROLLER_SERVICE'] || 'controller-local' 13 | c.use :grape 14 | c.use :dalli, service_name: 'dalli-cache' 15 | end 16 | -------------------------------------------------------------------------------- /ruby/dalli/config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format 4 | # (all these examples are active by default): 5 | # ActiveSupport::Inflector.inflections do |inflect| 6 | # inflect.plural /^(ox)$/i, '\1en' 7 | # inflect.singular /^(ox)en/i, '\1' 8 | # inflect.irregular 'person', 'people' 9 | # inflect.uncountable %w( fish sheep ) 10 | # end 11 | # 12 | # These inflection rules are supported but not enabled by default: 13 | # ActiveSupport::Inflector.inflections do |inflect| 14 | # inflect.acronym 'RESTful' 15 | # end 16 | -------------------------------------------------------------------------------- /ruby/dalli/config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /ruby/dalli/config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Blog::Application.config.session_store :cookie_store, key: '_blog_session' 4 | 5 | # Use the database for sessions instead of the cookie-based default, 6 | # which shouldn't be used to store highly confidential information 7 | # (create the session table with "rails generate session_migration") 8 | # Blog::Application.config.session_store :active_record_store 9 | -------------------------------------------------------------------------------- /ruby/dalli/config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # Disable root element in JSON by default. 12 | ActiveSupport.on_load(:active_record) do 13 | self.include_root_in_json = false 14 | end 15 | -------------------------------------------------------------------------------- /ruby/dalli/config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Sample localization file for English. Add more files in this directory for other locales. 2 | # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. 3 | 4 | en: 5 | hello: "Hello world" 6 | -------------------------------------------------------------------------------- /ruby/dalli/config/routes.rb: -------------------------------------------------------------------------------- 1 | Blog::Application.routes.draw do 2 | resources :posts do 3 | resources :comments 4 | end 5 | 6 | get "home/index" 7 | mount API => '/' 8 | root :to => "home#index" 9 | 10 | get "error", to: "home#error" 11 | end 12 | -------------------------------------------------------------------------------- /ruby/dalli/config/unicorn.rb: -------------------------------------------------------------------------------- 1 | worker_processes 5 2 | timeout 15 3 | -------------------------------------------------------------------------------- /ruby/dalli/db/migrate/20161030175305_create_posts.rb: -------------------------------------------------------------------------------- 1 | class CreatePosts < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :posts do |t| 4 | t.string :name 5 | t.string :title 6 | t.text :content 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /ruby/dalli/db/migrate/20161030181809_create_comments.rb: -------------------------------------------------------------------------------- 1 | class CreateComments < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :comments do |t| 4 | t.string :commenter 5 | t.text :body 6 | t.references :post 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /ruby/dalli/db/migrate/20170316112735_add_sessions_table.rb: -------------------------------------------------------------------------------- 1 | class AddSessionsTable < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :sessions do |t| 4 | t.string :session_id, :null => false 5 | t.text :data 6 | t.timestamps 7 | end 8 | 9 | add_index :sessions, :session_id 10 | add_index :sessions, :updated_at 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /ruby/dalli/db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | -------------------------------------------------------------------------------- /ruby/dalli/lib/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/dalli/lib/assets/.gitkeep -------------------------------------------------------------------------------- /ruby/dalli/lib/tasks/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/dalli/lib/tasks/.gitkeep -------------------------------------------------------------------------------- /ruby/dalli/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/dalli/public/favicon.ico -------------------------------------------------------------------------------- /ruby/dalli/public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-Agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /ruby/dalli/script/delayed_job: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment')) 4 | require 'delayed/command' 5 | Delayed::Command.new(ARGV).daemonize 6 | -------------------------------------------------------------------------------- /ruby/dalli/script/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. 3 | 4 | APP_PATH = File.expand_path('../../config/application', __FILE__) 5 | require File.expand_path('../../config/boot', __FILE__) 6 | require 'rails/commands' 7 | -------------------------------------------------------------------------------- /ruby/dalli/test/fixtures/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/dalli/test/fixtures/.gitkeep -------------------------------------------------------------------------------- /ruby/dalli/test/fixtures/comments.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html 2 | 3 | one: 4 | commenter: MyString 5 | body: MyText 6 | post: 7 | 8 | two: 9 | commenter: MyString 10 | body: MyText 11 | post: 12 | -------------------------------------------------------------------------------- /ruby/dalli/test/fixtures/posts.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html 2 | 3 | one: 4 | name: MyString 5 | title: MyString 6 | content: MyText 7 | 8 | two: 9 | name: MyString 10 | title: MyString 11 | content: MyText 12 | -------------------------------------------------------------------------------- /ruby/dalli/test/functional/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/dalli/test/functional/.gitkeep -------------------------------------------------------------------------------- /ruby/dalli/test/functional/comments_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class CommentsControllerTest < ActionController::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /ruby/dalli/test/functional/home_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class HomeControllerTest < ActionController::TestCase 4 | test "should get index" do 5 | get :index 6 | assert_response :success 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /ruby/dalli/test/integration/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/dalli/test/integration/.gitkeep -------------------------------------------------------------------------------- /ruby/dalli/test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV["RAILS_ENV"] = "test" 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. 7 | # 8 | # Note: You'll currently still have to declare fixtures explicitly in integration tests 9 | # -- they do not yet inherit this setting 10 | fixtures :all 11 | 12 | # Add more helper methods to be used by all tests here... 13 | end 14 | -------------------------------------------------------------------------------- /ruby/dalli/test/unit/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/dalli/test/unit/.gitkeep -------------------------------------------------------------------------------- /ruby/dalli/test/unit/comment_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class CommentTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /ruby/dalli/test/unit/helpers/comments_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class CommentsHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /ruby/dalli/test/unit/helpers/home_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class HomeHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /ruby/dalli/test/unit/helpers/posts_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PostsHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /ruby/dalli/test/unit/post_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PostTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /ruby/dalli/vendor/assets/javascripts/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/dalli/vendor/assets/javascripts/.gitkeep -------------------------------------------------------------------------------- /ruby/dalli/vendor/assets/stylesheets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/dalli/vendor/assets/stylesheets/.gitkeep -------------------------------------------------------------------------------- /ruby/dalli/vendor/plugins/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/dalli/vendor/plugins/.gitkeep -------------------------------------------------------------------------------- /ruby/mongoid/.envrc.sample: -------------------------------------------------------------------------------- 1 | export DD_API_KEY= 2 | -------------------------------------------------------------------------------- /ruby/mongoid/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.5.1 2 | 3 | # install build-tools 4 | RUN apt-get update -qq \ 5 | && apt-get install -y \ 6 | build-essential \ 7 | nodejs 8 | 9 | # install application dependencies 10 | RUN mkdir /app 11 | WORKDIR /app 12 | COPY Gemfile /app 13 | COPY Gemfile.lock /app 14 | RUN bundle install 15 | 16 | CMD ["bundle", "exec", "unicorn", "-c", "config/unicorn.rb", "-l", "3000"] 17 | -------------------------------------------------------------------------------- /ruby/mongoid/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # branch with MongoDB Ruby Driver instrumentation 4 | gem 'ddtrace' 5 | gem 'mongoid' 6 | 7 | # rails gems 8 | gem 'rails' 9 | 10 | # application server 11 | gem 'unicorn' 12 | -------------------------------------------------------------------------------- /ruby/mongoid/Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /ruby/mongoid/app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # Prevent CSRF attacks by raising an exception. 3 | # For APIs, you may want to use :null_session instead. 4 | protect_from_forgery with: :exception 5 | end 6 | -------------------------------------------------------------------------------- /ruby/mongoid/app/controllers/document_controller.rb: -------------------------------------------------------------------------------- 1 | class DocumentController < ApplicationController 2 | def index 3 | # fill the context 4 | @people = Person.where(first_name: 'Willy') 5 | end 6 | 7 | def add 8 | # create after each call 9 | Person.create([ 10 | { first_name: 'Heinrich', last_name: 'Heine' }, 11 | { first_name: 'Willy', last_name: 'Brandt' } 12 | ]) 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /ruby/mongoid/app/models/person.rb: -------------------------------------------------------------------------------- 1 | class Person 2 | include Mongoid::Document 3 | field :first_name, type: String 4 | field :middle_name, type: String 5 | field :last_name, type: String 6 | end 7 | -------------------------------------------------------------------------------- /ruby/mongoid/app/views/document/add.html.erb: -------------------------------------------------------------------------------- 1 |

Stored!

2 | -------------------------------------------------------------------------------- /ruby/mongoid/app/views/document/index.html.erb: -------------------------------------------------------------------------------- 1 |

Hello from:

2 | <% @people.each do |person| %> 3 |

* <%= person.first_name %> <%= person.last_name %>

5 | -------------------------------------------------------------------------------- /ruby/mongoid/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Mongoid Example 5 | 6 | 7 | 8 | <%= yield %> 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /ruby/mongoid/bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /ruby/mongoid/bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | APP_PATH = File.expand_path('../../config/application', __FILE__) 8 | require_relative '../config/boot' 9 | require 'rails/commands' 10 | -------------------------------------------------------------------------------- /ruby/mongoid/bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | require_relative '../config/boot' 8 | require 'rake' 9 | Rake.application.run 10 | -------------------------------------------------------------------------------- /ruby/mongoid/bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast. 4 | # It gets overwritten when you run the `spring binstub` command. 5 | 6 | unless defined?(Spring) 7 | require 'rubygems' 8 | require 'bundler' 9 | 10 | lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) 11 | spring = lockfile.specs.detect { |spec| spec.name == "spring" } 12 | if spring 13 | Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path 14 | gem 'spring', spring.version 15 | require 'spring/binstub' 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /ruby/mongoid/config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /ruby/mongoid/config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require "rails" 4 | require "active_model/railtie" 5 | require "active_job/railtie" 6 | require "action_controller/railtie" 7 | require "action_mailer/railtie" 8 | require "action_view/railtie" 9 | require "sprockets/railtie" 10 | require "rails/test_unit/railtie" 11 | 12 | # Require the gems listed in Gemfile, including any gems 13 | # you've limited to :test, :development, or :production. 14 | Bundler.require(*Rails.groups) 15 | 16 | module App 17 | class Application < Rails::Application 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /ruby/mongoid/config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /ruby/mongoid/config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /ruby/mongoid/config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.action_dispatch.cookies_serializer = :json 4 | -------------------------------------------------------------------------------- /ruby/mongoid/config/initializers/datadog.rb: -------------------------------------------------------------------------------- 1 | require 'ddtrace' 2 | 3 | Datadog.configure do |c| 4 | # Configure tracer settings 5 | c.tracer hostname: ENV['DATADOG_TRACER'] || 'datadog' 6 | 7 | # Activate and configure integrations 8 | c.use :rails, service_name: ENV['RAILS_SERVICE'] || 'example-rails-mongoid' 9 | c.use :mongo, service_name: ENV['MONGO_SERVICE'] || 'example-mongodb' 10 | end 11 | -------------------------------------------------------------------------------- /ruby/mongoid/config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /ruby/mongoid/config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_app_session' 4 | -------------------------------------------------------------------------------- /ruby/mongoid/config/initializers/to_time_preserves_timezone.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Preserve the timezone of the receiver when calling to `to_time`. 4 | # Ruby 2.4 will change the behavior of `to_time` to preserve the timezone 5 | # when converting to an instance of `Time` instead of the previous behavior 6 | # of converting to the local system timezone. 7 | # 8 | # Rails 5.0 introduced this config option so that apps made with earlier 9 | # versions of Rails are not affected when upgrading. 10 | ActiveSupport.to_time_preserves_timezone = true 11 | -------------------------------------------------------------------------------- /ruby/mongoid/config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters) 9 | end 10 | -------------------------------------------------------------------------------- /ruby/mongoid/config/mongoid.yml: -------------------------------------------------------------------------------- 1 | # default Mongoid configuration 2 | development: 3 | clients: 4 | default: 5 | database: mongoid_app 6 | hosts: 7 | - mongodb:27017 8 | -------------------------------------------------------------------------------- /ruby/mongoid/config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | get "document/index" 3 | get "document/add" 4 | root :to => "document#index" 5 | end 6 | -------------------------------------------------------------------------------- /ruby/mongoid/config/unicorn.rb: -------------------------------------------------------------------------------- 1 | worker_processes 5 2 | timeout 15 3 | -------------------------------------------------------------------------------- /ruby/mongoid/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.2' 2 | services: 3 | mongodb: 4 | image: mongo:4.1 5 | volumes: 6 | - ./db/data:/data/db 7 | datadog: 8 | image: datadog/agent 9 | environment: 10 | - DD_APM_ENABLED=true 11 | - DD_BIND_HOST=0.0.0.0 12 | - DD_API_KEY 13 | web: 14 | build: . 15 | volumes: 16 | - .:/app 17 | ports: 18 | - "127.0.0.1:3000:3000" 19 | depends_on: 20 | - mongodb 21 | - datadog 22 | -------------------------------------------------------------------------------- /ruby/rails/.envrc.sample: -------------------------------------------------------------------------------- 1 | export DD_API_KEY= 2 | -------------------------------------------------------------------------------- /ruby/rails/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.5.1 2 | 3 | # install build-tools 4 | RUN apt-get update -qq \ 5 | && apt-get install -y \ 6 | build-essential \ 7 | libpq-dev \ 8 | nodejs 9 | 10 | # install application dependencies 11 | RUN mkdir /app 12 | WORKDIR /app 13 | ADD Gemfile /app 14 | ADD Gemfile.lock /app 15 | RUN bundle install 16 | 17 | CMD ["bundle", "exec", "unicorn", "-c", "config/unicorn.rb", "-l", "3000"] 18 | -------------------------------------------------------------------------------- /ruby/rails/Procfile: -------------------------------------------------------------------------------- 1 | web: bundle exec unicorn -c config/unicorn.rb 2 | -------------------------------------------------------------------------------- /ruby/rails/Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | # Add your own tasks in files placed in lib/tasks ending in .rake, 3 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 4 | 5 | require File.expand_path('../config/application', __FILE__) 6 | 7 | Blog::Application.load_tasks 8 | -------------------------------------------------------------------------------- /ruby/rails/app/api/api.rb: -------------------------------------------------------------------------------- 1 | module FastAPI 2 | class Ping < Grape::API 3 | namespace :example_namespace 4 | desc 'Returns a pong' 5 | get :ping do 6 | { ping: params[:pong] || 'pong' } 7 | end 8 | end 9 | end 10 | 11 | module FastAPI 12 | class Cache < Grape::API 13 | desc 'Returns a value from the Rails cache' 14 | before do 15 | sleep 0.001 16 | end 17 | 18 | get :cache do 19 | { value: Rails.cache.fetch('custom_cache_key') } 20 | end 21 | end 22 | end 23 | 24 | class API < Grape::API 25 | prefix 'api' 26 | format :json 27 | mount FastAPI::Ping 28 | mount FastAPI::Cache 29 | end 30 | -------------------------------------------------------------------------------- /ruby/rails/app/assets/images/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/rails/app/assets/images/rails.png -------------------------------------------------------------------------------- /ruby/rails/app/assets/javascripts/comments.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ 4 | -------------------------------------------------------------------------------- /ruby/rails/app/assets/javascripts/home.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ 4 | -------------------------------------------------------------------------------- /ruby/rails/app/assets/javascripts/posts.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ 4 | -------------------------------------------------------------------------------- /ruby/rails/app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the top of the 9 | * compiled file, but it's generally better to create a new file per style scope. 10 | * 11 | *= require_self 12 | *= require_tree . 13 | */ 14 | -------------------------------------------------------------------------------- /ruby/rails/app/assets/stylesheets/comments.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Comments controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /ruby/rails/app/assets/stylesheets/home.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the home controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /ruby/rails/app/assets/stylesheets/posts.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Posts controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /ruby/rails/app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery 3 | end 4 | -------------------------------------------------------------------------------- /ruby/rails/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /ruby/rails/app/helpers/comments_helper.rb: -------------------------------------------------------------------------------- 1 | module CommentsHelper 2 | end 3 | -------------------------------------------------------------------------------- /ruby/rails/app/helpers/home_helper.rb: -------------------------------------------------------------------------------- 1 | module HomeHelper 2 | end 3 | -------------------------------------------------------------------------------- /ruby/rails/app/helpers/posts_helper.rb: -------------------------------------------------------------------------------- 1 | module PostsHelper 2 | end 3 | -------------------------------------------------------------------------------- /ruby/rails/app/mailers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/rails/app/mailers/.gitkeep -------------------------------------------------------------------------------- /ruby/rails/app/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/rails/app/models/.gitkeep -------------------------------------------------------------------------------- /ruby/rails/app/models/comment.rb: -------------------------------------------------------------------------------- 1 | class Comment < ActiveRecord::Base 2 | belongs_to :post 3 | end 4 | -------------------------------------------------------------------------------- /ruby/rails/app/models/post.rb: -------------------------------------------------------------------------------- 1 | class Post < ActiveRecord::Base 2 | validates :name, :presence => true 3 | validates :title, :presence => true, :length => { :minimum => 5 } 4 | 5 | has_many :comments, :dependent => :destroy 6 | end 7 | -------------------------------------------------------------------------------- /ruby/rails/app/views/comments/_comment.html.erb: -------------------------------------------------------------------------------- 1 |

2 | Commenter: 3 | <%= comment.commenter %> 4 |

5 | 6 |

7 | Comment: 8 | <%= comment.body %> 9 |

10 | 11 |

12 | <%= link_to 'Destroy Comment', [comment.post, comment], 13 | :confirm => 'Are you sure?', 14 | :method => :delete %> 15 |

16 | -------------------------------------------------------------------------------- /ruby/rails/app/views/comments/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for([@post, @post.comments.build]) do |f| %> 2 |   
3 |     <%= f.label :commenter %>
4 |     <%= f.text_field :commenter %> 5 |   
6 |   
7 |     <%= f.label :body %>
8 |     <%= f.text_area :body %> 9 |   
10 |   
11 |     <%= f.submit %> 12 |   
13 | <% end %> 14 | -------------------------------------------------------------------------------- /ruby/rails/app/views/home/index.html.erb: -------------------------------------------------------------------------------- 1 |

Hello from rails!

2 | <%= link_to "My Blog", posts_path %> 3 | -------------------------------------------------------------------------------- /ruby/rails/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Blog 5 | <%= stylesheet_link_tag "application", :media => "all" %> 6 | <%= javascript_include_tag "application" %> 7 | <%= csrf_meta_tags %> 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /ruby/rails/app/views/posts/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Editing post

2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Show', @post %> | 6 | <%= link_to 'Back', posts_path %> 7 | -------------------------------------------------------------------------------- /ruby/rails/app/views/posts/index.html.erb: -------------------------------------------------------------------------------- 1 |

Listing posts

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | <% @posts.each do |post| %> 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | <% end %> 23 |
NameTitleContent
<%= post.name %><%= post.title %><%= post.content %><%= link_to 'Show', post %><%= link_to 'Edit', edit_post_path(post) %><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' } %>
24 | 25 |
26 | 27 | <%= link_to 'New Post', new_post_path %> 28 | -------------------------------------------------------------------------------- /ruby/rails/app/views/posts/new.html.erb: -------------------------------------------------------------------------------- 1 |

New post

2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Back', posts_path %> 6 | -------------------------------------------------------------------------------- /ruby/rails/app/views/posts/show.html.erb: -------------------------------------------------------------------------------- 1 |

<%= notice %>

2 | 3 | <%= @cached_value %> <%= @secret_post.length %> 4 | 5 |
6 | 7 |

8 | Name: 9 | <%= @post.name %> 10 |

11 | 12 |

13 | Title: 14 | <%= @post.title %> 15 |

16 | 17 |

18 | Content: 19 | <%= @post.content %> 20 |

21 | 22 |
23 | 24 |

Comments

25 | <%= render @post.comments %> 26 | 27 |

Add a comment:

28 | <%= render "comments/form" %> 29 | 30 |
31 | 32 | <%= link_to 'Edit Post', edit_post_path(@post) %> | 33 | <%= link_to 'Back to Posts', posts_path %> | 34 | -------------------------------------------------------------------------------- /ruby/rails/config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Blog::Application 5 | -------------------------------------------------------------------------------- /ruby/rails/config/boot.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | # Set up gems listed in the Gemfile. 4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 5 | 6 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) 7 | -------------------------------------------------------------------------------- /ruby/rails/config/database.yml: -------------------------------------------------------------------------------- 1 | # MySQL demo 2 | 3 | default: &default 4 | host: mysql 5 | adapter: mysql2 6 | username: root 7 | password: 123456 8 | 9 | development: 10 | <<: *default 11 | database: myblog-dev 12 | 13 | test: 14 | <<: *default 15 | database: myblog-test 16 | 17 | production: 18 | url: <%= ENV['DATABASE_URL'] %> 19 | -------------------------------------------------------------------------------- /ruby/rails/config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the rails application 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the rails application 5 | Blog::Application.initialize! 6 | -------------------------------------------------------------------------------- /ruby/rails/config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /ruby/rails/config/initializers/datadog.rb: -------------------------------------------------------------------------------- 1 | require 'ddtrace' 2 | 3 | Datadog.configure do |c| 4 | # Configure tracer settings 5 | c.tracer hostname: ENV['DATADOG_TRACER'] || 'datadog' 6 | 7 | # Activate and configure integrations 8 | c.use :rails, 9 | service_name: ENV['RAILS_SERVICE'] || 'rails-local', 10 | database_service: ENV['RAILS_MYSQL_SERVICE'] || 'db-local', 11 | cache_service: ENV['RAILS_CACHE_SERVICE'] || 'cache-local', 12 | controller_service: ENV['RAILS_CONTROLLER_SERVICE'] || 'controller-local' 13 | c.use :grape 14 | c.use :redis, service_name: 'redis-cache' 15 | end 16 | -------------------------------------------------------------------------------- /ruby/rails/config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format 4 | # (all these examples are active by default): 5 | # ActiveSupport::Inflector.inflections do |inflect| 6 | # inflect.plural /^(ox)$/i, '\1en' 7 | # inflect.singular /^(ox)en/i, '\1' 8 | # inflect.irregular 'person', 'people' 9 | # inflect.uncountable %w( fish sheep ) 10 | # end 11 | # 12 | # These inflection rules are supported but not enabled by default: 13 | # ActiveSupport::Inflector.inflections do |inflect| 14 | # inflect.acronym 'RESTful' 15 | # end 16 | -------------------------------------------------------------------------------- /ruby/rails/config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /ruby/rails/config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Blog::Application.config.session_store :cookie_store, key: '_blog_session' 4 | 5 | # Use the database for sessions instead of the cookie-based default, 6 | # which shouldn't be used to store highly confidential information 7 | # (create the session table with "rails generate session_migration") 8 | # Blog::Application.config.session_store :active_record_store 9 | -------------------------------------------------------------------------------- /ruby/rails/config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # Disable root element in JSON by default. 12 | ActiveSupport.on_load(:active_record) do 13 | self.include_root_in_json = false 14 | end 15 | -------------------------------------------------------------------------------- /ruby/rails/config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Sample localization file for English. Add more files in this directory for other locales. 2 | # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. 3 | 4 | en: 5 | hello: "Hello world" 6 | -------------------------------------------------------------------------------- /ruby/rails/config/routes.rb: -------------------------------------------------------------------------------- 1 | Blog::Application.routes.draw do 2 | resources :posts do 3 | resources :comments 4 | end 5 | 6 | get "home/index" 7 | mount API => '/' 8 | root :to => "home#index" 9 | 10 | get "error", to: "home#error" 11 | end 12 | -------------------------------------------------------------------------------- /ruby/rails/config/unicorn.rb: -------------------------------------------------------------------------------- 1 | worker_processes 5 2 | timeout 15 3 | -------------------------------------------------------------------------------- /ruby/rails/db/migrate/20161030175305_create_posts.rb: -------------------------------------------------------------------------------- 1 | class CreatePosts < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :posts do |t| 4 | t.string :name 5 | t.string :title 6 | t.text :content 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /ruby/rails/db/migrate/20161030181809_create_comments.rb: -------------------------------------------------------------------------------- 1 | class CreateComments < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :comments do |t| 4 | t.string :commenter 5 | t.text :body 6 | t.references :post 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /ruby/rails/db/migrate/20170316112735_add_sessions_table.rb: -------------------------------------------------------------------------------- 1 | class AddSessionsTable < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :sessions do |t| 4 | t.string :session_id, :null => false 5 | t.text :data 6 | t.timestamps 7 | end 8 | 9 | add_index :sessions, :session_id 10 | add_index :sessions, :updated_at 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /ruby/rails/db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | -------------------------------------------------------------------------------- /ruby/rails/lib/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/rails/lib/assets/.gitkeep -------------------------------------------------------------------------------- /ruby/rails/lib/tasks/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/rails/lib/tasks/.gitkeep -------------------------------------------------------------------------------- /ruby/rails/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/rails/public/favicon.ico -------------------------------------------------------------------------------- /ruby/rails/public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-Agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /ruby/rails/script/delayed_job: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment')) 4 | require 'delayed/command' 5 | Delayed::Command.new(ARGV).daemonize 6 | -------------------------------------------------------------------------------- /ruby/rails/script/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. 3 | 4 | APP_PATH = File.expand_path('../../config/application', __FILE__) 5 | require File.expand_path('../../config/boot', __FILE__) 6 | require 'rails/commands' 7 | -------------------------------------------------------------------------------- /ruby/rails/test/fixtures/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/rails/test/fixtures/.gitkeep -------------------------------------------------------------------------------- /ruby/rails/test/fixtures/comments.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html 2 | 3 | one: 4 | commenter: MyString 5 | body: MyText 6 | post: 7 | 8 | two: 9 | commenter: MyString 10 | body: MyText 11 | post: 12 | -------------------------------------------------------------------------------- /ruby/rails/test/fixtures/posts.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html 2 | 3 | one: 4 | name: MyString 5 | title: MyString 6 | content: MyText 7 | 8 | two: 9 | name: MyString 10 | title: MyString 11 | content: MyText 12 | -------------------------------------------------------------------------------- /ruby/rails/test/functional/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/rails/test/functional/.gitkeep -------------------------------------------------------------------------------- /ruby/rails/test/functional/comments_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class CommentsControllerTest < ActionController::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /ruby/rails/test/functional/home_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class HomeControllerTest < ActionController::TestCase 4 | test "should get index" do 5 | get :index 6 | assert_response :success 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /ruby/rails/test/integration/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/rails/test/integration/.gitkeep -------------------------------------------------------------------------------- /ruby/rails/test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV["RAILS_ENV"] = "test" 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. 7 | # 8 | # Note: You'll currently still have to declare fixtures explicitly in integration tests 9 | # -- they do not yet inherit this setting 10 | fixtures :all 11 | 12 | # Add more helper methods to be used by all tests here... 13 | end 14 | -------------------------------------------------------------------------------- /ruby/rails/test/unit/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/rails/test/unit/.gitkeep -------------------------------------------------------------------------------- /ruby/rails/test/unit/comment_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class CommentTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /ruby/rails/test/unit/helpers/comments_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class CommentsHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /ruby/rails/test/unit/helpers/home_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class HomeHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /ruby/rails/test/unit/helpers/posts_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PostsHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /ruby/rails/test/unit/post_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PostTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /ruby/rails/vendor/assets/javascripts/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/rails/vendor/assets/javascripts/.gitkeep -------------------------------------------------------------------------------- /ruby/rails/vendor/assets/stylesheets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/rails/vendor/assets/stylesheets/.gitkeep -------------------------------------------------------------------------------- /ruby/rails/vendor/plugins/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/trace-examples/dbee48790ac84c078867afc313b4cfbca7693d7b/ruby/rails/vendor/plugins/.gitkeep -------------------------------------------------------------------------------- /ruby/sidekiq/.envrc.sample: -------------------------------------------------------------------------------- 1 | export DD_API_KEY= 2 | -------------------------------------------------------------------------------- /ruby/sidekiq/.gitignore: -------------------------------------------------------------------------------- 1 | .envrc 2 | -------------------------------------------------------------------------------- /ruby/sidekiq/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.5.1 2 | 3 | # install application dependencies 4 | RUN mkdir /app 5 | WORKDIR /app 6 | ADD Gemfile /app 7 | ADD Gemfile.lock /app 8 | RUN bundle install 9 | 10 | CMD ["bundle", "exec", "ruby", "app.rb"] 11 | -------------------------------------------------------------------------------- /ruby/sidekiq/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'connection_pool' 4 | gem 'json' 5 | gem 'redis' 6 | gem 'sidekiq' 7 | gem 'sinatra' 8 | gem 'sinatra-contrib' 9 | 10 | # tracing 11 | gem 'ddtrace' 12 | -------------------------------------------------------------------------------- /ruby/sidekiq/Procfile: -------------------------------------------------------------------------------- 1 | web: bundle exec ruby app.rb 2 | worker: bundle exec sidekiq -r ./job.rb 3 | -------------------------------------------------------------------------------- /ruby/sidekiq/views/jobs.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Create a new job

5 | 6 | 7 | 8 | 9 | 10 |
11 |
12 |
13 | 14 |
15 |
16 | -------------------------------------------------------------------------------- /ruby/sidekiq/views/jobs_fragment.erb: -------------------------------------------------------------------------------- 1 | <% jobs.each do |job| %> 2 |
3 |
4 |

5 | <%= job.cdate.strftime('%FT%T%z') %> — <%= job.duration %> seconds 6 |

7 |

<%= job.id %>

8 |

9 | <% if job.running? %> 10 | running 11 | <% else %> 12 | queued 13 | <% end %> 14 |

15 |
16 |
17 | <% end %> 18 | -------------------------------------------------------------------------------- /ruby/sinatra/.envrc.sample: -------------------------------------------------------------------------------- 1 | export DD_API_KEY= 2 | -------------------------------------------------------------------------------- /ruby/sinatra/.gitignore: -------------------------------------------------------------------------------- 1 | .envrc 2 | -------------------------------------------------------------------------------- /ruby/sinatra/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.5.1 2 | 3 | # install application dependencies 4 | RUN mkdir /app 5 | WORKDIR /app 6 | ADD Gemfile /app 7 | ADD Gemfile.lock /app 8 | RUN bundle install 9 | 10 | CMD ["bundle", "exec", "ruby", "app.rb"] 11 | -------------------------------------------------------------------------------- /ruby/sinatra/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | ruby "2.5.1" 3 | 4 | gem 'connection_pool' 5 | gem 'json' 6 | gem 'redis' 7 | gem 'sinatra' 8 | gem 'sinatra-contrib' 9 | 10 | # tracing 11 | gem 'ddtrace' 12 | -------------------------------------------------------------------------------- /ruby/sinatra/Procfile: -------------------------------------------------------------------------------- 1 | web: bundle exec ruby app.rb 2 | -------------------------------------------------------------------------------- /ruby/sinatra/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.2" 2 | services: 3 | redis: 4 | image: redis:4.0 5 | datadog: 6 | image: datadog/agent 7 | environment: 8 | - DD_APM_ENABLED=true 9 | - DD_BIND_HOST=0.0.0.0 10 | - DD_API_KEY 11 | web: 12 | build: . 13 | command: bundle exec ruby app.rb 14 | volumes: 15 | - .:/app 16 | ports: 17 | - "3000:3000" 18 | depends_on: 19 | - redis 20 | - datadog 21 | environment: 22 | - PROTECTED_USER=me 23 | - PROTECTED_PASSWORD=123456 24 | - REDIS_HOST=redis 25 | - DATADOG_TRACER=datadog 26 | -------------------------------------------------------------------------------- /ruby/sinatra/views/posts.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Create a new post

5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 | 17 |
18 |
19 | -------------------------------------------------------------------------------- /ruby/sinatra/views/posts_fragment.erb: -------------------------------------------------------------------------------- 1 | <% posts.each do |post| %> 2 |
3 |
4 |

5 | <%= post.cdate.strftime('%F') %> — <%= post.title %> 6 |

7 |

id: <%= post.id %>

8 |

<%= post.body %>

9 |
10 |
11 | <% end %> 12 | -------------------------------------------------------------------------------- /rust/rust-app/.dockerignore: -------------------------------------------------------------------------------- 1 | /.gitignore 2 | /.vscode 3 | /Dockerfile 4 | /LICENSE-3rdparty.yml 5 | /target 6 | -------------------------------------------------------------------------------- /rust/rust-app/.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | target/ 3 | -------------------------------------------------------------------------------- /rust/rust-app/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1.5 2 | 3 | # Keep version in sync with rust-toolchain.toml 4 | FROM rust:1.80.1-slim-bullseye 5 | 6 | WORKDIR /app 7 | 8 | COPY . . 9 | 10 | RUN --mount=type=cache,target=/usr/local/cargo/registry \ 11 | --mount=type=cache,target=/app/target \ 12 | cargo build --release && cp target/release/rust-app /app/rust-app 13 | 14 | ENTRYPOINT ["/app/rust-app"] 15 | -------------------------------------------------------------------------------- /rust/rust-app/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/ 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | [toolchain] 5 | channel = "1.80.1" # min 1.80 for axum tracing middleware that depends on opentelemetry 0.26 6 | --------------------------------------------------------------------------------