-
Notifications
You must be signed in to change notification settings - Fork 21
Is adding stats.Exporter into ocagent on the schedule? #28
Comments
@moooofly thanks for this question. We shall be implementing stats and metrics soon and we actually have a bunch of issues open for it in the opencensus-service repository, but are blocked on the protocol definitions for the services in the agent/opencensus-service :) |
Ok, glad to hear you are on top of this. @odeke-em 😄 |
Aye aye, cheers, we've got you, thanks for being vigilant and for using it! If I may ask what company are you or what's your usage of OpenCensus? Please feel free to send me an email if you'd prefer to keep the information confidential :) |
FYI we're waiting on one last PR to unblock the metrics service work: census-instrumentation/opencensus-proto#137. |
@moooofly awesome, thanks for that confirmation! So interestingly in a couple of hours, the OpenCensus service will be able to accept traces from Zipkin. I have finished adding that functionality in census-instrumentation/opencensus-service#111, am just waiting on that PR to be reviewed and merged but essentially you'll be able to accept Zipkin traffic and then that'll get transformed into OpenCensus spans and then exported to a backend of your choice. |
@moooofly also wow, congrats on your just recently announced IPO at the NYSE from September 27th 2018!! Hope that OpenCensus brings value to your teams and customers. |
@moooofly btw in regards to
If right now you download the latest opencensus-service as per https://github.com/census-instrumentation/opencensus-service/releases/tag/v0.0.1 you can now receive traffic from your Zipkin applications (in whatever language) that use the Zipkin /v2 API without having to change their code -- it should mostly work. The only thing that's left is tweaking the Zipkin OpenCensus-Go exporter to send over the remote endpoint but otherwise it intercepts Zipkin traffic when run at whatever address that your applications are uploading spans. Also please feel free to add your company to https://opencensus.io/introduction/ and https://opencensus.io/community/users/ and thank you for using OpenCensus! |
All done here as per #31 with PRs #32 #34 and here is a demo that can upload stats and transform them to metrics to the OpenCensus Agent package main
import (
"context"
"log"
"math/rand"
"time"
"contrib.go.opencensus.io/exporter/ocagent"
"go.opencensus.io/stats"
"go.opencensus.io/stats/view"
"go.opencensus.io/trace"
)
func main() {
oce, err := ocagent.NewExporter(ocagent.WithInsecure())
if err != nil {
log.Fatalf("Failed to create ocagent-exporter: %v", err)
}
// Enable trace exporting
trace.RegisterExporter(oce)
trace.ApplyConfig(trace.Config{
DefaultSampler: trace.AlwaysSample(),
})
// Enable stats exporting
view.RegisterExporter(oce)
mLatencyMs := stats.Float64("latency", "The latency per call", "ms")
views := []*view.View{
{
Name: "ocagent/example/latency",
Description: "The latency distribution per call",
Measure: mLatencyMs,
Aggregation: view.Distribution(0, 5, 10, 20, 50, 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600),
},
{
Name: "ocagent/example/counts",
Description: "The number of calls",
Measure: mLatencyMs,
Aggregation: view.Count(),
},
}
if err := view.Register(views...); err != nil {
log.Fatalf("Failed to register the views: %v", err)
}
rng := rand.New(rand.NewSource(time.Now().UnixNano()))
for {
ctx := context.Background()
startTime := time.Now()
_, span := trace.StartSpan(ctx, "foo")
time.Sleep(time.Duration(rng.Int63n(1000)) * time.Millisecond)
span.End()
timeSpentMs := float64(time.Since(startTime) / time.Millisecond)
stats.Record(ctx, mLatencyMs.M(timeSpentMs))
}
} |
hi, @odeke-em , this is what I need right now.
Just as opencensus-go-exporter-stackdriver did
The text was updated successfully, but these errors were encountered: