<div style="display: flex; flex-wrap: wrap; white-space: pre-wrap; align-items: center; "><img height="20" width="20" style="border-radius:50%; margin-right: 4px;" decoding="async" src="https://avatars.githubusercontent.com/u/147741?s=20&v=4" /><strong>tomhughes</strong> left a comment <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6405#issuecomment-3328687344">(openstreetmap/openstreetmap-website#6405)</a></div>
<p dir="auto">So I wanted to add it to the settings but the opentelemetry gems really, really don't help with that and want you to use the environment 😢</p>
<p dir="auto">I did eventually manage to make it work after digging through the source to find out what the gems did with the environment variables but it wasn't pretty - there's no API call that is a direct equivalent so you wind up having to create several objects yourself and wire them together.</p>
<p dir="auto">Much the same goes for the <code class="notranslate">-all</code> thing - it is possible, and it's not quite as bad and is at least documented but it's quite a bit more verbose.</p>
<p dir="auto">In particular there's no way to enable <code class="notranslate">opentelemetry-instrumentation-rails</code> and have it do everything so you have to do all the subcomponents of that separately and I wound up with something like this:</p>
<div class="highlight highlight-source-ruby" dir="auto"><pre class="notranslate"><span class="pl-en">require</span> <span class="pl-s">"opentelemetry/sdk"</span>
<span class="pl-en">require</span> <span class="pl-s">"opentelemetry/instrumentation/action_mailer"</span>
<span class="pl-en">require</span> <span class="pl-s">"opentelemetry/instrumentation/action_pack"</span>
<span class="pl-en">require</span> <span class="pl-s">"opentelemetry/instrumentation/action_view"</span>
<span class="pl-en">require</span> <span class="pl-s">"opentelemetry/instrumentation/active_job"</span>
<span class="pl-en">require</span> <span class="pl-s">"opentelemetry/instrumentation/active_record"</span>
<span class="pl-en">require</span> <span class="pl-s">"opentelemetry/instrumentation/active_storage"</span>
<span class="pl-en">require</span> <span class="pl-s">"opentelemetry/instrumentation/active_support"</span>
<span class="pl-en">require</span> <span class="pl-s">"opentelemetry/instrumentation/dalli"</span>
<span class="pl-en">require</span> <span class="pl-s">"opentelemetry/instrumentation/delayed_job"</span>
<span class="pl-en">require</span> <span class="pl-s">"opentelemetry/instrumentation/faraday"</span>
<span class="pl-en">require</span> <span class="pl-s">"opentelemetry/instrumentation/pg"</span>
<span class="pl-en">require</span> <span class="pl-s">"opentelemetry/instrumentation/rack"</span>
<span class="pl-en">require</span> <span class="pl-s">"opentelemetry/instrumentation/rails"</span>
<span class="pl-v">OpenTelemetry</span>::<span class="pl-c1">SDK</span><span class="pl-kos">.</span><span class="pl-en">configure</span> <span class="pl-k">do</span> |<span class="pl-s1">c</span>|
<span class="pl-s1">c</span><span class="pl-kos">.</span><span class="pl-en">use</span> <span class="pl-s">"OpenTelemetry::Instrumentation::ActionMailer"</span>
<span class="pl-s1">c</span><span class="pl-kos">.</span><span class="pl-en">use</span> <span class="pl-s">"OpenTelemetry::Instrumentation::ActionPack"</span>
<span class="pl-s1">c</span><span class="pl-kos">.</span><span class="pl-en">use</span> <span class="pl-s">"OpenTelemetry::Instrumentation::ActionView"</span>
<span class="pl-s1">c</span><span class="pl-kos">.</span><span class="pl-en">use</span> <span class="pl-s">"OpenTelemetry::Instrumentation::ActiveJob"</span>
<span class="pl-s1">c</span><span class="pl-kos">.</span><span class="pl-en">use</span> <span class="pl-s">"OpenTelemetry::Instrumentation::ActiveRecord"</span>
<span class="pl-s1">c</span><span class="pl-kos">.</span><span class="pl-en">use</span> <span class="pl-s">"OpenTelemetry::Instrumentation::ActiveStorage"</span>
<span class="pl-s1">c</span><span class="pl-kos">.</span><span class="pl-en">use</span> <span class="pl-s">"OpenTelemetry::Instrumentation::ActiveSupport"</span>
<span class="pl-s1">c</span><span class="pl-kos">.</span><span class="pl-en">use</span> <span class="pl-s">"OpenTelemetry::Instrumentation::Dalli"</span>
<span class="pl-s1">c</span><span class="pl-kos">.</span><span class="pl-en">use</span> <span class="pl-s">"OpenTelemetry::Instrumentation::DelayedJob"</span>
<span class="pl-s1">c</span><span class="pl-kos">.</span><span class="pl-en">use</span> <span class="pl-s">"OpenTelemetry::Instrumentation::Faraday"</span>
<span class="pl-s1">c</span><span class="pl-kos">.</span><span class="pl-en">use</span> <span class="pl-s">"OpenTelemetry::Instrumentation::PG"</span>
<span class="pl-s1">c</span><span class="pl-kos">.</span><span class="pl-en">use</span> <span class="pl-s">"OpenTelemetry::Instrumentation::Rack"</span>
<span class="pl-s1">c</span><span class="pl-kos">.</span><span class="pl-en">use</span> <span class="pl-s">"OpenTelemetry::Instrumentation::Rails"</span>
<span class="pl-k">end</span></pre></div>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6405#issuecomment-3328687344">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLOA6F6OIEVCSNLUZ4D3UKQZDAVCNFSM6AAAAACHDGJQPGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGMRYGY4DOMZUGQ">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLOX4OMFYDSLHYKKU6L3UKQZDA5CNFSM6AAAAACHDGJQPGWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTWGM66PA.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/6405/c3328687344</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/6405#issuecomment-3328687344",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/6405#issuecomment-3328687344",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>