This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
flush interval reader when stopping metric reader #282
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,8 +39,6 @@ import ( | |
"google.golang.org/api/support/bundler" | ||
distributionpb "google.golang.org/genproto/googleapis/api/distribution" | ||
labelpb "google.golang.org/genproto/googleapis/api/label" | ||
"google.golang.org/genproto/googleapis/api/metric" | ||
googlemetricpb "google.golang.org/genproto/googleapis/api/metric" | ||
metricpb "google.golang.org/genproto/googleapis/api/metric" | ||
monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres" | ||
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" | ||
|
@@ -147,6 +145,7 @@ func (e *statsExporter) startMetricsReader() error { | |
func (e *statsExporter) stopMetricsReader() { | ||
if e.ir != nil { | ||
e.ir.Stop() | ||
e.ir.Flush() | ||
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 the actual change |
||
} | ||
} | ||
|
||
|
@@ -433,7 +432,7 @@ func (e *statsExporter) combineTimeSeriesToCreateTimeSeriesRequest(ts []*monitor | |
// metricSignature creates a unique signature consisting of a | ||
// metric's type and its lexicographically sorted label values | ||
// See https://github.com/census-ecosystem/opencensus-go-exporter-stackdriver/issues/120 | ||
func metricSignature(metric *googlemetricpb.Metric) string { | ||
func metricSignature(metric *metricpb.Metric) string { | ||
labels := metric.GetLabels() | ||
labelValues := make([]string, 0, len(labels)) | ||
|
||
|
@@ -593,7 +592,7 @@ func newLabelDescriptors(defaults map[string]labelValue, keys []tag.Key) []*labe | |
return labelDescriptors | ||
} | ||
|
||
func (e *statsExporter) createMetricDescriptor(ctx context.Context, md *metric.MetricDescriptor) error { | ||
func (e *statsExporter) createMetricDescriptor(ctx context.Context, md *metricpb.MetricDescriptor) error { | ||
ctx, cancel := newContextWithTimeout(ctx, e.o.Timeout) | ||
defer cancel() | ||
cmrdesc := &monitoringpb.CreateMetricDescriptorRequest{ | ||
|
@@ -604,7 +603,7 @@ func (e *statsExporter) createMetricDescriptor(ctx context.Context, md *metric.M | |
return err | ||
} | ||
|
||
var createMetricDescriptor = func(ctx context.Context, c *monitoring.MetricClient, mdr *monitoringpb.CreateMetricDescriptorRequest) (*metric.MetricDescriptor, error) { | ||
var createMetricDescriptor = func(ctx context.Context, c *monitoring.MetricClient, mdr *monitoringpb.CreateMetricDescriptorRequest) (*metricpb.MetricDescriptor, error) { | ||
return c.CreateMetricDescriptor(ctx, mdr) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I added this to bypass SA1019 because the following failure after dependency upgrade:
Please let me know if this should be an issue or be fix as part of the PR.
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.
I'd prefer not disabling the deprecated notices. I might consider disabling specific files with //lint directives if the upgrade is problematic for some reason, but only if it isn't possible to use the new package easily.
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.
I think I have fixed the staticcheck errors. I had to make quite a bit of changes. I did test it by deploying it into Knative cluster just to be sure both metrics and traces are being exported correctly. Please let me know what you think. Thanks again!