Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ nrq apps get "production-api"
**Table Output:**
```
ID: 12345678
GUID: MjcxMjY0MHxBUE18QVBQTElDQVRJT058MTIzNDU2Nzg
GUID: MTIzNDU2N3xBUE18QVBQTElDQVRJT058MTIzNDU2Nzg
Name: production-api
Language: ruby
Alert Status: NOT_ALERTING
Expand Down Expand Up @@ -420,7 +420,7 @@ nrq deployments list 12345678
nrq deployments list --name "My Application"

# By entity GUID
nrq deployments list --guid "MjcxMjY0MHxBUE18..."
nrq deployments list --guid "MTIzNDU2N3xBUE18..."

# With time filtering
nrq deployments list 12345678 --since "7 days ago" --until "yesterday"
Expand Down Expand Up @@ -459,7 +459,7 @@ nrq deployments create 12345678 --revision v1.2.3
nrq deployments create --name "My Application" --revision v1.2.3

# By entity GUID
nrq deployments create --guid "MjcxMjY0MHxBUE18..." --revision v1.2.3
nrq deployments create --guid "MTIzNDU2N3xBUE18..." --revision v1.2.3

# Full example
nrq deployments create 12345678 \
Expand Down
28 changes: 14 additions & 14 deletions api/resolve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ import (
func TestEntityGUID_Parse(t *testing.T) {
t.Run("valid APM application GUID", func(t *testing.T) {
// Create a valid GUID: version|domain|type|entityId
rawGUID := "2712640|APM|APPLICATION|137708979"
rawGUID := "1234567|APM|APPLICATION|123456789"
encoded := base64.StdEncoding.EncodeToString([]byte(rawGUID))
guid := EntityGUID(encoded)

version, domain, entityType, entityID, err := guid.Parse()

assert.NoError(t, err)
assert.Equal(t, "2712640", version)
assert.Equal(t, "1234567", version)
assert.Equal(t, "APM", domain)
assert.Equal(t, "APPLICATION", entityType)
assert.Equal(t, "137708979", entityID)
assert.Equal(t, "123456789", entityID)
})

t.Run("invalid base64", func(t *testing.T) {
Expand All @@ -36,7 +36,7 @@ func TestEntityGUID_Parse(t *testing.T) {

t.Run("invalid format - wrong number of parts", func(t *testing.T) {
// Only 3 parts instead of 4
rawGUID := "2712640|APM|APPLICATION"
rawGUID := "1234567|APM|APPLICATION"
encoded := base64.StdEncoding.EncodeToString([]byte(rawGUID))
guid := EntityGUID(encoded)

Expand All @@ -49,18 +49,18 @@ func TestEntityGUID_Parse(t *testing.T) {

func TestEntityGUID_AppID(t *testing.T) {
t.Run("valid APM application GUID", func(t *testing.T) {
rawGUID := "2712640|APM|APPLICATION|137708979"
rawGUID := "1234567|APM|APPLICATION|123456789"
encoded := base64.StdEncoding.EncodeToString([]byte(rawGUID))
guid := EntityGUID(encoded)

appID, err := guid.AppID()

assert.NoError(t, err)
assert.Equal(t, "137708979", appID)
assert.Equal(t, "123456789", appID)
})

t.Run("non-APM entity", func(t *testing.T) {
rawGUID := "2712640|BROWSER|APPLICATION|137708979"
rawGUID := "1234567|BROWSER|APPLICATION|123456789"
encoded := base64.StdEncoding.EncodeToString([]byte(rawGUID))
guid := EntityGUID(encoded)

Expand All @@ -71,7 +71,7 @@ func TestEntityGUID_AppID(t *testing.T) {
})

t.Run("non-APPLICATION type", func(t *testing.T) {
rawGUID := "2712640|APM|HOST|137708979"
rawGUID := "1234567|APM|HOST|123456789"
encoded := base64.StdEncoding.EncodeToString([]byte(rawGUID))
guid := EntityGUID(encoded)

Expand All @@ -84,7 +84,7 @@ func TestEntityGUID_AppID(t *testing.T) {

func TestEntityGUID_Validate(t *testing.T) {
t.Run("valid GUID", func(t *testing.T) {
rawGUID := "2712640|APM|APPLICATION|137708979"
rawGUID := "1234567|APM|APPLICATION|123456789"
encoded := base64.StdEncoding.EncodeToString([]byte(rawGUID))
guid := EntityGUID(encoded)

Expand All @@ -103,7 +103,7 @@ func TestEntityGUID_Validate(t *testing.T) {
}

func TestEntityGUID_Domain(t *testing.T) {
rawGUID := "2712640|APM|APPLICATION|137708979"
rawGUID := "1234567|APM|APPLICATION|123456789"
encoded := base64.StdEncoding.EncodeToString([]byte(rawGUID))
guid := EntityGUID(encoded)

Expand All @@ -114,7 +114,7 @@ func TestEntityGUID_Domain(t *testing.T) {
}

func TestEntityGUID_EntityType(t *testing.T) {
rawGUID := "2712640|APM|APPLICATION|137708979"
rawGUID := "1234567|APM|APPLICATION|123456789"
encoded := base64.StdEncoding.EncodeToString([]byte(rawGUID))
guid := EntityGUID(encoded)

Expand All @@ -125,14 +125,14 @@ func TestEntityGUID_EntityType(t *testing.T) {
}

func TestEntityGUID_EntityID(t *testing.T) {
rawGUID := "2712640|APM|APPLICATION|137708979"
rawGUID := "1234567|APM|APPLICATION|123456789"
encoded := base64.StdEncoding.EncodeToString([]byte(rawGUID))
guid := EntityGUID(encoded)

entityID, err := guid.EntityID()

assert.NoError(t, err)
assert.Equal(t, "137708979", entityID)
assert.Equal(t, "123456789", entityID)
}

func TestEntityGUID_String(t *testing.T) {
Expand Down Expand Up @@ -169,7 +169,7 @@ func TestIsNumeric(t *testing.T) {

func TestIsValidEntityGUID(t *testing.T) {
t.Run("valid base64 GUID", func(t *testing.T) {
rawGUID := "2712640|APM|APPLICATION|137708979"
rawGUID := "1234567|APM|APPLICATION|123456789"
encoded := base64.StdEncoding.EncodeToString([]byte(rawGUID))

assert.True(t, IsValidEntityGUID(encoded))
Expand Down
8 changes: 4 additions & 4 deletions internal/cmd/dashboards/dashboards.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func newGetCmd(opts *root.Options) *cobra.Command {

The GUID is a base64-encoded entity identifier from 'dashboards list' or
the New Relic UI (visible in the dashboard URL).`,
Example: ` nrq dashboards get "MjcxMjY0MHxWSVp8REFTSEJPQVJEXDI5Mjg="`,
Example: ` nrq dashboards get "MTIzNDU2N3xWSVp8REFTSEJPQVJEXDI5Mjg="`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return runGet(opts, api.EntityGUID(args[0]))
Expand Down Expand Up @@ -252,7 +252,7 @@ func newUpdateCmd(opts *root.Options) *cobra.Command {
The JSON file format is the same as for 'dashboards create'.
The GUID identifies which dashboard to update.`,
Example: ` # Update a dashboard from a JSON file
nrq dashboards update "MjcxMjY0MHxWSVp8REFTSEJPQVJEXDI5Mjg=" --from-file dashboard.json`,
nrq dashboards update "MTIzNDU2N3xWSVp8REFTSEJPQVJEXDI5Mjg=" --from-file dashboard.json`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return runUpdate(updateOpts, api.EntityGUID(args[0]))
Expand Down Expand Up @@ -329,10 +329,10 @@ Use --force to skip the confirmation prompt.

WARNING: This action cannot be undone.`,
Example: ` # Delete with confirmation
nrq dashboards delete "MjcxMjY0MHxWSVp8REFTSEJPQVJEXDI5Mjg="
nrq dashboards delete "MTIzNDU2N3xWSVp8REFTSEJPQVJEXDI5Mjg="

# Delete without confirmation (use with caution)
nrq dashboards delete "MjcxMjY0MHxWSVp8REFTSEJPQVJEXDI5Mjg=" --force`,
nrq dashboards delete "MTIzNDU2N3xWSVp8REFTSEJPQVJEXDI5Mjg=" --force`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return runDelete(deleteOpts, api.EntityGUID(args[0]))
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/deployments/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Examples:
nrq deployments list --name "my-production-app"

# By entity GUID
nrq deployments list --guid "MjcxMjY0MHxBUE18QVBQTElDQVRJT058MTM3NzA4OTc5OQ"
nrq deployments list --guid "MTIzNDU2N3xBUE18QVBQTElDQVRJT058MTIzNDU2Nzg5OQ"

# With time filtering
nrq deployments list 12345678 --since "7 days ago"
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/logs/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Filter syntax uses Lucene query format:
Time range flags (--since, --until) set the visible window in the log viewer.
Without them, NR defaults to the last 30 minutes which may miss older data.`,
Example: ` # Link to error logs for a service (last hour)
nrq logs link 'entity.name:"prd-use1-monitapp-user-api-service" level:"ERROR"' --since "1 hour ago"
nrq logs link 'entity.name:"checkout-service" level:"ERROR"' --since "1 hour ago"

# Link to logs in a specific time range
nrq logs link 'message:"*timeout*"' --since "2026-03-10" --until "2026-03-11"
Expand Down
10 changes: 5 additions & 5 deletions internal/deeplink/deeplink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestBuildNRQLDeepLink(t *testing.T) {
}{
{
name: "simple query",
accountID: 2712640,
accountID: 1234567,
nrql: "SELECT count(*) FROM Transaction SINCE 1 hour ago",
},
{
Expand Down Expand Up @@ -79,12 +79,12 @@ func TestBuildLogDeepLink(t *testing.T) {
}{
{
name: "single entity error filter",
accountID: 2712640,
filterQuery: `entity.name:"prd-use1-monitapp-user-api-service" level:"ERROR"`,
accountID: 1234567,
filterQuery: `entity.name:"checkout-service" level:"ERROR"`,
},
{
name: "multiple entities",
accountID: 2712640,
accountID: 1234567,
filterQuery: `(entity.name:"svc-a" OR entity.name:"svc-b") level:"ERROR"`,
},
{
Expand All @@ -94,7 +94,7 @@ func TestBuildLogDeepLink(t *testing.T) {
},
{
name: "with time range",
accountID: 2712640,
accountID: 1234567,
filterQuery: `level:"ERROR"`,
beginMs: 1773323224894,
endMs: 1773323344894,
Expand Down
Loading