Skip to content

Commit

Permalink
adding updated doc ruby lambda and environment variables for ruby lib… (
Browse files Browse the repository at this point in the history
#4904)

Co-authored-by: Tiffany Hrabusa <[email protected]>
Co-authored-by: Kayla Reopelle <[email protected]>
Co-authored-by: Phillip Carter <[email protected]>
  • Loading branch information
4 people authored Aug 3, 2024
1 parent aa5f568 commit bd78b16
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
15 changes: 14 additions & 1 deletion content/en/docs/faas/lambda-auto-instrument.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ for the following languages:
- Java
- JavaScript
- Python
- Ruby

These can be added to your Lambda using the AWS portal to automatically
instrument your application. These layers do not include the Collector which is
Expand Down Expand Up @@ -80,12 +81,19 @@ information about supported Python versions, see the
[OpenTelemetry Python documentation](https://github.com/open-telemetry/opentelemetry-python/blob/main/README.md#supported-runtimes)
and the package on [PyPi](https://pypi.org/project/opentelemetry-api/).

{{% /tab %}} {{% tab Ruby %}}

The Lambda layer supports Ruby 3.2 and 3.3 Lambda runtimes. For more information
about supported OpenTelemetry Ruby SDK and API versions, see the
[OpenTelemetry Ruby documentation](https://github.com/open-telemetry/opentelemetry-ruby/blob/main/README.md#compatibility)
and the package on [RubyGem](https://rubygems.org/search?query=opentelemetry).

{{% /tab %}} {{< /tabpane >}}

### Configure `AWS_LAMBDA_EXEC_WRAPPER`

Change the entry point of your application by setting
`AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-handler` for Node.js or Java, and
`AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-handler` for Node.js, Java, or Ruby, and
`AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-instrument` for Python. These wrapper scripts
will invoke your Lambda application with the automatic instrumentation applied.

Expand Down Expand Up @@ -131,6 +139,11 @@ uses the protocol `http/protobuf`
`OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf` supports: `http/protobuf` and
`http/json` `OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318`

{{% /tab %}} {{% tab Ruby %}}

`OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf` supports: `http/protobuf`
`OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318`

{{% /tab %}} {{< /tabpane >}}

### Publish your Lambda
Expand Down
45 changes: 45 additions & 0 deletions content/en/docs/languages/ruby/libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ end

To override more instrumentation, add another entry in the `config` map.

#### Overriding configuration for specific instrumentation libraries with environment variables

You can also disable specific instrumentation libraries using environment
variables. An instrumentation disabled by an environment variable takes
precedence over local config. The convention for environment variable names is
the library name, upcased with `::` replaced by underscores, `OPENTELEMETRY`
shortened to `OTEL_LANG`, and `_ENABLED` appended.

For example, the environment variable name for
`OpenTelemetry::Instrumentation::Sinatra` is
`OTEL_RUBY_INSTRUMENTATION_SINATRA_ENABLED`.

```bash
export OTEL_RUBY_INSTRUMENTATION_SINATRA_ENABLED=false
```

### Configuring specific instrumentation libraries

If you prefer more selectively installing and using only specific
Expand All @@ -98,6 +114,35 @@ OpenTelemetry::SDK.configure do |c|
end
```

#### Configuring specific instrumentation libraries with environment variables

You can also define the option for specific instrumentation libraries using
environment variables. By convention, the environment variable will be the name
of the instrumentation, upcased with `::` replaced by underscores,
`OPENTELEMETRY` shortened to `OTEL_{LANG}`, and `_CONFIG_OPTS` appended.

For example, the environment variable name for
`OpenTelemetry::Instrumentation::Faraday` is
`OTEL_RUBY_INSTRUMENTATION_FARADAY_CONFIG_OPTS`. A value of
`peer_service=new_service;span_kind=client` overrides the options set from
[previous section](#configuring-specific-instrumentation-libraries) for Faraday.

```bash
export OTEL_RUBY_INSTRUMENTATION_FARADAY_CONFIG_OPTS="peer_service=new_service;span_kind=client"
```

The following table lists the acceptable format for values according to the
option data type:

| Data Type | Value | Example |
| --------- | -------------------------- | ---------------- |
| Array | string with `,` separation | `option=a,b,c,d` |
| Boolean | true/false | `option=true` |
| Integer | string | `option=string` |
| String | string | `option=string` |
| Enum | string | `option=string` |
| Callable | not allowed | N\A |

### Next steps

Instrumentation libraries are the easiest way to generate lots of useful
Expand Down
4 changes: 4 additions & 0 deletions static/refcache.json
Original file line number Diff line number Diff line change
Expand Up @@ -8435,6 +8435,10 @@
"StatusCode": 200,
"LastSeen": "2024-01-22T15:38:55.347099+01:00"
},
"https://rubygems.org/search": {
"StatusCode": 200,
"LastSeen": "2024-07-29T12:09:34.887196-04:00"
},
"https://rubyonrails.org/": {
"StatusCode": 206,
"LastSeen": "2024-01-30T06:01:26.488265-05:00"
Expand Down

0 comments on commit bd78b16

Please sign in to comment.