Skip to content

Conversation

@AbbanMustafa
Copy link
Contributor

@AbbanMustafa AbbanMustafa commented Feb 6, 2026

Why

Record Unknown Errors with Datadog logs so that we can index by build ID, track patterns, and determing regressions/fixes. More detailed here https://github.com/expo/universe/pull/24771

How

Use Datadogs log ingestion API https://docs.datadoghq.com/api/latest/logs/#send-logs

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Subscribed to pull request

File Patterns Mentions
**/* @douglowder

Generated by CodeMention

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Size Change: -1.61 kB (0%)

Total Size: 72.7 MB

Filename Size Change
./packages/eas-cli/dist/eas-linux-x64.tar.gz 72.7 MB -1.61 kB (0%)

compressed-size-action

@AbbanMustafa AbbanMustafa added the no changelog PR that doesn't require a changelog entry label Feb 6, 2026
const rawMessage =
maybeRawError instanceof Error ? maybeRawError.message : 'An unknown error occurred';
void datadogLogs.send({
message: `Unknown build error: ${rawMessage}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is "unknown build error:" helpful here?

void datadogLogs.send({
message: `Unknown build error: ${rawMessage}`,
level: 'error',
tags: { build_id: this.buildId },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the cardinality on this ok? I've heard high cardinality is where we would pay big bucks

Copy link
Contributor Author

@AbbanMustafa AbbanMustafa Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesnt apply to logs fields, that pricing is for custom metrics.

Adding a high-cardinality tag like a Build ID to your logs does not directly increase your per-log "Log Management" price, but it can trigger massive costs elsewhere in your Datadog bill.
Here is how that high-variable tag affects different parts of your bill:

  1. Log Management (Ingestion & Indexing)
    Direct Cost: There is no extra charge for adding more tags or high-cardinality attributes to your logs.
    The "Weight" Impact: Adding a long tag string increases the size (bytes) of each log. Since you are billed for ingestion by the gigabyte (~$0.10/GB), a very large number of long tags could slightly increase your ingestion costs over time.
  2. The Trap: "Log-Based Metrics"
    The real danger is if you use that tag in a Log-Based Metric.
    The Cost: Datadog charges for custom metrics based on the number of unique tag combinations (cardinality).
    The Result: If you create a metric from your logs and include the build_id tag, every single build will create a new "unique time series." This can quickly exceed your custom metric allotment and lead to thousands of dollars in overage fees ($0.05 per metric/month).

if (err.errorCode === errors.ErrorCode.UNKNOWN_ERROR) {
const rawMessage =
maybeRawError instanceof Error ? maybeRawError.message : 'An unknown error occurred';
void datadogLogs.send({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void datadogLogs.send({
datadogLogs.send({

?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also note technically we might finish the build before we get to send the request. Might be ok but worth mentioning.

method: 'POST',
headers: {
'Content-Type': 'application/json',
'DD-API-KEY': this.apiKey,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If worker has access to DataDog API key we could as well set it here — users are going to have access to it.

For step metrics we decided to relay these through www. Why can we not do it for this?

Comment on lines 3 to 8
interface DatadogLogsOptions {
apiKey: string | null;
site: string;
service: string;
logger: bunyan;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does AI like to extract these interfaces so much instead of inlining in the constructor…

]),
});
} catch (error) {
this.logger.error(error, 'Failed to send log to Datadog');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this.logger.error(error, 'Failed to send log to Datadog');
this.logger.error({ err: error }, 'Failed to send log to Datadog');

This is bunyan nomenclature

@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.31%. Comparing base (9c7ac49) to head (e3144d8).
⚠️ Report is 24 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3386      +/-   ##
==========================================
+ Coverage   49.63%   52.31%   +2.69%     
==========================================
  Files         673      804     +131     
  Lines       28355    33425    +5070     
  Branches     5903     6975    +1072     
==========================================
+ Hits        14070    17482    +3412     
- Misses      13082    14555    +1473     
- Partials     1203     1388     +185     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

⏩ The changelog entry check has been skipped since the "no changelog" label is present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog PR that doesn't require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants