Skip to content

Commit aafc4e0

Browse files
authored
Merge branch 'main' into rapphil-add-processors-v0.29.0
2 parents a5713d2 + 9e6285f commit aafc4e0

File tree

15 files changed

+173
-59
lines changed

15 files changed

+173
-59
lines changed

DEV_GUIDE.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,17 @@
88
## Development Setup
99

1010
1. Clone this repository onto your local machine
11-
2. [Download and Set up Gatsby Environment](https://www.gatsbyjs.com/tutorial/part-zero/).
12-
3. Open up the project using your preferred code editor
13-
4. Install the required node modules for this project.
11+
2. Open up the project using your preferred code editor
12+
3. Install the required node modules for this project.
1413
```
1514
npm install
1615
```
17-
5. Disable GitHub API access (Used to fetch the list of contributors)
18-
Create a new file in the root called `.env.development` (See [Project Structure](#project-structure) for more information)
19-
Write the following line to it:
20-
```
21-
NO_GH_API_KEY=true
22-
```
2316
4. Start up the Gatsby site
2417
```
25-
npm start
18+
NO_GH_API_KEY=true npm start
2619
```
2720
5. Open http://localhost:8000 to check the site
2821
29-
**Obs**: The `NO_GH_API_KEY` environment variable can also be passed through command line. E.g.: `NO_GH_API_KEY=true npm run start`.
30-
3122
### Optional - Test the GitHub API integration
3223
3324
This step is optional and allows you to test that the list of contributors is being fetched from GitHub.
105 KB
Loading

src/docs/getting-started/container-insights/ecs-prometheus.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,7 @@ Policy document merged from <Link to="/docs/setup/ecs/create-iam-policy">ECS set
307307
"ecs:DescribeContainerInstances",
308308
"ecs:DescribeServices",
309309
"ecs:DescribeTasks",
310-
"ecs:DescribeTaskDefinition",
311-
"ecs:DescribeInstances"
310+
"ecs:DescribeTaskDefinition"
312311
],
313312
"Resource": "*"
314313
}

src/docs/getting-started/go-sdk.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ In this tutorial, we will introduce how to use OpenTelemetry Go SDK for manual i
1616

1717
## Getting Started
1818

19-
* [Manual Instrumentation for Traces with OpenTelemetry Go SDK](/docs/getting-started/go-sdk/trace-manual-instr)
19+
* [Manual Instrumentation for Traces and Metrics with OpenTelemetry Go SDK](/docs/getting-started/go-sdk/manual-instr)
2020

2121

2222
## Sample Code
2323

24-
* [AWS Distro for OpenTelemetry Sample Code with Go SDK](https://github.com/aws-observability/aws-otel-go/tree/main/sampleapp)
24+
* [AWS Distro for OpenTelemetry Sample Code with Go SDK](https://github.com/aws-observability/aws-otel-community/tree/master/sample-apps/go-sample-app)

src/docs/getting-started/go-sdk/trace-manual-instr.mdx renamed to src/docs/getting-started/go-sdk/manual-instr.mdx

Lines changed: 78 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: 'Tracing with the AWS Distro for OpenTelemetry Go SDK and X-Ray'
2+
title: 'Using the AWS Distro for OpenTelemetry Go SDK'
33
description:
44
OpenTelemetry provides different language SDKs to instrument code for collecting telemetry data in the application.
5-
In this tutorial, we will introduce how to use OpenTelemetry Go SDK for traces instrumentation in the application.
6-
path: '/docs/getting-started/go-sdk/trace-manual-instr'
5+
In this tutorial, we will introduce how to use OpenTelemetry Go SDK for traces and metrics instrumentation in the application.
6+
path: '/docs/getting-started/go-sdk/manual-instr'
77
---
88

99
import SectionSeparator from "components/MdxSectionSeparator/sectionSeparator.jsx"
@@ -19,19 +19,19 @@ import goImg6 from "assets/img/docs/gettingStarted/goSDK/img6.jpg"
1919

2020
## Introduction
2121
Welcome to the AWS Distro for OpenTelemetry (ADOT) Go getting started guide. This walk-through covers the ADOT Go components, how to
22-
configure the ADOT components to capture traces with OpenTelemetry Go and AWS X-Ray, as well as how to use the AWS Elastic Container Service
22+
configure the ADOT components to capture traces and metrics with OpenTelemetry Go, as well as how to use the AWS Elastic Container Service
2323
(AWS ECS) and AWS Elastic Kubernetes Service (AWS EKS) resource detectors. Before reading this guide, you should familiarize with
24-
distributed tracing and the basics of OpenTelemetry. To learn more about getting started with OpenTelemetry Go, see the
24+
distributed tracing/metrics and the basics of OpenTelemetry. To learn more about getting started with OpenTelemetry Go, see the
2525
[OpenTelemetry developer documentation](https://opentelemetry.io/docs/go/).
2626

2727
<img src={goImg1} alt="Diagram" style="margin: 30px 0;" />
2828

2929
<SectionSeparator />
3030

3131
## Requirements
32-
Go `v1.15` or later is required to run an application using OpenTelemetry. Visit the [compatibility chart](https://github.com/open-telemetry/opentelemetry-go#compatibility) of OpenTelemetry Go SDK with different `OS`, `Go Version` and `Architecture`.
32+
Go `v1.19` or later is required to run an application using OpenTelemetry. Visit the [compatibility chart](https://github.com/open-telemetry/opentelemetry-go#compatibility) of OpenTelemetry Go SDK with different `OS`, `Go Version` and `Architecture`.
3333

34-
Note: You’ll also need to have the [ADOT Collector](https://aws-otel.github.io/docs/getting-started/collector) running to export traces to X-Ray.
34+
Note: You’ll also need to have the [ADOT Collector](https://aws-otel.github.io/docs/getting-started/collector) running to export traces and metrics.
3535

3636
<SectionSeparator />
3737

@@ -44,6 +44,9 @@ Download and install the following packages to use ADOT Components with OpenTele
4444
3. OTel Go SDK for tracing
4545
4. OTel Go API for tracing
4646
5. OTLP gRPC exporter for exporting trace data
47+
6. OTel Go SDK for metrics
48+
7. OTel Go API for metrics
49+
8. OTLP gRPC exporter for exporting metric data
4750
```
4851

4952
To install the above mentioned necessary prerequisites, run the following command in the same directory that the application `go.mod` file is in:
@@ -53,13 +56,15 @@ go get go.opentelemetry.io/otel
5356
go get go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc
5457
go get go.opentelemetry.io/otel/sdk/resource
5558
go get go.opentelemetry.io/otel/sdk/trace
59+
go get go.opentelemetry.io/otel/sdk/metric
60+
go get go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc
5661
```
5762

5863
<SectionSeparator />
5964

6065
## Setting up the Global Tracer
6166

62-
### Sending Traces to AWS X-Ray
67+
### Sending Traces
6368

6469
This section talks about how to instantiate a new tracer provider with the X-Ray ID generator and sampling config, setting global options (X-Ray propagator, tracer provider) and instantiate OTLP exporter with the collector's address to export trace data.
6570

@@ -70,10 +75,9 @@ This section talks about how to instantiate a new tracer provider with the X-Ray
7075
OpenTelemetry Go requires an exporter to send traces to a backend. Exporters allow telemetry data to be transferred either to the AWS Distro for OpenTelemetry Collector (ADOT Collector), or to a remote system or console for further analysis. The ADOT Collector is a separate process that is designed to be a "sink" for telemetry data emitted by many processes, which can then export
7176
that data to various back-end systems.
7277

73-
To initialize the OTLP exporter, add the following code to the file the `main.go` file.
78+
To initialize the OTLP trace exporter, add the following code to the file the `main.go` file.
7479

75-
76-
**IMPORTANT**: The following example creates an OTLP exporter that does not encrypt data at transfer because it uses the `otlptracegrpc.WithInsecure()` option. This should only be used for creating proof of concepts and experimenting with the Go SDK.
80+
**IMPORTANT**: The following examples creates an OTLP exporter that does not encrypt data at transfer because it uses the `otlptracegrpc.WithInsecure()` option. This should only be used for creating proof of concepts and experimenting with the Go SDK.
7781
For production environments you must properly configure TLS using the `otlptracegrpc.WithTLSCredentials` function.
7882

7983
```go lineNumbers=true
@@ -135,6 +139,48 @@ tracerProvider := trace.NewTracerProvider(
135139
trace.WithResource(resource),
136140
)
137141
```
142+
## Setting up the Global Meter
143+
144+
### Sending metrics
145+
146+
This section talks about how to instantiate a new meter provider , setting global options (meter provider) and instantiate OTLP exporter with the collector's address to export metric data.
147+
148+
#### Creating an OpenTelemetry Protocol (OTLP) Exporter
149+
150+
OpenTelemetry Go requires an exporter to send metrics to a backend. Exporters allow telemetry data to be transferred either to the AWS Distro for OpenTelemetry Collector (ADOT Collector), or to a remote system or console for further analysis. The ADOT Collector is a separate process that is designed to be a "sink" for telemetry data emitted by many processes, which can then export
151+
that data to various back-end systems.
152+
153+
To initialize the OTLP metric exporter, add the following code to the file the `main.go` file.
154+
155+
**IMPORTANT**: The following examples creates an OTLP exporter that does not encrypt data at transfer because it uses the `otlpmetricgrpc.WithInsecure()` option. This should only be used for creating proof of concepts and experimenting with the Go SDK.
156+
For production environments you must properly configure TLS using the `otlpmetricgrpc.WithTLSCredentials` function.
157+
158+
```go lineNumbers=true
159+
// Create and start new OTLP metric exporter
160+
metricExporter, err := otlpmetricgrpc.New(ctx, otlpmetricgrpc.WithInsecure(), otlpmetricgrpc.WithEndpoint("0.0.0.0:4317"), otlpmetricgrpc.WithDialOption(grpc.WithBlock()))
161+
if err != nil {
162+
log.Fatalf("failed to create new OTLP metric exporter: %v", err)
163+
}
164+
```
165+
166+
#### Creating a Meter Provider
167+
168+
In order to generate metrics, OpenTelemetry Go SDK requires a meter provider to be created. The meter provider is configured with a periodic reader in this example.
169+
170+
To create a new meter provider, add the following lines to the `main.go` file.
171+
```go lineNumbers=true
172+
mp := metric.NewMeterProvider(metric.WithReader(metric.NewPeriodicReader(metricExporter))
173+
```
174+
175+
Above block of code creates a new `MeterProvider` with a periodic reader.
176+
177+
178+
#### Setting Global Options
179+
180+
To set up global options for the meter provider, we will use the `otel` package and add the following line to the `main.go` file.
181+
```go lineNumbers=true
182+
otel.SetMeterProvider(mp)
183+
```
138184

139185
<SubSectionSeparator />
140186

@@ -256,7 +302,27 @@ _, span := tracer.Start(
256302
defer span.End()
257303
```
258304

305+
### Creating metrics
306+
307+
Similarly to Traces, you can create custom metrics in your application using the OpenTelemetry API and SDK.
308+
309+
In the following example application we demonstrate how to use metric instruments to record metrics with a Counter.
310+
```go lineNumbers=true
311+
var meter = otel.Meter("demo")
312+
timeAliveMetric, _ := meter.Int64Counter(
313+
"time_alive",
314+
instrument.WithDescription("Total amount of time that the application has been alive"),
315+
instrument.WithUnit("ms"),
316+
)
317+
go func() {
318+
for {
319+
timeAliveMetric.Add(context.Background(), 1000, attribute.String("a", "1")) // in millisconds
320+
time.Sleep(time.Second * time.Duration(1))
321+
}
322+
}()
323+
```
324+
259325
<SectionSeparator />
260326

261327
## Sample Application
262-
See [AWS Distro for OpenTelemetry Sample Code with Go SDK](https://github.com/aws-observability/aws-otel-go/tree/main/sampleapp) for instructions on setting up and using the sample app.
328+
See [AWS Distro for OpenTelemetry Sample Code with Go SDK](https://github.com/aws-observability/aws-otel-community/tree/master/sample-apps/go-sample-app) for instructions on setting up and using the sample app.

src/docs/getting-started/java-sdk.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ backend.
1717

1818
## Getting Started
1919

20-
* [Auto-Instrumentation for Traces and Metrics with the Java agent](/docs/getting-started/java-sdk/trace-auto-instr)
21-
* [Manual Instrumentation for Traces and Metrics with the Java SDK](/docs/getting-started/java-sdk/trace-manual-instr)
20+
* [Auto-Instrumentation for Traces and Metrics with the Java agent](/docs/getting-started/java-sdk/auto-instr)
21+
* [Manual Instrumentation for Traces and Metrics with the Java SDK](/docs/getting-started/java-sdk/manual-instr)
2222

2323
## Sample Code
24-
* [Sample Spring App using OpenTelemetry Java Auto-Instrumentation](https://catalog.us-east-1.prod.workshops.aws/workshops/31676d37-bbe9-4992-9cd1-ceae13c5116c/en-US/aws-managed-oss/adot/javawalkthrough)
24+
* [Sample Spring App using OpenTelemetry Java Auto-Instrumentation Workshop](https://catalog.us-east-1.prod.workshops.aws/workshops/31676d37-bbe9-4992-9cd1-ceae13c5116c/en-US/aws-managed-oss/adot/javawalkthrough)
25+
* [Sample App using OpenTelemetry Java Auto-Instrumentation and Manual-Instrumentation](https://github.com/aws-observability/aws-otel-community/tree/master/sample-apps/java-sample-app)

src/docs/getting-started/java-sdk/trace-auto-instr.mdx renamed to src/docs/getting-started/java-sdk/auto-instr.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description:
55
instrumentations for all supported libraries and all available data exporters, providing a complete out of the box
66
experience for tracing and metrics on AWS. The agent is preconfigured to generate trace IDs compatible with AWS X-Ray, which
77
will also work with any other tracing system, and enables trace propagation using W3C Trace Context, B3, and X-Ray.
8-
path: '/docs/getting-started/java-sdk/trace-auto-instr'
8+
path: '/docs/getting-started/java-sdk/auto-instr'
99
---
1010

1111
import SectionSeparator from "components/MdxSectionSeparator/sectionSeparator.jsx"

src/docs/getting-started/java-sdk/trace-manual-instr.mdx renamed to src/docs/getting-started/java-sdk/manual-instr.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: 'Manual Instrumentation for Traces and Metrics with the Java SDK'
33
description:
44
Learn how to get started with Java SDK for adding tracing to applications and libraries.
5-
path: '/docs/getting-started/java-sdk/trace-manual-instr'
5+
path: '/docs/getting-started/java-sdk/manual-instr'
66
---
77

88
import SectionSeparator from "components/MdxSectionSeparator/sectionSeparator.jsx"

src/docs/getting-started/javascript-sdk.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ In this tutorial, we will introduce how to use [OpenTelemetry JavaScript SDK](ht
2121

2222

2323
## Sample Code with JavaScript SDK
24-
* [AWS Distro for OpenTelemetry Sample Code with JavaScript SDK](https://github.com/aws-observability/aws-otel-js/tree/main/sample-apps)
24+
* [AWS Distro for OpenTelemetry Sample Code with JavaScript SDK](https://github.com/aws-observability/aws-otel-community/tree/master/sample-apps/javascript-sample-app)
2525

src/docs/getting-started/php-sdk/trace-manual-instr.mdx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ composer require open-telemetry/sdk
5656
In order to use this package, you must also install the GRPC package using PECL. See the instructions on the [OpenTelemetry PHP repository](https://github.com/open-telemetry/opentelemetry-php#optional-dependencies) for more information.
5757

5858
```bash
59-
composer require open-telemetry/exporter-otlp-grpc
59+
composer require open-telemetry/exporter-otlp
60+
composer require open-telemetry/transport-grpc
6061
```
6162

6263
<SectionSeparator />
@@ -71,7 +72,10 @@ In order to send trace data to AWS X-Ray, instantiate a new tracer provider and
7172
```
7273
// Initialize Span Processor, X-Ray ID generator, Tracer Provider, and Propagator
7374
74-
$spanProcessor = new SimpleSpanProcessor(new OTLPExporter());
75+
$transport = (new GrpcTransportFactory())->create('http://127.0.0.1:4317' . OtlpUtil::method(Signals::TRACE));
76+
$exporter = new SpanExporter($transport);
77+
$spanProcessor = new SimpleSpanProcessor($exporter);
78+
7579
$idGenerator = new IdGenerator();
7680
$tracerProvider = new TracerProvider($spanProcessor, null, null, null, $idGenerator);
7781
$propagator = new Propagator();
@@ -137,26 +141,28 @@ Run the following command to import the AWS SDK Instrumentation:
137141

138142

139143
```
140-
composer require open-telemetry/opentelemetry-php-contrib:0.0.15
144+
composer require open-telemetry/contrib-aws:1.0.0beta3
141145
```
142146

143147

144148
Import the `AwsSdkInstrumentation` class in your PHP source code to activate the SDK instrumentation:
145149

146150

147151
```
148-
use OpenTelemetry\Instrumentation\AwsSdk\AwsSdkInstrumentation;
152+
use OpenTelemetry\Aws\AwsSdkInstrumentation;
149153
```
150154

151155

152156
Tracing support for downstream AWS SDK calls to Amazon DynamoDB, S3, and others is provided by the [OpenTelemetry PHP AWS SDK Instrumentation](https://github.com/open-telemetry/opentelemetry-php-contrib/tree/main/src/Instrumentation/AwsSdk). The example below demonstrates setting up the AWS SDK instrumentation and tracing a call to S3.
153157

154158

155159
```
156-
use OpenTelemetry\Instrumentation\AwsSdk\AwsSdkInstrumentation;
160+
use OpenTelemetry\Aws\AwsSdkInstrumentation;
157161

158162
// Initialize Span Processor, X-Ray ID generator, Tracer Provider, and Propagator
159-
$spanProcessor = new SimpleSpanProcessor(new OTLPExporter());
163+
$transport = (new GrpcTransportFactory())->create('http://127.0.0.1:4317' . OtlpUtil::method(Signals::TRACE));
164+
$exporter = new SpanExporter($transport);
165+
$spanProcessor = new SimpleSpanProcessor($exporter);
160166
$xrayIdGenerator = new IdGenerator();
161167
$tracerProvider = new TracerProvider($spanProcessor, null, null, null, $xrayIdGenerator);
162168
$xrayPropagator = new Propagator();

0 commit comments

Comments
 (0)