mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-24 16:09:32 -06:00
* chore: set up instrumentation and instrument middleware * chore: set up console exporter * chore: add parent span option to telemetry package * chore: set up telemetry verbose mode * chore: instrument the network proxy - part 1 * chore: make sure to terminate spans when request is aborted * fix telemetry, create/end the request middle prior to sending the outbound request * avoid telemetry ts build step, create entrypoint into packages/telemetry using TS conventions * allow env vars to be "true" or "1" * when creating child span, inherit their attributes directly from the parent * create custom honeycomb exporter and span processor to log traces * remove duplicate code that's already called in this.setRootContext * cleanup * more clean up * update honeycomb network:proxy attributes, update console.log message * yarn lock * chore: remove performance API in middleware * chore: end response on correct event * recursively gather parent attributes on close * added key and some clean up * github action detector, move verbose into index, verbose log commands * some tests * clean up honeycomb exporter * some renaming * testing console trace link exporter * Don't lose the top span when running in verbose. * link to the right place for prod/dev * changes to verbose to make sure it is read in the browser * Apply suggestions from code review * pass parent attributes between telemetry instances * default to false * 'fix' build issues * src not dist * add back on start span * once more with feeling * Fix some tests * try this i guess * revert auto build * Apply suggestions from code review Co-authored-by: Bill Glesias <bglesias@gmail.com> * support failed commands * Address PR comments * Address PR Comments * error handling * handle all the errors --------- Co-authored-by: Bill Glesias <bglesias@gmail.com> Co-authored-by: Brian Mann <brian.mann86@gmail.com>
45 lines
980 B
TypeScript
45 lines
980 B
TypeScript
import { telemetry } from '@packages/telemetry'
|
|
import { Http, ServerCtx } from './http'
|
|
import type { BrowserPreRequest } from './types'
|
|
|
|
export class NetworkProxy {
|
|
http: Http
|
|
|
|
constructor (opts: ServerCtx) {
|
|
this.http = new Http(opts)
|
|
}
|
|
|
|
addPendingBrowserPreRequest (preRequest: BrowserPreRequest) {
|
|
this.http.addPendingBrowserPreRequest(preRequest)
|
|
}
|
|
|
|
handleHttpRequest (req, res) {
|
|
const span = telemetry.startSpan({
|
|
name: 'network:proxy:handleHttpRequest',
|
|
opts: {
|
|
attributes: {
|
|
'network:proxy:url': req.proxiedUrl,
|
|
'network:proxy:contentType': req.get('content-type'),
|
|
},
|
|
},
|
|
isVerbose: true,
|
|
})
|
|
|
|
this.http.handleHttpRequest(req, res, span).finally(() => {
|
|
span?.end()
|
|
})
|
|
}
|
|
|
|
handleSourceMapRequest (req, res) {
|
|
this.http.handleSourceMapRequest(req, res)
|
|
}
|
|
|
|
setHttpBuffer (buffer) {
|
|
this.http.setBuffer(buffer)
|
|
}
|
|
|
|
reset () {
|
|
this.http.reset()
|
|
}
|
|
}
|