diff --git a/equivalence_test.go b/equivalence_test.go index aeda057..54ad10a 100644 --- a/equivalence_test.go +++ b/equivalence_test.go @@ -276,7 +276,7 @@ func TestEquivalenceStatsVsMetricsUploads(t *testing.T) { ma.forEachRequest(func(emr *agentmetricspb.ExportMetricsServiceRequest) { for _, metric := range emr.Metrics { - _ = se.ExportMetric(context.Background(), emr.Node, emr.Resource, metric) + _ = se.ExportMetricProto(context.Background(), emr.Node, emr.Resource, metric) } }) se.Flush() diff --git a/metrics.go b/metrics.go index dc29bf7..b19ba57 100644 --- a/metrics.go +++ b/metrics.go @@ -49,8 +49,14 @@ type metricPayload struct { metric *metricspb.Metric } -// ExportMetric exports OpenCensus Metrics to Stackdriver Monitoring. -func (se *statsExporter) ExportMetric(ctx context.Context, node *commonpb.Node, rsc *resourcepb.Resource, metric *metricspb.Metric) error { +// ExportMetric exports OpenCensus Metrics proto to Stackdriver Monitoring. +// Deprecated in lieu of ExportMetricProto +func (se *statsExporter) ExportMetric(ctx context.Context, node *commonpb.Node, rsc *resourcepb.Resource, metricpb *metricspb.Metric) error { + return se.ExportMetricProto(ctx, node, rsc, metricpb) +} + +// ExportMetricProto exports OpenCensus Metrics proto to Stackdriver Monitoring. +func (se *statsExporter) ExportMetricProto(ctx context.Context, node *commonpb.Node, rsc *resourcepb.Resource, metric *metricspb.Metric) error { if metric == nil { return errNilMetric } diff --git a/stackdriver.go b/stackdriver.go index a6e7748..59f292e 100644 --- a/stackdriver.go +++ b/stackdriver.go @@ -345,9 +345,15 @@ func (e *Exporter) ExportView(vd *view.Data) { e.statsExporter.ExportView(vd) } +// ExportMetricProto exports OpenCensus Metrics to Stackdriver Monitoring. +func (e *Exporter) ExportMetricProto(ctx context.Context, node *commonpb.Node, rsc *resourcepb.Resource, metric *metricspb.Metric) error { + return e.statsExporter.ExportMetricProto(ctx, node, rsc, metric) +} + // ExportMetric exports OpenCensus Metrics to Stackdriver Monitoring. +// Deprecated in lieu of ExportMetriProto func (e *Exporter) ExportMetric(ctx context.Context, node *commonpb.Node, rsc *resourcepb.Resource, metric *metricspb.Metric) error { - return e.statsExporter.ExportMetric(ctx, node, rsc, metric) + return e.statsExporter.ExportMetricProto(ctx, node, rsc, metric) } // ExportSpan exports a SpanData to Stackdriver Trace.