Skip to content

Commit 97ffab1

Browse files
Merge branch 'open-telemetry:main' into main
2 parents d9338d4 + ee99079 commit 97ffab1

File tree

59 files changed

+4637
-84
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+4637
-84
lines changed

.github/workflows/php.yml

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: PHP QA
32

43
on:
@@ -19,28 +18,32 @@ jobs:
1918
fail-fast: false
2019
matrix:
2120
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3']
21+
# Sorted alphabetically to ease finding the desired run in the GitHub Workflow UI.
2222
project: [
2323
'Aws',
2424
'Context/Swoole',
25+
'Instrumentation/CakePHP',
26+
'Instrumentation/CodeIgniter',
27+
'Instrumentation/Curl',
2528
'Instrumentation/ExtAmqp',
2629
'Instrumentation/ExtRdKafka',
2730
'Instrumentation/Guzzle',
2831
'Instrumentation/HttpAsyncClient',
29-
'Instrumentation/Slim',
30-
'Instrumentation/CakePHP',
32+
'Instrumentation/IO',
33+
'Instrumentation/Laravel',
34+
'Instrumentation/MongoDB',
35+
'Instrumentation/MySqli',
36+
'Instrumentation/OpenAIPHP',
37+
'Instrumentation/PDO',
38+
# Sort PSRs numerically.
3139
'Instrumentation/Psr3',
3240
'Instrumentation/Psr6',
3341
'Instrumentation/Psr14',
3442
'Instrumentation/Psr15',
3543
'Instrumentation/Psr16',
3644
'Instrumentation/Psr18',
37-
'Instrumentation/IO',
38-
'Instrumentation/PDO',
45+
'Instrumentation/Slim',
3946
'Instrumentation/Symfony',
40-
'Instrumentation/OpenAIPHP',
41-
'Instrumentation/Laravel',
42-
'Instrumentation/MongoDB',
43-
'Instrumentation/CodeIgniter',
4447
'Instrumentation/Yii',
4548
'Logs/Monolog',
4649
'Propagation/ServerTiming',
@@ -49,7 +52,7 @@ jobs:
4952
'ResourceDetectors/Container',
5053
'Sampler/RuleBased',
5154
'Shims/OpenTracing',
52-
'Symfony'
55+
'Symfony',
5356
]
5457
exclude:
5558
- project: 'Instrumentation/Guzzle'
@@ -84,6 +87,18 @@ jobs:
8487
php-version: 8.0
8588
- project: 'Instrumentation/IO'
8689
php-version: 8.1
90+
- project: 'Instrumentation/Curl'
91+
php-version: 7.4
92+
- project: 'Instrumentation/Curl'
93+
php-version: 8.0
94+
- project: 'Instrumentation/Curl'
95+
php-version: 8.1
96+
- project: 'Instrumentation/MySqli'
97+
php-version: 7.4
98+
- project: 'Instrumentation/MySqli'
99+
php-version: 8.0
100+
- project: 'Instrumentation/MySqli'
101+
php-version: 8.1
87102
- project: 'Instrumentation/PDO'
88103
php-version: 7.4
89104
- project: 'Instrumentation/PDO'
@@ -116,6 +131,10 @@ jobs:
116131
php-version: 7.4
117132
- project: 'Sampler/RuleBased'
118133
php-version: 8.0
134+
- project: 'Symfony'
135+
php-version: 7.4
136+
- project: 'Symfony'
137+
php-version: 8.0
119138
steps:
120139
- uses: actions/checkout@v4
121140

@@ -124,7 +143,7 @@ jobs:
124143
with:
125144
php-version: ${{ matrix.php-version }}
126145
coverage: xdebug
127-
extensions: ast, amqp, grpc, opentelemetry, rdkafka
146+
extensions: ast, amqp, grpc, opentelemetry, rdkafka, mysqli
128147

