Skip to main content

New Relic SDK to interact with Nerdgraph API.

Project description

New Relic SB SDK

Automate your SRE tasks with ease using the New Relic SB SDK.

Community-Project

PyPI - Supported versions PyPI - Package version PyPI - Downloads PyPI - License Codacy Grade Badge Codacy Coverage Badge Gitlab Pipeline Status

This library provides a robust, typed Python client for the New Relic NerdGraph API, built on top of sgqlc. It simplifies the process of querying and mutating New Relic data, making it easier to build automation tools, monitoring scripts, and custom dashboards.

✨ Features

  • Typed Interactions: Leveraging sgqlc for type-safe GraphQL queries.
  • Easy Configuration: Simple setup with environment variables or direct initialization.
  • Comprehensive Coverage: Designed to support key SRE workflows.
  • Modern Stack: Built with Python 3.10+ and modern tooling.

📋 Requirements

  • Python 3.10.0 or higher

📦 Installation

Using pip

pip install newrelic-sb-sdk

Using uv

uv add newrelic-sb-sdk

🚀 Usage

Here is a simple example of how to use the NewRelicGqlClient to query the current user's information from New Relic.

import os
from newrelic_sb_sdk.client import NewRelicGqlClient
from sgqlc.operation import Operation

# Initialize the client
# Ensure NEW_RELIC_USER_KEY is set in your environment or pass it directly
client = NewRelicGqlClient(new_relic_user_key=os.getenv("NEW_RELIC_USER_KEY"))

# Create an operation based on the New Relic schema
op = Operation(client.schema.query_type)

# Select fields to query
op.actor.user.__fields__(
    "name",
    "email",
    "id"
)

# Execute the query
response = client.execute(op)

# Access the data as native Python objects
data = op + response.json()
user = data.actor.user

print(f"User: {user.name} <{user.email}> (ID: {user.id})")

For more advanced usage and examples, check out our Documentation and Playground.

🛠️ Development

We welcome contributions! Please see our Contribution Guide for details on setting up your development environment, running tests, and submitting pull requests.

The project uses uv for dependency management and ruff for linting.

📜 Changelog

See the CHANGELOG.md for a history of changes.

👥 Contributors

See our list of contributors.

📄 License

This project is licensed under the Apache License 2.0. See the LICENSE.txt file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

newrelic_sb_sdk-0.46.0.tar.gz (267.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

newrelic_sb_sdk-0.46.0-py3-none-any.whl (255.5 kB view details)

Uploaded Python 3

File details

Details for the file newrelic_sb_sdk-0.46.0.tar.gz.

File metadata

  • Download URL: newrelic_sb_sdk-0.46.0.tar.gz
  • Upload date:
  • Size: 267.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for newrelic_sb_sdk-0.46.0.tar.gz
Algorithm Hash digest
SHA256 b155a7622a3077c1680db84be3271c685436eb3c46a11535dcf8cd310f97d405
MD5 cded7b0528656ddfab9e711bc7c68519
BLAKE2b-256 f9fe5efe6129cf2bfff4745abe5ff70e4fbd04bf3d10b6a8d317f078d63795ce

See more details on using hashes here.

File details

Details for the file newrelic_sb_sdk-0.46.0-py3-none-any.whl.

File metadata

  • Download URL: newrelic_sb_sdk-0.46.0-py3-none-any.whl
  • Upload date:
  • Size: 255.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for newrelic_sb_sdk-0.46.0-py3-none-any.whl
Algorithm Hash digest
SHA256 836bf3b33e3c86a20298d36a7645affeca02ad1d513e56b44faa6e6b4ed266bd
MD5 f4432caf6407f09056cd20e950b0d36e
BLAKE2b-256 382754725782df2c6e262f3a79179ccf8f4a335a89dad22d2c92e4c3f84c3876

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page