Documentation
¶
Overview ¶
Package newrelic is a dfetch Connector backed by New Relic's NerdGraph GraphQL API (https://docs.newrelic.com/docs/apis/nerdgraph/get-started/introduction-new-relic-nerdgraph/). It is a dynamic source: NRDB event types (Transaction, Span, Log, custom types) are discovered on demand and scanned by translating the pushed-down request into NRQL. It additionally serves curated tables (accounts, entities, alert_policies, alert_conditions, issues, incidents) from NerdGraph object queries. It is config-only (`type: newrelic`): construction requires an account_id param and a User API key (NOT the ingest license key) from the environment.
Index ¶
- func New(params map[string]any) (source.Connector, error)
- type Connector
- func (c *Connector) DescribeTable(ctx context.Context, table string) (source.TableSchema, bool, error)
- func (c *Connector) ListTables(ctx context.Context, opts source.ListOptions) ([]string, error)
- func (c *Connector) Scan(ctx context.Context, req source.ScanRequest, emit func(*source.Rows) error) error
- func (c *Connector) Tables() []source.TableSchema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New builds a New Relic connector. Required: params["account_id"], and a User API key from $DFETCH_NEWRELIC_API_KEY or $NEW_RELIC_API_KEY — the key is checked only when a newrelic table is actually used, so a config that declares this source doesn't break unrelated dfetch commands for people without the env var. Optional params: "region" ("US" default, "EU"), "base_url" (overrides region; used by tests), "max_rows" (cap on un-pushable-LIMIT scans; default and max 5000, the NRQL hard cap), "nrql_timeout" (seconds, default 70, max 120). It is config-only — registered for `type: newrelic`, never auto-instantiated.
Types ¶
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
Connector talks to one New Relic account through NerdGraph.
func (*Connector) DescribeTable ¶
func (c *Connector) DescribeTable(ctx context.Context, table string) (source.TableSchema, bool, error)
DescribeTable resolves one table's columns: curated names first (fixed schemas, no API call — they always win over a same-named NRDB event type), then the keyset() of the event type. found is false for an unknown or idle event type.
func (*Connector) ListTables ¶
ListTables lists NRDB event types seen in the last week plus the curated tables, filtered by a case-insensitive substring.
func (*Connector) Scan ¶
func (c *Connector) Scan(ctx context.Context, req source.ScanRequest, emit func(*source.Rows) error) error
Scan dispatches curated tables to their NerdGraph fetchers and everything else to the dynamic NRDB path.
func (*Connector) Tables ¶
func (c *Connector) Tables() []source.TableSchema
Tables returns the curated table schemas. NRDB event types are dynamic and resolved on demand via DescribeTable/ListTables instead.