Skip to content

Commit

Permalink
Merge e7734ae into 3c3b6b8
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusvellone committed Dec 20, 2019
2 parents 3c3b6b8 + e7734ae commit 1e9addf
Show file tree
Hide file tree
Showing 13 changed files with 950 additions and 16 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,23 @@ const { logger, httpLogger } = escriba({
},
})
```

## Integrations
You can enable integrations by simply passing a `integrations` key in the config. Like this:
```javascript
escriba({
integrations: {
datadog: true
}
})
```

But remember, for each integration to work you may need to configure your application via environment variables.

### Datadog
You'll need to install `dd-trace` in your application.
The Datadog integration enable this feature: https://docs.datadoghq.com/tracing/advanced/connect_logs_and_traces/.

## Examples

The `log-generator` inside `examples` folder will run a Node.js application that will make a request for itself every in an interval defined by the user (in milliseconds). The application will get input values from an environment variable `ESCRIBA_TIMEOUT`(3000 is the default value, this represents 3 seconds)
Expand Down
6 changes: 6 additions & 0 deletions examples/log-generator/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DD_TRACE_ENABLED=true
DD_RUNTIME_METRICS_ENABLED=true
DD_LOGS_INJECTION=true
DD_SERVICE_NAME=escriba
DD_TRACE_AGENT_HOSTNAME=datadog-agent-host
DD_ENV=staging
4 changes: 3 additions & 1 deletion examples/log-generator/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require('dotenv').config()
require('dd-trace').init()
const express = require('express')
const bodyParser = require('body-parser')
const cuid = require('cuid')
const { logger, httpLogger } = require('./lib/logger')
const { logger, httpLogger } = require('./lib/logger')
const logGenerator = require('./lib/log-generator')

const app = express()
Expand Down
5 changes: 4 additions & 1 deletion examples/log-generator/lib/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ const log4jsConfig = {
log4js.configure(log4jsConfig)

const escribaConfig = {
integrations: {
datadog: true
},
loggerEngine: log4js.getLogger(),
service: 'Escriba App',
httpConf : {
envToLog: ['SHELL', 'PATH'],
httpConf: {
propsToLog: {
request: [
'id',
Expand Down
Loading

0 comments on commit 1e9addf

Please sign in to comment.