Tabnine Logo For Javascript
elastic-apm-node
Code IndexAdd Tabnine to your IDE (free)

How to use elastic-apm-node

Best JavaScript code snippets using elastic-apm-node(Showing top 4 results out of 315)

origin: elastic/apm-agent-nodejs-opentracing

function clean () {
 agent._instrumentation.currentTransaction = null
}
origin: elastic/apm-agent-nodejs-opentracing

test('#inject(noop, http, {})', setup(function (t) {
 const agent = getAgent()
 agent._conf.transactionSampleRate = 0

 const tracer = new Tracer(agent)

 const span1 = tracer.startSpan('foo')
 t.equal(span1._isTransaction, true)
 t.equal(span1._span.sampled, false)

 const span2 = tracer.startSpan('foo')
 t.ok(span2 instanceof UnsampledSpan)

 const carrier = {}

 tracer.inject(span2, opentracing.FORMAT_HTTP_HEADERS, carrier)

 t.equal(carrier['elastic-apm-traceparent'], span1.context().toString())

 agent._conf.transactionSampleRate = 1

 t.end()
}))
origin: prashant-shahi/Sample-NodeJS-Elastic-APM-Client

// for parsing application/json

// GET method route
app.get('/get-success', function (req, res) {
  query = {"somefield": {"someinnerfield":"somevalue"}}
  apm.addTags({"request-url": "/get-success", "query": JSON.stringify(query)});
  apm.setCustomContext(query);
  apm.setUserContext({
    id: 12345,
    username: "test-user",
    email: "test-user@rapido.bike"
  })
  res.json({
    status: "success",
    response: 'GET request to the success api'
  })
})
origin: elastic/apm-agent-nodejs-opentracing

test('#startSpan() - not sampled', setup(function (t) {
 const agent = getAgent()
 agent._conf.transactionSampleRate = 0

 const tracer = new Tracer(agent)
 const span1 = tracer.startSpan()

 t.ok(span1, 'should return span')
 t.ok(span1._span, 'should hold reference to span/transaction')
 t.equal(span1._isTransaction, true, 'first span should be a transaction')
 t.equal(span1._span.sampled, false)

 const span2 = tracer.startSpan()

 t.ok(span2 instanceof UnsampledSpan)

 agent._conf.transactionSampleRate = 1

 t.end()
}))
elastic-apm-node(npm)

Most used elastic-apm-node functions

  • Agent._conf
  • Agent._instrumentation
  • Agent.addTags
  • Agent.setCustomContext
  • Agent.setUserContext

Popular in JavaScript

  • ws
    Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js
  • glob
    a little globber
  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • lodash
    Lodash modular utilities.
  • crypto
  • commander
    the complete solution for node.js command-line programs
  • request
    Simplified HTTP request client.
  • fs
  • qs
    A querystring parser that supports nesting and arrays, with a depth limit
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now