Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] .NET OTel AutoInstrumentation - multistage docker image build #2680

Conversation

Kielek
Copy link
Contributor

@Kielek Kielek commented Feb 26, 2024

Description: Change the way how the .NET OTel auto docker image is build.
It reduces image size by 16 of 57 to 41 mb.
Final layer does not contain zip files.

Link to tracking Issue(s): N/A

  • Resolves: N/A

Testing: Compare images build by the new and old way.
And local check with my image. Output with enabled console exporter.

2024-02-27 09:56:12 info: Microsoft.Hosting.Lifetime[14]
2024-02-27 09:56:12       Now listening on: http://[::]:8080
2024-02-27 09:56:12 info: Microsoft.Hosting.Lifetime[0]
2024-02-27 09:56:12       Application started. Press Ctrl+C to shut down.
2024-02-27 09:56:12 info: Microsoft.Hosting.Lifetime[0]
2024-02-27 09:56:12       Hosting environment: Production
2024-02-27 09:56:12 info: Microsoft.Hosting.Lifetime[0]
2024-02-27 09:56:12       Content root path: /app
2024-02-27 09:56:21 Resource associated with Metric:
2024-02-27 09:56:21     host.name: redis-deployment-d8f74ccf9-95fkw
2024-02-27 09:56:21     process.pid: 1
2024-02-27 09:56:21     process.runtime.description: .NET 8.0.2
2024-02-27 09:56:21     process.runtime.name: .NET
2024-02-27 09:56:21     process.runtime.version: 8.0.2
2024-02-27 09:56:21     container.id: 7474e270f3e53f94f8cbd129ee0504d00e71fa7cbaf4c4ba33c52261860f6dd3
2024-02-27 09:56:21     telemetry.distro.name: opentelemetry-dotnet-instrumentation
2024-02-27 09:56:21     telemetry.distro.version: 1.4.0
2024-02-27 09:56:21     telemetry.sdk.name: opentelemetry
2024-02-27 09:56:21     telemetry.sdk.language: dotnet
2024-02-27 09:56:21     telemetry.sdk.version: 1.7.0
2024-02-27 09:56:21     service.name: redis-deployment
2024-02-27 09:56:21     k8s.container.name: redis
2024-02-27 09:56:21     k8s.deployment.name: redis-deployment
2024-02-27 09:56:21     k8s.namespace.name: default
2024-02-27 09:56:21     k8s.node.name: docker-desktop
2024-02-27 09:56:21     k8s.pod.name: redis-deployment-d8f74ccf9-95fkw
2024-02-27 09:56:21     k8s.replicaset.name: redis-deployment-d8f74ccf9
2024-02-27 09:56:21     service.version: v1.0.0
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.runtime.dotnet.gc.collections.count, Number of garbage collections that have occurred since process start., Meter: OpenTelemetry.Instrumentation.Runtime/1.7.0.0
2024-02-27 09:56:21 (2024-02-27T08:56:11.8431692Z, 2024-02-27T08:56:21.8424851Z] generation: gen2 LongSum
2024-02-27 09:56:21 Value: 0
2024-02-27 09:56:21 (2024-02-27T08:56:11.8431692Z, 2024-02-27T08:56:21.8424851Z] generation: gen1 LongSum
2024-02-27 09:56:21 Value: 0
2024-02-27 09:56:21 (2024-02-27T08:56:11.8431692Z, 2024-02-27T08:56:21.8424851Z] generation: gen0 LongSum
2024-02-27 09:56:21 Value: 0
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.runtime.dotnet.gc.objects.size, Count of bytes currently in use by objects in the GC heap that haven't been collected yet. Fragmentation and other GC committed memory pools are excluded., Unit: bytes, Meter: OpenTelemetry.Instrumentation.Runtime/1.7.0.0
2024-02-27 09:56:21 (2024-02-27T08:56:11.8456859Z, 2024-02-27T08:56:21.8425477Z] LongSumNonMonotonic
2024-02-27 09:56:21 Value: 10264848
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.runtime.dotnet.gc.allocations.size, Count of bytes allocated on the managed GC heap since the process start. .NET objects are allocated from this heap. Object allocations from unmanaged languages such as C/C++ do not use this heap., Unit: bytes, Meter: OpenTelemetry.Instrumentation.Runtime/1.7.0.0
2024-02-27 09:56:21 (2024-02-27T08:56:11.8457481Z, 2024-02-27T08:56:21.8425485Z] LongSum
2024-02-27 09:56:21 Value: 10251264
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.runtime.dotnet.gc.duration, The total amount of time paused in GC since the process start., Unit: ns, Meter: OpenTelemetry.Instrumentation.Runtime/1.7.0.0
2024-02-27 09:56:21 (2024-02-27T08:56:11.8458176Z, 2024-02-27T08:56:21.8425500Z] LongSum
2024-02-27 09:56:21 Value: 0
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.runtime.dotnet.jit.il_compiled.size, Count of bytes of intermediate language that have been compiled since the process start., Unit: bytes, Meter: OpenTelemetry.Instrumentation.Runtime/1.7.0.0
2024-02-27 09:56:21 (2024-02-27T08:56:11.8458352Z, 2024-02-27T08:56:21.8425504Z] LongSum
2024-02-27 09:56:21 Value: 831014
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.runtime.dotnet.jit.methods_compiled.count, The number of times the JIT compiler compiled a method since the process start. The JIT compiler may be invoked multiple times for the same method to compile with different generic parameters, or because tiered compilation requested different optimization settings., Meter: OpenTelemetry.Instrumentation.Runtime/1.7.0.0
2024-02-27 09:56:21 (2024-02-27T08:56:11.8458507Z, 2024-02-27T08:56:21.8425508Z] LongSum
2024-02-27 09:56:21 Value: 11927
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.runtime.dotnet.jit.compilation_time, The amount of time the JIT compiler has spent compiling methods since the process start., Unit: ns, Meter: OpenTelemetry.Instrumentation.Runtime/1.7.0.0
2024-02-27 09:56:21 (2024-02-27T08:56:11.8458650Z, 2024-02-27T08:56:21.8425512Z] LongSum
2024-02-27 09:56:21 Value: 1740470700
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.runtime.dotnet.monitor.lock_contention.count, The number of times there was contention when trying to acquire a monitor lock since the process start. Monitor locks are commonly acquired by using the lock keyword in C#, or by calling Monitor.Enter() and Monitor.TryEnter()., Meter: OpenTelemetry.Instrumentation.Runtime/1.7.0.0
2024-02-27 09:56:21 (2024-02-27T08:56:11.8458859Z, 2024-02-27T08:56:21.8425518Z] LongSum
2024-02-27 09:56:21 Value: 0
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.runtime.dotnet.thread_pool.threads.count, The number of thread pool threads that currently exist., Meter: OpenTelemetry.Instrumentation.Runtime/1.7.0.0
2024-02-27 09:56:21 (2024-02-27T08:56:11.8459050Z, 2024-02-27T08:56:21.8425532Z] LongSumNonMonotonic
2024-02-27 09:56:21 Value: 3
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.runtime.dotnet.thread_pool.completed_items.count, The number of work items that have been processed by the thread pool since the process start., Meter: OpenTelemetry.Instrumentation.Runtime/1.7.0.0
2024-02-27 09:56:21 (2024-02-27T08:56:11.8459281Z, 2024-02-27T08:56:21.8425537Z] LongSum
2024-02-27 09:56:21 Value: 5
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.runtime.dotnet.thread_pool.queue.length, The number of work items that are currently queued to be processed by the thread pool., Meter: OpenTelemetry.Instrumentation.Runtime/1.7.0.0
2024-02-27 09:56:21 (2024-02-27T08:56:11.8459451Z, 2024-02-27T08:56:21.8425542Z] LongSumNonMonotonic
2024-02-27 09:56:21 Value: 0
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.runtime.dotnet.timer.count, The number of timer instances that are currently active. Timers can be created by many sources such as System.Threading.Timer, Task.Delay, or the timeout in a CancellationSource. An active timer is registered to tick at some point in the future and has not yet been canceled., Meter: OpenTelemetry.Instrumentation.Runtime/1.7.0.0
2024-02-27 09:56:21 (2024-02-27T08:56:11.8459639Z, 2024-02-27T08:56:21.8425549Z] LongSumNonMonotonic
2024-02-27 09:56:21 Value: 2
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.runtime.dotnet.assemblies.count, The number of .NET assemblies that are currently loaded., Meter: OpenTelemetry.Instrumentation.Runtime/1.7.0.0
2024-02-27 09:56:21 (2024-02-27T08:56:11.8469218Z, 2024-02-27T08:56:21.8425557Z] LongSumNonMonotonic
2024-02-27 09:56:21 Value: 122
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.runtime.dotnet.exceptions.count, Count of exceptions that have been thrown in managed code, since the observation started. The value will be unavailable until an exception has been thrown after OpenTelemetry.Instrumentation.Runtime initialization., Meter: OpenTelemetry.Instrumentation.Runtime/1.7.0.0
2024-02-27 09:56:21 (2024-02-27T08:56:11.8469473Z, 2024-02-27T08:56:21.8425561Z] LongSum
2024-02-27 09:56:21 Value: 19
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.memory.usage, The amount of physical memory allocated for this process., Unit: By, Meter: OpenTelemetry.Instrumentation.Process/0.5.0.4
2024-02-27 09:56:21 (2024-02-27T08:56:11.8469652Z, 2024-02-27T08:56:21.8425567Z] LongSumNonMonotonic
2024-02-27 09:56:21 Value: 100413440
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.memory.virtual, The amount of committed virtual memory for this process., Unit: By, Meter: OpenTelemetry.Instrumentation.Process/0.5.0.4
2024-02-27 09:56:21 (2024-02-27T08:56:11.8469843Z, 2024-02-27T08:56:21.8425572Z] LongSumNonMonotonic
2024-02-27 09:56:21 Value: 282104201216
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.cpu.time, Total CPU seconds broken down by different states., Unit: s, Meter: OpenTelemetry.Instrumentation.Process/0.5.0.4
2024-02-27 09:56:21 (2024-02-27T08:56:11.8477217Z, 2024-02-27T08:56:21.8425959Z] state: user DoubleSum
2024-02-27 09:56:21 Value: 1.77
2024-02-27 09:56:21 (2024-02-27T08:56:11.8477217Z, 2024-02-27T08:56:21.8425959Z] state: system DoubleSum
2024-02-27 09:56:21 Value: 0.06
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.cpu.count, The number of processors (CPU cores) available to the current process., Unit: {processors}, Meter: OpenTelemetry.Instrumentation.Process/0.5.0.4
2024-02-27 09:56:21 (2024-02-27T08:56:11.8477921Z, 2024-02-27T08:56:21.8425967Z] LongSumNonMonotonic
2024-02-27 09:56:21 Value: 16
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: process.threads, Process threads count., Unit: {threads}, Meter: OpenTelemetry.Instrumentation.Process/0.5.0.4
2024-02-27 09:56:21 (2024-02-27T08:56:11.8478302Z, 2024-02-27T08:56:21.8425971Z] LongSumNonMonotonic
2024-02-27 09:56:21 Value: 38
2024-02-27 09:56:21 
2024-02-27 09:56:21 Metric Name: http.client.active_requests, Number of outbound HTTP requests that are currently active on the client., Unit: {request}, Meter: System.Net.Http
2024-02-27 09:56:21 (2024-02-27T08:56:17.1171650Z, 2024-02-27T08:56:21.8426030Z] http.request.method: POST server.address: otel-collector server.port: 4318 url.scheme: http LongSumNonMonotonic
2024-02-27 09:56:21 Value: 0

Documentation: N/A

@Kielek Kielek marked this pull request as ready for review February 27, 2024 08:58
@Kielek Kielek requested a review from a team February 27, 2024 08:58
@swiatekm swiatekm self-requested a review February 27, 2024 13:27
@pavolloffay pavolloffay merged commit 45a30d3 into open-telemetry:main Feb 28, 2024
30 checks passed
@Kielek Kielek deleted the dotnet-otel-auto-multistage-docker-build branch February 28, 2024 15:33
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants