Comments (15)
Hi @chregu, I think the problem is not "how" you do it (which is correct) but "when" you do it. What I bet is happening is that you do it early on in the process (e.g. in a bundle or similar) and that value is overwritten by our integration.
While we are working to improve the way we handle resources, here is a temporarily workaround that you can put in place in the meantime.
If you use a pretty much standard web/app.php
you should have toward the end something like:
$response->send();
$kernel->terminate($request, $response);
In this case you can either move your snippet after the kernel termination or early on in the process hook into the terminate
invocation:
dd_trace('Symfony\Component\HttpKernel\Kernel', 'terminate', function () {
$rootScope = \DDTrace\GlobalTracer::get()->getRootScope();
if (null !== $rootScope) {
$rootSpan = $rootScope->getSpan();
$rootSpan->setResource($name);
$rootSpan->setTag('symfony.route.name', $name);
}
return call_user_func_array([$this, 'terminate'], func_get_args());
});
A couple of notes though:
- We are working to make working with resource names easier in our api/configuration
- IMPORTANT: It is very important that you properly set resource names. Say you have 10k users and you set as the resource name
$_SERVER('REQUEST_URI')
you would end up with 10k different resources for the very same endpoint/users/<id>/profile
. In this case what you set as the resource name should not involve the id, e.g.user-profile
would be ok.
from dd-trace-php.
Is DD_SERVICE_MAPPING going to make an appearance?
from dd-trace-php.
Thanks a lot for the quick reply. Will try something in this direction.
from dd-trace-php.
Hi @chregu just checking in to know if the approach I suggested did work?
from dd-trace-php.
- We are working to make working with resource names easier in our api/configuration
Hi @labbati , we are currently facing this issue in company. Any updates in this front would would be deeply appreciated.
Having two different PHP applications running in the same environment proved to be a headache because there is not a way to track each service, from each app, properly. Currently we adopt a workaround, but it is far from ideal. As well as Manual Instrumentation would not be something we would be able to do.
from dd-trace-php.
Hi @lucasfernand-es
Having two different PHP applications running in the same environment proved to be a headache because there is not a way to track each service, from each app, properly.
Why not use DD_TRACE_APP_NAME=app_name
with different values in order to differentiate the two apps? Am I missing something?
from dd-trace-php.
Why not use
DD_TRACE_APP_NAME=app_name
with different values in order to differentiate the two apps? Am I missing something?
The problem is that DD_TRACE_APP_NAME=app_name
only renames the framework, in our case Laravel.
All other resources we use, such as PDO, Curl, Guzzle (etc) share the same name in the APM dashboard. We would like to be able to differentiate those for each project. Other languages, like Ruby, have that covered by DataDog.
from dd-trace-php.
@lucasfernand-es thanks for clarifying this. What you need then is service mapping (e.g. DD_SERVICE_MAPPING
in Java docs).
Currently PHP does not implement this but it is scheduled to be implemented very soon. I will get back to you with an ETA asap.
from dd-trace-php.
Hi @nickdgriffin, service mapping is in the road map but we cannot provide an ETA at the moment.
from dd-trace-php.
@labbati OK, thanks for the update
from dd-trace-php.
👍 looking forward to the addition of DD_SERVICE_MAPPING
for php
from dd-trace-php.
+1
from dd-trace-php.
👍
from dd-trace-php.
DD_SERVICE_MAPPING
looks to now be supported: https://github.com/DataDog/dd-trace-php/releases/tag/0.43.0
from dd-trace-php.
👋 hello everyone! With service mapping now released I think this issue can be closed. Feel free to reopen it if you think there is more work to be done.
from dd-trace-php.
Related Issues (20)
- [Bug]: ddappsec startup warnings HOT 9
- [Feature] CURL multi exec integration is lacking data in the APM view HOT 7
- [Bug]: PDO/PHPRedis client split by instance inconsistency HOT 1
- [Bug]: Segfault in dd_patched_zend_call_known_function HOT 3
- [Bug]: ddtrace overrides php error log permissions HOT 1
- [Documentation]: OTEL tracing HOT 8
- [Feature] Add JSON body items to http.request
- [Feature] Laravel Livewire 3 Support
- [Bug]: Standalone null Return Type for update_span_duration Causes Phan Parsing to Fail for PHP <8.2 HOT 1
- [Bug]: new operation `command_execution` HOT 3
- [Bug]: Memory leak in creating Tracer HOT 8
- [Bug]: 0.98.x tar.gz file size increased? HOT 1
- [Bug]: Bad signature error HOT 6
- [Feature] Error Tracking via logs HOT 2
- [Bug]: CLI PHP Processes do not stop and with Apache (mod_php) the connection is closed unexpectedly HOT 1
- [Bug]: Laravel Octane traces not showing in dashboard HOT 15
- [Bug]: Service name is always "laravelqueue" and can't be changed HOT 1
- [Feature] Missing instrumentation for batched AMQP publishing
- [Bug]: Integrations being added as Services in the APM UI HOT 1
- [Help]: Configurations in Docker and kubernetes HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dd-trace-php.