KosmoKrator

analytics

New Relic Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the New Relic KosmoKrator integration.

7 functions 6 read 1 write API key auth

Lua Namespace

Agents call this integration through app.integrations.newrelic.*. Use lua_read_doc("integrations.newrelic") inside KosmoKrator to discover the same reference at runtime.

Agent-Facing Lua Docs

This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.

New Relic — Lua API Reference

list_applications

List APM applications in the configured New Relic account.

Parameters

None.

Example

local result = app.integrations.newrelic.list_applications({})

for _, app in ipairs(result) do
  print(app.name .. " (" .. app.applicationId .. ") - " .. app.healthStatus)
end

get_application

Get details of a specific APM application by its application ID.

Parameters

NameTypeRequiredDescription
application_idintegeryesThe New Relic application ID

Example

local result = app.integrations.newrelic.get_application({
  application_id = 12345678
})

print("Name: " .. result.name)
print("Language: " .. result.language)
print("Health: " .. result.healthStatus)

list_deployments

List deployment markers for a New Relic APM application.

Parameters

NameTypeRequiredDescription
application_guidstringyesThe entity GUID of the application

Example

local result = app.integrations.newrelic.list_deployments({
  application_guid = "MxJ9MxNNTU2NjIxFExWFxBfEFBVXxBYU"
})

for _, dep in ipairs(result) do
  print(dep.revision .. " by " .. dep.user .. " at " .. dep.timestamp)
end

create_deployment

Record a new deployment marker in New Relic.

Parameters

NameTypeRequiredDescription
application_guidstringyesThe entity GUID of the application
revisionstringyesDeployment revision (e.g. commit SHA, version)
descriptionstringnoDescription of the deployment
userstringnoUser who triggered the deployment
changelogstringnoChangelog or commit message

Example

local result = app.integrations.newrelic.create_deployment({
  application_guid = "MxJ9MxNNTU2NjIxFExWFxBfEFBVXxBYU",
  revision = "abc123def456",
  description = "Release v2.5.0",
  user = "deploy-bot",
  changelog = "feat: add user dashboard"
})

print("Deployment created: " .. result.guid)

list_alert_policies

List alert policies in the configured New Relic account.

Parameters

None.

Example

local result = app.integrations.newrelic.list_alert_policies({})

for _, policy in ipairs(result) do
  print(policy.name .. " (ID: " .. policy.id .. ")")
end

list_dashboards

List dashboards in the configured New Relic account.

Parameters

None.

Example

local result = app.integrations.newrelic.list_dashboards({})

for _, dash in ipairs(result) do
  print(dash.title .. " - owner: " .. (dash.owner.email or "unknown"))
end

get_current_user

Get the profile of the currently authenticated New Relic user.

Parameters

None.

Example

local result = app.integrations.newrelic.get_current_user({})
print("User: " .. result.actor.user.name)
print("Email: " .. result.actor.user.email)

Multi-Account Usage

If you have multiple New Relic accounts configured, use account-specific namespaces:

-- Default account (always works)
app.integrations.newrelic.function_name({...})

-- Explicit default (portable across setups)
app.integrations.newrelic.default.function_name({...})

-- Named accounts
app.integrations.newrelic.production.function_name({...})
app.integrations.newrelic.staging.function_name({...})

All functions are identical across accounts — only the credentials differ.

Raw agent markdown
# New Relic — Lua API Reference

## list_applications

List APM applications in the configured New Relic account.

### Parameters

None.

### Example

```lua
local result = app.integrations.newrelic.list_applications({})

for _, app in ipairs(result) do
  print(app.name .. " (" .. app.applicationId .. ") - " .. app.healthStatus)
end
```

---

## get_application

Get details of a specific APM application by its application ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `application_id` | integer | yes | The New Relic application ID |

### Example

```lua
local result = app.integrations.newrelic.get_application({
  application_id = 12345678
})

print("Name: " .. result.name)
print("Language: " .. result.language)
print("Health: " .. result.healthStatus)
```

---

## list_deployments

List deployment markers for a New Relic APM application.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `application_guid` | string | yes | The entity GUID of the application |

### Example

```lua
local result = app.integrations.newrelic.list_deployments({
  application_guid = "MxJ9MxNNTU2NjIxFExWFxBfEFBVXxBYU"
})

for _, dep in ipairs(result) do
  print(dep.revision .. " by " .. dep.user .. " at " .. dep.timestamp)
end
```

---

## create_deployment

Record a new deployment marker in New Relic.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `application_guid` | string | yes | The entity GUID of the application |
| `revision` | string | yes | Deployment revision (e.g. commit SHA, version) |
| `description` | string | no | Description of the deployment |
| `user` | string | no | User who triggered the deployment |
| `changelog` | string | no | Changelog or commit message |

### Example

```lua
local result = app.integrations.newrelic.create_deployment({
  application_guid = "MxJ9MxNNTU2NjIxFExWFxBfEFBVXxBYU",
  revision = "abc123def456",
  description = "Release v2.5.0",
  user = "deploy-bot",
  changelog = "feat: add user dashboard"
})

print("Deployment created: " .. result.guid)
```

---

## list_alert_policies

List alert policies in the configured New Relic account.

### Parameters

None.

### Example

```lua
local result = app.integrations.newrelic.list_alert_policies({})

for _, policy in ipairs(result) do
  print(policy.name .. " (ID: " .. policy.id .. ")")
end
```

---

## list_dashboards

List dashboards in the configured New Relic account.

### Parameters

None.

### Example

```lua
local result = app.integrations.newrelic.list_dashboards({})

for _, dash in ipairs(result) do
  print(dash.title .. " - owner: " .. (dash.owner.email or "unknown"))
end
```

---

## get_current_user

Get the profile of the currently authenticated New Relic user.

### Parameters

None.

### Example

```lua
local result = app.integrations.newrelic.get_current_user({})
print("User: " .. result.actor.user.name)
print("Email: " .. result.actor.user.email)
```

---

## Multi-Account Usage

If you have multiple New Relic accounts configured, use account-specific namespaces:

```lua
-- Default account (always works)
app.integrations.newrelic.function_name({...})

-- Explicit default (portable across setups)
app.integrations.newrelic.default.function_name({...})

-- Named accounts
app.integrations.newrelic.production.function_name({...})
app.integrations.newrelic.staging.function_name({...})
```

All functions are identical across accounts — only the credentials differ.

Metadata-Derived Lua Example

local result = app.integrations.newrelic.newrelic_list_applications({})
print(result)

Functions

newrelic_list_applications

List APM applications in the configured New Relic account. Returns application names, GUIDs, IDs, language, reporting status, and health status.

Operation
Read read
Full name
newrelic.newrelic_list_applications
ParameterTypeRequiredDescription
No parameters.

newrelic_get_application

Get details of a specific New Relic APM application by its application ID, including language, health status, and Apdex thresholds.

Operation
Read read
Full name
newrelic.newrelic_get_application
ParameterTypeRequiredDescription
application_id integer yes The New Relic application ID.

newrelic_list_deployments

List deployment markers for a New Relic APM application. Requires the application entity GUID.

Operation
Read read
Full name
newrelic.newrelic_list_deployments
ParameterTypeRequiredDescription
application_guid string yes The entity GUID of the New Relic application.

newrelic_create_deployment

Record a new deployment marker in New Relic for a given application. This helps correlate deploys with performance changes.

Operation
Write write
Full name
newrelic.newrelic_create_deployment
ParameterTypeRequiredDescription
application_guid string yes The entity GUID of the New Relic application.
revision string yes The deployment revision (e.g. commit SHA, version number).
description string no A description of the deployment.
user string no The user who triggered the deployment.
changelog string no Changelog or commit message for the deployment.

newrelic_list_alert_policies

List alert policies in the configured New Relic account. Returns policy names, IDs, and incident preferences.

Operation
Read read
Full name
newrelic.newrelic_list_alert_policies
ParameterTypeRequiredDescription
No parameters.

newrelic_list_dashboards

List dashboards in the configured New Relic account. Returns dashboard titles, GUIDs, timestamps, and owner information.

Operation
Read read
Full name
newrelic.newrelic_list_dashboards
ParameterTypeRequiredDescription
No parameters.

newrelic_get_current_user

Get the profile of the currently authenticated New Relic user. Useful for verifying API credentials and retrieving account information.

Operation
Read read
Full name
newrelic.newrelic_get_current_user
ParameterTypeRequiredDescription
No parameters.