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.44.0.tar.gz (238.5 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.44.0-py3-none-any.whl (229.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: newrelic_sb_sdk-0.44.0.tar.gz
  • Upload date:
  • Size: 238.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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.44.0.tar.gz
Algorithm Hash digest
SHA256 9bddc57cff4f43e23c872efe0a47e7c2dc893a0cd1826ee2897f3f8d2c8c2487
MD5 0e3fb2bca39354334d98fd6d3141524f
BLAKE2b-256 d904ea736021fdc87b9ffd36a7f1bc58eba800f9ad0f6dca52b081e1ea511a74

See more details on using hashes here.

File details

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

File metadata

  • Download URL: newrelic_sb_sdk-0.44.0-py3-none-any.whl
  • Upload date:
  • Size: 229.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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.44.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c54678b4103e2639424ffc354d890454c2199f64ccfe818c658c7a485547c8c9
MD5 16670fcb62daa7972cbd6f607ad27614
BLAKE2b-256 0d78e44c8b79c3cbea9ebbba03c1089ec466349b6a946fb9272f372fbca84b87

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