APM agent to server

Hi Elastic Team:
I successfully built my Elastic APM system, the versions of each module are as follows:
Springboot : 1.5.10
Java: 1.8.0_161
APM Server : 6.3
APM Agent : 0.6
Elastic :6.3
Kibana:6.3

the java application is running OK.But,the apm agent to the apm server looks like something is wrong.

I sent two http requests in the java application, but I only saw one result on the kibana page, I saw the following log information in the agent-log file.

2018-08-23 14:34:51.035 [http-nio-8080-exec-3] DEBUG co.elastic.apm.impl.ElasticApmTracer - startTransaction '' 02ae0d14352e82d940fbc1dceafec1f1 {
2018-08-23 14:34:51.046 [http-nio-8080-exec-3] DEBUG co.elastic.apm.impl.ElasticApmTracer - } endTransaction 'ResourceHttpRequestHandler' 02ae0d14352e82d940fbc1dceafec1f1
2018-08-23 14:34:51.505 [apm-reporter] DEBUG co.elastic.apm.report.ApmServerHttpPayloadSender - Sending payload with 1 elements to APM server http://localhost:8200
2018-08-23 14:34:51.508 [apm-reporter] DEBUG co.elastic.apm.report.ApmServerHttpPayloadSender - APM server responded with status code 202

And I check the apm-server log info as follows:

2018-08-23T14:35:05.973+0800 INFO [request] beater/handlers.go:239 handled request {"request_id": "cf71668a-56cb-4a60-a632-ad904466c654", "method": "GET", "URL": "/healthcheck", "content_length": 0, "remote_address": "127.0.0.1", "user-agent": "co/elastic/apm/shaded/okhttp/3.9.1", "response_code": 200}
2018-08-23T14:35:15.973+0800 INFO [request] beater/handlers.go:239 handled request {"request_id": "7b2f9056-d875-43e3-96c8-32fb129ad298", "method": "GET", "URL": "/healthcheck", "content_length": 0, "remote_address": "127.0.0.1", "user-agent": "co/elastic/apm/shaded/okhttp/3.9.1", "response_code": 200}
2018-08-23T14:35:25.974+0800 INFO [request] beater/handlers.go:239 handled request {"request_id": "29f64e94-1e2f-4346-aa8d-8b0407cecb84", "method": "GET", "URL": "/healthcheck", "content_length": 0, "remote_address": "127.0.0.1", "user-agent": "co/elastic/apm/shaded/okhttp/3.9.1", "response_code": 200}

Is there anything I need to pay attention to?

Hi,

could you try the latest version (currently 0.6.2) to see if the problem still exists there?

Also, which two HTTP requests did you execute and which request can you see in Kibana? The agent logs only seem to indicate that there was one ResourceHttpRequestHandler request (probably a static resource). Could you attach the complete agent log?

The apm-server logs you sent, only contain logs for the /healthcheck endpoint.

Cheers,
Felix

Hi Feilix:

Thanks for you help.
I fixed a bug in my java application,and this time I send two HTTP requests ,I can see all two results in Kibana.

these five request path name are as follows:

/SpringBootTest-0.0.1-SNAPSHOT/A
/SpringBootTest-0.0.1-SNAPSHOT/B

These HTTP sending time are between 17:10:16 and 17:10:18,then I get the apm-agent log info and the apm-server log info during this time period as follows:
The agent log:

2018-08-23 17:10:16.432 [http-nio-8080-exec-8] DEBUG co.elastic.apm.impl.ElasticApmTracer - startTransaction '' 32b249d2db6068402c59870a4da81260 {
2018-08-23 17:10:16.444 [http-nio-8080-exec-8] DEBUG co.elastic.apm.impl.ElasticApmTracer - } endTransaction 'ResourceHttpRequestHandler' 32b249d2db6068402c59870a4da81260
2018-08-23 17:10:17.335 [apm-reporter] DEBUG co.elastic.apm.report.ApmServerHttpPayloadSender - Sending payload with 1 elements to APM server http://localhost:8200
2018-08-23 17:10:17.338 [apm-reporter] DEBUG co.elastic.apm.report.ApmServerHttpPayloadSender - APM server responded with status code 202
2018-08-23 17:10:17.954 [http-nio-8080-exec-9] DEBUG co.elastic.apm.impl.ElasticApmTracer - startTransaction '' be100ea783c4a65066f6ea2f289d455d {
2018-08-23 17:10:17.958 [http-nio-8080-exec-9] DEBUG co.elastic.apm.impl.ElasticApmTracer - } endTransaction 'ResourceHttpRequestHandler' be100ea783c4a65066f6ea2f289d455d
2018-08-23 17:10:18.335 [apm-reporter] DEBUG co.elastic.apm.report.ApmServerHttpPayloadSender - Sending payload with 1 elements to APM server http://localhost:8200
2018-08-23 17:10:18.338 [apm-reporter] DEBUG co.elastic.apm.report.ApmServerHttpPayloadSender - APM server responded with status code 202

The apm-server log is OK,I got one ack from apm-server as follows:

2018-08-23T17:10:18.337+0800	INFO	[request]	beater/handlers.go:239	handled request	{"request_id": "4ad40176-03ee-422a-88df-b60fa297a74b", "method": "POST", "URL": "/v1/transactions", "content_length": -1, "remote_address": "127.0.0.1", "user-agent": "apm-agent-java unknown", "response_code": 202}
2018-08-23T17:10:18.337+0800	DEBUG	[transaction]	transaction/payload.go:63	Transform transaction events: events=1, service=springboot-properties-service, agent=java:unknown
2018-08-23T17:10:18.338+0800	DEBUG	[publish]	pipeline/processor.go:291	Publish event: {
  "@timestamp": "2018-08-23T09:10:17.953Z",
  "@metadata": {
    "beat": "apm-server",
    "type": "doc",
    "version": "6.3.0"
  },
  "processor": {
    "name": "transaction",
    "event": "transaction"
  },
  "transaction": {
    "sampled": true,
    "id": "be100ea7-83c4-a650-66f6-ea2f289d455d",
    "name": "ResourceHttpRequestHandler",
    "duration": {
      "us": 4519
    },
    "type": "request",
    "result": "HTTP 3xx"
  },
  "context": {
    "request": {
      "method": "GET",
      "headers": {
        "host": "192.168.50.6:8080",
        "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
        "accept-language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
        "referer": "http://192.168.50.6:8080/SpringBootTest-0.0.1-SNAPSHOT/A",
        "connection": "keep-alive",
        "if-modified-since": "Thu, 23 Aug 2018 08:53:58 GMT",
        "user-agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0",
        "accept-encoding": "gzip, deflate",
        "upgrade-insecure-requests": "1"
      },
      "cookies": {
        "grafana_user": "admin",
        "grafana_remember": "29b3204c956ed9a66d15e816e25ec5bcdbe17963e3b1b20466692b1e2a709c5664"
      },
      "url": {
        "full": "http://192.168.50.6:8080/SpringBootTest-0.0.1-SNAPSHOT/B",
        "hostname": "192.168.50.6",
        "port": "8080",
        "pathname": "/SpringBootTest-0.0.1-SNAPSHOT/B",
        "protocol": "http"
      },
      "socket": {
        "remote_address": "192.168.50.8",
        "encrypted": false
      },
      "http_version": "1.1"
    },
    "response": {
      "headers": {
        "Last-Modified": "Thu, 23 Aug 2018 08:53:58 GMT",
        "Date": "Thu, 23 Aug 2018 09:10:17 GMT"
      },
      "finished": true,
      "headers_sent": true,
      "status_code": 304
    },
    "service": {
      "name": "springboot-properties-service",
      "agent": {
        "name": "java",
        "version": "unknown"
      },
      "language": {
        "name": "Java",
        "version": "1.8.0_161"
      },
      "runtime": {
        "version": "1.8.0_161",
        "name": "Java"
      }
    },
    "process": {
      "pid": 19597,
      "title": "/usr/lib/jvm/java-8-oracle/jre/bin/java"
    },
    "system": {
      "hostname": "Linux",
      "architecture": "amd64",
      "platform": "anextserver",
      "ip": "127.0.0.1"
    }
  },
  "host": {
    "name": "anextserver"
  },
  "beat": {
    "name": "anextserver",
    "hostname": "anextserver",
    "version": "6.3.0"
  }
}
2018-08-23T17:10:18.415+0800	DEBUG	[elasticsearch]	elasticsearch/client.go:303	PublishEvents: 2 events have been  published to elasticsearch in 76.683448ms.
2018-08-23T17:10:18.415+0800	DEBUG	[memqueue]	memqueue/ackloop.go:143	ackloop: receive ack [47: 0, 2]
2018-08-23T17:10:18.415+0800	DEBUG	[memqueue]	memqueue/eventloop.go:518	broker ACK events: count=2, start-seq=57, end-seq=58

I still has one question:
Why is there still two record with status code of 202 in the agent log file? No other requests during this time period

Best wishes!

It looks like the transactions were reported to the APM server using two different HTTP requests.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.