-
Notifications
You must be signed in to change notification settings - Fork 0
fix: log format doesn't uphold opentelemetry field naming (MAPCO-8460) #17
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
2bc017e
a46320f
0b756e5
538358b
0aaf0b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -6,42 +6,51 @@ log_format main escape=json | |||||
'{' | ||||||
'"Timestamp":$nanosec,' | ||||||
'"Attributes":{' | ||||||
'"mapcolonies.time_local":"$time_local",' | ||||||
'"mapcolonies.time_local": "$time_local",' | ||||||
{{ if .Values.authorization.enabled }} | ||||||
'"mapcolonies.http.auth.token.client_name":"$jwt_payload_sub",' | ||||||
'"mapcolonies.http.auth.token.client_name": "$jwt_payload_sub",' | ||||||
{{ end }} | ||||||
'"http.request.method":"$request_method",' | ||||||
'"http.request.header.referer":"$http_referer",' | ||||||
'"http.request.body.size":"$content_length",' | ||||||
'"http.response.body.size":"$body_bytes_sent",' | ||||||
'"http.response.header.x_forwarded_for":"$proxy_add_x_forwarded_for",' | ||||||
'"http.response.status_code":"$status",' | ||||||
'"user_agent.original":"$http_user_agent",' | ||||||
'"network.protocol":"$server_protocol",' | ||||||
'"mapcolonies.request_time":"$request_time",' | ||||||
'"mapcolonies.http.upstream_connect_time":"$upstream_connect_time",' | ||||||
'"mapcolonies.http.upstream_response_time":"$upstream_response_time",' | ||||||
'"mapcolonies.http.upstream_addr":"$upstream_addr",' | ||||||
'"mapcolonies.http.upstream_status_code":"$upstream_status",' | ||||||
'"mapcolonies.http.upstream_cache_status":"$upstream_cache_status",' | ||||||
'"mapcolonies.server":"$hostname",' | ||||||
'"server.address":"$host",' | ||||||
'"server.port":"$server_port",' | ||||||
'"client.address":"$remote_addr",' | ||||||
'"client.port":"$remote_port",' | ||||||
'"url.scheme":"$scheme",' | ||||||
'"url.path":"$uri",' | ||||||
'"url.full":"$request_uri"' | ||||||
'"http.request.method": "$request_method",' | ||||||
'"http.request.header.host": "$host",' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. according to the docs it should be in server address There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
|
||||||
'"http.request.header.referer": "$http_referer",' | ||||||
'"http.request.header.content-type": "$content_type",' | ||||||
'"http.request.header.content-length": "$content_length",' | ||||||
'"http.request.body.size": $request_length,' | ||||||
|
||||||
'"http.request.size": $bytes_sent,' | ||||||
shimoncohen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
'"http.response.body.size": $body_bytes_sent,' | ||||||
'"http.response.header.x_forwarded_for": "$proxy_add_x_forwarded_for",' | ||||||
'"http.response.status_code": "$status",' | ||||||
'"user_agent.original": "$http_user_agent",' | ||||||
'"network.protocol.name": "$otel_network_protocol_name",' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not required according to the docs if its http (pretty sure its always http in our case) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably, but it won't hurt. |
||||||
'"network.protocol.version": "$otel_network_protocol_version",' | ||||||
'"mapcolonies.request_time": "$request_time",' | ||||||
'"mapcolonies.http.upstream_addr": "$upstream_addr",' | ||||||
'"mapcolonies.http.upstream_status_code": "$upstream_status",' | ||||||
'"mapcolonies.http.upstream_connect_time": "$upstream_connect_time",' | ||||||
'"mapcolonies.http.upstream_response_time": "$upstream_response_time",' | ||||||
'"mapcolonies.http.upstream_response_length": "$upstream_response_length",' | ||||||
'"mapcolonies.http.upstream_bytes_sent": $upstream_bytes_sent,' | ||||||
'"mapcolonies.http.upstream_bytes_received": $upstream_bytes_received,' | ||||||
'"mapcolonies.http.upstream_cache_status": "$upstream_cache_status",' | ||||||
'"host.name": "$hostname",' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. $hostname in nginx is for the server name (in the SERVER block) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the documentation:
It seems that this is the recieved value from |
||||||
'"server.address": "$server_addr",' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to OpenTelemetry semantic conventions,
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
'"server.port": "$server_port",' | ||||||
'"client.address": "$remote_addr",' | ||||||
'"client.port": "$remote_port",' | ||||||
'"url.scheme": "$scheme",' | ||||||
'"url.path": "$uri",' | ||||||
'"url.full": "$request_uri",' | ||||||
'"url.query": "$query_string"' | ||||||
'},' | ||||||
'"Resource":{' | ||||||
# Additional important log details should be added here | ||||||
'"service.name":"{{ .Values.image.repository }}",' | ||||||
'"service.version":"{{ .Values.image.tag }}"' | ||||||
'"service.name": "{{ .Values.image.repository }}",' | ||||||
'"service.version": "{{ .Values.image.tag }}"' | ||||||
'},' | ||||||
'"TraceId":"$opentelemetry_trace_id",' ## this is a byte sequence (hex-encoded in JSON) | ||||||
'"SpanId":"$opentelemetry_span_id",' | ||||||
'"SeverityText":"INFO",' | ||||||
'"SeverityNumber":9,' | ||||||
'"InstrumentationScope":"access.log",' | ||||||
'"Body":"$request"' | ||||||
'"TraceId": "$opentelemetry_trace_id",' ## this is a byte sequence (hex-encoded in JSON) | ||||||
'"SpanId": "$opentelemetry_span_id",' | ||||||
'"SeverityText": "INFO",' | ||||||
'"SeverityNumber": 9,' | ||||||
'"InstrumentationScope": "access.log",' | ||||||
'"Body": "$request"' | ||||||
'}'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CptSchnitz , back in the days we tried to put mapcolonies custom fields under "mapcolonies" key, do you think we should put it in the body or message key ?