Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Exporter to match new API #46

Merged
merged 5 commits into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions exporters/metric/datadog/datadog.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (

"github.com/DataDog/datadog-go/statsd"

"go.opentelemetry.io/otel/api/label"
"go.opentelemetry.io/otel/api/metric"
export "go.opentelemetry.io/otel/sdk/export/metric"
"go.opentelemetry.io/otel/sdk/export/metric/aggregator"
"go.opentelemetry.io/otel/sdk/resource"
)

const (
Expand Down Expand Up @@ -66,12 +66,11 @@ func defaultFormatter(namespace, name string) string {
return name
}

func (e *Exporter) Export(ctx context.Context, _ *resource.Resource, cs export.CheckpointSet) error {
// TODO: Use the Resource argument.
func (e *Exporter) Export(ctx context.Context, cs export.CheckpointSet) error {
return cs.ForEach(func(r export.Record) error {
agg := r.Aggregator()
name := e.sanitizeMetricName(r.Descriptor().LibraryName(), r.Descriptor().Name())
itr := r.Labels().Iter()
itr := label.NewMergeIterator(r.Resource().LabelSet(), r.Labels())
MrAlias marked this conversation as resolved.
Show resolved Hide resolved
tags := append([]string{}, e.opts.Tags...)
for itr.Next() {
label := itr.Label()
Expand Down
6 changes: 3 additions & 3 deletions exporters/metric/datadog/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

func ExampleExporter() {
selector := simple.NewWithSketchMeasure(ddsketch.NewDefaultConfig())
selector := simple.NewWithSketchDistribution(ddsketch.NewDefaultConfig())
integrator := integrator.New(selector, false)
exp, err := datadog.NewExporter(datadog.Options{
Tags: []string{"env:dev"},
Expand All @@ -24,10 +24,10 @@ func ExampleExporter() {
panic(err)
}
defer exp.Close()
pusher := push.New(integrator, exp, time.Second*10)
pusher := push.New(integrator, exp, push.WithPeriod(time.Second*10))
jmacd marked this conversation as resolved.
Show resolved Hide resolved
defer pusher.Stop()
pusher.Start()
global.SetMeterProvider(pusher)
global.SetMeterProvider(pusher.Provider())
meter := global.Meter("marwandist")
m := metric.Must(meter).NewInt64Counter("mycounter")
meter.RecordBatch(context.Background(), nil, m.Measurement(19))
Expand Down
2 changes: 1 addition & 1 deletion exporters/metric/datadog/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ go 1.14
require (
github.com/DataDog/datadog-go v3.5.0+incompatible
github.com/DataDog/sketches-go v0.0.0-20190923095040-43f19ad77ff7
go.opentelemetry.io/otel v0.5.0
go.opentelemetry.io/otel v0.6.0
)
2 changes: 2 additions & 0 deletions exporters/metric/datadog/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
go.opentelemetry.io/otel v0.5.0 h1:tdIR1veg/z+VRJaw/6SIxz+QX3l+m+BDleYLTs+GC1g=
go.opentelemetry.io/otel v0.5.0/go.mod h1:jzBIgIzK43Iu1BpDAXwqOd6UPsSAk+ewVZ5ofSXw4Ek=
go.opentelemetry.io/otel v0.6.0 h1:+vkHm/XwJ7ekpISV2Ixew93gCrxTbuwTF5rSewnLLgw=
go.opentelemetry.io/otel v0.6.0/go.mod h1:jzBIgIzK43Iu1BpDAXwqOd6UPsSAk+ewVZ5ofSXw4Ek=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
Expand Down