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

Clean up metrics #27

Merged
merged 6 commits into from
Mar 22, 2022
Merged

Clean up metrics #27

merged 6 commits into from
Mar 22, 2022

Conversation

carrieedwards
Copy link
Contributor

This PR updates the recorder for metrics for influx2cortex. It adds a metric for metrics that have been written, as well as changes from measuring number of rejected metrics to measuring number of errors and error types.

@grafanabot

This comment was marked as outdated.

@grafanabot

This comment was marked as outdated.

@carrieedwards carrieedwards marked this pull request as ready for review March 22, 2022 21:04
Copy link
Contributor

@ywwg ywwg left a comment

Choose a reason for hiding this comment

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

looks good -- just a small refactor nit

pkg/influx/api.go Outdated Show resolved Hide resolved
pkg/influx/recorder.go Outdated Show resolved Hide resolved
@grafanabot

This comment was marked as outdated.

@grafanabot

This comment was marked as outdated.

@grafanabot
Copy link

Go coverage report:

Source Func %
github.com/grafana/influx2cortex/pkg/errorx/errors.go:32: FromGRPCStatus 84.2%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:71: WithErrorxTypeDetail 75.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:86: ErrorAsGRPCStatus 0.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:109: Error 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:116: Message 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:120: Unwrap 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:124: HTTPStatusCode 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:128: GRPCStatus 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:132: GRPCStatusDetails 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:145: Error 66.7%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:152: Message 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:156: Unwrap 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:160: HTTPStatusCode 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:164: GRPCStatus 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:168: GRPCStatusDetails 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:184: Error 66.7%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:191: Message 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:195: Unwrap 0.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:199: HTTPStatusCode 0.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:203: GRPCStatus 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:207: GRPCStatusDetails 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:221: Error 66.7%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:228: Message 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:232: Unwrap 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:236: HTTPStatusCode 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:240: GRPCStatus 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:244: GRPCStatusDetails 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:254: Message 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:258: Error 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:262: HTTPStatusCode 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:266: GRPCStatus 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:270: GRPCStatusDetails 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:282: Error 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:286: Message 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:290: HTTPStatusCode 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:294: GRPCStatus 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:298: GRPCStatusDetails 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:310: Error 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:314: Message 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:318: HTTPStatusCode 0.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:322: GRPCStatus 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:326: GRPCStatusDetails 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:339: Error 66.7%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:346: Message 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:350: Unwrap 0.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:354: HTTPStatusCode 0.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:358: GRPCStatus 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:362: GRPCStatusDetails 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:375: Error 0.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:382: Message 0.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:386: Unwrap 0.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:390: HTTPStatusCode 0.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:394: GRPCStatus 0.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:398: GRPCStatusDetails 0.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:411: Error 66.7%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:418: Message 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:422: Unwrap 0.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:426: HTTPStatusCode 0.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:430: GRPCStatus 100.0%
github.com/grafana/influx2cortex/pkg/errorx/errors.go:434: GRPCStatusDetails 100.0%
github.com/grafana/influx2cortex/pkg/errorx/http_translator.go:20: LogAndSetHTTPError 100.0%
github.com/grafana/influx2cortex/pkg/errorx/http_translator.go:44: tryUnwrap 100.0%
github.com/grafana/influx2cortex/pkg/influx/api.go:30: Register 0.0%
github.com/grafana/influx2cortex/pkg/influx/api.go:34: NewAPI 0.0%
github.com/grafana/influx2cortex/pkg/influx/api.go:46: handleSeriesPush 0.0%
github.com/grafana/influx2cortex/pkg/influx/errors.go:17: tryUnwrap 0.0%
github.com/grafana/influx2cortex/pkg/influx/errors.go:29: handleError 0.0%
github.com/grafana/influx2cortex/pkg/influx/errors.go:71: isNetworkTimeout 0.0%
github.com/grafana/influx2cortex/pkg/influx/errors.go:80: isGRPCTimeout 0.0%
github.com/grafana/influx2cortex/pkg/influx/parser.go:22: parseInfluxLineReader 88.2%
github.com/grafana/influx2cortex/pkg/influx/parser.go:51: writeRequestFromInfluxPoints 85.7%
github.com/grafana/influx2cortex/pkg/influx/parser.go:71: influxPointToTimeseries 76.7%
github.com/grafana/influx2cortex/pkg/influx/parser.go:135: replaceInvalidChars 83.3%
github.com/grafana/influx2cortex/pkg/influx/parser.go:154: batchReadCloser 100.0%
github.com/grafana/influx2cortex/pkg/influx/recorder.go:22: NewRecorder 100.0%
github.com/grafana/influx2cortex/pkg/influx/recorder.go:62: measureMetricsParsed 100.0%
github.com/grafana/influx2cortex/pkg/influx/recorder.go:67: measureMetricsWritten 100.0%
github.com/grafana/influx2cortex/pkg/influx/recorder.go:72: measureProxyErrors 100.0%
github.com/grafana/influx2cortex/pkg/influx/recorder.go:77: measureConversionDuration 100.0%
github.com/grafana/influx2cortex/pkg/remotewrite/client.go:45: RoundTrip 100.0%
github.com/grafana/influx2cortex/pkg/remotewrite/client.go:66: RegisterFlags 0.0%
github.com/grafana/influx2cortex/pkg/remotewrite/client.go:74: RegisterFlagsWithPrefix 0.0%
github.com/grafana/influx2cortex/pkg/remotewrite/client.go:88: NewClient 92.3%
github.com/grafana/influx2cortex/pkg/remotewrite/client.go:132: Write 73.9%
github.com/grafana/influx2cortex/pkg/remotewrite/client.go:178: do 88.9%
github.com/grafana/influx2cortex/pkg/remotewrite/client.go:196: errFromResp 75.0%
github.com/grafana/influx2cortex/pkg/remotewrite/measured_client.go:18: NewMeasuredClient 100.0%
github.com/grafana/influx2cortex/pkg/remotewrite/measured_client.go:27: Write 87.5%
github.com/grafana/influx2cortex/pkg/remotewrite/recorder.go:17: NewRecorder 100.0%
github.com/grafana/influx2cortex/pkg/remotewrite/recorder.go:44: measureOutOfOrderSamples 100.0%
github.com/grafana/influx2cortex/pkg/remotewrite/recorder.go:48: measure 100.0%
github.com/grafana/influx2cortex/pkg/tenant/resolver.go:21: WithDefaultResolver 0.0%
github.com/grafana/influx2cortex/pkg/tenant/resolver.go:32: TenantID 0.0%
github.com/grafana/influx2cortex/pkg/tenant/resolver.go:42: TenantIDs 0.0%
github.com/grafana/influx2cortex/pkg/tenant/resolver.go:62: NewSingleResolver 100.0%
github.com/grafana/influx2cortex/pkg/tenant/resolver.go:72: containsUnsafePathSegments 100.0%
github.com/grafana/influx2cortex/pkg/tenant/resolver.go:83: TenantID 100.0%
github.com/grafana/influx2cortex/pkg/tenant/resolver.go:97: TenantIDs 100.0%
github.com/grafana/influx2cortex/pkg/tenant/resolver.go:112: NewMultiResolver 100.0%
github.com/grafana/influx2cortex/pkg/tenant/resolver.go:116: TenantID 100.0%
github.com/grafana/influx2cortex/pkg/tenant/resolver.go:129: TenantIDs 100.0%
github.com/grafana/influx2cortex/pkg/tenant/resolver.go:151: ExtractTenantIDFromHTTPRequest 0.0%
github.com/grafana/influx2cortex/pkg/tenant/tenant.go:27: Error 100.0%
github.com/grafana/influx2cortex/pkg/tenant/tenant.go:38: NormalizeTenantIDs 100.0%
github.com/grafana/influx2cortex/pkg/tenant/tenant.go:58: ValidTenantID 100.0%
github.com/grafana/influx2cortex/pkg/tenant/tenant.go:76: JoinTenantIDs 0.0%
github.com/grafana/influx2cortex/pkg/tenant/tenant.go:83: isSupported 100.0%
github.com/grafana/influx2cortex/pkg/tenant/tenant.go:109: TenantIDsFromOrgID 0.0%
github.com/grafana/influx2cortex/pkg/util/extract_forwarded.go:18: GetSourceIPsFromOutgoingCtx 100.0%
github.com/grafana/influx2cortex/pkg/util/extract_forwarded.go:31: GetSourceIPsFromIncomingCtx 100.0%
github.com/grafana/influx2cortex/pkg/util/extract_forwarded.go:44: AddSourceIPsToOutgoingContext 0.0%
github.com/grafana/influx2cortex/pkg/util/extract_forwarded.go:52: AddSourceIPsToIncomingContext 0.0%
github.com/grafana/influx2cortex/pkg/util/http.go:32: IsRequestBodyTooLarge 100.0%
github.com/grafana/influx2cortex/pkg/util/http.go:42: RegisterFlagsWithPrefix 0.0%
github.com/grafana/influx2cortex/pkg/util/http.go:48: IsEnabled 0.0%
github.com/grafana/influx2cortex/pkg/util/http.go:53: WriteJSONResponse 66.7%
github.com/grafana/influx2cortex/pkg/util/http.go:69: WriteYAMLResponse 0.0%
github.com/grafana/influx2cortex/pkg/util/http.go:87: WriteTextResponse 100.0%
github.com/grafana/influx2cortex/pkg/util/http.go:95: WriteHTMLResponse 0.0%
github.com/grafana/influx2cortex/pkg/util/http.go:104: RenderHTTPResponse 85.7%
github.com/grafana/influx2cortex/pkg/util/http.go:118: StreamWriteYAMLResponse 60.0%
github.com/grafana/influx2cortex/pkg/util/http.go:145: ParseProtoReader 80.0%
github.com/grafana/influx2cortex/pkg/util/http.go:174: decompressRequest 81.8%
github.com/grafana/influx2cortex/pkg/util/http.go:192: decompressFromReader 83.3%
github.com/grafana/influx2cortex/pkg/util/http.go:218: decompressFromBuffer 75.0%
github.com/grafana/influx2cortex/pkg/util/http.go:248: tryBufferFromReader 100.0%
github.com/grafana/influx2cortex/pkg/util/http.go:258: SerializeProtoResponse 60.0%
github.com/grafana/influx2cortex/pkg/util/log/experimental.go:23: WarnExperimentalUse 0.0%
github.com/grafana/influx2cortex/pkg/util/log/log.go:27: InitLogger 0.0%
github.com/grafana/influx2cortex/pkg/util/log/log.go:40: NewDefaultLogger 0.0%
github.com/grafana/influx2cortex/pkg/util/log/log.go:53: CheckFatal 0.0%
github.com/grafana/influx2cortex/pkg/util/log/rate_limit.go:20: NewRateLimitedLogger 100.0%
github.com/grafana/influx2cortex/pkg/util/log/rate_limit.go:32: Log 85.7%
github.com/grafana/influx2cortex/pkg/util/log/wrappers.go:19: WithUserID 0.0%
github.com/grafana/influx2cortex/pkg/util/log/wrappers.go:26: WithTraceID 0.0%
github.com/grafana/influx2cortex/pkg/util/log/wrappers.go:37: WithContext 0.0%
github.com/grafana/influx2cortex/pkg/util/log/wrappers.go:55: WithSourceIPs 0.0%
github.com/grafana/influx2cortex/pkg/util/push/push.go:37: Handler 58.8%
total: (statements) 63.9%

Copy link
Contributor

@ywwg ywwg left a comment

Choose a reason for hiding this comment

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

nice

@carrieedwards carrieedwards merged commit 0bb7374 into main Mar 22, 2022
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.

None yet

3 participants