Skip to content

feat(transports/newrelic): add New Relic transport#90

Merged
theogravity merged 2 commits into
mainfrom
transports/newrelic
May 11, 2026
Merged

feat(transports/newrelic): add New Relic transport#90
theogravity merged 2 commits into
mainfrom
transports/newrelic

Conversation

@theogravity
Copy link
Copy Markdown
Contributor

Summary

Add a New Relic transport that wraps transports/http with New Relic Log Ingest API specific defaults: JSON-array encoding (logtype, timestamp, loglevel, message), site-aware intake URL derivation, and Api-Key header management.

New Module

  • Import: go.loglayer.dev/transports/newrelic
  • Go floor: inherits main module (1.25)
  • Dependencies: transports/http, github.com/goccy/go-json (as the core dependency)

Features

  • Site awareness: SiteUS (default) and SiteEU with correct intake URL derivation
  • On-prem support: Config.URL overrides site-derived URL
  • Non-https protection: Build() rejects http:// URLs by default (opt-out via Config.AllowInsecureURL)
  • License key redaction: Config.String() masks the key; json:"-" tag prevents JSON leak
  • Encoder: JSON-array format matching New Relic Log Ingest API spec
  • Level mapping: panic/fatal → "critical", rest → direct passthrough
  • API limit compliance: default BatchSize of 100 stays under 1MB per POST (documented in transport docs)

Sentinel Errors

  • ErrLicenseKeyRequired — empty license key
  • ErrInsecureURL — non-https URL without AllowInsecureURL
  • ErrHTTPOverrideForbiddenConfig.HTTP.URL or Config.HTTP.Encoder set by caller

Documentation

New docs/src/transports/newrelic.md page covering installation, usage, configuration, and API limits. Also removes "Live Test" sections from datadog.md and otellog.md transport docs (development artifacts don't belong in user-facing docs).

Docs Rules Update

  • Added rule to .claude/rules/documentation.md prohibiting "Live Test" sections in transport/plugin docs
  • Clarified sub-module versioning guidance (no /v2 suffix on module path initially)

Testing

  • 21 unit tests covering batch delivery, flush behavior, header verification, error handling, level filtering, encoded body shape, field/metadata passthrough, idempotent Close, panics, Build error returns, insecure URL rejection, HTTP override errors, site URL derivation, license key redaction, group forwarding, level mapping, JSON tag verification, URL override, and custom header merging
  • Live test (//go:build livetest) verified against real New Relic US intake API
  • goleak test main with HTTP connection-pool ignores

Changeset

.changeset/calm-ivy.md: transports/newrelic:majorv1.0.0

github-actions Bot and others added 2 commits May 6, 2026 00:57
monorel-Release: transports/axiom v1.0.0
monorel-PreRelease: false

Co-authored-by: monorel-bot[automation] <monorel-bot@users.noreply.github.com>
Wrap transports/http with New Relic-specific encoding,
site-aware URL derivation, and Api-Key header management.

Supports US and EU sites, on-prem URL overrides, and all
standard loglayer features (fields, metadata, groups,
level filtering, error handling).

- transports/newrelic: New Relic Log Ingest API transport
  - Site-aware intake URL (US, EU)
  - Configurable on-prem URL override
  - Non-https URL rejection (with AllowInsecureURL opt-out)
  - License key redaction in String() and JSON output
  - Build-tagged live test against real intake API
  - JSON-array encoder (logtype, timestamp, loglevel, message)
  - Level mapping: panic/fatal → critical, rest → passthrough
  - ErrLicenseKeyRequired, ErrInsecureURL,
    ErrHTTPOverrideForbidden sentinels
- docs: New Relic transport docs page
- docs: Remove live test sections from transport docs
- docs: Clarify sub-module versioning guidance
@theogravity theogravity enabled auto-merge (squash) May 11, 2026 00:29
@theogravity theogravity disabled auto-merge May 11, 2026 00:29
@theogravity theogravity merged commit 349350b into main May 11, 2026
13 checks passed
@theogravity theogravity deleted the transports/newrelic branch May 11, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant