Skip to content

Commit

Permalink
Resolved #635 by adding a new LoggerRestResource that can be used by …
Browse files Browse the repository at this point in the history
…external systems to store logging data in Salesforce, using OpenTelemetry's logs data model
  • Loading branch information
jongpie committed Sep 18, 2024
1 parent 1629291 commit b203f60
Show file tree
Hide file tree
Showing 23 changed files with 989 additions and 13 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

The most robust observability solution for Salesforce experts. Built 100% natively on the platform, and designed to work seamlessly with Apex, Lightning Components, Flow, Process Builder & integrations.

## Unlocked Package - v4.14.10
## Unlocked Package - v4.14.11

[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015oTdQAI)
[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015oTdQAI)
Expand Down Expand Up @@ -40,6 +40,7 @@ The most robust observability solution for Salesforce experts. Built 100% native
- [Lightning Components](https://github.com/jongpie/NebulaLogger/wiki/Logging-in-Components): lightning web components (LWCs) & aura components
- [Flow & Process Builder](https://github.com/jongpie/NebulaLogger/wiki/Logging-in-Flow): any Flow type that supports invocable actions
- [OmniStudio](https://github.com/jongpie/NebulaLogger/wiki/Logging-in-OmniStudio): omniscripts and omni integration procedures
- [OpenTelemetry (OTel) REST API](https://github.com/jongpie/NebulaLogger/wiki/Logging-in-OpenTelemetry-REST-API): inbound integrations, using HTTP and [OTel's JSON format for logs](https://github.com/open-telemetry/opentelemetry-proto/blob/main/examples/logs.json)

2. Built with an event-driven pub/sub messaging architecture, using `LogEntryEvent__e` [platform events](https://developer.salesforce.com/docs/atlas.en-us.platform_events.meta/platform_events/platform_events_intro.htm). For more details on leveraging platform events, see [the Platform Events Developer Guide site](https://developer.salesforce.com/docs/atlas.en-us.platform_events.meta/platform_events/platform_events_subscribe_cometd.htm)

Expand Down
193 changes: 193 additions & 0 deletions docs/apex/Log-Management/LoggerRestResource.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
---
layout: default
---

## LoggerRestResource class

REST Resource class for external integrations to interact with Nebula Logger

---

### Properties

#### `body``String`

#### `endpointRequest``EndpointRequest`

#### `errors``List<EndpointError>`

#### `headerKeys``List<String>`

#### `httpMethod``String`

#### `isSuccess``Boolean`

#### `message``String`

#### `name``String`

#### `parameters``Map<String, String>`

#### `particle``String`

#### `statusCode``Integer`

#### `type``String`

#### `uri``String`

---

### Methods

#### `EndpointError(System.Exception apexException)``public`

#### `EndpointError(String message)``public`

#### `EndpointError(String message, String type)``public`

#### `EndpointRequest(System.RestRequest restRequest)``public`

#### `addError(System.Exception apexException)``EndpointResponse`

#### `addError(EndpointError endpointError)``EndpointResponse`

#### `handlePost()``void`

Processes any HTTP POST requests sent

#### `handlePost(EndpointRequest endpointRequest)``EndpointResponse`

#### `handlePost(EndpointRequest endpointRequest)``EndpointResponse`

#### `handlePost(EndpointRequest endpointRequest)``EndpointResponse`

#### `setStatusCode(Integer statusCode)``EndpointResponse`

---

### Inner Classes

#### LoggerRestResource.OTelAttribute class

---

##### Constructors

###### `OTelAttribute(String key, String value)`

---

##### Properties

###### `key``String`

###### `value``OTelAttributeValue`

---

#### LoggerRestResource.OTelAttributeValue class

---

##### Constructors

###### `OTelAttributeValue(String value)`

---

##### Properties

###### `stringValue``String`

---

#### LoggerRestResource.OTelLogRecord class

---

##### Properties

###### `attributes``List<OTelAttribute>`

###### `body``OTelAttributeValue`

###### `severityText``String`

###### `timeUnixNano``String`

---

##### Methods

###### `getLogEntryEvent()``LogEntryEvent__e`

---

#### LoggerRestResource.OTelLogsPayload class

---

##### Properties

###### `resourceLogs``List<OTelResourceLog>`

---

##### Methods

###### `getConvertedLogEntryEvents()``List<LogEntryEvent__e>`

---

#### LoggerRestResource.OTelResource class

---

##### Properties

###### `attributes``List<OTelAttribute>`

---

#### LoggerRestResource.OTelResourceLog class

---

##### Properties

###### `resource``OTelResource`

###### `scopeLogs``List<OTelScopeLog>`

---

##### Methods

###### `getLogEntryEvents()``List<LogEntryEvent__e>`

---

#### LoggerRestResource.OTelScope class

---

##### Properties

###### `name``String`

###### `version``String`

---

#### LoggerRestResource.OTelScopeLog class

---

##### Properties

###### `logRecords``List<OTelLogRecord>`

###### `scope``OTelScope`

---
4 changes: 4 additions & 0 deletions docs/apex/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ Builds and sends email notifications when internal exceptions occur within the l

Controller class for the LWC `loggerHomeHeader`

### [LoggerRestResource](Log-Management/LoggerRestResource)

REST Resource class for external integrations to create &amp; retrieve logging data

### [LoggerSObjectMetadata](Log-Management/LoggerSObjectMetadata)

Provides details to LWCs about Logger&apos;s `SObjects`, using `@AuraEnabled` properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ public without sharing class LogEntryEventHandler extends LoggerSObjectHandler {
OriginSourceApiName__c = logEntryEvent.OriginSourceApiName__c,
OriginSourceId__c = logEntryEvent.OriginSourceId__c,
OriginSourceMetadataType__c = logEntryEvent.OriginSourceMetadataType__c,
OriginSystemName__c = logEntryEvent.OriginSystemName__c,
OriginType__c = logEntryEvent.OriginType__c,
RecordCollectionSize__c = logEntryEvent.RecordCollectionSize__c,
RecordCollectionType__c = logEntryEvent.RecordCollectionType__c,
Expand Down
Loading

0 comments on commit b203f60

Please sign in to comment.