-
Notifications
You must be signed in to change notification settings - Fork 79
Change ExportMetric api to ExportMetricProto #106
Conversation
Thank you for working on this change @rghetia! I have two comments:
|
@rghetia thanks for the reference. It would be useful to add such references to your commit message otherwise there is no context about the naming. With that I drop my suggestion not to rename.
[EDIT]: The purpose of a bundler is to relieve the goroutine that's invoking ExportMetric* from having to wait until the conversion is done. I see your point about it being used in a bundler on the ocagent-side. However, it can also be used by other folks hence the need for the bundler here. |
IMO the |
Only Agent/Collector would use this API so I would say we don't need it on exporter side. |
While that's true(thanks to the both of you for pointing that out), it doesn't seem like a great/robust design to remove a bundler here just because of one known use case that we assume will be the ONLY user. I'd argue that OpenCensus Service would be the one to remove its bundler. What if other companies ingest OpenCensus-Proto Metrics and do something with this exporter but their code isn't open source? What's the impetus to remove it from here? It also seems like a tertiary change to "Change ExportMetric api to ExportMetricProto" |
I'm good with this too. We can keep the bundling here and remove the logic from Agent.
That's true, if other companies depend on the |
I am on the same page with the reasoning to make the name change. Perhaps to ExportProtoMetrics or ExportMetricsProto since it now exports more than one, but also for keeping the bundler changes out of this PR. |
consensus is to just do the name change. I'll update the PR. |
Thanks @rghetia with the change. However, I personally had also alluded to accepting
as per #106 (comment) |
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.
LGTM
Change the api to ExportMetricsProto to reflect that it accepts more than one metric.
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.
LGTM, thank you @rghetia for this change and for bearing with my feedback!
metrics.go
Outdated
if metric == nil { | ||
// ExportMetricsProto exports OpenCensus Metrics Proto to Stackdriver Monitoring. | ||
func (se *statsExporter) ExportMetricsProto(ctx context.Context, node *commonpb.Node, rsc *resourcepb.Resource, metrics []*metricspb.Metric) error { | ||
if metrics == nil { |
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.
Minor nit: if len(metrics) == 0
instead of if metrics == nil
thanks for reviewing. |
This is a breaking change but only consumer of this api is oc-agent.
The api is renamed because this api should be used to export metric from core library to backends. After all, the api really exports metric proto and not metric data model.
The other change with this PR is taking slice of metrics instead of single metric. After that change there is no need for bundler. Hence it is removed.