Skip to content

Conversation

@Bennett-Lynch
Copy link
Contributor

@Bennett-Lynch Bennett-Lynch commented Dec 11, 2021

LoggingMetricPublisher provides a convenient way to emit and inspect metrics via standard logging. The default log format is concise and perhaps difficult to read when looking for particular values. For users that wish to log metrics purely for debugging purposes, we should offer a more readable and user-friendly format. This PR introduces PLAIN and PRETTY format options to LoggingMetricPublisher.

PLAIN example (default/original behavior):

Metrics published: MetricCollection(name=ApiCall, metrics=[MetricRecord(metric=MarshallingDuration, value=PT0.000202197S),
MetricRecord(metric=RetryCount, value=0), MetricRecord(metric=ApiCallSuccessful, value=true),
MetricRecord(metric=OperationName, value=HeadObject), MetricRecord(metric=ApiCallDuration, value=PT0.468369S),
MetricRecord(metric=CredentialsFetchDuration, value=PT0.000003191S), MetricRecord(metric=ServiceId, value=S3)],
children=[MetricCollection(name=ApiCallAttempt, metrics=[MetricRecord(metric=SigningDuration, value=PT0.000667268S),
MetricRecord(metric=ServiceCallDuration, value=PT0.460529977S), MetricRecord(metric=AwsExtendedRequestId,
value=jY/Co5Ge6WjRYk78kGOYQ4Z/CqUBr6pAAPZtexgOQR3Iqs3QP0OfZz3fDraQiXtmx7eXCZ4sbO0=), MetricRecord(metric=HttpStatusCode,
value=200), MetricRecord(metric=BackoffDelayDuration, value=PT0S), MetricRecord(metric=AwsRequestId, value=6SJ82R65SADHX098)],
children=[MetricCollection(name=HttpClient, metrics=[MetricRecord(metric=AvailableConcurrency, value=0),
MetricRecord(metric=LeasedConcurrency, value=0), MetricRecord(metric=ConcurrencyAcquireDuration, value=PT0.230757S),
MetricRecord(metric=PendingConcurrencyAcquires, value=0), MetricRecord(metric=MaxConcurrency, value=50),
MetricRecord(metric=HttpClientName, value=NettyNio)], children=[])])])

PRETTY example (new format option):

[18e5092e] ApiCall
[18e5092e] ┌────────────────────────────────────────┐
[18e5092e] │ MarshallingDuration=PT0.000227427S     │
[18e5092e] │ RetryCount=0                           │
[18e5092e] │ ApiCallSuccessful=true                 │
[18e5092e] │ OperationName=HeadObject               │
[18e5092e] │ ApiCallDuration=PT0.541751S            │
[18e5092e] │ CredentialsFetchDuration=PT0.00000306S │
[18e5092e] │ ServiceId=S3                           │
[18e5092e] └────────────────────────────────────────┘
[18e5092e]     ApiCallAttempt
[18e5092e]     ┌───────────────────────────────────────────────────────────────────────────────────────────────────┐
[18e5092e]     │ SigningDuration=PT0.000974924S                                                                    │
[18e5092e]     │ ServiceCallDuration=PT0.531462375S                                                                │
[18e5092e]     │ AwsExtendedRequestId=eGfwjV3mSwQZQD4YxHLswYguvhQoGcDTkr2jRvpio37a6QmhWd18C8wagC8LkBzzcnOOKoMuiXw= │
[18e5092e]     │ HttpStatusCode=200                                                                                │
[18e5092e]     │ BackoffDelayDuration=PT0S                                                                         │
[18e5092e]     │ AwsRequestId=ED46TP7NN62DDG4Q                                                                     │
[18e5092e]     └───────────────────────────────────────────────────────────────────────────────────────────────────┘
[18e5092e]         HttpClient
[18e5092e]         ┌────────────────────────────────────────┐
[18e5092e]         │ AvailableConcurrency=0                 │
[18e5092e]         │ LeasedConcurrency=0                    │
[18e5092e]         │ ConcurrencyAcquireDuration=PT0.235851S │
[18e5092e]         │ PendingConcurrencyAcquires=0           │
[18e5092e]         │ MaxConcurrency=50                      │
[18e5092e]         │ HttpClientName=NettyNio                │
[18e5092e]         └────────────────────────────────────────┘

License

  • I confirm that this pull request can be released under the Apache 2 license

LoggingMetricPublisher provides a convenient way to emit and inspect
metrics via standard logging. The default log format is concise but
perhaps difficult to read when looking for particular values. For users
that wish to log metrics purely for debugging purposes, we should offer
a more readable and user-friendly format.
@Bennett-Lynch Bennett-Lynch requested a review from a team as a code owner December 11, 2021 02:49
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@Bennett-Lynch Bennett-Lynch merged commit e292611 into aws:master Dec 14, 2021
aws-sdk-java-automation added a commit that referenced this pull request Feb 28, 2024
…e0dc947e9

Pull request: release <- staging/62943d57-2d32-4f24-a3e8-d13e0dc947e9
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.

2 participants