App Analytics

This page describes deprecated features with configuration information relevant to legacy App Analytics, useful for troubleshooting or modifying some old setups. To have full control over your traces, use ingestion controls and retention filters instead.

Migrate to the new configuration options

Navigate to the ingestion control page to see services with legacy configurations. These are flagged with a Legacy Setup status.

To migrate to the new configuration options, remove all legacy App Analytics configuration options from the services flagged with Legacy Setup. Then, implement the Datadog Agent and tracing libraries’ sampling mechanisms to send traces.

App Analytics setup

App Analytics configuration options are located in the Tracing Libraries and in the Datadog Agent. In the libraries, analytics spans from your services are generated either automatically or manually.

In Tracing Libraries

Automatic configuration

App Analytics is available starting in version 0.19.0 of the Python tracing client. Enable App Analytics globally for all web integrations with one configuration parameter in the Tracing Client:

  • Tracer Configuration: ddtrace.config.analytics_enabled = True
  • Environment Variable: DD_TRACE_ANALYTICS_ENABLED=true

Configure additional services (optional)

Configure by integration

In addition to setting globally, you can enable or disable App Analytics for individual integrations using the following setting:

  • Tracer Configuration: ddtrace.config.<INTEGRATION>.analytics_enabled = True
  • Environment Variable: DD_<INTEGRATION>_ANALYTICS_ENABLED=true

Use this in addition to the global configuration for any integrations that submit custom services. For example, for Boto spans which comes in as a custom service, set the following to enable all Boto Tracing in App Analytics:

  • Tracer Configuration: ddtrace.config.boto.analytics_enabled = True
  • Environment Variable: DD_BOTO_ANALYTICS_ENABLED=true

Note: Several integrations require non-standard configuration due to the integration-specific implementation of the tracer. Consult the library documentation on App Analytics for details.

Database services

Database tracing is not captured by App Analytics by default and you must enable collection manually for each integration. For example:

  • Tracer Configuration: ddtrace.config.psycopg.analytics_enabled = True
  • Environment Variable: DD_PSYCOPG_ANALYTICS_ENABLED=true
Custom instrumentation

Applications with custom instrumentation can enable App Analytics by setting the ddtrace.constants.ANALYTICS_SAMPLE_RATE_KEY tag on a span:

from ddtrace import tracer
from ddtrace.constants import ANALYTICS_SAMPLE_RATE_KEY

@tracer.wrap()
def my_method():
    span = tracer.current_span()
    span.set_tag(ANALYTICS_SAMPLE_RATE_KEY, True)

In the Datadog Agent

This section describes deprecated features with configuration information relevant to legacy App Analytics.

To configure a rate of spans to analyze by service, setup the following in the datadog.yaml file:

apm_config:
  analyzed_rate_by_service:
    service_A: 1
    service_B: 0.2
    service_C: 0.05

To configure a rate of spans to analyze by service and operation name, setup the following in the datadog.yaml file:

apm_config:
  analyzed_spans:
    service_A|operation_name_X: 1
    service_A|operation_name_Y: 0.25
    service_B|operation_name_Z: 0.01

Troubleshooting: Maximum events per second limit

If you encounter the following error message in your Agent logs, your applications are emitting more than the default 200 trace events per second allowed by APM.

Max events per second reached (current=300.00/s, max=200.00/s). Some events are now being dropped (sample rate=0.54). Consider adjusting event sampling rates.

To increase the APM rate limit for the Agent, configure the max_events_per_second attribute within the Agent’s configuration file (underneath the apm_config: section). For containerized deployments (for example, Docker or Kubernetes), use the DD_APM_MAX_EPS environment variable.

Note: Increasing the APM rate limit could result in increased costs for App Analytics.

PREVIEWING: deforest/fix-security-rule-link