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

Incorrect otlp/http http.response.status_code in request log #12635

Open
carsonip opened this issue Feb 12, 2024 · 0 comments
Open

Incorrect otlp/http http.response.status_code in request log #12635

carsonip opened this issue Feb 12, 2024 · 0 comments
Labels

Comments

@carsonip
Copy link
Member

carsonip commented Feb 12, 2024

APM Server version (apm-server version): confirmed on main (8.13)

Description of the problem including expected versus actual behavior: request log http.response.status_code is not returning the correct status code under otlp/http

Steps to reproduce:

  • Send malformed otlp/http request
  • otlp client should receive 400
  • apm-server logs 200
{"log.level":"info","@timestamp":"2024-02-12T19:20:08.420Z","log.logger":"request","log.origin":{"function":"github.com/elastic/apm-server/internal/beater/middleware.LogMiddleware.func1.1","file.name":"middleware/log_middleware.go","file.line":62},"message":"handled request","service.name":"apm-server","url.original":"/v1/metrics","http.request.method":"POST","user_agent.original":"Go-http-client/1.1","source.address":"127.0.0.1","http.request.id":"69abd34d-c901-48aa-96fc-5a0e89f8311b","event.duration":36046382336,"http.request.body.bytes":486,"http.response.status_code":200,"ecs.version":"1.6.0"}

Root cause:

  • Only request.Context.ResponseWriter is passed down to otlp handler level. otlp writes error to response writer directly without setting request.Context.Result.StatusCode.

Provide logs (if relevant):

@carsonip carsonip added the bug label Feb 12, 2024
@carsonip carsonip changed the title otlp/http http.response.status_code is wrong Incorrect otlp/http http.response.status_code in request log Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant