Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adapter: work-around missing res.response #216

Merged
merged 1 commit into from
Nov 4, 2016
Merged

Conversation

sam-github
Copy link
Contributor

@sam-github sam-github commented Nov 4, 2016

fix #213

@sam-github sam-github added the #wip label Nov 4, 2016
@@ -377,7 +377,7 @@ function createMessageListener() {
function createProbeListener(probeName) {
monitor.on(probeName, function(res) {
var duration = 0;
if (probeName === 'express') {
if (probeName === 'express' && res.response) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probeName isn't used to make any other decisions in this function, except for creating a probeMetrics entry for the name if it's not already there. Do we need to examine the probeName anymore? If the probeName isn't express, but the duration is stored on res.response.duration, this will miss it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the intention of the code is that there is only a res.response.duration for express probes, I've no reason to think any other probes have one, and I've no idea why the express probe doesn't always have one. This PR is a work-around, we can figure out what is really broken next week - but it doesn't effect apiconnect, which doesn't depend on this metric anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the res.response is only relevant to code that was deleted

@kjdelisle
Copy link
Contributor

LGTM

@kjdelisle
Copy link
Contributor

@slnode test please

1 similar comment
@kjdelisle
Copy link
Contributor

@slnode test please

@@ -377,7 +377,7 @@ function createMessageListener() {
function createProbeListener(probeName) {
monitor.on(probeName, function(res) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the argument name is wrong here, this is the data object from the express even that had docs removed in https://github.com/RuntimeTools/appmetrics/pull/260/files, right? res makes it seem like it is a https://nodejs.org/docs/latest/api/http.html#http_class_http_serverresponse

But the express probe got removed, and replace with strong-express-metrics... and now we are hitting this, which means that there is still an express event, what is the structure of this event?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Cannot read property 'duration' of undefined" when app receives request
2 participants