|
468 | 468 | end |
469 | 469 | end |
470 | 470 |
|
| 471 | + describe 'app-started event' do |
| 472 | + context 'when profiling is enabled' do |
| 473 | + http_server do |http_server| |
| 474 | + http_server.mount_proc('/telemetry/proxy/api/v2/apmtelemetry', &handler_proc) |
| 475 | + end |
| 476 | + |
| 477 | + before do |
| 478 | + Datadog.configure do |c| |
| 479 | + c.agent.port = http_server_port |
| 480 | + c.telemetry.enabled = true |
| 481 | + |
| 482 | + c.profiling.enabled = true |
| 483 | + end |
| 484 | + end |
| 485 | + |
| 486 | + after do |
| 487 | + Datadog.configuration.reset! |
| 488 | + end |
| 489 | + |
| 490 | + let(:settings) do |
| 491 | + Datadog.configuration |
| 492 | + end |
| 493 | + |
| 494 | + let(:component) { Datadog.send(:components).telemetry } |
| 495 | + |
| 496 | + it 'reports profiling as being enabled' do |
| 497 | + component.flush |
| 498 | + expect(sent_payloads.length).to eq 3 |
| 499 | + |
| 500 | + payload = sent_payloads[0] |
| 501 | + expect(payload.fetch(:payload)).to include( |
| 502 | + 'request_type' => 'app-started', |
| 503 | + ) |
| 504 | + expect(payload.fetch(:payload).dig('payload', 'products')).to include( |
| 505 | + 'profiler' => {'enabled' => true}, |
| 506 | + ) |
| 507 | + |
| 508 | + # For sanity checking verify that the remaining events are as we |
| 509 | + # expect them to be. |
| 510 | + payload = sent_payloads[1] |
| 511 | + expect(payload.fetch(:payload)).to include( |
| 512 | + 'request_type' => 'app-dependencies-loaded', |
| 513 | + ) |
| 514 | + |
| 515 | + payload = sent_payloads[2] |
| 516 | + expect(payload.fetch(:payload)).to include( |
| 517 | + 'request_type' => 'message-batch', |
| 518 | + ) |
| 519 | + expect(payload.fetch(:payload).fetch('payload').first).to include( |
| 520 | + 'request_type' => 'app-integrations-change', |
| 521 | + ) |
| 522 | + end |
| 523 | + end |
| 524 | + end |
| 525 | + |
471 | 526 | context 'when process forks' do |
472 | 527 | # The mode is irrelevant but we need settings from the context. |
473 | 528 | include_context 'agent mode' |
|
0 commit comments