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

[IA] Auto-Update rust versions in docs from registry #3944

Merged
merged 3 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions content/en/docs/languages/rust/exporters.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ cSpell:ignore: chrono millis ostream
## OTLP endpoint

To send trace data to a OTLP endpoint (like the [collector](/docs/collector) or
Jaeger) you'll want to use an exporter crate, such as `opentelemetry_otlp`:
Jaeger) you'll want to use an exporter crate, such as
[opentelemetry-otlp](https://crates.io/crates/opentelemetry-otlp):

```toml
[dependencies]
opentelemetry-otlp = { version = "0.13", features = ["default"] }
opentelemetry-otlp = { version = "{{% version-from-registry exporter-rust-otlp %}}", features = ["default"] }
```

Next, configure the exporter to point at an OTLP endpoint. For example you can
Expand Down
9 changes: 6 additions & 3 deletions content/en/docs/languages/rust/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,14 @@ Listening on 127.0.0.1:8080
## Instrumentation

To add OpenTelemetry to your application, update the `Cargo.toml` with the
following additional dependencies:
dependencies for the OpenTelemetry Rust SDK
[`opentelemetry`](https://crates.io/crates/opentelemetry) and the OpenTelemetry
Stdout Exporter
[`opentelemetry-stdout`](https://crates.io/crates/opentelemetry-stdout):

```toml
opentelemetry = { version = "0.20", features = ["trace"] }
opentelemetry-stdout = { version = "0.1", features = ["trace"] }
opentelemetry = { version = "{{% version-from-registry otel-rust %}}", features = ["trace"] }
opentelemetry-stdout = { version = "{{% version-from-registry exporter-rust-stdout %}}", features = ["trace"] }
```

Update the `dice_server.rs` file with code to initialize a tracer and to emit
Expand Down
4 changes: 4 additions & 0 deletions data/registry/otel-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ authors:
urls:
repo: https://github.com/open-telemetry/opentelemetry-rust
createdAt: 2020-02-04
package:
registry: crates
name: opentelemetry
version: 0.21.0
15 changes: 15 additions & 0 deletions layouts/shortcodes/version-from-registry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{ $name := (.Get 0) -}}

{{ with $name -}}
{{ with index $.Site.Data.registry . -}}
{{ with .package.version -}}
{{ . -}}
{{ else -}}
{{ errorf "No 'package.version' in registry entry %q: %s" $name $.Position -}}
{{ end -}}
{{ else -}}
{{ errorf "Registry entry %q not found: %s" $name $.Position -}}
{{ end -}}
{{ else -}}
{{ errorf "Shortcode parameter 'name' is missing %s: " $.Position -}}
{{ end -}}
Loading