dd-trace-php icon indicating copy to clipboard operation
dd-trace-php copied to clipboard

feat: OpenAI Integration

Open PROFeNoM opened this issue 1 year ago β€’ 3 comments

Description

TBC

GL reviewing

Reviewer checklist

  • [ ] Test coverage seems ok.
  • [ ] Appropriate labels assigned.

PROFeNoM avatar May 31 '24 14:05 PROFeNoM

Benchmarks

Benchmark execution time: 2024-07-19 22:47:29

Comparing candidate commit 841220b85e687f167512be07f2103b613994e5b7 in PR branch alex/feat/openai with baseline commit 5fe1c5ae9ff97ecc011135fdd0ddddb0452c1cbc in branch master.

Found 3 performance improvements and 48 performance regressions! Performance is the same for 127 metrics, 0 unstable metrics.

scenario:ComposerTelemetryBench/benchTelemetryParsing

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.419%; +3.419%]

scenario:ContextPropagationBench/benchExtractHeaders128Bit

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.418%; +3.418%]

scenario:ContextPropagationBench/benchExtractHeaders64Bit

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.418%; +3.418%]

scenario:ContextPropagationBench/benchExtractTraceContext128Bit

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.418%; +3.418%]

scenario:ContextPropagationBench/benchExtractTraceContext64Bit

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.418%; +3.418%]

scenario:ContextPropagationBench/benchInject128Bit

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.418%; +3.418%]

scenario:ContextPropagationBench/benchInject64Bit

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.418%; +3.418%]

scenario:ContextPropagationBench/benchInject64Bit-opcache

  • πŸŸ₯ execution_time [+186.587ns; +415.413ns] or [+2.535%; +5.645%]

scenario:EmptyFileBench/benchEmptyFileBaseline

  • πŸŸ₯ mem_peak [+246.024KB; +246.024KB] or [+5.721%; +5.721%]

scenario:EmptyFileBench/benchEmptyFileOverhead

  • πŸŸ₯ mem_peak [+246.024KB; +246.024KB] or [+5.721%; +5.721%]

scenario:HookBench/benchHookOverheadInstallHookOnFunction

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.418%; +3.418%]

scenario:HookBench/benchHookOverheadInstallHookOnMethod

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.418%; +3.418%]

scenario:HookBench/benchHookOverheadTraceFunction

  • πŸŸ₯ mem_peak [+107.480KB; +107.480KB] or [+3.282%; +3.282%]

scenario:HookBench/benchHookOverheadTraceMethod

  • πŸŸ₯ mem_peak [+107.479KB; +107.482KB] or [+3.219%; +3.219%]

scenario:HookBench/benchWithoutHook

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.419%; +3.419%]

scenario:LaravelBench/benchLaravelBaseline

  • πŸŸ₯ mem_peak [+246.056KB; +246.056KB] or [+5.720%; +5.720%]

scenario:LaravelBench/benchLaravelOverhead

  • πŸŸ₯ mem_peak [+246.056KB; +246.056KB] or [+5.720%; +5.720%]

scenario:LogsInjectionBench/benchLogsInfoBaseline

  • πŸŸ₯ mem_peak [+135.288KB; +135.288KB] or [+3.859%; +3.859%]

scenario:LogsInjectionBench/benchLogsInfoInjection

  • πŸŸ₯ mem_peak [+139.264KB; +139.264KB] or [+3.949%; +3.949%]

scenario:LogsInjectionBench/benchLogsNullBaseline

  • πŸŸ₯ mem_peak [+135.288KB; +135.288KB] or [+3.859%; +3.859%]

scenario:LogsInjectionBench/benchLogsNullInjection

  • πŸŸ₯ mem_peak [+139.320KB; +139.320KB] or [+3.947%; +3.947%]

scenario:MessagePackSerializationBench/benchMessagePackSerialization

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.321%; +3.321%]

scenario:PDOBench/benchPDOBaseline

  • πŸŸ₯ mem_peak [+71.632KB; +71.632KB] or [+2.047%; +2.047%]

scenario:PDOBench/benchPDOOverhead

  • πŸŸ₯ execution_time [+7.473Β΅s; +16.463Β΅s] or [+2.739%; +6.034%]
  • πŸŸ₯ mem_peak [+135.318KB; +135.321KB] or [+3.217%; +3.217%]

scenario:PDOBench/benchPDOOverhead-opcache

  • πŸŸ₯ mem_peak [+125.248KB; +125.248KB] or [+5.964%; +5.964%]
  • 🟩 execution_time [-10.465Β΅s; -8.390Β΅s] or [-3.512%; -2.815%]

scenario:PDOBench/benchPDOOverheadWithDBM

  • πŸŸ₯ mem_peak [+135.318KB; +135.321KB] or [+3.172%; +3.172%]

scenario:PDOBench/benchPDOOverheadWithDBM-opcache

  • πŸŸ₯ mem_peak [+125.247KB; +125.250KB] or [+5.800%; +5.800%]

scenario:PHPRedisBench/benchRedisOverhead

  • πŸŸ₯ mem_peak [+135.335KB; +135.337KB] or [+2.675%; +2.675%]

scenario:PHPRedisBench/benchRedisOverhead-opcache

  • πŸŸ₯ mem_peak [+125.263KB; +125.266KB] or [+4.185%; +4.185%]

scenario:SamplingRuleMatchingBench/benchGlobMatching1

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.419%; +3.419%]

scenario:SamplingRuleMatchingBench/benchGlobMatching1-opcache

  • 🟩 execution_time [-149.145ns; -71.655ns] or [-5.730%; -2.753%]

scenario:SamplingRuleMatchingBench/benchGlobMatching2

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.419%; +3.419%]

scenario:SamplingRuleMatchingBench/benchGlobMatching3

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.419%; +3.419%]

scenario:SamplingRuleMatchingBench/benchGlobMatching4

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.419%; +3.419%]

scenario:SamplingRuleMatchingBench/benchRegexMatching1

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.419%; +3.419%]

scenario:SamplingRuleMatchingBench/benchRegexMatching2

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.419%; +3.419%]

scenario:SamplingRuleMatchingBench/benchRegexMatching3

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.419%; +3.419%]

scenario:SamplingRuleMatchingBench/benchRegexMatching3-opcache

  • πŸŸ₯ execution_time [+202.523ns; +405.877ns] or [+3.177%; +6.366%]

scenario:SamplingRuleMatchingBench/benchRegexMatching4

  • πŸŸ₯ execution_time [+175.310ns; +401.690ns] or [+2.704%; +6.196%]
  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.419%; +3.419%]

scenario:SamplingRuleMatchingBench/benchRegexMatching4-opcache

  • πŸŸ₯ execution_time [+130.057ns; +358.743ns] or [+2.028%; +5.593%]

scenario:SymfonyBench/benchSymfonyBaseline

  • πŸŸ₯ mem_peak [+246.056KB; +246.056KB] or [+5.720%; +5.720%]

scenario:SymfonyBench/benchSymfonyOverhead

  • πŸŸ₯ mem_peak [+246.056KB; +246.056KB] or [+5.720%; +5.720%]

scenario:TraceAnnotationsBench/benchTraceAnnotationOverhead

  • πŸŸ₯ mem_peak [+107.480KB; +107.484KB] or [+3.211%; +3.211%]

scenario:TraceFlushBench/benchFlushTrace

  • πŸŸ₯ mem_peak [+135.256KB; +135.256KB] or [+3.699%; +3.699%]

scenario:TraceSerializationBench/benchSerializeTrace

  • πŸŸ₯ mem_peak [+107.144KB; +107.144KB] or [+3.418%; +3.418%]
  • 🟩 execution_time [-11.128Β΅s; -8.372Β΅s] or [-5.677%; -4.272%]

scenario:WordPressBench/benchWordPressBaseline

  • πŸŸ₯ mem_peak [+250.216KB; +250.216KB] or [+3.717%; +3.717%]

scenario:WordPressBench/benchWordPressOverhead

  • πŸŸ₯ mem_peak [+246.024KB; +246.024KB] or [+5.712%; +5.712%]

pr-commenter[bot] avatar May 31 '24 14:05 pr-commenter[bot]

I'd like to discuss the DatadogLogger, and would like to know if this needs to be done this way.

At a glance, I'm not particularly fond of it. I don't mind having logging. But I think the extension should expose an API to log messages, rather than having a custom logger written in PHP. Which then get sent to the right location, can be forwarded to the sidecar, possibly for logging telemetry and such in future.

bwoebi avatar May 31 '24 21:05 bwoebi

Codecov Report

Attention: Patch coverage is 94.68713% with 45 lines in your changes missing coverage. Please review.

Project coverage is 78.62%. Comparing base (5fe1c5a) to head (841220b).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2685      +/-   ##
============================================
+ Coverage     77.97%   78.62%   +0.65%     
- Complexity     2216     2459     +243     
============================================
  Files           228      230       +2     
  Lines         26951    27794     +843     
  Branches        989      989              
============================================
+ Hits          21015    21853     +838     
- Misses         5410     5415       +5     
  Partials        526      526              
Flag Coverage Ξ”
appsec-extension 69.19% <ΓΈ> (ΓΈ)
tracer-extension 78.82% <100.00%> (+<0.01%) :arrow_up:
tracer-php 82.13% <94.64%> (+1.57%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Ξ”
ext/configuration.h 100.00% <ΓΈ> (ΓΈ)
ext/git.c 74.29% <100.00%> (+0.12%) :arrow_up:
ext/integrations/integrations.c 91.25% <100.00%> (+0.14%) :arrow_up:
ext/startup_logging.c 86.06% <ΓΈ> (ΓΈ)
src/api/Log/InterpolateTrait.php 77.77% <100.00%> (+77.77%) :arrow_up:
src/bridge/_files_tracer.php 100.00% <100.00%> (ΓΈ)
src/api/Log/DatadogLogger.php 80.00% <80.00%> (ΓΈ)
.../DDTrace/Integrations/OpenAI/OpenAIIntegration.php 96.50% <96.50%> (ΓΈ)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update 5fe1c5a...841220b. Read the comment docs.

codecov-commenter avatar Jun 04 '24 18:06 codecov-commenter