Comments (8)
Hey @TheLevti 👋
your problem looks like a different problem then what the author wrote.
Could you please signup to our public Slack or open a Support Case with us?
If you choose Slack, please ping "Florian Engelhardt" and/or "Bob Weinand"
from dd-trace-php.
@TheLevti unrelated question, but what tool do you use to measure memory usage and plot such graphs?
Its datadog's profiler component. Shows you CPU time, wall time, memory allocations etc.
from dd-trace-php.
Oh,
after exchanging
$tracer = GlobalTracer::get();
to
$tracer = new Tracer();
memory doesn't increase anymore. I am trying to think now whether it makes sense or not 🤔
from dd-trace-php.
Hey @iNviNho,
Is there something in the internal state of GlobalTracer::get()
which is ever-growing? I.e. observing var_dump(GlobalTracer::get())
, do you observe some arrays growing or data structures getting more and more nested?
from dd-trace-php.
After we call
GlobalTracer::get()->getRootScope()?->getSpan()->setTag('result', 'OK');
GlobalTracer::get()->getRootScope()?->close();
dump(GlobalTracer::get());
we always get DDTrace\Tracer object with a different object id as with every new message we consume, we create a new Tracer.
DDTrace\Tracer^ {#4063 // app/Console/Commands/LinkMultiSwapTradesCommand.php:91
-traces: []
-transport: DDTrace\Transport\Internal^ {#4087}
-propagators: array:2 [
"text_map" => DDTrace\Propagators\TextMap^ {#4086
-tracer: DDTrace\Tracer^ {#4063}
}
"http_headers" => DDTrace\Propagators\TextMap^ {#4086}
]
-config: array:3 [
"service_name" => "cli"
"enabled" => true
"global_tags" => []
]
-scopeManager: DDTrace\ScopeManager^ {#4037
-scopes: []
-hostRootScopes: array:1 [
0 => DDTrace\Scope^ {#4047
-span: DDTrace\Span^ {#4049
+context: DDTrace\SpanContext^ {#4052
+traceId: "89806696424059378"
+spanId: "89806696424059378"
+parentId: null
+isDistributedTracingActivationContext: false
+propagatedPrioritySampling: null
+origin: null
+parentContext: null
+baggageItems: []
}
+hasError: false
#internalSpan: ?
+internalSpan: DDTrace\RootSpanData {#4048
+name: "Jobs"
+resource: "..."
+service: "..."
+type: "cli"
+meta: array:5 [
"runtime-id" => "52936d31-37bd-414e-a474-8a0842804c58"
"version" => "0.0.1"
"command_origin" => "..."
"result" => "OK"
"_dd.p.dm" => "-0"
]
+metrics: array:2 [
"process_id" => 753.0
"_dd.agent_psr" => 1.0
]
+exception: null
+id: "89806696424059378"
+links: []
+peerServiceSources: []
+parent: null
+stack: DDTrace\SpanStack {#4006
+parent: DDTrace\SpanStack {#1
+parent: null
+active: null
}
+active: null
}
+origin: ? string
+propagatedTags: []
+samplingPriority: 1
+propagatedSamplingPriority: ? int
+tracestate: ? string
+tracestateTags: []
+parentId: ? string
+traceId: "6602ef6300000000013f0eb6eeceb1f2"
}
}
-scopeManager: DDTrace\ScopeManager^ {#4037}
-finishSpanOnClose: true
}
]
-rootContext: null
}
-serviceVersion: "0.0.1"
-environment: ""
-rootContext: null
}
and the memory keeps increasing until we do
gc_collect_cycles();
gc_mem_caches();
from dd-trace-php.
We see that all our daemon deployments slowly climb in memory usage. This screenshot shows a datadog profile of total allocated memory over an hour in one of our service.
from dd-trace-php.
Actually it is related as we investigate the same issue with @iNviNho.
What we have found out is that calling $tracer->reset()
after flushing is fixing the memory leak.
Can we maybe have more details about when reset()
should be called and whether thats the correct approach?
Why is the tracer accumulating already closed/flushed traces if reset is not called?
This call also allows us to use the global tracer instance as a singleton and not reinstantiate it after each trace.
from dd-trace-php.
@TheLevti unrelated question, but what tool do you use to measure memory usage and plot such graphs?
from dd-trace-php.
Related Issues (20)
- [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]: 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 16
- [Bug]: Service name is always "laravelqueue" and can't be changed HOT 2
- [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 8
- [Bug]: DD Trace breaks project with PHP 8.3.7 - Laravel 11.7 HOT 4
- [Bug]: Memory leak with DD_APPSEC_ENABLED="false" HOT 3
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.