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.47.0.tar.gz (271.7 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.47.0-py3-none-any.whl (259.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: newrelic_sb_sdk-0.47.0.tar.gz
  • Upload date:
  • Size: 271.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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.47.0.tar.gz
Algorithm Hash digest
SHA256 fbbe525584b760dfc897db35b43591761648fd9d3754cf8962cf614b4a9b8569
MD5 d8f659cf23eb3f38a2ca823ab3dc6f4a
BLAKE2b-256 87b806084851b673d0b281bc2c157a5e0854a68eab850aa83c2c1027e240e80b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: newrelic_sb_sdk-0.47.0-py3-none-any.whl
  • Upload date:
  • Size: 259.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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.47.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f617f55e92fc8a1e818c3eb8fe82fba0f59f412a98ecd0cacd92c12f12e859a7
MD5 307279791af1dcdcbb1c117bf89923a2
BLAKE2b-256 7a90bc73c447bbad213da05f8fde74d4aa7df3d5735b564e04de23bdad6b4e26

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