129148
- name: Validate composer.json and composer.lock
130149
run: composer validate
@@ -184,6 +203,11 @@ jobs:
184203
run: |
185204
KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:29092,PLAINTEXT_HOST://localhost:9092 docker compose up kafka -d --wait
186205
206+
- name: Start Mysql
207+
if: ${{ matrix.project == 'Instrumentation/MySqli' }}
208+
run: |
209+
docker compose up mysql -d --wait
210+
187211
- name: Run PHPUnit
188212
working-directory: src/${{ matrix.project }}
189213
run: vendor/bin/phpunit

.gitsplit.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ splits:
1414
target: "https://${GH_TOKEN}@github.com/opentelemetry-php/contrib-sdk-bundle.git"
1515
- prefix: "src/Instrumentation/CodeIgniter"
1616
target: "https://${GH_TOKEN}@github.com/opentelemetry-php/contrib-auto-codeigniter.git"
17+
- prefix: "src/Instrumentation/Curl"
18+
target: "https://${GH_TOKEN}@github.com/opentelemetry-php/contrib-auto-curl.git"
1719
- prefix: "src/Instrumentation/ExtAmqp"
1820
target: "https://${GH_TOKEN}@github.com/opentelemetry-php/contrib-auto-ext-amqp.git"
1921
- prefix: "src/Instrumentation/ExtRdKafka"
@@ -28,6 +30,8 @@ splits:
2830
target: "https://${GH_TOKEN}@github.com/opentelemetry-php/contrib-auto-laravel.git"
2931
- prefix: "src/Instrumentation/MongoDB"
3032
target: "https://${GH_TOKEN}@github.com/opentelemetry-php/contrib-auto-mongodb.git"
33+
- prefix: "src/Instrumentation/MySqli"
34+
target: "https://${GH_TOKEN}@github.com/opentelemetry-php/contrib-auto-mysqli.git"
3135
- prefix: "src/Instrumentation/OpenAIPHP"
3236
target: "https://${GH_TOKEN}@github.com/opentelemetry-php/contrib-auto-openai.git"
3337
- prefix: "src/Instrumentation/PDO"

composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818
"psr-4": {
1919
"OpenTelemetry\\Contrib\\Aws\\": "src/Aws/src",
2020
"OpenTelemetry\\Contrib\\Context\\Swoole\\": "src/Context/Swoole/src",
21+
"OpenTelemetry\\Contrib\\Instrumentation\\Curl\\": "src/Instrumentation/Curl/src",
2122
"OpenTelemetry\\Contrib\\Instrumentation\\ExtAmqp\\": "src/Instrumentation/ExtAmqp/src",
2223
"OpenTelemetry\\Contrib\\Instrumentation\\ExtRdKafka\\": "src/Instrumentation/ExtRdKafka/src",
2324
"OpenTelemetry\\Contrib\\Instrumentation\\Laravel\\": "src/Instrumentation/Laravel/src",
2425
"OpenTelemetry\\Contrib\\Instrumentation\\HttpAsyncClient\\": "src/Instrumentation/HttpAsyncClient/src",
2526
"OpenTelemetry\\Contrib\\Instrumentation\\IO\\": "src/Instrumentation/IO/src",
2627
"OpenTelemetry\\Contrib\\Instrumentation\\MongoDB\\": "src/Instrumentation/MongoDB/src",
28+
"OpenTelemetry\\Contrib\\Instrumentation\\MySqli\\": "src/Instrumentation/MySqli/src",
2729
"OpenTelemetry\\Contrib\\Instrumentation\\PDO\\": "src/Instrumentation/PDO/src",
2830
"OpenTelemetry\\Contrib\\Instrumentation\\Psr3\\": "src/Instrumentation/Psr3/src",
2931
"OpenTelemetry\\Contrib\\Instrumentation\\Psr15\\": "src/Instrumentation/Psr15/src",
@@ -40,12 +42,14 @@
4042
"OpenTelemetry\\Contrib\\Symfony\\": "src/Symfony/src"
4143
},
4244
"files": [
45+
"src/Instrumentation/Curl/_register.php",
4346
"src/Instrumentation/ExtAmqp/_register.php",
4447
"src/Instrumentation/ExtRdKafka/_register.php",
4548
"src/Instrumentation/HttpAsyncClient/_register.php",
4649
"src/Instrumentation/IO/_register.php",
4750
"src/Instrumentation/Laravel/_register.php",
4851
"src/Instrumentation/MongoDB/_register.php",
52+
"src/Instrumentation/MySqli/_register.php",
4953
"src/Instrumentation/PDO/_register.php",
5054
"src/Instrumentation/Psr3/_register.php",
5155
"src/Instrumentation/Psr15/_register.php",
@@ -60,10 +64,12 @@
6064
"open-telemetry/contrib-aws": "self.version",
6165
"open-telemetry/contrib-sdk-bundle": "self.version",
6266
"open-telemetry/context-swoole": "self.version",
67+
"open-telemetry/opentelemetry-auto-curl": "self.version",
6368
"open-telemetry/opentelemetry-auto-laravel": "self.version",
6469
"open-telemetry/opentelemetry-auto-http-async": "self.version",
6570
"open-telemetry/opentelemetry-auto-io": "self.version",
6671
"open-telemetry/opentelemetry-auto-mongodb": "self.version",
72+
"open-telemetry/opentelemetry-auto-mysqli": "self.version",
6773
"open-telemetry/opentelemetry-auto-pdo": "self.version",
6874
"open-telemetry/opentelemetry-auto-psr3": "self.version",
6975
"open-telemetry/opentelemetry-auto-psr15": "self.version",

docker-compose.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ services:
1414
PHP_IDE_CONFIG: ${PHP_IDE_CONFIG:-''}
1515
RABBIT_HOST: ${RABBIT_HOST:-rabbitmq}
1616
KAFKA_HOST: ${KAFKA_HOST:-kafka}
17+
MONGODB_HOST: ${MONGODB_HOST:-mongodb}
18+
MONGODB_PORT: ${MONGODB_PORT:-27017}
19+
MYSQL_HOST: ${MYSQL_HOST:-mysql}
1720

1821
zipkin:
1922
image: openzipkin/zipkin-slim
@@ -61,4 +64,26 @@ services:
6164
volumes:
6265
- ./docker/kafka/update_run.sh:/tmp/update_run.sh
6366

67+
mongodb:
68+
image: mongo:4
69+
hostname: mongodb
70+
ports:
71+
- "27017:27017/tcp"
6472

73+
mysql:
74+
image: mysql:8.0
75+
hostname: mysql
76+
ports:
77+
- "3306:3306/tcp"
78+
environment:
79+
MYSQL_ROOT_PASSWORD: root_password
80+
MYSQL_DATABASE: otel_db
81+
MYSQL_USER: otel_user
82+
MYSQL_PASSWORD: otel_passwd
83+
healthcheck:
84+
test: mysql -uotel_user -potel_passwd -e "USE otel_db;"
85+
interval: 30s
86+
timeout: 30s
87+
retries: 3
88+
volumes:
89+
- ./docker/mysql/init.sql:/docker-entrypoint-initdb.d/init.sql

docker/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ RUN install-php-extensions \
77
opentelemetry \
88
mongodb \
99
amqp \
10-
rdkafka
10+
rdkafka \
11+
mysqli
1112

1213
USER php

docker/mysql/init.sql

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
CREATE DATABASE IF NOT EXISTS otel_db2;
2+
CREATE USER 'otel_user2'@'%' IDENTIFIED BY 'otel_passwd';
3+
4+
5+
GRANT ALL PRIVILEGES ON *.* TO 'otel_user'@'%';
6+
GRANT ALL PRIVILEGES ON *.* TO 'otel_user2'@'%';
7+
FLUSH PRIVILEGES;
8+
9+
10+
USE otel_db;
11+
12+
CREATE TABLE users (
13+
id INT AUTO_INCREMENT PRIMARY KEY,
14+
name VARCHAR(255) NOT NULL,
15+
email VARCHAR(255) UNIQUE NOT NULL,
16+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
17+
);
18+
19+
INSERT INTO users (name, email) VALUES
20+
('John Doe', '[email protected]'),
21+
('Jane Smith', '[email protected]'),
22+
('Bob Johnson', '[email protected]');
23+
24+
CREATE TABLE products (
25+
id INT AUTO_INCREMENT PRIMARY KEY,
26+
name VARCHAR(255) NOT NULL,
27+
price DECIMAL(10, 2) NOT NULL,
28+
stock INT NOT NULL DEFAULT 0
29+
);
30+
31+
INSERT INTO products (name, price, stock) VALUES
32+
('Laptop', 999.99, 10),
33+
('Smartphone', 499.99, 25),
34+
('Headphones', 49.99, 50);

examples/instrumentation/Wordpress/autoinstrumented-wordpress.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM composer:2.5 as build
33
COPY composer.json ./
44
RUN composer install --ignore-platform-reqs
55

6-
FROM wordpress:6.2
6+
FROM wordpress:6.7.1
77
# Install the opentelemetry and protobuf extensions
88
RUN pecl install opentelemetry protobuf
99
COPY otel.php.ini $PHP_INI_DIR/conf.d/.

examples/instrumentation/Wordpress/compose.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ services:
4242
# OpenTelemetry collector. Make sure you set USERID and GOOGLE_APPLICATION_CREDENTIALS
4343
# environment variables for your container to authenticate correctly
4444
otel-collector:
45-
image: otel/opentelemetry-collector-contrib:0.79.0
45+
image: otel/opentelemetry-collector-contrib:0.91.0
4646
volumes:
4747
- ./otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml
48-
48+
4949
jaeger:
50-
image: jaegertracing/all-in-one:1.46
50+
image: jaegertracing/all-in-one
5151
ports:
5252
- 16686:16686
5353
environment:
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
2-
"name": "opentelemetry/wordpress-example",
3-
"description": "An example of autoinstrumentation of wordpress with the official wordpress docker image",
4-
"type": "project",
5-
"minimum-stability": "beta",
6-
"require": {
7-
"open-telemetry/opentelemetry-auto-wordpress": "^0.0.15",
8-
"open-telemetry/sdk": "^1.0",
9-
"open-telemetry/exporter-otlp": "^1.0",
10-
"php-http/guzzle7-adapter": "^1.0"
11-
},
12-
"config": {
13-
"allow-plugins": {
14-
"php-http/discovery": true
15-
}
16-
}
17-
}
2+
"name": "opentelemetry/wordpress-example",
3+
"description": "An example of autoinstrumentation of wordpress with the official wordpress docker image",
4+
"type": "project",
5+
"minimum-stability": "beta",
6+
"require": {
7+
"open-telemetry/opentelemetry-auto-wordpress": "^0.0.16",
8+
"open-telemetry/sdk": "^1.1",
9+
"open-telemetry/exporter-otlp": "^1.1",
10+
"php-http/guzzle7-adapter": "^1.1"
11+
},
12+
"config": {
13+
"allow-plugins": {
14+
"php-http/discovery": true
15+
}
16+
}
17+
}

examples/instrumentation/Wordpress/otel-collector-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ processors:
1414
# Alternatively, add additional exporters for the backend of your choice and update the
1515
# pipelines below
1616
exporters:
17-
logging:
17+
debug:
1818
verbosity: detailed
1919
otlp:
2020
endpoint: jaeger:4317
@@ -26,9 +26,9 @@ service:
2626
metrics:
2727
receivers: [otlp]
2828
processors: [memory_limiter, batch]
29-
exporters: [logging]
29+
exporters: [debug]
3030

3131
traces:
3232
receivers: [otlp]
3333
processors: [memory_limiter, batch]
34-
exporters: [logging, otlp]
34+
exporters: [debug, otlp]

0 commit comments

Comments
 (0)