omninewrelic

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2026 License: MIT Imports: 1 Imported by: 0

README

Omni-NewRelic

Go CI Go Lint Go SAST Go Report Card Docs Visualization License

New Relic integrations for PlexusOne abstraction layers.

Overview

omni-newrelic wraps the official newrelic-client-go SDK and provides implementations for multiple PlexusOne packages:

Package Status Description
omnisignal ✅ Implemented Alert and incident ingestion
omniobserve ✅ Implemented Telemetry export and data querying

Installation

go get github.com/plexusone/omni-newrelic

Usage

Signal Ingestion (omnisignal)
import (
    "github.com/plexusone/omnisignal"
    _ "github.com/plexusone/omni-newrelic/omnisignal" // Register New Relic provider
)

func main() {
    provider, err := omnisignal.New("newrelic", omnisignal.Config{
        APIKey: os.Getenv("NEW_RELIC_API_KEY"),
        Options: map[string]any{
            "account_id": 12345,
            "region":     "US", // or "EU"
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    defer provider.Close()

    // Fetch incidents from the last 24 hours
    signals, err := provider.Fetch(ctx, omnisignal.FetchOptions{
        Since: time.Now().Add(-24 * time.Hour),
    })
    if err != nil {
        log.Fatal(err)
    }

    for _, sig := range signals {
        fmt.Printf("Signal: %s - %s\n", sig.ID, sig.Summary)
    }
}
Telemetry Export (omniobserve)

Import the package to register the New Relic telemetry provider:

import (
    "github.com/plexusone/omniobserve/observops"
    _ "github.com/plexusone/omni-newrelic/omniobserve" // Register New Relic provider
)

func main() {
    provider, err := observops.Open("newrelic",
        observops.WithAPIKey(os.Getenv("NEW_RELIC_LICENSE_KEY")),
        observops.WithServiceName("my-service"),
    )
    if err != nil {
        log.Fatal(err)
    }
    defer provider.Shutdown(context.Background())

    // Create metrics
    counter, _ := provider.Meter().Counter("requests_total")
    counter.Add(ctx, 1)

    // Create traces
    ctx, span := provider.Tracer().Start(ctx, "ProcessRequest")
    defer span.End()
}
Data Querying (omniobserve)

Query observability data from New Relic using NRQL, APM APIs, and entity search:

import "github.com/plexusone/omni-newrelic/omniobserve"

func main() {
    qp, err := omniobserve.NewQueryProvider(omniobserve.QueryConfig{
        APIKey:    os.Getenv("NEW_RELIC_API_KEY"),
        AccountID: 12345,
        Region:    "US",
    })
    if err != nil {
        log.Fatal(err)
    }
    defer qp.Close()

    // Execute NRQL queries
    result, err := qp.QueryNRQL(ctx, "SELECT count(*) FROM Transaction SINCE 1 hour ago")

    // List APM applications
    apps, err := qp.ListAPMApplications(ctx)

    // Search entities
    entities, err := qp.SearchEntities(ctx, omniobserve.EntitySearchOptions{
        Domain: "APM",
        Type:   "APPLICATION",
    })

    // Query logs
    logs, err := qp.QueryLogs(ctx, "level='ERROR'", 100, time.Hour)

    // Query distributed traces
    traces, err := qp.QueryTraces(ctx, "name='WebTransaction'", 50, time.Hour)
}

Configuration

omnisignal
Option Type Required Description
APIKey string Yes New Relic Personal API Key
account_id int Yes New Relic Account ID
region string No "US" (default) or "EU"
omniobserve (Telemetry Export)
Option Type Required Description
WithAPIKey string Yes New Relic License Key (Ingest)
WithServiceName string Yes Service name for telemetry
WithNewRelicRegion string No "us" (default) or "eu"
omniobserve (Data Query)
Option Type Required Description
APIKey string Yes New Relic Personal API Key (User key)
AccountID int Yes New Relic Account ID
Region string No "US" (default) or "EU"

Capabilities

omnisignal Provider
  • Fetch: List incidents with filtering by time and status
  • Acknowledge: Acknowledge open incidents
  • Close: Close open incidents
  • Streaming: Not supported (requires webhook configuration)
omniobserve Provider

Telemetry Export:

  • Metrics (counters, gauges, histograms)
  • Distributed tracing
  • Structured logging with trace correlation

Data Query:

  • NRQL query execution
  • APM application listing and metrics
  • Entity search across all domains
  • Log querying via NRQL
  • Distributed trace querying via NRQL

Changelog

See CHANGELOG.md for release history and RELEASE_NOTES_v0.1.0.md for detailed release notes.

License

MIT

Documentation

Overview

Package omninewrelic provides New Relic integrations for PlexusOne packages.

This package wraps the official newrelic-client-go SDK and provides implementations for multiple PlexusOne abstraction layers:

  • omnisignal: Alert and incident ingestion
  • omniobserve: Observability data access (future)

Usage:

import (
    "github.com/plexusone/omnisignal"
    _ "github.com/plexusone/omni-newrelic/omnisignal" // Register New Relic signal provider
)

provider, err := omnisignal.New("newrelic", omnisignal.Config{
    APIKey: os.Getenv("NEW_RELIC_API_KEY"),
    Options: map[string]any{
        "account_id": 12345,
        "region":     "US", // or "EU"
    },
})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*newrelic.NewRelic
	// contains filtered or unexported fields
}

Client wraps the New Relic client for use across PlexusOne packages.

func NewClient

func NewClient(cfg Config) (*Client, error)

NewClient creates a new New Relic client wrapper.

func (*Client) AccountID

func (c *Client) AccountID() int

AccountID returns the configured account ID.

type Config

type Config struct {
	// APIKey is the New Relic Personal API Key.
	APIKey string

	// AccountID is the New Relic account ID.
	AccountID int

	// Region is the New Relic region ("US" or "EU").
	// Defaults to "US".
	Region string
}

Config holds New Relic configuration.

Directories

Path Synopsis
Package omniobserve provides New Relic observability integration for omniobserve.
Package omniobserve provides New Relic observability integration for omniobserve.
Package omnisignal provides a New Relic signal provider for omnisignal.
Package omnisignal provides a New Relic signal provider for omnisignal.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL