Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
cdaguerre committed Jan 12, 2025
1 parent a255dc2 commit a8fc0aa
Show file tree
Hide file tree
Showing 151 changed files with 2,781 additions and 1,055 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
example/ export-ignore
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
name: PHPSpec
strategy:
matrix:
php-version: ["8.1", "8.3"]
php-version: ["8.3"]
fail-fast: false
runs-on: ubuntu-latest
steps:
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
"require-dev": {
"doctrine/dbal": "^3.0",
"friends-of-phpspec/phpspec-expect": "^4.0",
"open-telemetry/transport-grpc": "^1.0",
"open-telemetry/gen-otlp-protobuf": "^1.0",
"open-telemetry/transport-grpc": "^1.0",
"php-http/httplug": "^2.3",
"phpspec/phpspec": "^7.5",
"phpstan/phpstan": "^1.4",
"symfony/framework-bundle": "*",
"symfony/framework-bundle": "^7.1",
"symfony/http-client": "*",
"symfony/messenger": "*",
"symfony/monolog-bundle": "^3.7",
Expand Down Expand Up @@ -69,4 +69,4 @@
"dev-main": "1.0.x-dev"
}
}
}
}
75 changes: 23 additions & 52 deletions docs/config-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,54 +10,31 @@ instrumentation:
resource:

# Default:
service.name: app
service.name: %env(default:instrumentation.default_service_name:OTEL_SERVICE_NAME)%

# Examples:
service.name: my-instrumented-app
service.version: 1.2.3
# service.name: my_instrumented_app
# service.version: 1.2.3
baggage:
enabled: true
health:
enabled: true
path: /_healthz
enabled: false
logging:
enabled: true

# Handlers to which the trace context processor should be bound
handlers:

# Defaults:
- main
- console
keys:
trace: context.trace
span: context.span
sampled: context.sampled
operation: context.operation
tracing:
enabled: true

# Allows you to have links to your traces generated in error messages and twig.
trace_url: ~ # Example: 'http://localhost:16682/trace/{traceId}'
logs:

# One of the Monolog\Logger levels.
level: 200 # One of 100; 200; 250; 300; 400; 500; 550; 600
channels: []
request:
enabled: true
attributes:

# Use the primary server name of the matched virtual host
server_name: null # Example: example.com
headers:
headers: []

# Examples:
- accept
- accept-encoding
incoming_header:
name: ~
regex: ~
# - accept
# - accept-encoding
blacklist:

# Defaults:
Expand All @@ -81,33 +58,27 @@ instrumentation:
- ^assets:install$
message:
enabled: true
flush_spans_after_handling: true
blacklist: []
http:
enabled: true
propagate_by_default: true
doctrine:
instrumentation: true
propagation: true
log_queries: true
instrumentation: false
propagation: false
log_queries: false
connections: []
metrics:
enabled: true
path: /metrics

# Prefix added to all metrics.
namespace: ''
storage:
adapter: apcu # One of "apc"; "apcu"; "redis"; "in_memory"

# When using the redis adapter, set "instance" to a service id that is an instance of \Redis
instance: null
message:
enabled: false
request:
enabled: false
blacklist:

# Set a prefix for Redis keys to avoid collisions, defaults to "metrics:<hostname>"
prefix: null
metrics:
# Defaults:
- ^/_fragment
- ^/_profiler
- ^/_wdt

# Prototype
-
name: ~ # Required
help: ~ # Required
type: ~ # One of "gauge"; "counter"; "histogram", Required
labels: []
buckets: []
```
34 changes: 0 additions & 34 deletions docs/logging/custom-keys.md

This file was deleted.

17 changes: 0 additions & 17 deletions docs/tracing/message-bodies.md

This file was deleted.

32 changes: 0 additions & 32 deletions docs/tracing/propagating-context.md

This file was deleted.

6 changes: 0 additions & 6 deletions docs/tracing/simple-trace.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@ class CurrentTime
public function __invoke(Request $request): Response
{
$ip = $request->getClientIp();

$span = $this->getTracer()->spanBuilder('http')
->setSpanKind(SpanKind::KIND_CLIENT)
->setAttribute('net.peer.name', 'worldtimeapi.org')
->startSpan();
$info = $this->httpClient->request('GET', 'http://worldtimeapi.org/api/ip/' . $ip)->toArray();
$span->end();

$span = $this->getTracer()->spanBuilder('process')->startSpan();
$result = sprintf('Current time is %s in timezone "%s".', $info['datetime'], $info['timezone']);
Expand Down
37 changes: 0 additions & 37 deletions docs/tracing/static-usage.md

This file was deleted.

19 changes: 0 additions & 19 deletions docs/tracing/upstream-request-id.md

This file was deleted.

36 changes: 36 additions & 0 deletions example/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
# https://symfony.com/doc/current/configuration/secrets.html
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=
###< symfony/framework-bundle ###

###> symfony/messenger ###
# Choose one of the transports below
MESSENGER_TRANSPORT_DSN=amqp://guest:guest@rabbitmq:5672/%2f/messages
# MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
###< symfony/messenger ###

###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
DATABASE_URL="postgresql://app:!ChangeMe!@postgresql:5432/app?serverVersion=16&charset=utf8"
###< doctrine/doctrine-bundle ###
11 changes: 11 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
symfony.lock
composer.lock
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###
21 changes: 21 additions & 0 deletions example/bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php

use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;

if (!is_dir(dirname(__DIR__).'/vendor')) {
throw new LogicException('Dependencies are missing. Try running "composer install".');
}

if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return function (array $context) {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);

return new Application($kernel);
};
Loading

0 comments on commit a8fc0aa

Please sign in to comment.