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

Combine the Push and Pull metric controllers #1378

Merged
merged 45 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
41cd10f
Push->basic
Nov 28, 2020
a4cc190
Repackage
Nov 28, 2020
d2eb038
Rename away from push
Nov 28, 2020
d421cb5
Make exporter optional; export from a separate goroutine
Nov 28, 2020
b3b080d
Move pull_test into controller_test
Nov 29, 2020
14f9dc3
Precommit pass
Nov 29, 2020
6da90ab
New OTLP/Prom example
Nov 29, 2020
ac85aa5
Precommit
Nov 29, 2020
5adda98
Fix the example
Nov 29, 2020
410096f
Shorten the example
Nov 30, 2020
85e4889
Test starting controller w/o exporter
Nov 30, 2020
2089c22
Test export timeout
Nov 30, 2020
c64eba1
Remove ancient example & lint
Nov 30, 2020
70d5326
go.mod revert & tidy
Nov 30, 2020
f0318ac
Comments
Nov 30, 2020
a345da8
Tidy a diff
Nov 30, 2020
92adfd6
Tidy a diff
Nov 30, 2020
14e8814
Move export kind selector in the new example
Dec 1, 2020
b8b6d7a
Upstream
Dec 1, 2020
8eccdc9
Split this test into its original parts
Dec 1, 2020
7662f6e
Reduce diff size
Dec 1, 2020
c1ceb43
Changelog
Dec 1, 2020
06401cd
Remove extra Add/Done pair
Dec 1, 2020
ea7d7a3
Remove unused stopCh param; document the Stop behavior
Dec 2, 2020
793560e
Typo
Dec 2, 2020
9038614
Upstream
Dec 2, 2020
8435dde
Use ctx
Dec 3, 2020
8a8bddb
Upstream
Dec 3, 2020
34b0855
Upstream
Dec 12, 2020
f6fba89
Missed v0.15
Dec 12, 2020
d27a2ec
Remove print stmt
Dec 18, 2020
3cfa9f0
Upstream
Dec 22, 2020
c4719c6
Apply PR feedback
Dec 22, 2020
68ca202
Precommit pass
Dec 22, 2020
89be714
0.14 -> 0.15 in new file
Dec 22, 2020
44128e7
Remove diff chunk markers
Dec 22, 2020
8beee82
Merge remote-tracking branch 'origin' into jmacd/pushpull
Dec 29, 2020
0e46354
Fix OTLP example
Dec 29, 2020
508ac7a
Merge remote-tracking branch 'origin' into jmacd/pushpull
Jan 6, 2021
689cb62
Upstream
Jan 6, 2021
a9e1e95
dashpole comments
Jan 12, 2021
7324ba0
aneurysm9 feedback
Jan 12, 2021
b291413
Upstream
Jan 12, 2021
c4c087a
Upstream
Jan 12, 2021
44eacc8
Tidy go.sum
Jan 12, 2021
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
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ updates:
interval: weekly
-
package-ecosystem: gomod
directory: /example/basic
directory: /example/prom-collector
labels:
- dependencies
- go
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ coverage.*

gen/

/example/basic/basic
/example/grpc/client/client
/example/grpc/server/server
/example/http/client/client
Expand All @@ -19,5 +18,6 @@ gen/
/example/namedtracer/namedtracer
/example/opencensus/opencensus
/example/prometheus/prometheus
/example/prom-collector/prom-collector
/example/zipkin/zipkin
/example/otel-collector/otel-collector
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Rename `export.SpanData` to `export.SpanSnapshot` and use it only for exporting spans. (#1360)
- Store the parent's full `SpanContext` rather than just its span ID in the `span` struct. (#1360)
- Improve span duration accuracy. (#1360)
- Metric Push and Pull Controller components are combined into a single "basic" Controller:
- `WithExporter()` and `Start()` to configure Push behavior
- `Start()` is optional; use `Collect()` and `ForEach()` for Pull behavior
- `Start()` and `Stop()` accept Context. (#1378)

### Removed

Expand All @@ -37,7 +41,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Bump `github.com/google/go-cmp` from 0.5.3 to 0.5.4 (#1374)
- Bump `github.com/golangci/golangci-lint` in `/internal/tools` (#1375)


### Fixed

- Metric SDK `SumObserver` and `UpDownSumObserver` instruments correctness fixes. (#1381)
Expand Down
15 changes: 0 additions & 15 deletions example/basic/go.mod

This file was deleted.

21 changes: 0 additions & 21 deletions example/basic/go.sum

This file was deleted.

118 changes: 0 additions & 118 deletions example/basic/main.go

This file was deleted.

18 changes: 9 additions & 9 deletions example/otel-collector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (
"go.opentelemetry.io/otel/label"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/propagation"
"go.opentelemetry.io/otel/sdk/metric/controller/push"
"go.opentelemetry.io/otel/sdk/metric/processor/basic"
controller "go.opentelemetry.io/otel/sdk/metric/controller/basic"
processor "go.opentelemetry.io/otel/sdk/metric/processor/basic"
"go.opentelemetry.io/otel/sdk/metric/selector/simple"
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
Expand Down Expand Up @@ -71,25 +71,25 @@ func initProvider() func() {
sdktrace.WithSpanProcessor(bsp),
)

pusher := push.New(
basic.New(
controller := controller.New(
MrAlias marked this conversation as resolved.
Show resolved Hide resolved
jmacd marked this conversation as resolved.
Show resolved Hide resolved
processor.New(
simple.NewWithExactDistribution(),
exp,
),
exp,
push.WithPeriod(2*time.Second),
controller.WithExporter(exp),
controller.WithCollectPeriod(2*time.Second),
)

// set global propagator to tracecontext (the default is no-op).
otel.SetTextMapPropagator(propagation.TraceContext{})
otel.SetTracerProvider(tracerProvider)
otel.SetMeterProvider(pusher.MeterProvider())
pusher.Start()
otel.SetMeterProvider(controller.MeterProvider())
handleErr(controller.Start(context.Background()), "failed to start controller")

return func() {
handleErr(tracerProvider.Shutdown(ctx), "failed to shutdown provider")
handleErr(exp.Shutdown(ctx), "failed to stop exporter")
pusher.Stop() // pushes any last exports to the receiver
handleErr(controller.Stop(context.Background()), "failed to stop controller")
}
}

Expand Down
3 changes: 3 additions & 0 deletions example/prom-collector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This example demonstrates a metrics export pipeline that supports
Prometheus (pull) and simultaneously exports OTLP to an OpenTelemetry
endpoint (push).
18 changes: 18 additions & 0 deletions example/prom-collector/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module go.opentelemetry.io/otel/example/prom-collector

go 1.14

replace (
go.opentelemetry.io/otel => ../..
go.opentelemetry.io/otel/exporters/metric/prometheus => ../../exporters/metric/prometheus
go.opentelemetry.io/otel/exporters/otlp => ../../exporters/otlp
go.opentelemetry.io/otel/sdk => ../../sdk
)

require (
go.opentelemetry.io/otel v0.15.0
go.opentelemetry.io/otel/exporters/metric/prometheus v0.14.0
go.opentelemetry.io/otel/exporters/otlp v0.14.0
jmacd marked this conversation as resolved.
Show resolved Hide resolved
go.opentelemetry.io/otel/sdk v0.15.0
google.golang.org/grpc v1.32.0
)
Loading