Skip to content

Commit

Permalink
chore: add detailed information about dice example, add source for al…
Browse files Browse the repository at this point in the history
…l shell scripts from docs

Signed-off-by: Igor Eulalio <[email protected]>
  • Loading branch information
IgorEulalio committed Nov 22, 2024
1 parent 2227bde commit 6f9ad53
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 7 deletions.
4 changes: 3 additions & 1 deletion examples/dice/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Dice example

Instructions on how to run instrumented and uninstrumented examples.
This is the foundation example for [Getting Started](https://opentelemetry.io/docs/languages/go/getting-started/) with OpenTelemetry.

Below, you will see instructions on how to run this application, either with or without instrumentation.

## Usage

Expand Down
1 change: 1 addition & 0 deletions examples/dice/instrumented/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
golang 1.22.0
17 changes: 17 additions & 0 deletions examples/dice/instrumented/get.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

#!/bin/bash

go get "go.opentelemetry.io/otel" \
"go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" \
"go.opentelemetry.io/otel/exporters/stdout/stdouttrace" \
"go.opentelemetry.io/otel/exporters/stdout/stdoutlog" \
"go.opentelemetry.io/otel/sdk/log" \
"go.opentelemetry.io/otel/log/global" \
"go.opentelemetry.io/otel/propagation" \
"go.opentelemetry.io/otel/sdk/metric" \
"go.opentelemetry.io/otel/sdk/resource" \
"go.opentelemetry.io/otel/sdk/trace" \
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"\
"go.opentelemetry.io/contrib/bridges/otelslog"
6 changes: 6 additions & 0 deletions examples/dice/instrumented/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

#!/bin/bash

module go.opentelemetry.io/contrib/examples/dice/instrumented
8 changes: 8 additions & 0 deletions examples/dice/instrumented/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

#!/bin/bash

go mod tidy
export OTEL_RESOURCE_ATTRIBUTES="service.name=dice,service.version=0.1.0"
go run .
6 changes: 6 additions & 0 deletions examples/dice/instrumented/tidy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

#!/bin/bash

go mod tidy
9 changes: 3 additions & 6 deletions examples/dice/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@ case "$1" in
instrumented)
echo "Running instrumented example..."
cd instrumented || exit
go mod tidy
source tidy.sh
go mod download
export OTEL_RESOURCE_ATTRIBUTES="service.name=dice,service.version=0.1.0"
go run .
source run.sh
;;
uninstrumented)
echo "Running uninstrumented example..."
cd uninstrumented || exit
go mod tidy
go mod download
go run .
source run.sh
;;
*)
echo "Invalid argument: $1. Use 'instrumented' or 'uninstrumented'."
Expand Down
6 changes: 6 additions & 0 deletions examples/dice/uninstrumented/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

#!/bin/bash

go run .

0 comments on commit 6f9ad53

Please sign in to comment.