Skip to content

Commit eced64a

Browse files
authored
Merge pull request #1498 from mboersma/export-to-jaeger
Export traces to Jaeger and update OpenTelemetry
2 parents 84192b4 + 945b355 commit eced64a

35 files changed

+932
-212
lines changed

Tiltfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,23 @@ COPY manager .
121121
def observability():
122122
instrumentation_key = os.getenv("AZURE_INSTRUMENTATION_KEY", "")
123123
if instrumentation_key == "":
124-
warn("AZURE_INSTRUMENTATION_KEY is not set, so tracing won't be exported to Application Insights")
124+
warn("AZURE_INSTRUMENTATION_KEY is not set, so traces won't be exported to Application Insights")
125+
trace_links = []
126+
else:
127+
trace_links = [link("https://ms.portal.azure.com/#blade/HubsExtension/BrowseResource/resourceType/microsoft.insights%2Fcomponents", "App Insights")]
125128
k8s_yaml(helm("./hack/observability/opentelemetry/chart",
126129
name="opentelemetry-collector", namespace="capz-system",
127130
values=["./hack/observability/opentelemetry/values.yaml"],
128131
set=["config.exporters.azuremonitor.instrumentation_key="+instrumentation_key]))
132+
k8s_yaml(helm("./hack/observability/jaeger/chart",
133+
name="jaeger-all-in-one", namespace="capz-system",
134+
set=["crd.install=false", "rbac.create=false",
135+
"resources.limits.cpu=200m", "resources.limits.memory=256Mi"]))
136+
k8s_resource(workload="jaeger-all-in-one", new_name="traces: jaeger-all-in-one",
137+
port_forwards=[port_forward(16686, name="View traces", link_path='/search?service=capz')],
138+
links=trace_links)
139+
k8s_resource(workload="prometheus-operator", new_name="metrics: prometheus-operator",
140+
port_forwards=[port_forward(9090, name="View metrics")], extra_pod_selectors=[{"app": "prometheus"}])
129141

130142
# Build CAPZ and add feature gates
131143
def capz():

docs/book/src/developers/development.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -213,19 +213,29 @@ make delete-workload-cluster
213213
> Check out the [troubleshooting guide](../topics/troubleshooting.md) for common errors you might run into.
214214
215215
#### Viewing Telemetry
216-
The CAPZ controller emits tracing and metrics data. When run in Tilt, the KinD cluster is provisioned with a development
217-
deployment of OpenTelemetry for distributed tracing, and Prometheus for metrics scraping and visualization.
218216

219-
The OpenTelemetry and Prometheus deployments are for development purposes only. These illustrate the hooks for tracing and
220-
metrics, but lack the robustness of production cluster deployments.
217+
The CAPZ controller emits tracing and metrics data. When run in Tilt, the KinD management cluster is
218+
provisioned with development deployments of OpenTelemetry for collecting distributed traces, Jaeger
219+
for viewing traces, and Prometheus for scraping and visualizing metrics.
221220

222-
After the Tilt cluster has been initialized, if you followed the [tracing documentation](../../../../hack/observability/opentelemetry/readme.md),
223-
you can view distributed traces in the Azure Portal. Open the App Insights resource identified by the
224-
`AZURE_INSTRUMENTATION_KEY` you specified, choose "Transaction search" from the "Investigate" menu on the left,
225-
and click "Refresh" or make a specific query of the trace data.
221+
The OpenTelemetry, Jaeger, and Prometheus deployments are for development purposes only. These
222+
illustrate the hooks for tracing and metrics, but lack the robustness of production cluster
223+
deployments. For example, the Jaeger "all-in-one" component only keeps traces in memory, not in a
224+
persistent store.
226225

227-
To view metrics, run `kubectl port-forward -n capz-system prometheus-prometheus-0 9090` and open
228-
`http://localhost:9090` to see the Prometheus UI.
226+
To view traces in the Jaeger interface, wait until the Tilt cluster is fully initialized. Then open
227+
the Tilt web interface, select the "traces: jaeger-all-in-one" resource, and click "View traces"
228+
near the top of the screen. Or visit http://localhost:16686/ in your browser. <!-- markdown-link-check-disable-line -->
229+
230+
To view traces in App Insights, follow the
231+
[tracing documentation](../../../../hack/observability/opentelemetry/readme.md) before running
232+
`make tilt-up`. Then open the Azure Portal in your browser. Find the App Insights resource you
233+
specified in `AZURE_INSTRUMENTATION_KEY`, choose "Transaction search" on the left, and click
234+
"Refresh" to see recent trace data.
235+
236+
To view metrics in the Prometheus interface, open the Tilt web interface, select the
237+
"metrics: prometheus-operator" resource, and click "View metrics" near the top of the screen. Or
238+
visit http://localhost:9090/ in your browser. <!-- markdown-link-check-disable-line -->
229239

230240
### Manual Testing
231241

go.mod

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@ require (
2525
github.com/pkg/errors v0.9.1
2626
github.com/prometheus/client_golang v1.11.0
2727
github.com/spf13/pflag v1.0.5
28-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0
29-
go.opentelemetry.io/otel v0.20.0
30-
go.opentelemetry.io/otel/exporters/metric/prometheus v0.20.0
31-
go.opentelemetry.io/otel/exporters/trace/jaeger v0.20.1-0.20210504183141-c99d5e999c69
32-
go.opentelemetry.io/otel/sdk v0.20.1-0.20210504183141-c99d5e999c69
33-
go.opentelemetry.io/otel/trace v0.20.0
28+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.22.0
29+
go.opentelemetry.io/otel v1.0.0-RC2
30+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.0.0-RC2
31+
go.opentelemetry.io/otel/exporters/prometheus v0.22.0
32+
go.opentelemetry.io/otel/metric v0.22.0
33+
go.opentelemetry.io/otel/sdk v1.0.0-RC2
34+
go.opentelemetry.io/otel/sdk/export/metric v0.22.0
35+
go.opentelemetry.io/otel/sdk/metric v0.22.0
36+
go.opentelemetry.io/otel/trace v1.0.0-RC2
3437
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
3538
golang.org/x/mod v0.4.2
3639
k8s.io/api v0.21.2

0 commit comments

Comments
 (0)