Skip to content

Commit

Permalink
cleaning #2
Browse files Browse the repository at this point in the history
  • Loading branch information
RodrigoAD authored and justinkaseman committed Apr 9, 2021
1 parent de20ea5 commit 777e6a8
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions packages/core/bootstrap/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import * as server from './lib/server'
import * as util from './lib/util'
import { configureStore } from './lib/store'
import { Requester } from '@chainlink/external-adapter'
import * as metrics from './lib/metrics'
import { WARMUP_REQUEST_ID } from './lib/cache-warmer/config'

const rootReducer = combineReducers({
cacheWarmer: cacheWarmer.reducer.rootReducer,
Expand Down Expand Up @@ -71,27 +69,6 @@ const withLogger: Middleware = async (execute) => async (input: AdapterRequest)
}
}

const withMetrics: Middleware = async (execute) => async (input: AdapterRequest) => {
try {
const start = Date.now()
metrics.httpRequestsTotal.inc()
if (input.id === WARMUP_REQUEST_ID) {
metrics.cacheWarmerRequests.inc()
}
const result = await execute(input)
result.data.maxAge !== undefined
? metrics.httpRequestsCacheHits.inc()
: metrics.httpRequestsDataProviderHits.inc()

metrics.httpRequestDurationSeconds.observe((Date.now() - start) / 1000)
return result
} catch (error) {
// Counter errored responses?
logger.debug(error)
throw error
}
}

const middleware = [
withLogger,
skipOnError(withCache),
Expand All @@ -100,7 +77,6 @@ const middleware = [
dispatch: (a) => store.dispatch(a),
} as Store),
withStatusCode,
withMetrics,
]

// Init all middleware, and return a wrapped execute fn
Expand Down

0 comments on commit 777e6a8

Please sign in to comment.