# Hosted monitoring: Datadog, New Relic and Dynatrace

What the paid observability platforms add on top of the open-source stack, how each one charges, what drives a surprise bill, and how to decide between running it yourself and paying someone else.

Course: [Monitoring](https://devops.rajeev.pro/courses/monitoring), lesson 9. About 25 minutes, intermediate. Source: https://devops.rajeev.pro/courses/monitoring/09-hosted-monitoring-tools

## What you will learn

- Explain what a hosted observability platform does that a self-hosted stack doesn't
- Describe the main strengths of Datadog, New Relic and Dynatrace
- Name the pricing units each uses and the usual causes of a surprise bill
- Use OpenTelemetry to keep the choice of vendor reversible
- Decide between self-hosted, hosted and a mix for a given team

The stack from this course costs nothing in licences, but someone has to run it: upgrades, storage,
scaling and high availability. Hosted platforms run all of that for you and add features on top, and
charge by how much data you send. In this lesson you'll see what Datadog, New Relic and Dynatrace
add, how they charge, and how to decide.

> **Figure.** Left, self-hosted open source with Prometheus, Grafana, Loki and Tempo: no licence and data stays in your network, PromQL and Grafana skills transfer anywhere, full control of retention and cost; but you run upgrades, scaling, HA and backups, long-term storage needs Thanos or Mimir, and APM and real-user monitoring take extra work. Fits a platform team, steady scale, data that must stay in-house, tight budgets. Right, hosted SaaS with Datadog, New Relic and Dynatrace: install an agent and see data in minutes, APM, RUM, synthetics and security in one place, the vendor runs storage, scaling and upgrades; but priced per host, GB ingested or user and grows fast, custom metrics and logs drive surprise bills, data leaves your network and there is lock-in risk. Fits small teams with no time to run monitoring, or many languages and services. Below, OpenTelemetry: instrument once, send to either side.
>
> Both sides collect the same three signals. The difference is who runs the machinery and how you pay.

## What the platforms add

All three collect metrics, logs and traces. On top, they sell:

- **APM** (application performance monitoring): automatic tracing and per-endpoint latency and
  error rates for your services, from an agent with little or no code change.
- **RUM** (real user monitoring): a script in your web pages or mobile app that measures what real
  users experience: page load time, JavaScript errors, slow clicks.
- **Synthetic monitoring**: robots that load your login page or call your API every minute from
  several countries, so you know it's down before users do.
- **Correlation**: click from a slow endpoint to its traces, to the logs of that trace, to the
  host's CPU, without building derived fields and links yourself.
- **Anomaly detection and AI assistance**: alerts on "unusual for this hour" rather than fixed
  thresholds, and suggested root causes.
- **Security products** on the same agent: vulnerability scanning, runtime threat detection, SIEM.

## Datadog

**Datadog** started as infrastructure monitoring for the cloud and grew into the broadest platform.
You install the **Datadog Agent** on hosts (or as a DaemonSet on Kubernetes), and turn on
**integrations**: there are hundreds, for AWS, PostgreSQL, Nginx, Kafka and so on, each with
ready-made dashboards.

- **Strengths:** very wide integrations, good dashboards and Kubernetes views, strong APM, logs,
  RUM and synthetics in one place, and security products on the same agent.
- **How it charges:** mostly per product. Infrastructure and APM per host, logs by GB ingested plus
  by events indexed (kept searchable), and **custom metrics** by number of distinct series.
- **Watch out for:** custom metric cardinality. A metric with a `user_id` tag becomes one billable
  series per user. Use Datadog's usage pages from day one, and decide which logs to index and which
  to only archive.

## New Relic

**New Relic** began as an APM tool for application developers and is now a full platform on its own
database, **NRDB**, queried with **NRQL**, a SQL-like language
(`SELECT average(duration) FROM Transaction FACET name SINCE 1 hour ago`).

- **Strengths:** deep APM for many languages, one query language across all data, and a
  usage-based model where all products are included rather than bought one by one.
- **How it charges:** by **data ingested** (GB per month) plus **users**, with different user types
  (full platform users cost the most). There's a free tier with a limited amount of data and users,
  useful for learning and small projects.
- **Watch out for:** full-platform users add up as a team grows, and noisy logs fill the data
  allowance. Decide who needs full access, and drop or sample low-value data before it's sent.

## Dynatrace

**Dynatrace** is popular in large enterprises. Its **OneAgent** installs once per host and
discovers processes, services and their connections automatically, building a live dependency map
called **Smartscape**. Its AI engine, **Davis**, uses that map to group related problems and point
at a likely root cause.

- **Strengths:** very little manual setup, automatic discovery and topology, strong root-cause
  analysis, and a good fit for big, mixed estates (Kubernetes, VMs, mainframes, many languages).
- **How it charges:** mainly by host size and time (memory per host per hour for full-stack
  monitoring) plus data volumes for logs and other features, usually under an annual commitment.
- **Watch out for:** an enterprise sales process and commitments; it's rarely the first choice for
  a small team.

### Others worth knowing

**Grafana Cloud** hosts the same Prometheus, Loki, Tempo and Grafana you learned in this course,
so the skills carry over directly. **Elastic Cloud** hosts the Elastic Stack. **Honeycomb** focuses
on tracing and high-cardinality questions. **AWS CloudWatch**, Azure Monitor and Google Cloud
Monitoring come with their clouds and cover their own services first.

## Keep the choice reversible

The single best decision is to **instrument with OpenTelemetry**, not with a vendor's own SDK.
Datadog, New Relic and Dynatrace all accept OTLP. Your services send to an OpenTelemetry Collector,
and the Collector's exporters decide where data goes:

```yaml
# otel-collector.yaml (exporters only)
exporters:
  otlp/jaeger: # the self-hosted backend from lesson 6
    endpoint: jaeger:4317
    tls:
      insecure: true
  otlphttp/vendor: # any vendor that accepts OTLP over HTTP
    endpoint: https://otlp.vendor.example.com
    headers:
      api-key: ${env:VENDOR_API_KEY}
```

Trying a vendor, sending to two backends during a migration, or leaving one, becomes a Collector
change. The application code doesn't move. The vendor's own agent may still be worth it for
features such as RUM or automatic discovery; just keep your core instrumentation standard.

## Decide: build, buy or mix

Ask these questions in order:

1. **Who would run it?** No platform engineer with time for monitoring → hosted.
2. **How much data, and how fast is it growing?** Estimate hosts, log GB per day and custom metric
   series, then price it. Self-hosted cost is mostly people; hosted cost is mostly volume.
3. **Where must data live?** Strict data residency or regulations can rule out some vendors or
   regions.
4. **What do you need beyond the three signals?** RUM, synthetics and security from one vendor can
   be worth more than the licence saving.
5. **What do you already know?** A team fluent in PromQL and Grafana is productive on day one with
   self-hosted or Grafana Cloud.

Many teams **mix**: Prometheus and Grafana for infrastructure and Kubernetes metrics (huge volume,
cheap to keep yourself), and a vendor for APM and RUM (hard to build, valuable). Whatever you choose,
the bill follows data volume, so cut noise at the source: drop debug logs in production, keep metric
labels low-cardinality, and sample traces.

> **Set budgets and alerts on the bill.** Every vendor has usage dashboards and limits. Set a daily ingestion cap or a usage alert on the first day. Teams regularly find out about a runaway debug log or a new high-cardinality tag from the invoice, a month too late.

## Mission: Make the build-or-buy case for your team

For one real or imagined team, write a one-page comparison of self-hosted (Prometheus, Grafana, Loki, Tempo) against one hosted vendor. Include estimated volumes (hosts, log GB per day, custom metric series), the main costs of each option (licence or people hours), what each gives you beyond the three signals, the data-location constraint, and your recommendation in two sentences.

- You need: Your team's services, or: 30 hosts, 40 GB logs/day, 200k metric series, 6 engineers
- You'll have: ~/build-vs-buy.md

```text
Team: 6 engineers, 30 hosts on Kubernetes, 40 GB logs/day, ~200k series
Self-hosted:  no licence; ~1 engineer-day/week to run; skills already in team; data stays in-house
Hosted (X):   price 30 hosts + APM + 40 GB/day logs from the vendor's pricing page; zero ops; adds RUM, synthetics
Volumes to cut first: debug logs (~15 GB/day), a user_id label on 2 metrics
Recommendation: metrics and logs self-hosted on the existing stack; buy APM and RUM only.
                Instrument with OpenTelemetry so the APM vendor can change later.
```

There's no single right answer. A good case shows the volumes, the people cost and the reason for
the choice. Use each vendor's current pricing page: prices change, and the units matter more than
any number in a course.

## Try it

- List the services your team runs and estimate hosts, log GB per day and custom metric series for each.
- Read the pricing page of one vendor and work out what your estimate would cost per month.
- Point the OpenTelemetry Collector from the tracing lesson at a second exporter, and note what changed in your app (nothing).
- Find the five highest-volume log sources in Loki with `topk(5, sum by (container) (bytes_over_time({host="lab-1"}[1h])))`.
- Do the mini mission and keep `~/build-vs-buy.md`.

## Quiz

1. What is the main thing you pay a hosted observability platform for?
   - Better metrics than Prometheus can collect
   - **Someone else runs the storage, scaling, upgrades and UI, and it adds features such as APM, real-user monitoring and synthetics in one place** (answer)
   - Faster servers
   Why: The signals are the same metrics, logs and traces. You're buying operations work you no longer do, plus integrated features that take effort to build yourself.

2. A team's Datadog bill doubled in a month without new servers. What is the most likely cause?
   - The agent got slower
   - **New high-cardinality custom metrics or a jump in ingested and indexed logs** (answer)
   - Grafana dashboards
   Why: Hosted tools usually charge for custom metric series and log volume. One label with user IDs, or a service logging at debug level, can multiply the bill.

3. Why instrument with OpenTelemetry even if you use a vendor's platform?
   - Vendors require it
   - **Your code emits a standard format, so switching or adding a backend is a Collector config change, not re-instrumenting every service** (answer)
   - It makes the data free
   Why: Vendor-specific agents and SDKs tie your code to one platform. OTLP is accepted by all three vendors and by the open-source backends.

4. Which situation fits a self-hosted Prometheus and Grafana stack best?
   - A three-person startup with no time to run infrastructure
   - **A platform team with Kubernetes skills, steady scale, a tight budget and data that must stay in-house** (answer)
   - A company that needs real-user monitoring next week
   Why: Self-hosting trades licence cost for operations work. It pays off when you have the people to run it and reasons like budget or data location.

## Resources

- [Datadog documentation](https://docs.datadoghq.com/) (Datadog)
- [Datadog pricing](https://www.datadoghq.com/pricing/) (Datadog)
- [New Relic documentation](https://docs.newrelic.com/) (New Relic)
- [New Relic pricing](https://newrelic.com/pricing) (New Relic)
- [Dynatrace documentation](https://docs.dynatrace.com/docs) (Dynatrace)
- [OpenTelemetry vendors that support OTLP](https://opentelemetry.io/ecosystem/vendors/) (OpenTelemetry)
