-
Notifications
You must be signed in to change notification settings - Fork 327
Conversation
examples/exporter/logexporter.go
Outdated
// limitations under the License. | ||
|
||
// Package exporter contains a log exporter that supports exporting | ||
// OpenCensus metrics to a logging framework. |
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.
Nit: metrics and spans.
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.
done.
examples/exporter/logexporter.go
Outdated
"go.opencensus.io/trace" | ||
) | ||
|
||
// LogExporter exports stats to log file |
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.
Nit: stats and spans
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.
fixed.
examples/exporter/logexporter.go
Outdated
// If it is nil then the metrics are logged on console | ||
MetricsLogFile string | ||
|
||
//TracesLogFile is path where exported span data are logged. |
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.
Nit: space after //
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.
done.
|
||
func printMetricDescriptor(metric *metricdata.Metric) string { | ||
d := metric.Descriptor | ||
return fmt.Sprintf("name: %s, type: %s, unit: %s ", |
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.
Label keys?
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 print it as k=v pair in printLabels.
examples/exporter/logexporter.go
Outdated
} | ||
} | ||
|
||
// Start starts the metric exporter. |
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.
Nit: metric and trace
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.
it doesn't start trace exporter. For trace it sill requires to register but I don't see why I cannot call registerExporter here. I'll make the change and update the comment.
examples/exporter/logexporter.go
Outdated
return e.ir.Start() | ||
} | ||
|
||
// Stop stops the metric exporter. |
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.
Ditto
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.
done.
e.ir, _ = metricexport.NewIntervalReader(&metricexport.Reader{}, e) | ||
}) | ||
e.ir.ReportingInterval = e.o.ReportingInterval | ||
return e.ir.Start() |
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.
Do you need to register this as a trace exporter too?
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'll register as trace exporter here. see my response to prev 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 overall
examples/exporter/logexporter.go
Outdated
} | ||
f, err := os.OpenFile(filepath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666) | ||
if err != nil { | ||
log.Fatalf("error opening file: %v", err) |
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.
Nit: consider returning err
instead of logging it.
* Add log exporter. * close log files when program terminates. * split stats into multiple lines. * fix review comments. * one more comment.
* Add log exporter. * close log files when program terminates. * split stats into multiple lines. * fix review comments. * one more comment.
No description provided.