# Create a trace and spans via OpenTelemetry instrumentation
TRACER.in_span('JSONPlaceholder API Call', kind: :client, attributes: {
  'http.url' => uri.to_s,
  'http.method' => 'GET',
}) do |span|
  # Your application logic ...

  # For example, making an HTTP request to JSONPlaceholder
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true

  request = Net::HTTP::Get.new(uri)
  request["Content-Type"] = "application/json"

  response = http.request(request)
  span.set_attribute('http.status_code', response.code.to_i)

  puts "Response from JSONPlaceholder: #{response.body}"

  span.set_attribute('output', response.body)
end
```

It's important to note that OpenTelemetry (otel) auto-instrumentations don’t automatically align with Opik’s schema, so you may need to manually set certain attributes, like the `output` attribute in the example above.

Opik supports mapping of attributes to Opik traces, for the following libraries:

* `python/OpenInference`
* `python/Pydantic`
* `python/GenAI`

In the future we may add more integrations to Opik. If you have any suggestions on what else could be integrated into Opik, please let us know!

<Tip>
  If your application is a short-lived process, you may need to call `OpenTelemetry.tracer_provider.force_flush(timeout: <timeout>)` or similar method at the end of your application to ensure all telemetry data is flushed before exiting.
</Tip>

## Conclusion

This guide provided an overview of how to integrate Opik with the OpenTelemetry SDK in Ruby. By following the steps outlined above, you can easily set up your application to send telemetry data to Opik for monitoring and analysis.

Feel free to reach out to us if you have any questions or issues with the integration, via the [GitHub repository](https://github.com/comet-ml/opik/issues), or join our [Slack](https://chat.comet.com) channel.