Compare commits

...

1435 Commits

Author SHA1 Message Date
Alexandru-Liviu Bratosin 063107068c
fix(async-processor): concurrent exports actually serialised (#3028) 2025-07-14 10:37:21 -07:00
Reiley Yang 8925f064d2
chore: Remove file .github/repository-settings.md (#3067) 2025-07-14 10:31:30 -07:00
Lalit Kumar Bhasin 8aba0913e9
chore: Bump semantic-conventions to v1.36.0 (#3064) 2025-07-14 10:04:21 -07:00
OpenTelemetry Bot 34d6d5082e
Sort contributor listings and remove affiliation from emeriti (#3060) 2025-07-09 22:11:59 +02:00
Berkus Decker 5e447d02cc
chore: Switch from unmaintained hex dependency to const-hex (#3053) 2025-07-09 08:54:12 -07:00
Whoemoon Jang 8d46c40b60
fix: Support HttpClient implementation for HyperClient with custom connectors (#3057) 2025-07-07 11:36:38 -07:00
Copilot eac368a7e4
chore: Fix spelling errors and typos in documentation (#3044)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-07-02 09:53:05 -07:00
dependabot[bot] 2bf8175d07
chore(deps): bump taiki-e/install-action from 2.52.4 to 2.56.0 (#3051)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-07-01 13:33:02 -07:00
dependabot[bot] 3fc7194796
chore(deps): bump EmbarkStudios/cargo-deny-action from 2.0.11 to 2.0.12 (#3052)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-01 13:24:26 -07:00
dependabot[bot] db15ecb541
chore(deps): bump obi1kenobi/cargo-semver-checks-action from 2.6 to 2.8 (#3050)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-01 13:24:14 -07:00
dependabot[bot] 674914a8ef
chore(deps): bump github/codeql-action from 3.28.16 to 3.29.2 (#3049)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-07-01 13:23:57 -07:00
dependabot[bot] 6bc2b19b85
chore(deps): bump step-security/harden-runner from 2.12.0 to 2.12.2 (#3048)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-01 12:49:44 -07:00
Lushe Shipkov d59aded375
docs: A few small doc touch-ups in some of the various in_memory_exporter modules (#3042) 2025-06-30 09:24:40 -07:00
OpenTelemetry Bot e7784bb78f
docs: Update community member listings (#3038)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-06-27 09:43:55 -06:00
Anton Grübel 5e29598369
chore: fix format lint (#3039) 2025-06-27 09:33:16 -06:00
yoshi-taka af2f1449e8
chore: remove unused glob (#3035) 2025-06-22 17:00:42 -07:00
Scott Gerring 0c2f808ec2
ci: Run benchmarks on main on the new oracle dedicated workers (#2942) 2025-06-20 08:37:17 -07:00
Cijo Thomas d4eb35a0cc
docs: on how to set right cardinality limit (#2998)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-06-12 17:03:39 -07:00
Lalit Kumar Bhasin 1f0d9a9f62
chore: Prepare for opentelemetry-appender-tracing 0.30.1 - bump tracing-opentelemetry to 0.31 (#3022) 2025-06-05 11:43:18 -07:00
dependabot[bot] 51dc2f04b7
chore(deps): update dtolnay/rust-toolchain requirement to b3b07ba8b418998c39fb20f53e8b695cdcc8de1b (#3016)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-06-05 10:43:48 -07:00
Igor Unanua eaca267d04
feat: support multi-value key propagation extraction (#3008)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-06-04 14:52:57 -07:00
Lalit Kumar Bhasin 7b3db0b6a6
chore: Bump otel-proto v1.7.0 (#3018) 2025-06-03 08:20:25 -07:00
Lalit Kumar Bhasin 082213e4e9
chore: bump semcon 1.34.0 (#3019) 2025-06-02 11:24:51 -07:00
dependabot[bot] c473db0788
chore(deps): bump taiki-e/install-action from 2.50.4 to 2.52.4 (#3015) 2025-06-01 21:31:03 -07:00
dependabot[bot] 85e639aef9
chore(deps): bump ossf/scorecard-action from 2.4.1 to 2.4.2 (#3014) 2025-06-01 21:21:45 -07:00
dependabot[bot] f1a541c3ca
chore(deps): bump codecov/codecov-action from 5.4.2 to 5.4.3 (#3013)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-06-01 20:34:16 -07:00
dependabot[bot] c30dc37002
chore(deps): bump fossas/fossa-action from 1.6.0 to 1.7.0 (#3012)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-01 13:22:45 -07:00
Gabriel 28becc0674
fix: with_cleared_baggage (#3006)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-05-30 08:19:46 -07:00
Joonas Bergius cab5565ba1
fix: use default endpoint for endpoint when provided empty string (#3000)
Signed-off-by: Joonas Bergius <joonas@cosmonic.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-05-30 07:51:40 -07:00
Cijo Thomas 62790608e1
fix: Small improvement to OTLP Exporter logs (#3007) 2025-05-30 07:13:26 -07:00
paullegranddc 167c94663a
fix(span_processor): only call on_start with recording spans (#3011) 2025-05-30 06:53:57 -07:00
Cijo Thomas 8e47d84922
chore: Add release notes for 0.30 (#3001)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2025-05-27 06:43:34 -07:00
Cijo Thomas 8882c31c95
chore: Nit fixes to examples (#3002) 2025-05-23 10:56:42 -07:00
Cijo Thomas c811cde1ae
chore: Prepare release 0.30.0 (#2999) 2025-05-23 09:52:50 -07:00
SF-Zhou 200885a6c3
fix: fix trace id in logs when using set_parent nested in a trace span (#2924)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-05-23 08:01:46 -07:00
Cijo Thomas c24369e86a
chore: Update metric sdk to stable status (#2996) 2025-05-23 07:51:41 -07:00
Cijo Thomas bf22aeb7cc
fix: Remove pub fields and replace with getter method consistently across … (#2997) 2025-05-22 22:41:49 -07:00
Cijo Thomas 4be1a32d3f
fix: remove cardinality capping via instrument advice (#2995) 2025-05-22 13:46:27 -07:00
Cijo Thomas 3d04c16e39
docs: Add metric doc (#2946)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-05-22 13:32:37 -07:00
Cijo Thomas 2018959eec
fix: Fix validation in Metric stream (#2991) 2025-05-22 11:18:44 -07:00
Anton Grübel 8c29ca7e21
chore: leverage fallback resolver for MSRV check (#2993) 2025-05-22 08:39:53 -07:00
Cijo Thomas 4b3a383267
chore: add required features to benches (#2990) 2025-05-21 20:45:20 -07:00
Cijo Thomas ebbebf57ba
fix: Further trim public API on views (#2989)
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-05-21 19:07:08 -07:00
Cijo Thomas e123996d80
feat: View cleanups (#2988) 2025-05-21 16:40:32 -07:00
Adrian Garcia Badaracco 3cdc62e716
feat: add generated proto models for profiles signal (#2979)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-05-21 09:24:47 -07:00
Cijo Thomas f04e9ec6cd
feat: Use builder pattern for constructing Metric Streams (#2984) 2025-05-21 07:37:16 -07:00
Cijo Thomas 7cfe8cd883
chore: fix changelogs (#2983) 2025-05-21 07:07:07 -07:00
Cijo Thomas aeb38a02c1
feat: Promote subset of Metric Views to stable (#2982) 2025-05-20 21:09:20 -07:00
Elichai Turkel 857a38b191
fix: Expose SpanExporterBuilder and MetricExporterBuilder (#2966)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-05-20 20:21:04 -07:00
Cijo Thomas cc93ead2df
fix: Metrics Views - fix a bug that causes unit, description to be lost when applying views that influence other aspects (#2981) 2025-05-20 17:59:17 -07:00
Cijo Thomas d52dcef07d
fix: MetricExporters use getter methods instead of direct access (#2973)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-05-20 10:07:07 -07:00
Lalit Kumar Bhasin 84999140a7
chore: bump semconv 1.33.0 (#2975) 2025-05-16 20:14:16 -07:00
Cijo Thomas 9a0099ab8d
chore: remove unused (and incorrect!) doc links (#2974) 2025-05-16 13:21:00 -07:00
Mohammad Vatandoost c5f97180a3
feat: add shutdown with timeout for traces (#2956)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-05-16 07:12:50 -07:00
Cijo Thomas 8f4fe23bb1
fix: Avoid exposing HistogramBuckets and bounds (#2969) 2025-05-14 22:11:59 -07:00
StepSecurity Bot fed6fee190
ci: Harden GitHub Actions (#2971)
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
2025-05-14 22:03:27 -07:00
Cijo Thomas 970bb1e4b6
fix: Avoid exposing implementation detail in public API for PushMetricExporter (#2968) 2025-05-14 10:15:50 -07:00
Utkarsh Umesan Pillai a4575af593
fix: Update ResourceMetrics public API (#2965)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-05-14 07:39:02 -07:00
Cijo Thomas 82e5ed405e
fix: PeriodicReader to reuse data structures across collect (#2963) 2025-05-14 07:29:37 -07:00
paullegranddc 8fe3dcccc4
fix(CI): patch dependencies before running external-types check (#2967) 2025-05-14 06:44:27 -07:00
Cijo Thomas 3f29f6d8bf
chore: fix cargo deny check by updating unicode allowed list (#2964) 2025-05-14 06:39:46 +02:00
Björn Antonsson f771404f82
fix: allow span links to be added to a SpanRef (#2959) 2025-05-07 08:34:42 -07:00
Lalit Kumar Bhasin 1d9bd25ec8
chore: Fix CI coverage error for failing to install llvm-cov (#2958) 2025-05-05 11:32:10 -07:00
Lalit Kumar Bhasin 377fe5db7c
chore: publish otel-proto v1.6.0 (#2955) 2025-05-05 10:32:16 -07:00
Cijo Thomas 3d589d6449
ci: Try to build examples in CI (#2711)
Co-authored-by: Harold Dost <h.dost@criteo.com>
2025-05-05 08:08:50 +02:00
dependabot[bot] fa692d8c5c
chore(deps): bump taiki-e/install-action from 2.49.45 to 2.50.4 (#2952)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-05-01 14:13:49 -07:00
dependabot[bot] c6c2453ac4
chore(deps): update dtolnay/rust-toolchain requirement to b3b07ba8b418998c39fb20f53e8b695cdcc8de1b (#2953)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-05-01 14:05:18 -07:00
dependabot[bot] 06c6dfd6a8
chore(deps): bump github/codeql-action from 3.28.13 to 3.28.16 (#2954)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-05-01 13:57:25 -07:00
dependabot[bot] 175c7c6e9c
chore(deps): bump step-security/harden-runner from 2.11.1 to 2.12.0 (#2951)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-05-01 13:43:03 -07:00
dependabot[bot] 225bc0ebfa
chore(deps): bump codecov/codecov-action from 4.6.0 to 5.4.2 (#2950)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-01 13:17:20 -07:00
Mohammad Vatandoost 1d37e07529
feat: add-shutdown-with-timeout-for-log-provider-and-processor (#2941)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-05-01 09:09:01 -07:00
Cijo Thomas 4f2de12350
fix: Pass immutable metrics to PushMetricExporter (#2947) 2025-04-30 10:01:52 -07:00
Mathieu Tricoire 1d610a211a
feat(otlp): Re-export tonic crate (#2898)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-04-30 09:44:23 -07:00
Cijo Thomas 409713d2d9
fix: Allow Histograms with no buckets (#2948) 2025-04-30 09:19:05 -07:00
bestgopher 7f8adcc3f5
docs(semconv): fix some invalid urls (#2944) 2025-04-29 10:49:48 -07:00
Anton Grübel 02c290de84
chore: change webpki-roots exception license to CDLA (#2945) 2025-04-28 16:18:24 -07:00
Cijo Thomas 9dc727ef58
chore: Add Bjorn as approver (#2937)
Björn has been actively helping the repo for last few months, and is leading the exploration/development of tokio-tracing interop, among many other contributions/reviews.
He has agreed to volunteer time as an Approver for the repo.

In my view, https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#requirements-2 requirements have been met.
2025-04-22 22:25:22 +02:00
Mohammad Vatandoost 5c60f12f04
feat: add shutdown with timeout for log exporter (#2909)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-04-21 18:17:42 -07:00
Utkarsh Umesan Pillai d7f824486a
ci: Add cargo deny license check (#2936) 2025-04-21 14:55:29 -07:00
Utkarsh Umesan Pillai d8d57d834d
ci: Add cargo deny checks for bans and sources (#2935) 2025-04-21 11:34:20 +02:00
Gilles Henaux b5d31f11fa
docs: fix the HTTP and gRPC transports quickstart guides (#2933) 2025-04-17 07:43:06 -07:00
Lalit Kumar Bhasin 9cdc93161d
chore: bump semconv 1.32.0 (#2932) 2025-04-15 13:28:43 -07:00
Cijo Thomas 10cf02c458
chore: Fix changelogs and few nits (#2929) 2025-04-13 18:24:26 -07:00
Cijo Thomas 4ce765567c
feat: Hide MetricReader and friends (#2928) 2025-04-11 16:48:34 -07:00
Cijo Thomas 64cf2916c4
chore: Patch release prometheus to fix security vulnerability (#2927)
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-04-10 21:55:25 -07:00
houseme 431689dd04
chore: Upgrade `prometheus` to 0.14 and clean up protobuf-related code in `lib.rs` (#2920)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-04-10 19:33:36 -07:00
Utkarsh Umesan Pillai 8b3fc06555
ci: Update permissions for workflow (#2923) 2025-04-09 15:51:59 -07:00
Utkarsh Umesan Pillai 130e178ad3
docs: Add openssf scorecard badge (#2919) 2025-04-08 16:32:20 -07:00
Utkarsh Umesan Pillai 6b5251f0d0
ci: Update CodeQL workflow (#2918) 2025-04-08 14:46:01 -07:00
Cijo Thomas 4ff8e02031
fix: Cardinality overflow to use bool value instead of string (#2916) 2025-04-08 12:52:16 -07:00
Cijo Thomas d4c646738f
fix: cleanup MetricError (#2906) 2025-04-08 08:23:51 -07:00
Cijo Thomas df262401da
feat: Add ability to specify cardinality limit via Instrument advice (#2903) 2025-04-07 22:52:25 -07:00
Utkarsh Umesan Pillai 1760889e27
ci: Harden GitHub Actions (#2915) 2025-04-07 22:41:11 -07:00
Utkarsh Umesan Pillai e680514e4f
ci: Harden GitHub Actions (#2913) 2025-04-07 19:55:50 -07:00
Utkarsh Umesan Pillai bef0523b68
ci: Harden GitHub Actions (#2914) 2025-04-07 19:46:09 -07:00
StepSecurity Bot 72fc1b60a5
ci: [StepSecurity] Harden GitHub Actions (#2910)
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-04-07 18:03:12 -07:00
StepSecurity Bot f99f20a87d
ci: [StepSecurity] Harden GitHub Actions (#2912)
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-04-07 17:28:49 -07:00
Utkarsh Umesan Pillai 940ec2304b
ci: Harden GitHub Actions (#2911) 2025-04-07 15:25:42 -07:00
StepSecurity Bot 9a0ffc4adf
fix: [StepSecurity] ci: Harden GitHub Actions (#2907)
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-04-07 13:01:32 -07:00
Lalit Kumar Bhasin 16ff4b0575
chore: CI lint fix for dead link (#2908) 2025-04-07 12:22:18 -07:00
Cijo Thomas bc82d4f66d
fix: Cleanup MetricError and use OTelSdkResult instead (#2905) 2025-04-06 11:29:55 -07:00
Mohammad Vatandoost e9ae9f90ef
feat: add shutdown with timeout for metric reader and provider (#2890)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-04-06 09:37:37 -07:00
Cijo Thomas 4791aae19f
test: Add ignored code in test to prove known issue (#2872) 2025-04-06 07:59:30 -07:00
Cijo Thomas 4b56ee354c
fix: Remove logging for cardinality overflow (#2904) 2025-04-06 07:38:55 -07:00
Cijo Thomas 2564a71808
feat: Add and enabled Metric cardinality capping by default (#2901) 2025-04-04 16:04:45 -07:00
Björn Antonsson 86e842ca5e
chore: fix clippy lint errors for rust 1.86.0 (#2896) 2025-04-03 09:14:04 -07:00
dependabot[bot] 24b92cb7c7
chore(deps): bump fossas/fossa-action from 1.5.0 to 1.6.0 (#2892)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-01 12:50:07 -07:00
dependabot[bot] 93a151e720
chore(deps): bump github/codeql-action from 3.28.12 to 3.28.13 (#2891)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-01 12:49:36 -07:00
Scott Gerring 7bdd2f4160
fix: re-export WithContext in the same place (#2879)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-04-01 08:26:38 -07:00
Mohammad Vatandoost af3a33e1b3
feat: Add shutdown with timeout for metric exporter (#2854)
Co-authored-by: Braden Steffaniak <BradenSteffaniak+github@gmail.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2025-04-01 08:02:17 -07:00
Scott Gerring 37d794788e
chore: Move 'main' benchmark to shared workers temporarily (#2889) 2025-04-01 07:49:30 -07:00
OpenTelemetry Bot 36633015ab
ci: Add ossf-scorecard scanning workflow (#2887)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
2025-04-01 07:43:12 -07:00
Björn Antonsson 867e2a172c
perf: Run all benchmarks in one action (#2885)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-03-31 08:03:31 -07:00
Anton Grübel d5e409ce1f
refactor: re-export tracing for internal-logs (#2867)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-03-31 07:47:41 -07:00
Cijo Thomas 99cb67d19c
perf: Nit fix to benchmarks (#2884) 2025-03-28 15:33:23 -07:00
Cijo Thomas 303803e304
chore: Add Anton Grübel as approver (#2863) 2025-03-28 14:55:40 -07:00
Cijo Thomas 62e43c5489
feat: Leverage Suppression Context in Sdk (#2868)
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-03-28 10:51:40 -07:00
Björn Antonsson 50f0bb82f8
ci: run clippy on features separately to find issues (#2866)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-03-28 09:38:51 -07:00
Björn Antonsson da2029ea17
perf: Run all benchmarks for shorter time (#2870) 2025-03-28 09:23:06 -07:00
Anton Grübel b2de6cc5a3
chore: update tonic to 0.13 (#2876) 2025-03-27 14:47:02 -07:00
Anton Grübel a071d8fc39
ci: update deny GHA and its config (#2875) 2025-03-27 12:03:54 -07:00
Cijo Thomas 297146701d
feat: Add Suppression flag to context (#2821)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-03-26 16:14:41 -07:00
Mindaugas Vinkelis f3e93a09ea
refactor: AggregatedMetrics as enum instead of dyn Aggregation (#2857)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-03-26 10:39:57 -07:00
Cijo Thomas f12833f383
docs: Modify example to use logs, baggage (#2855)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2025-03-26 07:55:06 -07:00
Scott Gerring fb3699bc05
chore: Update error handling ADR - mention non_exhaustive (#2865) 2025-03-26 06:41:38 -07:00
Anton Grübel a711ae91c7
ci: add cargo machete and remove unused dependencies (#2864) 2025-03-25 15:01:24 -07:00
Cijo Thomas 5bfa70ef23
chore: Add company affiliation to maintainers and approvers (#2859) 2025-03-25 10:26:49 -07:00
houseme e9b27a4df6
chore: update from tracing-opentelemetry 0.29.0 to 0.30.0 (#2856)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-03-24 09:56:56 -07:00
Cijo Thomas f1c7ce9225
chore: fix few nit build warnings (#2848) 2025-03-24 08:11:49 -07:00
Cijo Thomas fa170f3258
fix: LogEnabled benchmarks to use blackbox (#2853) 2025-03-23 17:09:58 -07:00
tison 369b952baf
chore: Add link to sdk's CHANGELOG.md (#2850) 2025-03-22 10:28:12 -07:00
Braden Steffaniak e994d5237e
chore: Upgrade opentelemetry-prometheus to 0.29 (#2851) 2025-03-22 10:15:28 -07:00
Anton Grübel c5d5a1cc69
perf: small perf improvements in OTel API (#2842)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-03-21 20:20:52 -07:00
Cijo Thomas d32d34c8e0
chore: fix and release appender-tracing (#2847) 2025-03-21 17:47:50 -07:00
Cijo Thomas ad0552a6a9
chore: Prepare 0.29 release (#2844) 2025-03-21 17:10:01 -07:00
Anton Grübel 14d8f749ac
ci: replace actions-rs/cargo GHA (#2846) 2025-03-21 15:18:06 -07:00
Lalit Kumar Bhasin 5881f99528
chore: bump semconv 1.31.0 (#2845) 2025-03-21 15:03:28 -07:00
Cijo Thomas 34835a89e5
chore: Prepare docs before 0.29 (#2837)
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-03-21 12:10:29 -07:00
Cijo Thomas 1ecd1a8718
fix: KeyValueMetadata to not expose its fields public (#2843) 2025-03-21 12:00:35 -07:00
Cijo Thomas 3e77a22ca3
fix: Error cleanups continued (#2838) 2025-03-21 11:42:30 -07:00
Scott Gerring 36c48db5fd
chore: context stabilization tests & logging pieces (#2833)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-03-20 16:04:05 -07:00
Cijo Thomas b03296cc3a
chore: Add warning on Prometheus crate (#2831) 2025-03-20 07:26:48 -07:00
Cijo Thomas 969bedf1a7
fix: Cleanup zipkin build error (#2839) 2025-03-20 07:09:01 -07:00
Anton Grübel 702c61dcee
test: validate code-based config is preferred over env vars in ZipkinExporterBuilder (#2836)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-03-19 18:54:03 -07:00
Cijo Thomas dc580ff54b
fix: Report error using OTel convention (#2808)
Co-authored-by: Anton Grübel <anton.gruebel@gmail.com>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-03-19 17:24:41 -07:00
Anton Grübel bece03ba59
fix: validate Baggage key by W3C standards (#2804)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-03-19 15:46:11 -07:00
Scott Gerring 31b494bccb
ci: fix filter for benchmark pushes on branch (#2834) 2025-03-19 08:25:15 -07:00
Scott Gerring 75485dcd07
ci: Use bare-metal OTEL runners for benchmark CI for pushes to main (#2832) 2025-03-19 07:19:53 -07:00
Anton Grübel 5be79c7477
refactor: prioritize code-based config over env vars in OTLP exporter (#2827)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-03-18 21:02:29 -07:00
Anton Grübel 06abe3dbf9
ci: use GHCR otel-collector image (#2830) 2025-03-18 16:03:41 -07:00
Cijo Thomas d2859dc8c0
docs: Add docs to tracing appender (#2811) 2025-03-18 13:02:53 -07:00
Cijo Thomas 01898be24a
perf: LogEnabled inline more (#2828) 2025-03-18 10:32:43 -07:00
Cijo Thomas e43f3dfa4a
perf: Inline enabled check in Logger (#2823) 2025-03-18 10:08:56 -07:00
Cijo Thomas 40effae08a
fix: Remove async std (#2820)
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-03-18 07:47:43 -07:00
Cijo Thomas 9569b0f816
docs: Add few more notes about Logs design doc (#2816) 2025-03-17 16:18:00 -07:00
Cijo Thomas 2070e6cf90
chore: Modify OTLP doc to show jaeger usage instead of a full example (#2805) 2025-03-17 14:05:03 -07:00
Julian Tescher 0ff8c34b06
chore: Move jtescher from Maintainer to Emeritus (#2815) 2025-03-17 13:02:41 -07:00
Cijo Thomas a80dc0c686
test: Improve OTLP Builder test (#2817) 2025-03-17 12:54:00 -07:00
Cijo Thomas 233d11a5fd
docs: OTLP Examples to shutdown all signals (#2806) 2025-03-17 09:49:56 -07:00
Scott Gerring 1bce83fcda
chore: Move FutureExt into context (#2776)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-03-17 07:45:22 -07:00
Anton Grübel e48e6f4e16
chore: remove deprecated functions/methods in trace::Config (#2810) 2025-03-16 06:19:40 -07:00
Anton Grübel e5f8a48d3b
test: validate code based config is preferrred over env vars in trace BatchConfig (#2809) 2025-03-15 18:46:03 -07:00
Cijo Thomas a442d623e5
fix: Byte arrays represented as Anyvalue::Byte instead of string (#2807) 2025-03-14 19:05:34 -07:00
Cijo Thomas 6e58810080
docs: Include context, baggage etc to main readme (#2785)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2025-03-14 08:28:46 -07:00
Cijo Thomas 8872bf810d
feat: OTLP Exporter builders to return specific Error type (#2790) 2025-03-14 08:22:23 -07:00
Cijo Thomas ddac8e1ef3
fix: LogProcessor.SetResource to require mutable self (#2801) 2025-03-13 18:06:18 -07:00
Cijo Thomas 07b3b4056d
perf: Small perf optimization for logs (#2799) 2025-03-13 10:55:21 -07:00
Cijo Thomas 6b221e496b
fix: Avoid stringifying int values unless necessary (#2795) 2025-03-13 10:11:49 -07:00
Anton Grübel 66579ac47e
fix: Change logger scope in log appender (#2796) 2025-03-13 07:48:50 -07:00
Marcus Griep ad886152d5
docs: fix unit in metrics semantic conventions example (#2794)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-03-12 09:40:06 -07:00
Cijo Thomas 5bcaf30581
chore: Update BUG-REPORT.yml (#2791) 2025-03-12 08:41:34 -07:00
Cijo Thomas 8aa5b00493
feat: Add experimental concurrent processor for logs (#2780) 2025-03-11 16:01:38 -07:00
Cijo Thomas 52cd0e9ef1
test: Add test to confirm programmatic config wins over env in BatchConfig (#2781) 2025-03-11 11:04:04 -07:00
paullegranddc 51dda2f0a1
test: fix otlp log integration tests failing with some set of features (#2784) 2025-03-11 10:51:44 -07:00
paullegranddc dac8bd5cde
test: fix span_processor test failing with default features (#2782) 2025-03-11 07:42:33 -07:00
Cijo Thomas 68c9133867
fix: Remove mut ref requirement for shutdown LogExporter (#2764)
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-03-10 14:58:15 -07:00
Cijo Thomas 9d3a5079f6
test: Add test showing Baggage and Context interation with Tracing (#2732)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-03-06 05:57:25 -08:00
Scott Gerring 69c4adee46
docs: Add ADR dir and error handling ADR (#2664)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2025-03-06 05:42:05 -08:00
Pixels b33f0cc56c
fix: typo in metrics.rs (#2761)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-03-05 12:19:11 -08:00
Cijo Thomas 36cbe8dc1f
test: Modify perf tests to pass event name correctly to avoid string allocation (#2762) 2025-03-05 11:09:11 -08:00
Cijo Thomas f013b3d474
test: Stress test for logs modified to show throughput when enabled()… (#2760) 2025-03-05 10:31:32 -08:00
Anton Grübel a317856787
refactor: refactor Baggage with Context interaction (#2748)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-03-05 06:40:55 -08:00
Björn Antonsson baf4bfd61e
fix: Allow overlapping context scopes (#2378)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-03-04 17:03:45 -08:00
Cijo Thomas ff33638d1e
feat: Allow event name to be provided to IsEnabled check in Logger (#2756) 2025-03-04 15:39:58 -08:00
Cijo Thomas c5a4b7f436
doc: Update CONTRIBUTING.md with meeting notes (#2755) 2025-03-04 10:04:48 -08:00
Cijo Thomas 88cae2cf7d
test: Add test to show how to add baggage to logrecords via processor (#2738) 2025-03-03 21:40:49 -08:00
Cijo Thomas f15a3379f8
fix: Fix Logger scope in Tracing Appender (#2735) 2025-03-03 19:11:33 -08:00
Anton Grübel 5a77fb2b50
chore: enable Rust 2024 edition lints (#2728)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-03-03 13:46:22 -08:00
Cijo Thomas 1ddecb04d9
perf: Nit additions to Baggage benchmarks (#2740) 2025-03-03 11:33:41 -08:00
Anton Grübel 2493fecc40
fix: align baggage.remove() implementation (#2734) 2025-03-03 11:31:25 -08:00
Cijo Thomas 46a7cd623c
perf: Add benchmarks to show the cost of attributes in Log (#2741) 2025-03-03 11:13:09 -08:00
Anton Grübel 92303b6f72
test: add benchmark tests for baggage (#2737) 2025-03-02 11:00:51 -08:00
Shunsuke Tokunaga 13fafcb0ab
test: Add Scope attributes test cases for metrics (#2736)
Signed-off-by: Shunpoco <tkngsnsk313320@gmail.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-03-02 09:41:42 -08:00
Mindaugas Vinkelis 1583e70c2f
perf: Baggage insert & BaggageExt::with_baggage & updated constants to latest standard (#2284) 2025-03-02 08:02:34 -08:00
Anton Grübel 5e47487427
fix: change value type of Baggage to StringValue (#2729)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-03-01 12:03:32 -08:00
dependabot[bot] 382bad420b
Bump ytanikin/pr-conventional-commits from 1.4.0 to 1.4.1 (#2733)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-01 12:01:46 -08:00
Anton Grübel a423ad2aa9
ci: fix rate limiting of setup-protoc in CI (#2731) 2025-02-28 12:47:02 -08:00
Anton Grübel d581ae170d
test: fix and enable doctests (#2730) 2025-02-28 12:46:30 -08:00
Cijo Thomas 91ae096206
test : Add test to confirm Context expected behavior (#2724) 2025-02-28 07:04:54 -08:00
martintmk fb74565453
feat: Refine runtime trait (#2641) 2025-02-27 10:09:43 -08:00
Cijo Thomas 367e484686
ci: Run perf tests on demand (#2722) 2025-02-26 14:00:26 -08:00
Cijo Thomas edb0d5857f
docs: Modify examples to show best practices - reuse tracer (#2709) 2025-02-26 12:08:01 -08:00
Cijo Thomas 11ed8e0af7
docs: Fix tracing grpc example (#2710) 2025-02-26 11:05:55 -08:00
Cijo Thomas 08a1f52e18
test: Try fix a flaky test (#2719) 2025-02-26 10:05:28 -08:00
Scott Gerring 4830a3cf3b
ci: comment out intermittent failing assertion (#2714) 2025-02-26 08:01:43 -08:00
Björn Antonsson f9ccdfff1c
chore: Fix small nits on benchmarks and remove throughput (#2713) 2025-02-26 07:18:48 -08:00
Scott Gerring 261ac75ab5
ci: Add criterion performance regressions to PR workflows (#2706) 2025-02-25 23:37:37 -08:00
Björn Antonsson 2bf05f6161
perf: More Context benchmarks (#2707) 2025-02-25 23:03:55 -08:00
Cijo Thomas 7954252154
test: Nit improvement to Logger test logic (#2708) 2025-02-25 15:32:44 -08:00
Mohammad Vatandoost 29eda05337
Modify batch processor test use flush instead of sleeptime (#2675)
Co-authored-by: Braden Steffaniak <BradenSteffaniak+github@gmail.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-02-25 14:43:58 -08:00
Dimitris Apostolou 81fea0747c
Avoid duplicate crates (#2703)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-02-25 08:07:55 -08:00
Scott Gerring bfd9f3139b
ci: add pr naming workflow (#2698) 2025-02-25 07:15:18 -08:00
Scott Gerring 59af7e2277
chore: Prevent libtest being added to bench builds (#2705) 2025-02-25 07:13:26 -08:00
Josh W Lewis 64549d741f
Fix `.with_headers` to support multiple k/v pairs (#2699)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-02-24 15:52:59 -08:00
Spencer Judge edab145d6a
Reduce various info logs to debug (#2700) 2025-02-24 11:28:38 -08:00
Cijo Thomas bc5e6cea61
InstrumentationScope to include attributes in hash and eq check (#2701) 2025-02-21 12:06:10 -08:00
Cijo Thomas 27d364b105
Fix: BatchLogProcessor to invoke shutdown on exporter (#2696) 2025-02-21 11:55:36 -08:00
Cijo Thomas cb81eb6873
Add Scott Gerring as an Approver (#2679)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2025-02-21 07:07:10 -08:00
Cijo Thomas ee76205a8a
Add few more notes to design docs for Logs (#2694) 2025-02-20 17:45:41 -08:00
Lalit Kumar Bhasin a70affd3e3
Remove `mut` self reference from SpanExporter::export() method. (#2695) 2025-02-20 17:39:03 -08:00
Cijo Thomas c072629648
Use Duration for const for delays (#2688) 2025-02-20 16:43:31 -08:00
Cijo Thomas 19dba6964e
Appender-Tracing - extend spl treatment of message when recording str (#2689)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-02-20 16:10:15 -08:00
Cijo Thomas 6648d74cb2
Nit fix to changelogs (#2693) 2025-02-20 16:02:05 -08:00
Anton Grübel 5ce50ae4ed
simplify async trait impl (#2692) 2025-02-20 15:42:43 -08:00
Anton Grübel 37efb88e55
move TraceError, TraceResult and ExportError to opentelemetry-sdk (#2680)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-02-20 11:11:02 -08:00
martintmk f01e8f4682
Calls to `with_resource` for signal builders (Metrics, Logs, Traces) are now additive (#2677)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2025-02-20 10:25:43 -08:00
Lalit Kumar Bhasin dc9a5c87d6
Span Exporter async native (#2685) 2025-02-20 00:16:48 -08:00
Anton Grübel ac69af6a0a
update rand dependency (#2681)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-02-19 16:35:06 -08:00
Lalit Kumar Bhasin f4690f18b3
chore: CI fix - msrv patching for native-tls. (#2687) 2025-02-19 13:42:34 -08:00
Luc van Kampen 64868d239e
Update typo (#2686) 2025-02-19 11:32:58 -08:00
houseme 1f0e361dff
Fix typos (#2684) 2025-02-18 21:35:36 -08:00
Shunsuke Tokunaga b5c9fdc409
Fix 2638: Use absolute URL for LICENSE/CHANGELOG in README (#2682)
Signed-off-by: Shunpoco <tkngsnsk313320@gmail.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-02-18 19:00:29 -08:00
OpenTelemetry Bot 58c7644ac8
Add FOSSA scanning workflow (#2676)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
2025-02-18 14:58:21 -08:00
Anton Grübel 1b1ba899cf
use workspace lint configuration (#2674) 2025-02-17 18:18:13 -08:00
Cijo Thomas eca1ce8708
Temp fix flaky test for BatchSpanprocessors (#2671) 2025-02-15 10:26:53 -08:00
Anton Grübel a9a5cbf7a0
leverage native async trait in MetricsClient (#2672) 2025-02-15 09:50:47 -08:00
Cijo Thomas 06ca4a12f2
Nit cleanup of method signature for async export (#2669) 2025-02-14 19:31:27 -08:00
Anton Grübel bc931b151f
make force_flush() in PushMetricExporter synchronous (#2663)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-02-14 16:37:29 -08:00
Cijo Thomas dbd44a3486
Fix OTel Appender for tracing from suppressing other layers (#2668) 2025-02-14 15:26:08 -08:00
Mohammad Vatandoost 41b381ae80
Chang timeout value to miliseconds (#2656)
Co-authored-by: Braden Steffaniak <BradenSteffaniak+github@gmail.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-02-14 12:58:35 -08:00
Cijo Thomas 2997c4bb89
Show using tracing layer filters in examples (#2667) 2025-02-14 09:44:33 -08:00
tison 32a43caada
build: drop unused tonic server deps (#2666)
Signed-off-by: tison <wander4096@gmail.com>
2025-02-14 06:59:42 -08:00
Drew Relmas cd9bbcfa0d
Split SimpleLogProcessor and BatchLogProcessor out of single file (#2661) 2025-02-13 18:00:24 -08:00
Anton Grübel 00ebc98e63
leverage native async trait in PushMetricExporter (#2662) 2025-02-13 17:45:14 -08:00
Cijo Thomas ac66848ae8
Add design docs (#2657)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-02-13 10:56:06 -08:00
Cijo Thomas 1aca212a72
Simplifiy OTLP Example Resource creation (#2660) 2025-02-13 10:13:11 -08:00
martintmk e68fe94500
Enable per-thread instances for histogram stress test (#2659) 2025-02-13 08:46:54 -08:00
Drew Relmas 0592075930
Update appender-tracing pprof usage with Windows exclusion (#2655) 2025-02-12 14:11:23 -08:00
Lalit Kumar Bhasin f88d930be7
chore: Prepare for opentelemetry-appender-tracing v0.28.1 (#2653) 2025-02-12 10:05:20 -08:00
Lalit Kumar Bhasin f657b5522d
chore: fix doc tests (#2652) 2025-02-12 09:33:28 -08:00
Cijo Thomas 6ea208652a
Fix link in migration guide (#2647) 2025-02-11 14:36:43 -08:00
Braden Steffaniak b3582021b0
Upgrade opentelemetry-prometheus to 0.28 (#2650) 2025-02-11 12:01:16 -08:00
Cijo Thomas f3a375cb48
Update CI for ARM to use public image (#2646) 2025-02-11 10:48:08 -08:00
Drew Relmas 2d7e7d6936
Add missing Windows exclusion for pprof crate in sdk/benches (#2648) 2025-02-11 10:35:46 -08:00
tison 5236670f8d
chore: fix CHANGELOG.md (#2642) 2025-02-11 07:03:05 -08:00
Cijo Thomas de197e4011
Fix zipkin deadlink (#2640) 2025-02-10 12:26:29 -08:00
Lalit Kumar Bhasin 189078d7a9
Bump otel-appender-tracing version to 0.28 (#2637) 2025-02-10 10:18:49 -08:00
Lalit Kumar Bhasin 062c9d6589
Prepare v0.28.0 (#2635) 2025-02-10 09:52:55 -08:00
Cijo Thomas b6783a1098
Changelog refactoring (#2632) 2025-02-07 15:25:55 -08:00
Cijo Thomas c56a03ebbc
Separate logger and loggerprovider mod (#2633) 2025-02-07 11:53:55 -08:00
Tom Tan 34742d02dc
Set pwd for precommit.sh script to support running it in any directory (#2535)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-02-07 11:32:25 -08:00
Cijo Thomas eeb367d933
Nit fixes to doc and tests (#2626) 2025-02-06 22:05:43 -08:00
Cijo Thomas c2a2b8dd9b
Fix stress test for Logs to use OTelSdkResult (#2627) 2025-02-06 20:43:02 -08:00
Cijo Thomas 3a8ceddd5e
Rearrange trace integration tests (#2628) 2025-02-06 20:16:06 -08:00
Cijo Thomas 1fc86da1c6
0.28 migration guide and OTLP Example fixes (#2622) 2025-02-06 19:11:38 -08:00
Anton Grübel 61e539f491
leverage tracer provider to set service name for Zipkin exporter (#2624)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-02-06 17:12:11 -08:00
Lalit Kumar Bhasin 420416f2bf
Logs SDK - use OTelSdkError, OTelSdkResult (#2625) 2025-02-06 16:33:35 -08:00
Cijo Thomas 41464d1c1a
Readme updates in prep for release (#2623) 2025-02-06 12:48:05 -08:00
Cijo Thomas 69e7e89b47
Remove ExportResult and TraceError as no longer required/used (#2620) 2025-02-05 14:35:43 -08:00
Mindaugas Vinkelis d79950da59
ObservableGauge collect data points since previous collection (#2618)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-02-05 13:53:44 -08:00
Cijo Thomas ad3830383f
Add conditional compilation to avoid build warnings (#2619) 2025-02-05 13:01:24 -08:00
Cijo Thomas 1fbaaf2ac3
Rename LogRecord to SdkLogRecord (#2617) 2025-02-05 12:02:23 -08:00
Lalit Kumar Bhasin 5f7f2d5b7f
Remove export timeout configuration for PeriodicReader (#2598) 2025-02-05 11:52:47 -08:00
Cijo Thomas 15b5fa4e20
Move traceid spanid traceflags to common (#2609) 2025-02-05 11:07:56 -08:00
Cijo Thomas dfeeac7a7d
Rename TracerProvider to SdkTracerProvider (#2614)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-02-05 11:01:29 -08:00
Lalit Kumar Bhasin d01c1137cf
Trace subsystem - use OTelSdkResult/OTelSdkError (#2613) 2025-02-05 10:20:34 -08:00
Adrian Garcia Badaracco 0e751b4a2b
json: ser/de bytes as base64 strings not an array of bytes (#2471)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-02-05 09:09:34 -08:00
anujnegi270 775f1f9a3e
Disabling the Instrument Name Validation under a new feature flag (#2543)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-02-05 08:08:18 -08:00
Cijo Thomas fdc1151251
Rename LoggerProvider, Logger to SdkLoggerProvider, SdkLogger (#2612) 2025-02-05 07:37:45 -08:00
Lalit Kumar Bhasin 5bebbcc6d7
Refine error messages for OTelSdkError variants (#2608)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-02-04 16:05:57 -08:00
Mohammad Vatandoost d481be5a4f
Use opentelemetry:time::now instead of systemtime (final part) (#2607)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-02-04 15:57:48 -08:00
Cijo Thomas 4a76c96344
Use OTelSdkResult for metric flush (#2606) 2025-02-04 15:49:47 -08:00
Cijo Thomas 4783b64467
Assert explicitly that shutdown succeeded in Integration tests (#2605) 2025-02-04 13:33:33 -08:00
Cijo Thomas 4cdc64fc77
Metric export to use common OTelSdkResult (#2604) 2025-02-04 13:08:09 -08:00
Lalit Kumar Bhasin f5b44a54ea
Shutdown in separate thread for Logs integration tests in current_thread mode. (#2601) 2025-02-04 12:19:54 -08:00
Cijo Thomas 6bdb4c69b6
Make a common Error enum for export shutdown and flush operations (#2603) 2025-02-04 12:00:57 -08:00
Cijo Thomas b017c7b9c4
Fix PeriodicReader panic due to timeout (#2586)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-02-03 15:42:25 -08:00
Cijo Thomas 5e6b3d622e
Add easier way to add periodicreader to meterprovider (#2597) 2025-02-03 13:50:23 -08:00
Cijo Thomas 013d51af6e
Doc additions to warn about tokio current (#2594)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-02-03 13:35:53 -08:00
Lalit Kumar Bhasin 7ca4a85a24
Remove export timeout configuration for BatchSpanProcessor (#2596)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-02-03 13:01:46 -08:00
Mohammad Vatandoost 6c88d31aa2
Use opentelemetry:time::now instead of systemtime (#2595) 2025-02-03 12:35:25 -08:00
Lalit Kumar Bhasin a81ad249ec
Enable reqwest and reqwest-blocking client creation with custom timeout (#2584)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-02-03 11:17:01 -08:00
Lalit Kumar Bhasin 7c9447ff6c
Remove export timeout configuration for BatchLogProcessor. (#2587)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-02-03 10:22:41 -08:00
Cijo Thomas dde68a073c
Nit fix to log message on LogProcessor (#2590)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-02-03 09:47:39 -08:00
Cijo Thomas aece6419eb
Few fixes to PeriodicReader tests (#2589) 2025-02-03 09:38:02 -08:00
Cijo Thomas 3fc8485067
Add more metric integration tests (#2582) 2025-02-03 06:54:29 -08:00
Shunsuke Tokunaga 8c5daa2557
Version up sample code/Cargo.toml on README.md (#2585)
Signed-off-by: Shunpoco <tkngsnsk313320@gmail.com>
2025-02-02 09:41:23 -08:00
Cijo Thomas a1860eb7a8
Better handling of shutdown in BatchLogProcessor (#2581) 2025-01-31 11:36:25 -08:00
Cijo Thomas 9dfcff1f55
Use dedicated ShutdownResult for Metric SDK shutdown (#2573) 2025-01-31 10:20:22 -08:00
Cijo Thomas b50da912b4
Remove unwanted Arc insider PeriodicReader (#2579) 2025-01-31 09:59:38 -08:00
Cijo Thomas 732b938e59
Removed unnecessary public methods from OTLP Exporter (#2575) 2025-01-30 10:01:31 -08:00
Yury Yarashevich 85206105f8
Use bytes::Bytes as the HTTP request body in HttpClient. (#2485)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-01-29 08:41:22 -08:00
Anton Grübel 17cce839c3
feat: Replace Zipkin pipeline with exporter builders (#2565)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-01-28 21:57:48 -08:00
Cijo Thomas 144fdd961c
Print histogram bucket info in stdout exporter (#2569) 2025-01-28 12:09:20 -08:00
Lalit Kumar Bhasin 45f4d7c24a
chore: bump semantic convention 1.30.0 (#2572) 2025-01-28 11:40:17 -08:00
Cijo Thomas 3ec4c186ad
Nit doc update for OTLP Exporter (#2567) 2025-01-27 12:59:29 -08:00
David Pitoniak 6fa9ae2f09
doc(resource): update docs to be accurate with current behavior (#2568) 2025-01-27 09:23:51 -08:00
Dylan Thacker-Smith 18834f53af
appender-tracing: Include trace ID and span ID in logs when nested in tracing crate's spans (#2438)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2025-01-25 12:00:15 -08:00
Cijo Thomas b3879b6781
Minor fixes, stdout to print scope info for logs (#2563) 2025-01-24 18:46:10 -08:00
Cijo Thomas 879f4d7964
Rename provider builders (#2562) 2025-01-24 16:40:50 -08:00
Cijo Thomas bd0ee846e5
Rename log emitter to provider (#2559) 2025-01-24 11:30:05 -08:00
Cijo Thomas a1ac8065c5
Use opentelemetry:time::now instead of systemtime in LogEmitter (#2558) 2025-01-24 10:58:00 -08:00
Cijo Thomas b2d3d74962
Remove unsupported feature from BatchSpanProcessor (#2556) 2025-01-24 09:46:31 -08:00
Cijo Thomas 14faca3fbe
Resource.get modified to only need a reference (#2552) 2025-01-24 09:27:30 -08:00
Cijo Thomas 4f472a8c67
Run integration tests on all PRs (#2554) 2025-01-24 08:35:49 -08:00
Cijo Thomas de2b25ee89
Update pprof version (#2553) 2025-01-24 08:20:14 -08:00
Lalit Kumar Bhasin 8a4e5ca419
Restrict LogRecord creation access outside opentelemetry_sdk crate. (#2549) 2025-01-24 07:08:49 -08:00
Cijo Thomas 6a8db83871
Move Metric inmemory exporter (#2548) 2025-01-23 21:39:47 -08:00
Cijo Thomas 6a13678421
Move inmemory exporter for spans to diff namespace (#2544) 2025-01-23 18:44:14 -08:00
Cijo Thomas 97cf951396
Cleanup unused Error struct - PropagationError (#2547) 2025-01-23 18:33:01 -08:00
Lalit Kumar Bhasin 4c77c89999
More integration tests added (#2545)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-01-23 18:04:37 -08:00
Cijo Thomas 95fa209669
Remove unused Error enum (#2546) 2025-01-23 17:47:24 -08:00
Cijo Thomas fdf4a63a5b
Move inmemory exporter for logs to diff namespace (#2538) 2025-01-23 11:44:00 -08:00
Cijo Thomas 5935ccac93
Move span exporter module (#2540) 2025-01-23 11:34:10 -08:00
Utkarsh Umesan Pillai a0e50615cd
Update documentation for Metrics API (#2280)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2025-01-23 11:24:42 -08:00
Lalit Kumar Bhasin 927a08c902
Enable hyper client tests for SimpleLogProcessor integration tests (#2541) 2025-01-22 18:47:38 -08:00
Cijo Thomas 38be4d98f4
Nit leftovers from previous PR (#2537) 2025-01-22 17:37:00 -08:00
Cijo Thomas 3042aa0cac
Simplify metric::data imports (#2536) 2025-01-22 17:23:10 -08:00
Cijo Thomas 57d129734c
Refactor LogExporter mod (#2534) 2025-01-22 16:50:18 -08:00
Tom Tan b1debf0797
Short circuit the event_enabled check (#2533) 2025-01-22 15:10:02 -08:00
Cijo Thomas acaa98d814
Doc additions for Simple and Batch processors (#2529)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2025-01-22 10:15:42 -08:00
Cijo Thomas 90b0dd46c8
Remove cardinality capping in Metrics (#2528) 2025-01-21 17:38:46 -08:00
Lalit Kumar Bhasin d2a6b3b2fc
BatchSpanProcessor optimizations - Separate control signal queue, and wake up background thread only when required. (#2526)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-01-21 15:00:40 -08:00
Lalit Kumar Bhasin 78db32c58d
Add the full log validation test in Integration test (#2525) 2025-01-21 14:33:20 -08:00
Cijo Thomas 68af3bb038
Add reqwest client to integration test (#2523) 2025-01-16 19:23:59 -08:00
Cijo Thomas dace0ca7fa
Add simple processor to integration test (#2522) 2025-01-16 17:18:34 -08:00
Cijo Thomas 27410b0031
Integration test for non tokio main (#2520) 2025-01-16 16:07:25 -08:00
Lalit Kumar Bhasin c51c4b2c71
Add runtime traits under experimental flag. (#2519) 2025-01-15 17:18:08 -08:00
William Perron a719d0d1a6
Allow values containing '=' in OTEL_RESOURCE_ATTRIBUTES (#2120)
Values passed in to OTEL_RESOURCE_ATTRIBUTES containing an equal sign "=" are currently ignored by the Resource constructor, but should be accepted as it is part of the W3C Baggage octet
range.
2025-01-16 00:22:53 +01:00
Cijo Thomas b53c19e2e6
Few fixes to OTLP Exporter Examples (#2518) 2025-01-15 12:41:41 -08:00
Cijo Thomas 1904d4b8eb
Remove redundant shutdown check in batchlogprocessor (#2514) 2025-01-15 10:39:34 -08:00
Cijo Thomas 9aea82698a
OTLPExporter - change to http as default feature flag (#2516) 2025-01-15 09:52:30 -08:00
Cijo Thomas f46bccceab
PeriodicReader shutdown modified to enforce timeout (#2513) 2025-01-14 20:21:53 -08:00
Utkarsh Umesan Pillai 5aa9120f1e
Fix BatchLogProcessor (#2510) 2025-01-14 13:53:35 -08:00
Utkarsh Umesan Pillai 888d5a34ad
Refactor BatchLogProcessor (#2494)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2025-01-14 03:31:39 -08:00
Utkarsh Umesan Pillai 73859c3bd7
Add internal-logs feature to opentelemetry-proto (#2507) 2025-01-13 18:01:25 -08:00
Utkarsh Umesan Pillai 6cc327d555
Update metrics benchmarks (#2502) 2025-01-09 11:42:56 -08:00
Utkarsh Umesan Pillai e05979d6d7
Update the link to Meeting Notes doc (#2501) 2025-01-07 22:57:07 -08:00
Joe Burnard a1dda220de
OTLP documentation: Fix typo where webkpi is used instead of webpki (#2498) 2025-01-07 07:58:36 -08:00
Mindaugas Vinkelis 82ed8e05f4
Sepatate Aggregate measure and collect functions (#2492) 2025-01-04 16:40:33 -08:00
Lalit Kumar Bhasin 37d2e51c23
chore: disable failing integration tests (#2495)
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2025-01-04 02:02:28 +05:30
Utkarsh Umesan Pillai 42b4f2fbd8
Minor refactoring- Rename the variants of LogBatchData enum (#2490) 2025-01-01 06:14:37 -08:00
Takahiro Ebato 17855be169
Retain empty tracer name as is instead of using default name (#2486)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-12-31 07:53:33 +00:00
Utkarsh Umesan Pillai 56e7fae000
Avoid vec allocation during each export for BatchLogProcessor - Part 2 (#2488) 2024-12-31 07:46:06 +00:00
Utkarsh Umesan Pillai 9a8ad95ee8
Avoid vec allocation during each export for BatchLogProcessor (#2483)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-12-27 17:56:14 -08:00
Utkarsh Umesan Pillai f3b5fd3af2
Minor refactoring (#2484) 2024-12-27 17:48:11 -08:00
Cijo Thomas d52fec7939
Minor cleanup in Stdout exporter (#2481) 2024-12-27 12:21:03 -08:00
Cijo Thomas 8fde6eb3b2
Remove unnecessary featureflag for eventname (#2480) 2024-12-27 10:45:39 -08:00
Cijo Thomas e378bc8776
Fix PeriodicReader shutdown to invoke shutdown on exporter (#2477) 2024-12-26 14:55:07 -08:00
Cijo Thomas 36f9caf45e
Fix changelog and few spell check issues (#2474)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-12-26 11:56:36 -08:00
Lalit Kumar Bhasin 5b86b7fd2c
Add doc-comment for SimpleLogProcessor and BatchLogProcessor (#2468) 2024-12-24 09:33:19 -08:00
Cijo Thomas 6e1032f9af
Nit fix to LogProcessor tests (#2467) 2024-12-24 05:23:32 -08:00
Cijo Thomas 8d5f2226df
Nit improvements to batchprocessors (#2466) 2024-12-23 17:17:37 -08:00
Cijo Thomas ef49833f4d
Minor followups to LogProcessor (#2464) 2024-12-23 12:46:53 -08:00
Lalit Kumar Bhasin 1f354674d6
BatchSpanProcessor with dedicated thread. (#2456) 2024-12-23 11:15:48 -08:00
Cijo Thomas 6209c06db5
Move BatchLogProcessor with runtime to separate module (#2463) 2024-12-20 22:14:39 -08:00
Lalit Kumar Bhasin 23f6ae2992
Use native Rust support for async traits in LogExporter::export() method (11% improvement) (#2374)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-12-20 08:03:49 -08:00
Cijo Thomas 80629c8161
Minor update to stdout exporter example to show log correlation (#2459) 2024-12-19 20:50:27 -08:00
Cijo Thomas 3694ff9fe7
Modify OTLP Http example to use reqwest blocking (#2460) 2024-12-19 20:27:57 -08:00
Cijo Thomas f911ed5d7b
Cleanup leftover feature flag (#2458) 2024-12-19 10:38:38 -08:00
Lalit Kumar Bhasin c617be7449
chore: bring back BatchLogProcessorWithAsyncRuntime unit tests (#2457) 2024-12-19 09:27:42 -08:00
Scott Gerring 0fc0764ffd
chore: Test sync exporters (#2455) 2024-12-19 07:47:23 -08:00
Cijo Thomas acf16ed451
Tweaks to logs integration test (#2453) 2024-12-18 18:33:15 -08:00
Cijo Thomas 0a7ad690fc
Add internal logging to HTTP libraries (#2452) 2024-12-18 18:21:06 -08:00
Tom Tan 938893c526
Handle batch log processing in a dedicated background thread (#2436) 2024-12-18 16:12:02 -08:00
Mindaugas Vinkelis 06053411bd
Directly implement Measure trait for metric aggregates (#2371)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-12-18 10:52:38 -08:00
Cijo Thomas fbcba3b003
Enable metric integration test for req-blocking (#2445) 2024-12-18 06:28:32 -08:00
Cijo Thomas 9011f63ff6
Nit spelling fixes (#2443) 2024-12-17 18:00:31 -08:00
Mindaugas Vinkelis b9a422b39e
Directly implement ComputeAggregation (#2425)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2024-12-17 17:36:29 -08:00
Lalit Kumar Bhasin 551760b220
chore: publish otel-proto v1.5.0 (#2439)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-12-17 08:43:25 -08:00
Cijo Thomas 6a3b04dc0b
Add observable instruments to periodicreader tests (#2428) 2024-12-17 08:15:33 -08:00
Lalit Kumar Bhasin 4e5255401f
chore: cleanup unused dependencies (#2440)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-12-17 07:26:31 -08:00
Scott Gerring 9173ddf93f
chore: refactor integration tests and add metrics coverage (#2432)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-12-17 07:08:31 -08:00
David Pitoniak eb8d7c69ce
otlp: spawn thread to create blocking reqwest client (#2431)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2024-12-17 06:59:02 -08:00
Cijo Thomas 9cf7a40b21
Add a minor log to help debug when Meter is obtained from noops (#2435) 2024-12-16 17:16:43 -08:00
Cijo Thomas 967dc93055
Move shutdown checks to MeterProvider (#2433) 2024-12-16 07:51:09 -08:00
Lalit Kumar Bhasin c726c4d97a
Version pinning for tracing and tracing-core (#2418)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-12-15 22:28:53 +05:30
Lalit Kumar Bhasin fbc3c70c27
Make LogRecord fields private and add getters for encapsulation (#2314) 2024-12-15 20:28:55 +05:30
David Pitoniak b8380ebfa4
resource: remove vec allocations for attributes (#2429) 2024-12-13 17:15:21 -08:00
Mindaugas Vinkelis d2e179eb5d
Aggregate time initiator (#2423)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-12-13 12:33:59 -08:00
David Pitoniak 9aeae0f03f
Feat/add resource builder (#2322)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2024-12-13 12:16:03 -08:00
Cijo Thomas 15d69b1840
Improve shutdown handling in PeriodicReader (#2422) 2024-12-13 07:56:19 -08:00
Cijo Thomas 9b0ccce04e
Small improvements to PeriodicReader (#2421)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2024-12-13 05:44:26 -08:00
Lalit Kumar Bhasin ce550e36bb
bump MSRV to 1.75.0 for all crates (#2417) 2024-12-12 21:12:41 -08:00
Mindaugas Vinkelis dcaff0d7c1
Update CHANGELOGs for time changes in metrics aggregations (#2412)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2024-12-12 09:00:54 -08:00
Björn Antonsson d0ef36510f
Include SpanContext information in Context Debug (#2365)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-12-11 20:03:40 -08:00
Cijo Thomas 1da35a99a2
Enable Feature in otlp http example (#2416) 2024-12-11 17:40:58 -08:00
Lalit Kumar Bhasin e8a28788b9
fix: missing thiserror crate when building with --no-default-features (#2413)
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-12-11 09:32:34 -08:00
Utkarsh Umesan Pillai f9581f545f
Add internal logging for OTLP Exporter tonic client (#2415) 2024-12-11 09:05:26 -08:00
Mindaugas Vinkelis e4cba9457e
Move time from DataPoint to Histogram/ExpoHistogram (#2411) 2024-12-11 07:27:43 -08:00
Cijo Thomas 1a4e931fe5
Minor fixes to PeriodicReader and examples (#2409) 2024-12-10 20:13:46 -08:00
Cijo Thomas 238a8f2a74
Make PeriodicReader with own Thread the default (#2403) 2024-12-10 16:08:00 -08:00
Mindaugas Vinkelis d67d1fc558
Move time from DataPoint to Sum/Gauge (#2377) 2024-12-10 13:14:58 -08:00
David Pitoniak f513768305
test: use rstest for table testing sdk resource (#2407)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-12-10 12:16:48 -08:00
Cijo Thomas 540cdb3613
Remove self diagnostics example (#2404) 2024-12-10 11:53:13 -08:00
Dirkjan Ochtman 257377315d
Upgrade to thiserror 2 (#2406)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-12-10 07:53:08 -08:00
Dirkjan Ochtman e8ccb01676
sdk: set correct span limit in builder (#2405) 2024-12-10 07:36:29 -08:00
Mindaugas Vinkelis 902baa9161
Gauge start-time is optional (#2389)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-12-09 15:20:31 -08:00
Lalit Kumar Bhasin de3ea4ee97
Remov deprecated LogData structure (#2398) 2024-12-09 18:33:31 +00:00
Cijo Thomas a16fac6ca6
OTLP Example fixes (#2394) 2024-12-09 10:19:05 -08:00
Cijo Thomas 2030f8f77f
Modify logs basic example to use tracing (#2397)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2024-12-09 09:38:48 -08:00
Lalit Kumar Bhasin 3df15a1b59
chore: Update semantic conventions v1.29.0, weaver v0.11.0 (#2395) 2024-12-08 11:02:31 -08:00
Lalit Kumar Bhasin b417e848dd
Remove Deprecated Logger Method (#2396) 2024-12-08 06:45:43 -08:00
Karol Fuksiewicz 01561465cb
feat: update otel versions for prometheus to 0.27 (#2309)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: ttys3 <ttys3.rust@gmail.com>
2024-12-05 16:12:33 -08:00
Lalit Kumar Bhasin 96b7acc73d
Remove `mut` self reference from LogExporter::export() method. (#2380) 2024-12-05 13:36:08 -08:00
Lalit Kumar Bhasin 957659fac9
chore: ARM64 CI fix. (#2382) 2024-12-04 09:48:31 -08:00
David Pitoniak 6d1a765c41
chore: remove the global::shutdown_tracer_provider function (#2369) 2024-12-04 06:03:46 -08:00
David Pitoniak b35c0d6b99
Feat/remove timeout from detectors (#2332) 2024-12-03 21:09:16 -08:00
Utkarsh Umesan Pillai 506a4f9fb2
[Metrics] Remove unnecessary box (#2376)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-12-02 20:01:35 -08:00
Utkarsh Umesan Pillai c73c938c4a
Fix CI (#2375) 2024-12-02 19:27:37 -08:00
Lalit Kumar Bhasin c225c82784
Add OTLP integration test for hyper and request client for logs and traces (#2312)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-12-02 15:47:57 -08:00
Mindaugas Vinkelis 5b6e9b952f
Time is not optional in DataPoints (#2367)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-12-02 12:15:56 -08:00
Cijo Thomas 6b71301b99
Use static dispatch in SimpleLogProcessor (#2338)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2024-12-02 10:01:08 -08:00
Lalit Kumar Bhasin a3c469b1a6
Fix CI lint error from new stable toolchain v1.83 (#2370) 2024-12-02 08:20:55 -08:00
Cijo Thomas e0159ad91f
Bump version of sdk release 0.27.1 (#2362) 2024-11-27 12:05:00 -08:00
Cijo Thomas b7276d824e
Minor Internal logs (#2361) 2024-11-27 11:45:03 -08:00
Scott Gerring cbe9ebe91e
Track dropped spans and logs due to full buffer (#2357)
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-11-27 10:24:06 -08:00
Cijo Thomas 195dea8070
Few doc updates for opentelemetry (#2353) 2024-11-27 10:04:27 -08:00
Cijo Thomas ab332b06c9
Let CI check for stable run even if beta run fails (#2360) 2024-11-27 09:56:47 -08:00
Cijo Thomas 53e892a2ca
Nit fix by avoiding bound validation unless View feature is enabled (#2355) 2024-11-26 17:55:06 -08:00
Cijo Thomas 0e221c1d43
Bugfix - add validation for custom buckets provided for Histograms (#2351)
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2024-11-26 17:30:29 -08:00
Lalit Kumar Bhasin fa6e6cd289
Replace once_cell::Lazy with std::sync::OnceLock for global Initialization in otel-sdk crate (#2342) 2024-11-26 17:09:04 -08:00
Utkarsh Umesan Pillai 8e6b479684
Avoid additional HashMap allocation for Cumulative aggregation (#2352) 2024-11-26 16:00:51 -08:00
Cijo Thomas 1cecaeabf4
Add few internal logs for Metrics sdks (#2350) 2024-11-26 14:05:26 -08:00
Lalit Kumar Bhasin 91370d23cf
Deprecate logger::provider() and logger::instrumentation_scope() (#2349)
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2024-11-26 13:04:18 -08:00
Cijo Thomas c9388e4753
Preallocate and keep memory for HashMap in Metric aggregation (#2343) 2024-11-26 10:25:12 -08:00
Cijo Thomas 3a4d12af9a
Minor fix to main readme (#2348) 2024-11-26 10:15:49 -08:00
Björn Antonsson 9a85ce1c0c
Remove non-default feature from doc test (#2346) 2024-11-26 07:22:15 -08:00
Lalit Kumar Bhasin 1541a330e2
attempt to fix stress test CI by pinning libc (#2344) 2024-11-25 19:20:32 -08:00
Lalit Kumar Bhasin 1119549b0d
Remove async-trait crate as dependency for traces (#2339) 2024-11-25 12:24:15 -08:00
Cijo Thomas e6c351f2d7
More consistent readme for msrv (#2336)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2024-11-25 10:40:27 -08:00
David Pitoniak 129ca03128
feat: add concurrency options to ci workflow (#2337) 2024-11-24 17:38:29 -08:00
Cijo Thomas dd982e3501
InternalLog fixes for GlobalMeterProvider (#2333) 2024-11-24 12:35:48 -08:00
Lalit Kumar Bhasin a6e2cd6e91
Remove default logger name (#2316)
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-11-24 11:39:18 -08:00
Cijo Thomas 882e1c2d25
Empty MeterName retained as is instead of using default name (#2334) 2024-11-24 10:33:03 -08:00
Cijo Thomas 5de2caf5de
Emit internal log for global meter provider (#2331) 2024-11-23 18:37:01 -08:00
Cijo Thomas 8c9babbda8
Minor additions to internal logs (#2330) 2024-11-23 12:52:32 -08:00
Lalit Kumar Bhasin ebeeea1724
Replace `once_cell::Lazy` with `std::sync::OnceLock` for global Initialization in OpenTelemetry API crate (#2326)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-11-23 12:22:53 -08:00
Lalit Kumar Bhasin 3d352d870a
[Logs SDK] Deprecate LogData struct (#2325)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-11-22 18:42:22 -08:00
Lalit Kumar Bhasin 2ba2e7fffe
[CI fix] msrv patch for rustls (#2327) 2024-11-22 17:05:54 -08:00
Lalit Kumar Bhasin 6ca7881f7c
CI fix: patch msrv for rustls-native-certs (#2318) 2024-11-22 13:43:41 -08:00
Cijo Thomas 465fcc2eda
AttributeSet cleanup, better perf for overflows (#2313) 2024-11-20 19:41:40 -08:00
Lalit Kumar Bhasin af9d925736
chore: update proto definition to v1.4.0 (#2315) 2024-11-20 17:33:37 -08:00
Cijo Thomas ca6c67e752
Remove building examples twice (#2311) 2024-11-20 11:27:48 -08:00
Mindaugas Vinkelis 3b652aca29
Use ValueMap in ExpoHistogram (#2282)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-11-20 11:13:24 -08:00
Cijo Thomas cd54f24224
Update benchmark results for metrics (#2307) 2024-11-20 10:36:09 -08:00
Cijo Thomas a4f602b4cb
Doc CI to use stable rust (#2310) 2024-11-20 10:25:09 -08:00
David Pitoniak 849778d524
Refactor/deprecate trace config (#2303) 2024-11-18 18:11:46 -08:00
Utkarsh Umesan Pillai 41afd7f916
Make stress tests independent of batch size (#2306) 2024-11-18 10:53:52 -08:00
Raphael Deem 3ac2d9fb64
cleanup imports in examples (#2300) 2024-11-14 07:49:32 -08:00
Lalit Kumar Bhasin 45ed2e061a
Publish otel-appender-log : add version to semconv (#2299) 2024-11-11 17:43:34 -08:00
Lalit Kumar Bhasin ade08cb1a3
Prepare for v0.27.0 - update Metrics API and Log(bridge) API to RC, Metrics SDK & OTLP Exporter to Beta. (#2290) 2024-11-11 16:18:20 -08:00
Utkarsh Umesan Pillai 648710edf1
Move Views under feature flag (#2298) 2024-11-11 16:05:00 -08:00
Cijo Thomas 47d501670e
Add PeriodicReaderWithOwnThread (#2292) 2024-11-11 15:29:07 -08:00
Lalit Kumar Bhasin b83311845d
Rename `logs_level_enabled` flag to `spec_unstable_logs_enabled` (#2291) 2024-11-11 12:39:20 -08:00
Lalit Kumar Bhasin 0cc2cd571f
Add usage doc comment for AnyValue type (#2293)
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2024-11-08 15:57:21 -08:00
Cijo Thomas 845cf21e51
Move Temporality enum opentelemetry_sdk::metrics::data:: to opentelemetry_sdk::metrics:: (#2289)
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2024-11-08 13:49:26 -08:00
Utkarsh Umesan Pillai a707bb938b
Update code documentation for Metric instruments (#2281) 2024-11-07 21:46:48 -08:00
Mindaugas Vinkelis c322a50d3e
Histogram implementation cleanup (#2283) 2024-11-07 14:12:30 -08:00
Cijo Thomas 540c6f17fc
Few fixes to changelog for breaking changes (#2287) 2024-11-07 12:05:28 -08:00
Mindaugas Vinkelis 52f6d9214e
Remove Counter/Add benchmark for delta temporality (#2285) 2024-11-07 09:40:03 -08:00
Lalit Kumar Bhasin ebf1bb6eba
Move Logs and Metrics error constructs to SDK (#2266)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-11-06 15:05:35 -08:00
Lalit Kumar Bhasin 31bea196b4
Add `name` attribute in logging macros (#2279) 2024-11-06 13:48:09 -08:00
Mindaugas Vinkelis ac0ea9f17d
Add collect methods on ValueMap (#2267)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-11-06 13:08:46 -08:00
stormshield-fabs 1fd871a012
Remove Cow from InstrumentationScope (#2275)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-11-06 13:00:28 -08:00
Lalit Kumar Bhasin 0b716a708a
fix integration test (#2278) 2024-11-06 12:52:29 -08:00
Cijo Thomas 500d913e31
Add few debug level internal logs to PeriodicReader (#2277) 2024-11-06 08:34:12 -08:00
Cijo Thomas dd7b53159f
Simplified self-diagnostics example (#2274) 2024-11-05 08:59:21 -08:00
Lalit Kumar Bhasin 91f44ff249
Remove Global Error handler. (#2260) 2024-11-04 18:12:00 -08:00
Lalit Kumar Bhasin eca53b2fdd
CI fix: pin url for msrv build (#2272) 2024-11-04 11:42:52 -08:00
Lalit Kumar Bhasin 6a079eb977
nit - collector config fix for self-diagnostic example (#2271) 2024-11-04 10:35:37 -08:00
Mindaugas Vinkelis 16f80c2ee6
Remove redundant generic argument from Aggregator (#2269) 2024-11-03 15:11:00 -08:00
Lalit Kumar Bhasin fcd7cae39b
Global error handler cleanup - Trace SDK (#2256)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-11-02 20:37:13 -07:00
Lalit Kumar Bhasin 374295381f
Enable hyper client for opentelemetry-otlp (#2263) 2024-11-01 09:49:26 -07:00
Cijo Thomas 9f6c725cd3
Update links to log api spec (#2265) 2024-11-01 09:40:14 -07:00
Mindaugas Vinkelis 706a067b12
ValueMap interface change (#2117)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-11-01 09:31:47 -07:00
Lalit Kumar Bhasin e1860c7b91
[chore] Revert pinning of pin-project-lite crate after upstream fix, and CI fix (#2264) 2024-11-01 05:52:00 -07:00
Lalit Kumar Bhasin a5e2061162
Global error handler cleanup - Jaeger Remote sampler (#2257) 2024-10-29 13:05:12 -07:00
Lalit Kumar Bhasin 40b18699a1
Global error handler cleanup - Metrics data-point overflow (#2259)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-28 21:30:30 -07:00
David Pitoniak 1b2d841e37
refactor: InMemoryLogsExporter non plural (#2258)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-10-28 20:48:34 -07:00
Cijo Thomas a736604ea2
Add Utkarsh as maintainer (#2226)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2024-10-28 07:43:07 -07:00
David Pitoniak 17f4627ab8
Refactor/metric exporters non plural (#2255)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-10-27 20:26:15 -07:00
Lalit Kumar Bhasin afc8ff516e
Global error handler cleanup - UpDown Counter, Historgram, Gauge. (#2242)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2024-10-26 22:13:44 -07:00
Lalit Kumar Bhasin 3bc9b3d93d
Global error handler cleanup - Metrics Pipeline (#2244) 2024-10-26 21:59:53 -07:00
Lalit Kumar Bhasin 4a405fdfa2
Global error handler cleanup - otel-proto (#2248) 2024-10-26 19:13:30 -07:00
Lalit Kumar Bhasin 9e9b8384ae
Global error handler cleanup - baggage propagator (#2251)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-26 17:08:31 -07:00
Lalit Kumar Bhasin ed4d37913e
Global error handler cleanup - Metrics View (#2249) 2024-10-26 16:54:09 -07:00
Lalit Kumar Bhasin 1a73d52bb3
Global error handler cleanup - Jaeger Propagator (#2250) 2024-10-25 22:38:53 -07:00
David Pitoniak f3be05bb6f
refactor: update metrics Result to be MetricResult (#2241)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-25 21:52:22 -07:00
Lalit Kumar Bhasin 9382bfb1cc
Global error handler cleanup - trace API (#2252) 2024-10-25 21:27:25 -07:00
Lalit Kumar Bhasin 4c7bf582e5
Global error handler cleanup - ObservableUpDownCounter, ObservableGauge (#2240)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-24 23:49:46 -07:00
Lalit Kumar Bhasin b90c9fb09a
Global error handler cleanup - PeriodicReader (#2243)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-24 22:14:36 -07:00
stormshield-fabs e2db7a0a37
Unify builders across signals (#2220)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-24 21:55:24 -07:00
Jialun Cai 5628f66395
Exclude benchmark setup duration using iter_batched (#2233) 2024-10-24 21:34:40 -07:00
Lalit Kumar Bhasin a18853e47a
Global error handler cleanup - exponential histogram (#2235)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2024-10-24 13:43:46 -07:00
Lalit Kumar Bhasin d3b1c47e1a
Global error handler cleanup - MeterProvider (#2237) 2024-10-24 13:41:41 -07:00
Lalit Kumar Bhasin 0202299dd7
Pin pin_project_lite to older version due to external_type_check compatibility (#2239) 2024-10-24 13:04:26 -07:00
Lalit Kumar Bhasin 2f65b5406f
Global error handler cleanup - ManualReader (#2236)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-24 10:05:16 -07:00
Lalit Kumar Bhasin 45b4f8294e
Global error handler cleanup - Counter and Observable counter creation (#2234) 2024-10-24 02:04:45 -07:00
David Pitoniak 80dc298cf4
feat: replace OtlpPipeline with exporter builders (#2221)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-23 21:20:10 -07:00
Utkarsh Umesan Pillai a7de955e16
[Metrics API] Rename `init` to `build` (#2232) 2024-10-23 18:33:37 -07:00
Utkarsh Umesan Pillai 8bd529a6d6
[Metrics API] Update Instrument Provider and remove `try_init` methods (#2227) 2024-10-22 22:42:13 -07:00
Utkarsh Umesan Pillai f45e840ed5
[Metrics API] Mark KeyValue types non-exhaustive (#2228) 2024-10-22 22:30:47 -07:00
Lalit Kumar Bhasin a47b429001
Avoid redundant shutdown in TracerProvider::drop when already shut down (#2197)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2024-10-22 21:21:30 -07:00
Lalit Kumar Bhasin 2bb53b4fc6
[Logs API] Mark Anyvalue enum as non-exhaustive (#2230) 2024-10-22 19:38:09 -07:00
Lalit Kumar Bhasin ea4b5e4d99
Add Unit Tests for Sync and Async Log Exporters - with and without runtime - for SimpleLogProcessor (#2218) 2024-10-21 15:30:50 -07:00
slim e91138351a
feat: update otel versions for prometheus to 0.26 (#2183)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-10-21 12:23:20 -07:00
Lalit Kumar Bhasin 84c151c0b6
Fix integration tests failure for traces. (#2223) 2024-10-20 18:41:27 -07:00
David Pitoniak 4852a5e323
example: add temporality selector option to metrics-basic (#2217)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-18 07:39:13 -07:00
Lalit Kumar Bhasin f677458768
fix integration test (#2219) 2024-10-17 21:30:14 -07:00
Utkarsh Umesan Pillai e6965bd004
[Metrics API] Remove unnecessary auto trait implementations (#2215)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-16 12:50:28 -07:00
Renato Lochetti 20f1204d01
docs: Remove mention to unexisting `tls-tonic` feature flag (#2216) 2024-10-16 10:35:34 -07:00
Utkarsh Umesan Pillai 8d84a76b8f
[Metrics-API] Update asynchronous instruments to not allow calling `observe` outside of a callback (#2210)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-15 15:27:34 -07:00
Lalit Kumar Bhasin 16c0e10343
Global Log handler cleanup - Logs SDK (#2184) 2024-10-14 14:29:11 -07:00
David Pitoniak 3f5c230ecb
Chore/metrics advanced (#2204)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-13 17:30:48 -07:00
Utkarsh Umesan Pillai 42685e8e0d
[Metrics API] Simplify public API contract of instruments for SDK (#2207)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-13 17:14:11 -07:00
Cijo Thomas c5cfa4064e
Fix CI (#2209) 2024-10-13 12:11:21 -07:00
Toby Dimmick 0c414249f7
`opentelemetry-appender-log`: Add code attributes to logs (#2193) 2024-10-13 10:40:46 -07:00
Utkarsh Umesan Pillai d78930a486
[Metrics API] Remove unnecessary auto trait implementations (#2206)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-13 10:32:18 -07:00
Lalit Kumar Bhasin bacb3dab78
Prevent lint warnings if internal-logs features is not enabled. (#2196) 2024-10-13 00:14:11 -07:00
Utkarsh Umesan Pillai c3687d4fb6
[Metrics-API] Mark no-op structs as pub(crate) (#2203)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-12 19:12:15 -07:00
Utkarsh Umesan Pillai f1a6e16485
[Metrics API] Mark structs non-exhaustive (#2202) 2024-10-12 18:27:38 -07:00
Cijo Thomas caa4246ca3
Add tests to confirm known deadlock issues (#2199) 2024-10-12 10:29:11 -07:00
Lalit Kumar Bhasin b6a108eedf
Avoid redundant shutdown in LoggerProvider::drop when already shut down (#2195)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-12 09:58:40 -07:00
Vaalla 20fd454c4b
Use the correct format when deserializing body field from logs (#2178) 2024-10-12 09:44:58 -07:00
Lalit Kumar Bhasin e524bdb935
Remove redundant Arc's in MeterProviderInner (#2198) 2024-10-11 14:07:38 -07:00
Lalit Kumar Bhasin f344b5b7ff
chore: update semantic convention version v1.28.0 (#2192) 2024-10-10 13:40:47 -07:00
Utkarsh Umesan Pillai acdc4003a0
[Metrics API] Mark NoopMeterProvider as pub(crate) (#2191)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-10 13:23:53 -07:00
Utkarsh Umesan Pillai 78a684cc38
[Metrics API] Remove unnecessary public observe methods (#2190) 2024-10-10 13:03:32 -07:00
Utkarsh Umesan Pillai af4527c11f
[Metrics API] Remove as_any methods (#2187) 2024-10-08 18:26:37 -07:00
Utkarsh Umesan Pillai 21e1ba5a61
[Metrics API] Update HistogramBuilder (#2186) 2024-10-08 17:35:31 -07:00
Utkarsh Umesan Pillai c3794c0cff
[Public API cleanup] Remove unnecessary conversion methods for builder and instruments (#2138)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-10-08 16:33:50 -07:00
Dirkjan Ochtman 99d24b7b8c
proto: bump dependency requirement to match generated code (#2168) 2024-10-08 07:45:10 -07:00
Lalit Kumar Bhasin 720c62d395
nit cleanups after upgrde to rustc 1.70.0 (#2182) 2024-10-07 19:03:35 -07:00
Dirkjan Ochtman 58e0904d9e
Bump MSRV to 1.70 (#2179)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-10-07 16:33:38 -07:00
Cijo Thomas 80771d3b55
Nits: Collect config fix in examples (#2180) 2024-10-07 13:24:13 -07:00
Ashley Mannix 6aad3dbc99
Add a set_trace_context method to LogRecord trait (#2129) 2024-10-05 18:15:26 -07:00
Nikita Moshenskiy 9cbf6934b1
Docs: Remove unnecessary indentation for better readability (#2174) 2024-10-04 09:24:54 -07:00
Cijo Thomas a941c0a82a
Remove comments that are not relevant anymore (#2171) 2024-10-04 07:43:16 -07:00
Lalit Kumar Bhasin 2ff7ec0380
Improve internal opentelemetry logging (#2128)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2024-10-03 20:09:36 -07:00
Cijo Thomas 86dd4863dd
Metrics - Instrument Name Validation fixes (#2166) 2024-10-02 15:37:37 -07:00
Cijo Thomas ed276119cc
Nit fixes to bug template (#2161) 2024-10-01 16:06:52 -07:00
Cijo Thomas 21fc16c0da
Prepare 0.26.0 release, update Metrics API to Beta (#2160)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2024-10-01 15:07:17 -07:00
Cijo Thomas 167baf8555
Minor cleanups in Metrics module (#2155) 2024-09-30 16:05:05 -07:00
Cijo Thomas 380a709162
MeterProvider modified to not do shutdown if user has already shut down (#2156)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-09-30 15:45:31 -07:00
Lalit Kumar Bhasin 81a95e308b
Improve internal opentelemetry logging - directly using tracing mcros (#2152)
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2024-09-30 15:31:13 -07:00
Cijo Thomas 8bdd18995d
For Delta Temporarlity, avoid exporting when no new measurements are made (#2153) 2024-09-30 14:02:31 -07:00
Lalit Kumar Bhasin 6ed2b4394e
Fix CI - Regenerate proto files, and selective msrv-patching (#2159) 2024-09-30 13:46:08 -07:00
Laurent Quérel 161929d8b6
Use weaver for semantic convention codegen (#2098)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-09-26 06:11:37 -07:00
Utkarsh Umesan Pillai 0f15d21ed2
Update doc comments (#2149) 2024-09-25 14:44:22 -07:00
Cijo Thomas 88023d9a28
Add tests for periodic reader from various RT combinations (#2147)
These tests should help with testing #2142
2024-09-25 22:05:05 +02:00
Utkarsh Umesan Pillai c8136d9b46
Add `with_boundaries` hint API for explicit bucket histograms (#2135)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-09-24 10:55:40 -07:00
Tom Tan b244673a4a
[TEST] Add test about batch processor with current_thread async runtime (#2123)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-09-23 19:04:03 -07:00
Utkarsh Umesan Pillai c93cf26bb3
Fix CI and bump the msrv of OTLP to 1.71.1 (#2140) 2024-09-23 16:38:36 -07:00
Cijo Thomas d652dc82fc
Minor - exclude pprof in windows (#2134) 2024-09-20 09:52:34 -07:00
Utkarsh Umesan Pillai 13ee7a8318
Update builder for ObservableCounter, ObservableUpDownCounter, and ObservableGauge (#2132)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-09-20 09:18:40 -07:00
Mindaugas Vinkelis a8d62c1fb6
PeriodicReader::build make interval registration in same thread/task (#2133) 2024-09-20 08:03:22 -07:00
Utkarsh Umesan Pillai 3347bde903
Update builder for Counter, UpDownCounter, and Gauge (#2131) 2024-09-19 17:16:51 -07:00
Utkarsh Umesan Pillai 606a3cd7cc
Update Histogram Builder (#2130) 2024-09-19 15:41:57 -07:00
Matthew Boddewyn 26b3320eef
Implement clone for ExponentialBucket and ExponentialHistogramDataPoint (#2126)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-09-19 11:31:36 -07:00
Utkarsh Umesan Pillai 1a4e245cb1
[Cleanup] Remove `Value` to `AnyValue` conversion methods (#2127) 2024-09-19 10:24:25 -07:00
Utkarsh Umesan Pillai 8e21c75fc2
Update CHANGELOG (#2125) 2024-09-18 15:21:17 -07:00
Utkarsh Umesan Pillai 3976f3d486
[Breaking] Enforce meter name, version schema_url to be static string slices (#2112)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-09-17 13:26:30 -07:00
Tom Tan d0a4fd0466
[BUILD] Add required features for test build (#2121) 2024-09-17 13:13:30 -07:00
Charles Samborski 7a074b53ae
feature: expose `SimpleSpanProcessor::new` (#2119) 2024-09-16 09:20:06 -07:00
Oliver Evans 7ab5e0fbbe
Don't impl HttpClient for reqwest::blocking::Client on wasm32 (#2073)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-09-13 11:27:53 -07:00
Utkarsh Umesan Pillai ff9d50bc43
Mark SdkMeter as pub(crate) (#2113)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-09-12 16:13:47 -07:00
Mindaugas Vinkelis 8bd3294b86
update trait `Number<T>` to `Number` (#2109) 2024-09-12 15:18:33 -07:00
Utkarsh Umesan Pillai b2e5640e48
Mark `ObjectSafeProvider` and `GlobalMeterProvider::new()` as private (#2108) 2024-09-12 07:25:42 -07:00
Cijo Thomas 921f25327b
Remove unused multi callback (#2107) 2024-09-11 17:34:38 -07:00
Cijo Thomas eb0d997a04
Remove MetricProducer (#2105) 2024-09-11 17:12:57 -07:00
Franco Posa 24da59e1e1
note breaking change in opentlemetry-otlp v0.17.0 CHANGELOG (#2104) 2024-09-11 16:19:30 -07:00
Mindaugas Vinkelis 5873cae3f5
AggregationSelector is not needed anymore (#2085) 2024-09-11 13:59:07 -07:00
John Vandenberg 5269660e70
Upgrade async-std v1.13 (#2082)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-09-11 08:01:58 -07:00
Lalit Kumar Bhasin 8f4d64e83a
Remove `target` from LogRecord::attributes for `log` events emitted through `tracing` pipeline (#2101) 2024-09-11 07:37:13 -07:00
Emostar 38f7fd517b
Update README.md (#2092)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-09-10 19:05:14 -07:00
Charles Samborski e206533785
fix: JSON serialization of `metrics::Examplar` and `trace::span::Link… (#2069) 2024-09-10 18:13:03 -07:00
Aumetra Weisman c3b59ba610
Remove range requirement, patch in shell script (#2095) 2024-09-10 10:58:57 -07:00
Utkarsh Umesan Pillai 089d9fbb3b
Update code samples to use `KeyValue::new()` (#2091) 2024-09-10 07:27:14 -07:00
Cijo Thomas 66f29b876f
Prepare for 0.25 release (#2088) 2024-09-09 13:34:42 -07:00
Lalit Kumar Bhasin 6c4f50ee51
msrv patch for tokio-stream, and other lint changes (#2086) 2024-09-09 11:24:41 -07:00
Lalit Kumar Bhasin a50e3ff46d
CI failure: msrv patch tokio-util (#2081) 2024-09-07 06:52:43 -07:00
Utkarsh Umesan Pillai 4a86e167b5
Add benchmarks (#2080) 2024-09-04 12:52:53 -07:00
Utkarsh Umesan Pillai 3aa50261a7
Update SDK CHANGELOG with metric improvements (#2076)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-09-04 12:21:56 -07:00
Lalit Kumar Bhasin 54a3ad1a84
fix msrv (#2079) 2024-09-04 08:45:52 -07:00
Lalit Kumar Bhasin 4bc02f41e1
Regenerate otlp proto files to fix CI (#2077) 2024-09-04 07:38:17 -07:00
Lalit Kumar Bhasin 976bc54dba
Introduce LogBatch Struct to Replace Vec in LogExporter Interface (#2057) 2024-08-30 11:43:27 -07:00
Utkarsh Umesan Pillai 8e713e42ac
nit: Remove unnecessary clippy suppressions (#2067) 2024-08-29 13:54:05 -07:00
Utkarsh Umesan Pillai 29fd682203
Update attributes benchmarks (#2064) 2024-08-28 16:32:36 -07:00
Lalit Kumar Bhasin 7d47bf213d
Update Log benchmarks (#2061) 2024-08-28 05:40:57 -07:00
tsfotis 7ad7ab3fba
fix broken docs.rs build (#2052)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-08-27 10:17:34 -07:00
Cijo Thomas a2c8c7dea1
Simplified stdout exporter for logs and traces (#2040)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2024-08-26 10:57:23 -07:00
Cijo Thomas 322c98533f
Use event.name as attribute key for exporting Log event name (#2050) 2024-08-26 09:11:08 -07:00
Lalit Kumar Bhasin b24bb9c2f1
Preallocate storage for log attributes on stack (#1965) 2024-08-23 10:05:21 -07:00
Lalit Kumar Bhasin 4c854108e6
Update log stress and benchmark results (#2049)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-08-23 09:50:56 -07:00
Utkarsh Umesan Pillai 916a11782a
Update visibility of AttributeSet from pub to pub(crate) (#2045) 2024-08-23 07:30:44 -07:00
Lalit Kumar Bhasin 673c328522
Log SDK optimization - Improve perf 15%-30% (#2043) 2024-08-22 08:24:44 -07:00
Utkarsh Umesan Pillai 90ca577d42
Use arrays instead of vec in the documentation (#2042) 2024-08-21 19:42:43 -07:00
Lalit Kumar Bhasin 3193320fa6
Simplify LogExporter::Export interface (#2041)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-08-21 07:43:26 -07:00
Utkarsh Umesan Pillai 056d2ae8ac
Add multithreaded test for Histogram for f64 values (#2038)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-08-19 14:52:09 -07:00
Utkarsh Umesan Pillai ceb4e714f0
Update test markdown (#2039) 2024-08-19 14:34:53 -07:00
Utkarsh Umesan Pillai 3a4b17aed3
Move precomputed sum code to a new file (#2036)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-08-19 11:56:32 -07:00
Utkarsh Umesan Pillai 20625f9b8a
Rename metrics benchmarks (#2037)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-08-19 11:41:55 -07:00
Cijo Thomas 241431e690
Refactor Metric Tests - Part2 (#2034) 2024-08-19 11:35:06 -07:00
Utkarsh Umesan Pillai fcada1775b
Use ValueMap for Histogram- Throughput increased by 5x (#2033) 2024-08-16 16:35:36 -07:00
Utkarsh Umesan Pillai 7742587c83
Add multithreaded test for Histogram (#2032) 2024-08-16 14:25:10 -07:00
Cijo Thomas 108161c12e
Add log export benchmark to measure the cost paid for async abstraction (#2027)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-08-16 09:51:39 -07:00
Utkarsh Umesan Pillai 72ac56f71a
Add benchmark for Histogram (#2030) 2024-08-16 08:05:31 -07:00
Utkarsh Umesan Pillai 16d927bed9
Update Histogram min max computation (#2029) 2024-08-15 08:46:44 -07:00
Utkarsh Umesan Pillai 0097d16d9f
Simplify Histogram code (#2028) 2024-08-14 22:12:17 -07:00
Cijo Thomas cb1ffb5275
Add benchmark for logprocessor and its cloning costs (#2026)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-08-14 09:29:06 -07:00
Cijo Thomas 286cb6ca23
Provide default implementation for event_enabled trait in LogProcessor (#2025) 2024-08-13 21:03:28 -07:00
Utkarsh Umesan Pillai b8ef2a744f
Increase test coverage for AtomicTracker (#2022)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-08-13 19:35:07 -07:00
Cijo Thomas 884b86d575
Refactor Metric test - part1 (#2024) 2024-08-13 19:19:10 -07:00
Utkarsh Umesan Pillai b6ab7287ff
Fix start_time exporter for Gauge (#2023) 2024-08-13 17:43:56 -07:00
Utkarsh Umesan Pillai d2fafa41a4
Fix aggregation for Gauge (#2021)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-08-13 16:40:41 -07:00
Cijo Thomas df91db34fd
Nit fix to opentelemetry doc (#2019) 2024-08-13 15:31:57 -07:00
Utkarsh Umesan Pillai f2e9df28dd
Fix metrics aggregation bug for Sum and Precomputed Sum to avoid duplicate export (#2018)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-08-13 12:54:56 -07:00
Cijo Thomas 07b918d2ef
Remove ability to specify observable callback on Meter (#2015) 2024-08-13 12:31:52 -07:00
Utkarsh Umesan Pillai 17b99a19ba
Lock free updates for floating point metrics - Throughput increased by up to 50% (#2016)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-08-13 10:27:34 -07:00
Utkarsh Umesan Pillai b24608ed7b
Use ValueMap for Gauge - Throughput increased around 8x (#2017) 2024-08-13 08:38:21 -07:00
Lalit Kumar Bhasin 399846ea4c
Remove CoW for `LogRecord::event_name` and `LogRecord::severity_text` (#2014) 2024-08-12 21:05:10 -07:00
Utkarsh Umesan Pillai 5d89aee9db
Add stress test for Synchronous Gauge (#2013)
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2024-08-12 17:44:27 -07:00
Utkarsh Umesan Pillai d583695d30
Move ValueMap to mod file to allow for code reuse (#2012) 2024-08-12 15:45:15 -07:00
Utkarsh Umesan Pillai ed82d78eb8
Add a special test for synchronous instruments (cumulative aggregation) (#2010) 2024-08-12 12:48:56 -07:00
Cijo Thomas 6c3cffb739
Nit update to stress test (#2009) 2024-08-09 15:08:20 -07:00
Utkarsh Umesan Pillai ce96b43f86
Add test coverage for observable gauge (#2007)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-08-09 12:47:34 -07:00
Cijo Thomas fe2fb96b79
Add a benchmark to sdk logs that is comparable to tracing appender (#2006) 2024-08-09 11:42:39 -07:00
Cijo Thomas 60f332432b
Appender-Tracing benchmark to pass message as attribute - 10% faster (#2001) 2024-08-09 11:06:38 -07:00
stormshield-fabs 2bba6b04ca
Use generics to dispatch updates in `ValueMap` (#2004)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2024-08-09 10:14:32 -07:00
Lalit Kumar Bhasin 6a16baf055
Export event-name in OTLP Exporter optionally, if the feature-flag is enabled (#1994) 2024-08-08 15:01:34 -07:00
Lalit Kumar Bhasin e905cf7274
chore: update semantic convention version v1.27.0 (#2000) 2024-08-07 21:02:11 -07:00
Lalit Kumar Bhasin 2409c18a75
Box complex types in AnyValue enum (Improve perf by 10%, and size reduction by ~60%) (#1993)
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-08-07 17:46:10 -07:00
Utkarsh Umesan Pillai fe10ab1065
[logs-appender-tracing] Use method from tracing-core instead of creating our own (#1999) 2024-08-07 16:18:02 -07:00
Cijo Thomas 83ba87f671
LogAppender - 5% perf gain and reduce heap alloc for SeverityText (#1997) 2024-08-07 14:16:25 -07:00
Cijo Thomas d8bb7648cc
Add benchmarks for measuring cost of Logger, Provider creation (#1996) 2024-08-07 13:17:28 -07:00
Cijo Thomas 528e0a6c14
Metric refactor - 2x perf and allocation free (#1989)
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2024-08-06 17:29:02 -07:00
Cijo Thomas 76b40ba630
Metric benchmark - more isolation (#1991) 2024-08-06 15:00:01 -07:00
Utkarsh Umesan Pillai 75eb96d974
Fix metrics counter benchmarks (#1990) 2024-08-06 12:42:14 -07:00
Cijo Thomas 20226cd550
Nit additions to Metrics tests (#1988) 2024-08-06 09:06:34 -07:00
Lalit Kumar Bhasin 171924452b
Hide LogRecord attributes Implementation Details from exporters (#1985)
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2024-08-05 17:21:32 -07:00
Mark Ingram 9f716528c3
[opentelemetry-otlp] fix example when running with OTEL Collector 0.104+ (#1982) 2024-08-05 09:42:41 -07:00
dependabot[bot] d3c10f84fa
Bump obi1kenobi/cargo-semver-checks-action from 2.4 to 2.6 (#1981) 2024-08-01 17:45:08 -07:00
Cijo Thomas 8710248dc1
Add Utkarsh as approver (#1978)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-08-01 10:11:10 -07:00
Lalit Kumar Bhasin dae1081400
[CI fix] Fix community contributing hyperlink (#1980) 2024-08-01 08:12:38 -07:00
Cijo Thomas ac7343f374
MetricRefactor - Part1 - Move AttributeSet inside aggregations (#1977) 2024-07-31 16:48:55 -07:00
Utkarsh Umesan Pillai cfbd1c30f0
Update counter multi-threaded test (#1976) 2024-07-31 07:39:52 -07:00
Cijo Thomas 7a9076032d
Apply changes from Span BatchProcessor to Log BatchProcessor (#1973) 2024-07-29 11:07:07 -07:00
Cijo Thomas cd59346af5
BatchSpanProcessor to trigger first export after the interval instead of right away (#1971) 2024-07-26 20:52:16 -07:00
Lalit Kumar Bhasin 4d31408dda
Remove SimpleLogProcessor from log benchmark (#1969)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-07-26 19:06:53 -07:00
Lalit Kumar Bhasin f9076ea92c
CI fix (#1970) 2024-07-26 18:47:43 -07:00
John Howard 2eba546f7b
Fix shutdown of single threaded trace batch provider (#1964) 2024-07-26 18:10:32 -07:00
Sebastian Bernauer 383c7d13b6
[opentelemetry-prometheus]: Prepare 0.17.0 release using opentelemetry 0.24 (#1957) 2024-07-24 09:32:20 -07:00
Gary Coady 2b026d9759
Fix PartialEq for Value in opentelemetry-stdout (#1955)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-07-23 19:42:20 -07:00
Lalit Kumar Bhasin 57bcd59989
fix ci (#1960) 2024-07-23 16:39:59 -07:00
harscoet 406e31b76b
zstd compression for tonic exporter (#1947) 2024-07-23 10:21:21 -07:00
Lalit Kumar Bhasin a1f02faf7c
chore: update proto definition to v1.3.2 (#1945)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-07-18 16:45:14 -07:00
Pato Sandaña acd6cbe4f7
Adding `PartialEq` for `LogRecord` and `SpanContext` to help unit testing (#1944)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2024-07-18 16:12:40 -07:00
Razvan Rotari e1a3494c34
When deserializing JSON, accept both int and string in 'intValue' (#1906)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-07-18 13:51:35 -07:00
Dirkjan Ochtman 0e8f259cf3
sdk: expose hidden Tracer::should_sample() method (#1937)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-07-18 08:04:34 -07:00
Howard a9b8621cd1
Flatten field + fix u64 to string serde (#1911)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-07-16 15:24:32 -07:00
Utkarsh Umesan Pillai 47e52f1feb
Fix Stress Test (#1935) 2024-07-16 11:56:02 -07:00
Dirkjan Ochtman 5922205d07
sdk: expose Tracer::id_generator() (#1934) 2024-07-15 09:13:45 -07:00
Cijo Thomas cdf5f03abe
Prepare .24 release (#1932) 2024-07-12 20:47:03 -07:00
Lalit Kumar Bhasin 6207882b4b
Insert tracing event name into LogRecord::event_name instead of attributes (#1928)
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2024-07-12 17:16:06 -07:00
Utkarsh Umesan Pillai a2e435f25b
[opentelemetry-otlp][tonic] Add more information to error message for Unknown status code (#1931) 2024-07-12 12:26:58 -07:00
Theodore Brockman 597327f199
Initial attempt at adding metric semconvs. (#1918)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-07-12 08:07:30 -07:00
Aumetra Weisman 621a5a9737
Upgrade to hyper/http v1.0 (#1674)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-07-12 07:27:25 -07:00
Shawn 166a12734c
Update CHANGELOG.md (#1927) 2024-07-11 11:38:49 -07:00
Utkarsh Umesan Pillai df815bdc7f
Simplify OTLP example (#1926) 2024-07-10 18:03:05 -07:00
Ramji 3882b2288d
Update http example with json protocol (#1912)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-07-10 10:06:02 -07:00
Aumetra Weisman 224289e9e0
Remove `isahc` support (#1924) 2024-07-10 09:45:19 -07:00
Cijo Thomas c53c5f1fcb
Add code comment about default Log attribute size (#1914) 2024-07-08 12:52:04 -07:00
Utkarsh Umesan Pillai 31a3491b14
Update metric benchmarks (#1907)
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-07-03 16:09:30 -07:00
Lalit Kumar Bhasin ae6e2ffa9a
Predefine Vector Capacity for LogRecord Attributes (#1908) 2024-07-03 12:26:16 -07:00
Utkarsh Umesan Pillai ad990d6d33
[Baggage] Simplify Get APIs (#1902)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-07-01 19:33:37 -07:00
Mark Ingram d5c86d9adc
[opentelemetry-otlp] adds an example HTTP exporter backed by Hyper (#1861)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-07-01 15:44:01 -07:00
Cijo Thomas 028d3e7efb
Benchmarks for AnyValue (#1901) 2024-07-01 15:20:04 -07:00
Lalit Kumar Bhasin 0cfc8d95c3
Add self-diagnostics example (#1846)
Example to demonstrate using tracing as a global error handler for errors generated by the OpenTelemetry Metrics SDK. In this example, measurements are recorded to exceed the cardinality limit, which triggers the error to be logged. This error is then emitted to `stdout` using `opentelemetry-appender-tracing` subscriber.
2024-07-01 12:57:21 +02:00
Cijo Thomas 0303a38758
Add flamegraph for some benchmarks (#1899)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-06-27 17:20:00 -07:00
Utkarsh Umesan Pillai 16410d7555
Use arrays instead of vec for creating resource in examples (#1900) 2024-06-27 17:06:18 -07:00
Cijo Thomas d54c18b80c
Use as many threads as logical cores for achieving full utilization (#1897) 2024-06-27 13:25:04 -07:00
Cijo Thomas 4df74e85ef
Nit fix to benchmark results (#1895) 2024-06-26 16:41:24 -07:00
Lalit Kumar Bhasin 9b746e0288
Group Logs and Spans by Resource and Instrumentation Scope in OTLP Exporter (#1873)
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2024-06-26 11:17:11 -07:00
Tom Tan b3315f2804
Make the stress threads number configurable via command line argument (#1871)
Co-authored-by: Harold Dost <h.dost@criteo.com>
2024-06-21 13:19:13 +02:00
Lalit Kumar Bhasin c1f351cd67
Add CI for ARM (#1884)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-06-20 12:13:05 -07:00
Lalit Kumar Bhasin 4d455062ab
Adding target as LogRecord field, and using it as scope.name in OTLP exporter (#1869)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2024-06-20 11:45:00 -07:00
Lalit Kumar Bhasin e0fb7fe3b7
fix otlp/json exporter (#1882) 2024-06-18 13:53:41 -07:00
Utkarsh Umesan Pillai da368d4085
Simplify tracing-grpc example (#1886) 2024-06-17 15:55:13 -07:00
Utkarsh Umesan Pillai 3e49f2313e
Remove "logs_level_enabled" from cargo toml for appender crates (#1885) 2024-06-14 17:40:41 -07:00
Utkarsh Umesan Pillai 50c574a18b
Add criterion to workspace dependencies (#1883) 2024-06-13 18:05:27 -07:00
Mark Ingram 66e3ea5335
[opentelemetry-otlp] basic-otlp-http example - trivial cleanup (#1878)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-06-13 13:02:26 -07:00
Lalit Kumar Bhasin 64aa5061b8
fix msrv (#1877) 2024-06-13 11:21:33 -07:00
Utkarsh Umesan Pillai b933bdd82d
Update collector config to use debug exporter (#1876) 2024-06-10 15:55:46 -07:00
Zhongyang Wu 2ac2b180ae
feat: add `shutdown` in `TracerProvider` (#1855)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-06-10 09:57:48 -07:00
Utkarsh Umesan Pillai bc1f94ce72
Remove unused dev/test dependencies (#1872) 2024-06-07 22:28:32 -07:00
Lalit Kumar Bhasin 36ad46ae28
update msrv check, and bump opentelemetry-proto to v1.70.0 (#1864) 2024-06-06 10:35:22 -07:00
Utkarsh Umesan Pillai f1cdaca447
Improve multi-threaded test for Counter (#1858)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-06-04 10:39:44 -07:00
Lalit Kumar Bhasin f488006858
Small change to return error from periodic exporter (#1857)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-06-04 09:24:17 -07:00
Utkarsh Umesan Pillai 406cc3101c
[opentelemetry-otlp] Use recommended API for config in examples (#1859) 2024-06-03 18:07:35 -07:00
dependabot[bot] 935610612c
Bump obi1kenobi/cargo-semver-checks-action from 2.3 to 2.4 (#1853)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-03 09:16:43 -07:00
Zhongyang Wu 19854021af
test: fix MockLogExporter (#1854) 2024-06-03 09:16:16 -07:00
Utkarsh Umesan Pillai 54b807fe0b
Remove unnecessary features from command-line args (#1852) 2024-06-01 11:52:41 -07:00
Lalit Kumar Bhasin 91c685f433
Small cleanup in Logs SDK. (#1850)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-05-31 12:23:27 -07:00
Lalit Kumar Bhasin 300f8e5fca
[SEMANTIC CONVENTIONS] Upgrade to version 1.26.0 (#1851) 2024-05-31 12:13:29 -07:00
Zhongyang Wu 82fa485359
feat: clean up trace SDK APIs (#1755)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-05-30 10:04:08 -07:00
Lalit Kumar Bhasin 84c23a3017
[Trace SDK] Send resource once to processor and exporter, and not with every span (#1830)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-30 09:40:14 -07:00
EAimTY 1beffd2149
Fix typos in webpki feature name (#1842)
Signed-off-by: EAimTY <EAimTY@users.noreply.github.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-05-30 09:24:09 -07:00
Expyron 7cad751cab
Remove unused dependency (#1847) 2024-05-30 07:29:34 -07:00
Utkarsh Umesan Pillai e2e6a6e2a8
Add multi-threaded test for Counter (#1845)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-05-29 16:17:18 -07:00
Utkarsh Umesan Pillai 3825edcc85
Update metrics tests (#1844) 2024-05-29 16:00:08 -07:00
Cijo Thomas 78943fd674
Add more validations to Metrics tests (#1841) 2024-05-29 12:41:38 -07:00
Zhongyang Wu d0c8105446
chore: bump the msrv of OTLP to 1.70 (#1840) 2024-05-29 05:22:34 -07:00
Utkarsh Umesan Pillai 2dd47fd578
Fix tests to make precommit.sh run on Windows (#1831)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-05-28 21:46:38 -07:00
Utkarsh Umesan Pillai e521083cd2
Minor refactoring (#1839) 2024-05-28 21:27:21 -07:00
Cijo Thomas 0f6de5a946
Metrics Aggregation - Improve throughput by 10x (#1833)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-28 18:26:50 -07:00
Cijo Thomas 6ee5579838
Add tests for Histogram metrics (#1834) 2024-05-28 18:12:16 -07:00
Utkarsh Umesan Pillai 14c038d5bf
Fix external-types check (#1838) 2024-05-28 17:18:39 -07:00
Zhongyang Wu 0ce6a6dc36
fix: make `shutdown` `&self` in span processor (#1836) 2024-05-28 07:04:06 -07:00
Cijo Thomas 91397fc64f
Add memory and cpu stats to Stress test (#1832) 2024-05-25 09:50:28 -07:00
Utkarsh Umesan Pillai e699233bcc
Fix typos (#1828)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-05-24 14:44:21 -07:00
Utkarsh Umesan Pillai b1a80eed9f
OtlpTracePipeline fixed to no longer set global provider (#1812)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-05-24 13:22:29 -07:00
Cijo Thomas 28f8dbca39
Add note about using newer protoc in contributing doc (#1824) 2024-05-24 13:01:56 -07:00
Cijo Thomas ec9fd62d2e
Run msrv check for all crates (#1826) 2024-05-24 12:52:35 -07:00
Cijo Thomas ac741c2186
Remove env_logger from cargo (#1825) 2024-05-24 11:45:49 -07:00
Cijo Thomas 57f87d68ff
Add more observable counter tests (#1818) 2024-05-24 10:55:24 -07:00
Cijo Thomas f8ee5518d7
Improve CI speed by removing duplicate run of tests (#1822) 2024-05-24 10:10:20 -07:00
Cijo Thomas 1b410d08dd
Remove AWSid generator (#1820)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-24 09:45:17 -07:00
Cijo Thomas 98741c7cc7
[Metrics] - Remove unit abstraction (#1821)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-24 09:35:29 -07:00
Cijo Thomas 74b0ad41eb
Fix metrics overflow stress test (#1819) 2024-05-24 08:48:02 -07:00
Cijo Thomas bded5989ef
Fix overflow for counter metric (#1815)
Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
2024-05-23 20:43:18 -07:00
Cijo Thomas ca03c79ee1
Add bench for gauge instrument (#1816) 2024-05-23 19:20:09 -07:00
Lalit Kumar Bhasin aca4b52e20
Remove temporary vector in tracer appender (#1814) 2024-05-23 14:38:17 -07:00
Cijo Thomas 5c7c695c6c
Run semver CI on demand (#1813) 2024-05-23 12:15:13 -07:00
Lalit Kumar Bhasin 4883d2d350
Support LogProcessors chaining through mutable reference (#1726) 2024-05-23 11:30:28 -07:00
Cijo Thomas 33abef2a78
Log SDK, OTLP builders to accept Resource directly instead of wrapping in Config (#1788)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-23 09:49:39 -07:00
Lalit Kumar Bhasin d21b13ae1e
Integration tests for Logs (#1759)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-23 09:08:35 -07:00
Cijo Thomas 35f9a60d5c
Removes ordered-float dependency, and make own implementation for f64 hashing. (#1806) 2024-05-22 16:09:27 -07:00
Utkarsh Umesan Pillai f82dd14d06
[opentelemetry-otlp] Update example output (#1807) 2024-05-22 15:29:40 -07:00
Cijo Thomas f64bdd2e1c
Use better random generation in benchmark and stress tests (#1800)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-22 11:54:59 -07:00
Cijo Thomas 6d3bea7282
Add name to info logs in OTLP Example (#1802) 2024-05-22 09:05:26 -07:00
Lalit Kumar Bhasin 6d4ae8718d
Nit fix for review comments from #1798 (#1803) 2024-05-22 08:31:11 -07:00
Utkarsh Umesan Pillai 9fa13bc7c4
[opentelemetryt-stdout] Remove `default_features = false` (#1791)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-21 22:57:18 -07:00
Lalit Kumar Bhasin d3b3f70578
Update OTLP examples to use opentelemetry-appender-tracing, with filtering of the events from specific crates. (#1798) 2024-05-21 21:54:17 -07:00
Cijo Thomas d08a861234
[Metric SDK] - Avoid exposing AttributeSet to exporters - Part2 (#1794)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-21 16:10:32 -07:00
Cijo Thomas 5937065f6f
Nit fixes to Resource docs (#1796)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-21 11:40:48 -04:00
Zhongyang Wu 21bc36c958
chore: add prometheus back with API and SDK pinned at 0.23 (#1795) 2024-05-20 23:23:46 -07:00
Cijo Thomas 66b00d6e32
[Metric SDK] - Avoid exposing AttributeSet to exporters - Part1 (#1792) 2024-05-20 21:06:28 -04:00
Utkarsh Umesan Pillai 5c17ed1995
Add semver check to CI (#1793) 2024-05-20 20:52:34 -04:00
Cijo Thomas cb149bf6a7
Use warning in rustdocs for stdout (#1789) 2024-05-20 11:04:22 -07:00
Cijo Thomas 595ad05bc5
Minor cleanups of readme files (#1785) 2024-05-20 12:43:39 -04:00
Cijo Thomas 426a1ddd1b
OTLPMetricPipeline fixed to no longer set global provider (#1787) 2024-05-20 09:56:08 -04:00
Zhongyang Wu 4d2ac7fa9e
fix: broken link in jaeger docs (#1786) 2024-05-19 19:31:55 -04:00
Cijo Thomas 79189a88ac
Add logs and metrics to default features in api, sdk and otlp crate (#1783) 2024-05-19 12:22:50 -04:00
Cijo Thomas 29ac005986
Move codeowners to a single place (#1784) 2024-05-18 22:16:32 -07:00
Cijo Thomas 2210d7b5de
Remove opentelemetry-jaeger (#1782) 2024-05-18 11:20:41 -07:00
David Cook 1580105b65
Move a changelog entry to the correct version (#1781) 2024-05-16 19:25:44 -04:00
Cijo Thomas 2863632af3
Add script to tag and publish to crates.io (#1774)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-15 18:40:15 -04:00
Lalit Kumar Bhasin 349d804496
Enhance LogRecord Deserialization with Default Values for Missing Fields (#1773)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-05-15 16:23:58 -04:00
Cijo Thomas 5b238eb8ce
Fix appender-tracing features to remove sdk dependency (#1775) 2024-05-15 14:32:46 -04:00
Cijo Thomas 4042f511d7
Use token for code cov (#1772) 2024-05-15 13:32:10 -04:00
Cijo Thomas 1faa9a7c7b
Prepare v0.23 release (#1738)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-15 12:44:13 -04:00
Cijo Thomas 49c88ea550
Minor fix to OTLP doc and integration test (#1758)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-15 08:29:59 -07:00
Lalit Kumar Bhasin 10f99bf9d6
Update serialization format for LogRecord fields. (#1771)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-05-14 20:40:00 -07:00
Cijo Thomas 1733da5560
more stable metrics sdk tests (#1768) 2024-05-14 23:22:04 -04:00
Cijo Thomas 06ed50d1b9
Remove OTLPExporter dependency on sem conventions (#1769) 2024-05-14 22:47:14 -04:00
Lalit Kumar Bhasin 6d7a16cba4
Update msrv version to 1.65 in docs (#1770) 2024-05-14 19:33:28 -07:00
Cijo Thomas 48112e0f44
Fix periodic reader to trigger first exporter at the interval (#1766) 2024-05-14 20:52:06 -04:00
Cijo Thomas 0cc7228559
Try to use authenticated request to install protoc in GH (#1767) 2024-05-14 20:39:53 -04:00
Cijo Thomas c8ca03ea91
Add http-json warning to OTLP Exporter (#1765) 2024-05-14 17:09:21 -07:00
Cijo Thomas a4d92119e6
Make readme for api,sdk,stdout,otlp consistent (#1760)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-14 14:01:35 -04:00
Lalit Kumar Bhasin d34de1a11a
Add macos-latest in CI test (#1762) 2024-05-14 10:01:37 -07:00
Cijo Thomas 4bc2d8cfd9
Show working example for OTLP Http (#1756) 2024-05-13 22:47:29 -04:00
Cijo Thomas d2668e6c7e
OTLP Examples fixed to be consistent (#1752)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-13 22:11:10 -04:00
Cijo Thomas 06d8b6c49d
Fix stdout traceexporter to show scope attributes (#1747)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-13 20:42:43 -04:00
Cijo Thomas cdd9309cd3
Use updated image for jaeger ui (#1754)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-13 20:27:18 -04:00
Lalit Kumar Bhasin 656b1e6fa9
Enable integration test for Span validation (#1753)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-13 20:00:46 -04:00
Cijo Thomas e726892e16
Modify loggerprovider shutdown, flush to return single Result and handle repeat shutdown calls (#1750) 2024-05-13 16:45:00 -07:00
Cijo Thomas b98b5896d2 revert 2024-05-13 12:22:14 -07:00
Cijo Thomas 4ec536bf44 fix yml 2024-05-13 12:18:36 -07:00
Cijo Thomas a58404ebc8
Few doc updates, mostly cleanups. (#1749) 2024-05-13 12:52:32 -04:00
Cijo Thomas 78c5c084d8
Remove global shutdown from metrics and doc fixes (#1743)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-13 10:47:45 -04:00
Cijo Thomas 2fcd65e46a
Add Resource validation to Log SDK test (#1748) 2024-05-12 13:02:25 -07:00
Cijo Thomas bf20372116
Refactor Metrics tests and add more (#1737)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-12 11:16:27 -07:00
Chielo 2a526d7618
Fix feature flags (#1746) 2024-05-12 09:44:29 -07:00
Lalit Kumar Bhasin de3147aa9c
Enhance LogRecord::add_attributes interface to accept generic Iterables (#1741)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-11 17:14:52 -04:00
Cijo Thomas 161d28d34e
Metrics examples to stop using global shutdown (#1742) 2024-05-11 13:24:53 -07:00
Cijo Thomas bf7b4a0f20
Modify metrics example to shutdown without global shutdown method (#1739) 2024-05-11 12:13:36 -07:00
Utkarsh Umesan Pillai 736712d005
Use shared slices instead of references to owned vectors as return types (#1729)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-05-10 14:35:46 -04:00
Cijo Thomas 01d584ac0b
Add logs to stdout example (#1735) 2024-05-10 13:24:32 -04:00
Cijo Thomas 5e02f38a29
Stdout example to default to all features (#1734) 2024-05-10 12:36:36 -04:00
Cijo Thomas 6d50e5fc02
Remove SDK's attributeset usage in stdout, add tests (#1730)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-05-09 23:46:43 -04:00
Cijo Thomas 6da455b28e
Fix changelog nit (#1731) 2024-05-09 20:37:06 -07:00
Lalit Kumar Bhasin 60a3cbe8c8
[Logs] fixing couple of issues in LogRecord move (#1725)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-05-09 15:04:16 -04:00
Lalit Kumar Bhasin 431baf6515
upgrade codecov/codecov-action from v3 to v4 (#1728)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-05-09 12:11:51 -04:00
Zhongyang Wu 8f8c259bef
chore: remove flaky tests (#1727) 2024-05-09 11:51:16 -04:00
Cijo Thomas feb8d48645
[Metrics API] InstrumentBuilder modified to take instrumentprovider instead of meter (#1707) 2024-05-08 14:03:20 -04:00
Cijo Thomas 5fba0de083
Minor: Add tests to confirm Meter creation behavior (#1724) 2024-05-08 13:40:48 -04:00
Zhongyang Wu 19d3223e24
fix: URLs in OTLP exporters (#1706)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-05-08 11:52:00 -04:00
Lalit Kumar Bhasin b5fe16edd3
Moving LogRecord implementation to SDK (#1702)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-05-07 21:01:49 -07:00
Cijo Thomas 845f2f04d1
Simpler usage of Observable instruments (#1715) 2024-05-07 20:01:46 -07:00
Cijo Thomas 348ec9e583
Metric attributes need sort with keys only (#1718) 2024-05-07 20:23:04 -04:00
Lalit Kumar Bhasin ecfad5fd6a
Upgrade opentelemetry-proto v1.3.1 (#1721) 2024-05-07 14:51:14 -04:00
Lalit Kumar Bhasin 8fd83e29ba
fix ci (#1720) 2024-05-07 13:59:40 -04:00
Cijo Thomas cb67a4b470
Document github repo settings (#1717) 2024-05-06 21:28:01 -04:00
Utkarsh Umesan Pillai c7e0d5023d
Add CI coverage for Windows (#1714) 2024-05-06 20:46:13 -04:00
Utkarsh Umesan Pillai 6c9385ca0f
Minor changes (#1711) 2024-05-06 15:25:06 -04:00
Utkarsh Umesan Pillai a99438af99
Code changes for the new Clippy version and running test on Windows (#1704) 2024-05-06 11:46:23 -04:00
Cijo Thomas ccd5f08c00
Add test to confirm known bug (#1700) 2024-05-01 21:48:42 -04:00
Utkarsh Umesan Pillai 0b78252d24
Stabilize Gauge (#1701) 2024-05-01 21:39:02 -04:00
Ashley Mannix 9eb548ab2b
Treat log's key-values as attributes in log bridge (#1628)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-05-01 17:03:59 -07:00
Cijo Thomas 832fad414b
Minor cleanups to Metrics API docs (#1695)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2024-05-01 00:37:03 -04:00
Cijo Thomas 943bb7a03f
Reflect status of each component (#1694) 2024-04-30 16:22:09 -04:00
Cijo Thomas d5dd14baa4
Add repository settings log (#1693) 2024-04-30 14:47:07 -04:00
Lalit Kumar Bhasin 8c60749eb8
[Logs SDK] Send resource once to processor and exporter, and not for every event. (#1636) 2024-04-30 14:38:24 -04:00
Lalit Kumar Bhasin 213fa3f001
[Logs API] Remove global provider for Logs (#1691)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-04-30 14:20:29 -04:00
Zhongyang Wu 0ba4cbd2de
feat(logs): make logger shutdown &self (#1643) 2024-04-28 23:01:08 -07:00
Lalit Kumar Bhasin 8a9a569d21
Upgrade to Semantic Convention v1.25.0 (#1681)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-04-24 19:56:35 -04:00
Zhongyang Wu 0bb0be2186
Update RELEASING.md (#1677) 2024-04-24 15:46:02 -07:00
Ramji cc80ec6aa4
Support http/json protocol (#1585)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2024-04-22 21:55:36 -04:00
Cijo Thomas 97b229edc3
Nit fix to gh issue template about slack; (#1676) 2024-04-22 19:40:13 -04:00
Tom Tan 9854bb54a9
Run a stress thread for each logical core (#1675) 2024-04-22 14:38:33 -04:00
Daniel Izquierdo 7a51e75f53
Use a builder pattern for loggers and tracers (#1567)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Harold Dost <h.dost@criteo.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2024-04-21 16:58:29 -04:00
Lev1ty 6952f290a0
Add feature webkpi-roots for reqwest and tonic exporter backends (#1672)
adds for both opentelemetry-http and opentelemetry-otlp
2024-04-21 20:04:02 +02:00
Lalit Kumar Bhasin 8f27e2676c
Refactor SdkMeterProvider with Inner Structure for Better Lifecycle Control (#1663)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-04-19 12:58:17 -07:00
Cijo Thomas 9242ed1d3a
Add Lalit as maintainer (#1669)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-04-19 12:54:12 -04:00
Lalit Kumar Bhasin 6386f4599f
upgrade otel-proto v1.2.0 (#1668)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-04-19 11:40:23 -04:00
Zhongyang Wu fc6f970b80
fix: fail open when upload code coverage fails (#1671) 2024-04-18 16:58:48 -07:00
Severin Neumann 5d214761a0
fix: revert modifications to Apache license (#1664)
Signed-off-by: svrnm <neumanns@cisco.com>
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-04-18 16:30:52 -07:00
Cijo Thomas 590c7ab602
Add benchmarks to show cost of random generation (#1667) 2024-04-17 16:02:04 -07:00
Lalit Kumar Bhasin 758cdd7fc0
Add custom serde encoding/decoding for timestamp (#1666) 2024-04-17 11:57:23 -04:00
Lalit Kumar Bhasin 2286378632
CI fix (#1665) 2024-04-16 14:53:59 -04:00
Lalit Kumar Bhasin f203b0327f
Replace unmaintained actions-rs/toolchain action. (#1655)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-04-15 12:59:00 -04:00
Lalit Kumar Bhasin d5392dc1df
[CI fix] Compile proto files with latest prost (#1658) 2024-04-07 13:05:30 -07:00
Roger Coll ed1d128498
test: wrap default batch test with temp_env (#1653)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-04-04 11:14:24 -07:00
Roger Coll 04a800c1b6
test: increase Telemetry resource testing coverage (#1646) 2024-04-03 09:18:55 -07:00
Lalit Kumar Bhasin 278f5c7092
Add benchmark for opentelemetry-appender-tracing (#1649) 2024-03-29 11:58:27 -04:00
Cijo Thomas 5b5cb618cd
Nit fixes to releasing doc (#1648) 2024-03-28 23:01:53 -04:00
Cijo Thomas aa7065fb08
Prepare for opentelemetry-http release (#1647) 2024-03-28 15:00:25 -04:00
Zhongyang Wu 8483914c52
fix: send propagator error to global error handler (#1640) 2024-03-28 14:47:29 -04:00
Luis Osta 936c46639a
Add Rust TLS Feature Flag For `opentelemetry-http` (#1638)
Similar issue to what #472 but for opentelemetry-http
Please provide a brief description of the changes here.
Added new feature flag for the opentelemetry-http crate to enable rustls instead of openssl
2024-03-25 20:01:06 +01:00
Yuta Yamaguchi 815e3874a2
Use semantic conventions in examples (#1639)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-03-25 12:27:25 -04:00
Zhongyang Wu 9fe943d535
chore: fix rust 1.77 lints (#1641) 2024-03-25 11:53:39 -04:00
Cijo Thomas e0bb2b6b03
Remove unwanted dependency on sdk in tracingappender (#1634) 2024-03-20 13:23:13 -04:00
Harold Dost e98c61ce73
opentelemetry-sdk: Update changelog (#1633) 2024-03-19 15:49:55 -07:00
Harold Dost 1e36840903
Simplify the workspace. (#1632) 2024-03-19 18:02:10 -04:00
Lalit Kumar Bhasin ab39fd2df8
Add add_link API (#1515)
Co-authored-by: Harold Dost <github@hdost.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-03-19 13:43:22 -04:00
Roger Coll 13c9dc5104
Remove os and process resource detectors (#1624)
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-03-19 13:19:31 -04:00
Sreeraj Rajan a7a47a745d
replace usages of TestSpanExporter with InMemorySpanExporter (#1626) 2024-03-17 10:59:51 -07:00
Lalit Kumar Bhasin bae8fb3321
Add global::meter_provider_shutdown (#1623)
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-03-15 21:33:12 -04:00
Cijo Thomas a4fae95bd6
Remove unnecessary flush from tests (#1622) 2024-03-15 01:12:47 -04:00
Cijo Thomas 9f0ac7daab
Add test to validate log shutdown (#1620) 2024-03-14 11:40:06 -04:00
Sreeraj Rajan b7b7d7ea5d
remove dependency of urlencoding crate (#1615)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2024-03-14 02:33:45 -04:00
masato-hi 5ef3fd31df
Fixed a problem that caused response errors when compression is enabled. (#1621) 2024-03-14 02:21:47 -04:00
Cijo Thomas a8b308ae92
Fix aggregation bug due to stale hash value (#1422) 2024-03-12 21:27:48 -07:00
Zhongyang Wu 69f50f5256
feat: allow user to attach resource to every metrics. (#1608)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-03-12 15:09:40 -04:00
Cijo Thomas 35c7803c5b
More nit fixes to opentelemetry benches (#1617) 2024-03-12 11:13:34 -04:00
Cijo Thomas a80dedf37c
Add more tests to Metric SDK aggregation (#1600) 2024-03-12 01:56:07 -04:00
Cijo Thomas d5bf258cc8
Use regular lock for simplespanprocessor (#1612) 2024-03-12 01:43:35 -04:00
Cijo Thomas a34c5ee35f
Refactory opentelemetry benchmarks (#1614) 2024-03-11 17:39:16 -07:00
Lalit Kumar Bhasin df12c2cce0
Disable compiler optimization for noop benchmark tests (#1613)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-03-11 18:16:31 -04:00
Lalit Kumar Bhasin 440725ed69
Fix CI (#1611) 2024-03-11 18:02:51 -04:00
Lalit Kumar Bhasin e816cb926d
Adding noop metrics benchmark (#1607) 2024-03-10 19:51:48 -07:00
Harold Dost 1904d34e15
Add RELEASING.md documentation. (#1555)
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-03-08 11:08:05 -05:00
Harold Dost bcf1205799
Add External Type Checking (#1603)
The purpose of this is to ensure we understand the API surface area. Anything exposed by a crate like a type can affect the possible compatibility. This means that if we bump an external type it could cause breaking changes. This tracks them to limit this possibility.

Affected Crates:

opentelemetry-otlp
opentelemetry-zipkin
2024-03-08 15:19:15 +08:00
Lalit Kumar Bhasin 4aa4827191
Update semantic convention to v1.24.0 (#1596)
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2024-03-05 01:28:33 -05:00
Cijo Thomas 7cff678865
Add test to confirm bug in metrics sdk (#1597) 2024-03-05 00:39:34 -05:00
Johannes Tax 58ec379c2a
Support URL-encoded values for `OTEL_EXPORTER_OTLP_HEADERS` (#1578)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-02-29 21:34:03 -05:00
David Cook 7bdbc47a44
Fix errors in changelogs (#1584)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-02-29 12:30:23 -05:00
Cijo Thomas 1f7b6c4e3f
Tweaks to readme docs (#1588) 2024-02-28 22:12:28 -08:00
Dimitris Apostolou 5e67cae020
fix: fix feature = "cargo-clippy" deprecation (#1587)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-02-28 11:40:07 -05:00
Cijo Thomas eb1a09bd64
Rewrite readme page for opentelemetry crate (#1586) 2024-02-28 10:38:29 -05:00
Jonas Platte ef4701055c
otlp: Add DeltaTemporalitySelector (#1568)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-02-27 12:50:01 -05:00
Cijo Thomas fe85521c89
Readme fixes part2 (#1583) 2024-02-26 22:15:47 -08:00
Cijo Thomas 186c0b0727
Modify main readme and contrib guide (#1581) 2024-02-27 00:07:09 -05:00
Cijo Thomas 19b9878ccb
Prepare for SDK 0.22.1 hotfix release (#1579) 2024-02-26 13:30:20 -05:00
Cijo Thomas 5542f37b46
Fix span kind being always internal (#1576) 2024-02-26 12:33:25 -05:00
Dirkjan Ochtman ab9415a8cd
Bump versions to prepare for release v0.22 (#1539)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2024-02-24 19:46:48 -08:00
Zhongyang Wu 64225243c0
fix: disable workspace default feature (#1562)
Co-authored-by: Harold Dost <github@hdost.com>
Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-02-24 16:27:57 -08:00
Marcus Pettersen Irgens d88e83d3b8
Fix invalid import paths under "Getting Started" (#1574) 2024-02-25 00:45:00 +08:00
Sreeraj Rajan 27cf653ffd
Deprecate AWS XrayIdGenerator (#1573)
Deprecates the XrayIdGenerator in the opentelemetry core sdk.

Now available in opentelemetry-aws
Relates #1489
2024-02-25 00:03:15 +08:00
Ed Morley 188a26c802
Switch from the chrono `clock` feature to `now` (#1569)
In #1192, chrono was added as a dependency of the opentelemetry-stdout crate in order to support outputting timestamps in human readable format.

In that PR, all Chrono features were disabled apart from the clock feature.

However, since that change landed, chrono v0.4.32 has added support for an even finer-grained feature named now, which is a subset of the clock feature - that excludes timezone support, and so avoids pulling in many timezone related crates.
2024-02-24 15:18:30 +08:00
Robert Collins 47b928ebf0
Disable default features on reqwest (#1570) 2024-02-23 20:35:27 -08:00
Zhongyang Wu 98cd103234
chore: skip coverage check for dependencies update (#1558)
skip coverage check if the PR is labeled dependencies
2024-02-23 15:53:58 +08:00
Harold Dost 36c2a8e0a3
deprecation(opentelemetry-jaeger): Add deprecation notice. (#1560)
- Add deprecation flags to the various components to give notices in users compilers.
- Add more definition around the deprecation in the README.
- Add a deprecation badge for crates.io.

Relates #995
2024-02-19 10:01:44 +08:00
Harold Dost 11694455a9
opentelemetry-otlp: Default the port correctly. (#1556)
Signed-off-by: Harold Dost <h.dost@criteo.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-02-18 12:28:11 -05:00
James Lucas 4c22cf67ba
Safer endpoint Uri construction (#1553)
Make endpoint Uri construction less fragile by stripping out duplicate slashes.

Fixes #997

The functionality to append the signal path to a user-supplied tracing endpoint is already in place. However, it does so in a way that is likely to break for any user who's passing the string value of a Uri or Url, which will have a trailing slash appended to them. This attempts to fix that issue.

There were other possible changes discussed but ever implemented/merged in #1056. This PR attempts to keep it simple by just changing existing behavior to not break in a common use case.
2024-02-18 14:19:37 +01:00
Lalit Kumar Bhasin 1be83bbfea
Add markdown link CI check (#1540)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-02-17 00:50:45 -08:00
dependabot[bot] 59f53713c0
Bump arduino/setup-protoc from 1 to 3 (#1541)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-17 00:03:15 -08:00
dependabot[bot] 895334e1e0
Update typed-builder requirement from 0.12 to 0.18 (#1549)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-17 00:02:54 -08:00
dependabot[bot] 1b39800172
Bump actions/checkout from 1 to 4 (#1542)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-17 14:57:29 +08:00
Vasiliy Taranov ed7a7099d1
Add dependabot (#1522)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2024-02-16 16:48:37 -05:00
Dirkjan Ochtman 93f206a1eb
Remove support for surf HTTP client (#1537) 2024-02-16 12:29:18 -05:00
Yuta Yamaguchi d96d59fe7f
fix(doc): update EnvResourceDetector specification link (#1538)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-02-16 10:41:52 -05:00
Dirkjan Ochtman fe2b2d54e8
Upgrade to tonic 0.11 and prost 0.12 (#1536) 2024-02-16 10:24:22 -05:00
Dirkjan Ochtman c05b23d48d
Clean up dependencies (#1535)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-02-15 18:03:19 -05:00
Dirkjan Ochtman cad63b69dd
Remove the option of using grpcio for gRPC (#1534) 2024-02-15 17:41:00 -05:00
Lalit Kumar Bhasin 476f2c11a9
Optimize Resource Sharing Across Exporters with Arc Implementation (#1526)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2024-02-15 12:43:48 -05:00
Matthew Shapiro 650904f8b6
Reduce cost of no attribute counters (#1519)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-02-15 12:06:55 -05:00
Lalit Kumar Bhasin b35bf380b7
CI failure fix for external-type-check (#1532) 2024-02-15 08:17:31 -08:00
Cijo Thomas f80d7547c4
Make stress test more realistic (#1531) 2024-02-14 15:58:47 -05:00
Matthew Boddewyn 054b0c891d
Ignore flaky opentelemetry-jaeger tests (#1529) 2024-02-14 11:47:24 -05:00
Daniel Izquierdo 87153d30fa
Test successful collection by PeriodicReader (#1521)
Add a success scenario test for PeriodicReader as suggested in #1481 (comment)
2024-02-14 10:06:28 +01:00
Cijo Thomas 49f1be6164
Add basic doc comments for opentelemetry-http (#1528) 2024-02-14 00:45:19 -05:00
Zhongyang Wu 64b11e04b9
fix: don't return empty string when trace header is not present (#1523) 2024-02-14 00:05:48 -05:00
Daniel Izquierdo 3f327a1ecb
Fix error message caused by race condition when using PeriodicReader (#1481)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2024-02-08 13:53:04 -05:00
Cijo Thomas c60a178f3a
Use consistent style of passing attributes to metrics (#1518) 2024-02-08 12:50:40 -05:00
Zhongyang Wu d7c9ef0eb5
feat(otlp): add integration test setup for traces (#1477) 2024-02-07 21:03:08 -05:00
Harold Dost 80da6564e6
Change to owned LoggerProvider (#1455) 2024-02-07 10:29:56 -05:00
Cijo Thomas 8688e7eaa4
Minor readme fixes for examples (#1513) 2024-02-06 20:01:53 -05:00
Matthew Shapiro aba0af5d66
Revert "Allow precreation of AttributeSets for metrics (#1421)" (#1512) 2024-02-06 17:00:48 -05:00
Zhongyang Wu dd4c13bd69
fix(sdk): fix incorrect doc (#1499)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-02-02 00:33:30 -05:00
James Lucas 270c857bc6
http: surface errors based on status code (#1484)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-02-01 15:43:12 -05:00
Mohammad Mustakim Ali d19187db46
chore: Add error logging for failed OpenTelemetry HTTP export (#1498)
Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-02-01 06:46:07 -08:00
Lalit Kumar Bhasin 57c3aa3189
Enable doc generation for testing module for InMemory*Exporters. (#1503)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-01-31 22:58:23 -08:00
Mike Goldsmith 989fa3b595
Move MikeGoldsmith to emeritus (#1504) 2024-01-31 14:22:58 -05:00
Matthew Boddewyn d4a6b3e812
Add initial tests to opentelemetry-appender-log (#1501) 2024-01-31 02:33:32 -05:00
Cijo Thomas 0b2c70398e
Add warning about Log API that is it not for app users (#1502) 2024-01-30 16:15:05 -05:00
Zhongyang Wu e3bee4e5c7
fix(doc): update feature flag lists (#1486) 2024-01-30 13:32:41 -05:00
Matthew Boddewyn 4ea4a61581
Use temp_env when constructing BatchConfig from environment variables in log_processor.rs test (#1496)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
2024-01-29 23:48:15 -05:00
Bhargav 8237f87f42
Add event_name field to `LogRecord` (#1488) 2024-01-26 18:21:26 -05:00
Matthew Boddewyn 0101233973
Create new opentelemetry-jaeger-propagator library (#1487) 2024-01-26 11:54:16 -05:00
Cijo Thomas 433c1b34e2
Fix tracing grpc example (#1493)
Cleaned up readme as we already removed tracing-opentelemetry and jaeger
from it.
2024-01-25 17:53:23 -08:00
Cosmin Lazar 85f678a601
Remove Batch LogRecord&Span Processor configuration via non-standard environment variables (#1495) 2024-01-25 17:12:31 -05:00
Cosmin Lazar 26600476b3
Consolidate BatchConfig creation and validation via BatchConfigBuilder (#1480) 2024-01-25 12:17:47 -05:00
Lalit Kumar Bhasin 27b19b6026
Update OTLP proto version to 1.1.0 (#1482) 2024-01-24 23:08:55 -05:00
Lalit Kumar Bhasin c7ab26b6ef
Code coverage config cleanup (#1492) 2024-01-24 21:26:41 -05:00
Cijo Thomas de8e7506c5
Add note about stdout exporter (#1491) 2024-01-24 20:55:52 -05:00
Matthew Shapiro 16fd1abb87
Allow precreation of AttributeSets for metrics (#1421) 2024-01-24 15:10:30 -05:00
Zhongyang Wu 5b456ddfde
fix(proto): add `serde(default)` to `Events` and `Status` (#1485)
This should allow all fields in event to be optional, which is needed to
decode JSON strings

## Changes
- add `serde(default)` to `Events` for tonic generated types
- add `serde(default)` to `Status` for tonic generated types

## Merge requirement checklist

* [x]
[CONTRIBUTING](https://github.com/open-telemetry/opentelemetry-rust/blob/main/CONTRIBUTING.md)
guidelines followed
* [x] Unit tests added/updated (if applicable)
* [ ] Appropriate `CHANGELOG.md` files updated for non-trivial,
user-facing changes
* [ ] Changes in public API reviewed (if applicable)
2024-01-22 11:53:16 -08:00
Cosmin Lazar 67e6a71d8c
Expose log batchconfig (#1471) 2024-01-22 12:12:32 -05:00
Olivier Soucy 27d338dd95
Add new benches for logs (#1450)
Implement new bench ideas from this
[PR](https://github.com/open-telemetry/opentelemetry-rust/pull/1431)’s
comments.

Please provide a brief description of the changes here.

## Merge requirement checklist

* [ ]
[CONTRIBUTING](https://github.com/open-telemetry/opentelemetry-rust/blob/main/CONTRIBUTING.md)
guidelines followed
* [ ] Unit tests added/updated (if applicable)
* [ ] Appropriate `CHANGELOG.md` files updated for non-trivial,
user-facing changes
* [ ] Changes in public API reviewed (if applicable)

Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2024-01-07 20:43:42 -08:00
Zhongyang Wu 306286e382
fix(proto): use camelCase for json (de)serialization. (#1462)
Part of the effort of #1327 as we need json formats for assertation in
integration tests.

## Changes

- add configuration to serde to deserialize the json in camelCase field
name
- add custom (de)serialization for traceId, spanId as they are
case-insensitive hex encoded string(see
[here](https://opentelemetry.io/docs/specs/otlp/#json-protobuf-encoding))
- add custom (de)serialization for `KeyValue`
- add tests for above, and a test using example json files

## Merge requirement checklist

* [ x]
[CONTRIBUTING](https://github.com/open-telemetry/opentelemetry-rust/blob/main/CONTRIBUTING.md)
guidelines followed
* [x] Unit tests added/updated (if applicable)
* [x] Appropriate `CHANGELOG.md` files updated for non-trivial,
user-facing changes
* [] Changes in public API reviewed (if applicable)
2024-01-05 08:56:35 -08:00
Julian Tescher 7eb4c2704e
Prepare for v0.21.2 release (#1463)
Backport #1434 and #1452 to v0.21.x.
2024-01-04 12:31:44 -05:00
Jesse White 4c5c101253
Fix StatusCode in stdout exporter (#1453) (#1454)
Fixes https://github.com/open-telemetry/opentelemetry-rust/issues/1453

## Changes

Swap the ordinals to match the spec.

Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2024-01-04 10:50:00 -05:00
Rodolfo P A f31c4dd1b1
Workspace dependencies (#1457)
Adds shared dependencies to the workspace.
It improves the experience while managing the dependencies.

## Changes

Picked the shared dependencies of the member projects and used added
then to the workspace dependencies, https://crates.io/crates/work_dep
can help with that.

## Merge requirement checklist

* [ ]
[CONTRIBUTING](https://github.com/open-telemetry/opentelemetry-rust/blob/main/CONTRIBUTING.md)
guidelines followed
* [ ] Unit tests added/updated (if applicable)
* [ ] Appropriate `CHANGELOG.md` files updated for non-trivial,
user-facing changes
* [ ] Changes in public API reviewed (if applicable)
2023-12-30 15:46:34 -08:00
Zhongyang Wu 5aa0311de8 chore: fix 1.75 linter errors 2023-12-28 23:34:42 +01:00
Harold Dost f9b08c1080 chore: Pin nightly version for check-external-types
This is is because the versions are extremely tied to each other.
2023-12-27 10:18:49 +01:00
Olivier Soucy ce64d9fa81
Use good OpenTelemetry conventions for attributes in appender-tracing (#1448)
Also, only removed duplicates attributes from the log crate. I think it
is a good compromise for a little more performance.

Fixes #1445
2023-12-26 23:21:03 +01:00
Ameer Ghani bd572d5469
Fix max_scale validation of exponential histogram configuration (#1452)
`metrics::Aggregation::validate()` has a bug that limits `max_scale` of
a `Base2ExponentialHistogram` to the interval `[10, 20]` instead of the
expected `[-10, 20]`.
2023-12-21 21:23:51 -05:00
Jasper Zeng 7f77ec69f4
feat: make trace state can be propagated for dropped sampler (#1435) 2023-12-19 21:13:13 -05:00
Bouke van der Bijl 09ae384174
Add impl Into to some logs methods (#1442)
This adds `impl Into` to two logs methods, the first to match the
equivalent metrics/traces method and the other to make `with_body` more
ergonomic so you can do `with_body("hello")`
2023-12-19 07:20:42 +01:00
Cijo Thomas d3497392fb
Minor doc fix to reflect correct crate for runtime (#1449)
Fixes https://github.com/open-telemetry/opentelemetry-rust/issues/1357
2023-12-18 21:33:27 -05:00
Cijo Thomas 03b42ac4e4
Fix changelog (#1447) 2023-12-18 20:50:19 -05:00
Olivier Soucy 4e80e3a2eb
Fix opentelemetry appender tracing test (#1441) 2023-12-13 15:06:54 -05:00
Julian Tescher 7d0b80ea85
Fix delta aggregation metric reuse (#1434) 2023-12-12 21:29:07 -05:00
Olivier Soucy fdacd58e70
Bench for logs (#1431) 2023-12-12 20:01:39 -05:00
Jacob Rothstein bd3ba65546
Add await to async trace documentation (#1440) 2023-12-12 18:22:26 -05:00
Lalit Kumar Bhasin 038b91b651
Add experimental synchronous gauge (#1410) 2023-12-12 15:23:42 -05:00
Cijo Thomas 1dd269af45
Update meeting time to 9 AM PT (#1438) 2023-12-11 21:15:23 -05:00
Thomas Knickman 8f237f9d99
fix(docs): dead examples link in README.md (#1436) 2023-12-11 18:21:34 -05:00
Jacob Rothstein 443f68b1b8
Add trillium-opentelemetry to readme (#1430) 2023-12-07 19:54:25 -08:00
Olivier Soucy 66c1d5f734
Normalized metadata in opentelemetry-appender-tracing. (#1380) 2023-12-07 13:53:30 -05:00
Lalit Kumar Bhasin 670d34a460
Remove `tracing-opentelemetry` dependency from `tracing-grpc` example (#1426) 2023-12-07 13:12:49 -05:00
Jasper Zeng 1a3f368347
feat: omit empty otel_scope_info and otel_target_info metrics (#1428)
Fixes #1282 

* omit otel_scope_info and otel_target_info metrics when scope
attributes and resource attributes are empty.
* Update `CHANGELOG.md`
2023-12-06 09:43:09 +01:00
Olivier Soucy ec38660f69
Fix metric_counter bench (#1424) 2023-12-04 19:59:54 -05:00
Ho Kim 10456d4684
Add schemars support for opentelemetry-proto (#1419) 2023-12-01 12:49:12 -05:00
Cijo Thomas 0862af1285
Add tests to validate spatial aggregation (#1416) 2023-11-30 18:26:59 -05:00
Matthew Shapiro 359424776c
Ignore intellij directory (#1417) 2023-11-30 17:32:43 -05:00
Cijo Thomas 772f75ad48
Invalid View to proceed as if view did not exist (#1408) 2023-11-30 12:24:14 -05:00
Cijo Thomas 8b838fc07e
Add tests for tracing appender (#1415) 2023-11-30 08:53:18 -08:00
Julian Tescher cd23ec279a
Remove old global meter provider shutdown method (#1412)
This change removes the old `global::shutdown_meter_provider` method
which is not part of the metrics API spec, and properly documents the
`SdkMeterProvider::shutdown` method which is spec compliant.
2023-11-29 23:56:20 +01:00
Matthew Shapiro c0104d3f54
Precalculated attribute set hashes (#1407)
The hash of `AttributeSet`s are expensive to compute, as they have to be
computed for each key and value in the attribute set. This hash is used
by the `ValueMap` to look up if we are already aggregating a time series
for this set of attributes or not. Since this hashmap lookup occurs
inside a mutex lock, no other counters can execute their `add()` calls
while this hash is being calculated, and therefore contention in high
throughput scenarios exists.

This PR calculates and caches the hashmap at creation time. This
improves throughput because the hashmap is calculated by the thread
creating the `AttributeSet` and is performed outside of any mutex locks,
meaning hashes can be computed in parallel and the time spent within a
mutex lock is reduced. As larger sets of attributes are used for time
series, the benefits of reduction of lock times should be greater.

The stress test results of this change for different thread counts are:

| Thread Count | Main        |  PR           |
| -------------- | ---------- | --------- |
| 2                       | 3,376,040 | 3,310,920 |
| 3                       | 5,908,640 | 5,807,240 |
| 4                       | 3,382,040 | 8,094,960 |
| 5                       | 1,212,640 | 9,086,520 |
| 6                       | 1,225,280 | 6,595,600 |

The non-precomputed hashes starts feeling contention with 4 threads, and
drops substantially after that while precomputed hashes doesn't start
seeing contention until 6 threads, and even then we still have 5-6x more
throughput after contention due to reduced locking times.

While these benchmarks may not be "realistic" (since most applications
will be doing more work in between counter updates) it does show a
benefit of better parallelism and the opportunity to reduce lock
contention at the cost of only 8 bytes per time series (so a total of
16KB additional memory at maximum cardinality).
2023-11-28 18:05:44 +01:00
Lalit Kumar Bhasin 897e70a093
Add tracing-http example (#1404)
Modified version of the
[tracingresponse](https://github.com/open-telemetry/opentelemetry-rust-contrib/tree/main/examples/traceresponse)
example (in `contrib` repo) to demonstrate context propagation from
client to server. The example
- Removes the code to propagate trace-context as part of response
headers from server to client, as the W3C specs is still in draft
(https://w3c.github.io/trace-context/#trace-context-http-response-headers-format),
and also the propagator is part of contrib repo.
- Modify the HTTP server and client code to look more complete and also
demonstrate the context propagation across async delegates.
**_Server_** - Enhance the server's request handling, by adding support
for `/echo` and `/health` endpoints. Upon receiving the request, the
server now creates a child span, linked to the originating remote span,
and the request is forwarded to its respective delegate async task.
Furthermore, within each async task, a subsequent child span is spawned,
parented by the initial child span. This nested span creation
exemplifies the effective propagation of tracing context through the
multiple layers of async execution.
**_Client_** - The client sends requests for `/echo` and `/health`
within the context of the client root span.
2023-11-28 09:32:55 +01:00
Cijo Thomas fcd12eb2c2
Fix CI check for docs (#1406) 2023-11-27 17:29:29 -05:00
Kevin Sun d52ff83f30
opentelemetry-proto-support-feature-gen-grpcio-messages (#1316)
In some cases (e.g. rust wasm), it is not possible to have
network-related crates (e.g. grpcio) included, and we would like to
support protobuf encoding support. so similar to the already existing
feature `gen-tonic-messages`, here introduce a feature
`gen-grpcio-messages` to support protobuf encoding without any network
client/server included.

## Changes

replaces some of existing `gen-grpcio` to `gen-grpcio-messages`
enables feature `gen-grpcio` will automatically enable
`gen-grpcio-messages`
2023-11-27 11:55:00 -05:00
Zhongyang Wu f2d57b13cc
fix(sdk, zipkin, otlp): use `temp_env` for testing (#1403)
Fixes #1383
2023-11-27 08:58:54 +01:00
Matthew Shapiro 075d26cf23
Improve cost of creating AttributeSets (#1379) 2023-11-22 15:24:40 -05:00
Cijo Thomas 073f7a6b6a
Remove jaeger crate from tracing example deps (#1393) 2023-11-22 13:54:48 -05:00
Cijo Thomas 6e1c8c1844
Cleanup indexmap from allowed external types (#1392)
More cleanups following
https://github.com/open-telemetry/opentelemetry-rust/pull/1381/files
2023-11-22 10:26:27 -08:00
Cijo Thomas 04c863e560
Add focused benchmark for metric hotpath (#1389) 2023-11-22 12:50:33 -05:00
Rene B 32299790f1
Add missing event timestamps to `opentelemetry-stdout` (#1391) 2023-11-22 12:19:31 -05:00
Cijo Thomas 3939ab58fe
Test to validate identical instruments are merged (#1385) 2023-11-21 12:33:51 -05:00
Zhongyang Wu 7848755c71
fix(api): move composite propagator to API (#1373)
Move `TextMapCompositePropagator` from `opentelemetry-sdk` to `opentelemetry` crate. 

Fixes #1013
2023-11-21 09:26:46 +01:00
Cijo Thomas 28aca997e5
Attempt to write metric tests with inmemoryexp (#1382) 2023-11-20 12:31:02 -05:00
harscoet abc23c166b
Run opentelemetry-jaeger tests consecutively (#1384)
Limit threads to 1 (to force tests to run
consecutively) to temporarily fix random [failures](https://github.com/open-telemetry/opentelemetry-rust/actions/runs/6915742069/job/18815025248)
during `opentelemetry-jaeger` tests, due to environment variable updates
from parallel tests
If you run this command line multiple times, you should be able to
reproduce it (`test_resolve_timeout` and `test_resolve_endpoint` are
updating some environment variables)
```shell
cargo test --manifest-path=opentelemetry-jaeger/Cargo.toml --all-features collector -- --test-threads=5
```
2023-11-19 08:38:02 +01:00
harscoet 9e2e3db72d
OTLP tonic metadata from env variable (#1377)
Fixes https://github.com/open-telemetry/opentelemetry-rust/issues/1336

As per the
[specs](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.25.0/specification/protocol/exporter.md#specifying-headers-via-environment-variables),
the custom headers for OTLP exporter can be specified through env
variables - `OTEL_EXPORTER_OTLP_HEADERS`,
`OTEL_EXPORTER_OTLP_TRACES_HEADERS`,
`OTEL_EXPORTER_OTLP_METRICS_HEADERS`.
This PR completes the work already done in PR
open-telemetry/opentelemetry-rust#1290 adding support for tonic metadata
To reproduce the same behavior as http exporter, the env-variable takes
precedence (as discussed in
open-telemetry/opentelemetry-rust-contrib#10)

* Move common code for http and tonic exporters in `exporter/mod.rs`
(function to parse header from string and test helper to run tests with
isolated env variables)
I wanted to minimize the changes but maybe it should be a good idea to
use a crate like https://crates.io/crates/temp-env for environment
related testing
2023-11-19 08:32:10 +01:00
Cijo Thomas a70bb74080
Remove evicted q and hmap (#1381) 2023-11-17 12:08:21 -05:00
Lalit Kumar Bhasin 33b5e9b4e2
Fix metric collections during PeriodicReader shutdown (#1375) 2023-11-15 21:07:37 -05:00
Lalit Kumar Bhasin c06c04bb12
Remove API for Creating Histograms with signed integers. (#1371)
As per the OTel [specs], the value to be recorded with histogram instrument SHOULD be non-negative. Removing the existing method to record signed integer values.

> The value is expected to be non-negative. This API SHOULD be documented in a way to communicate to users that > this value is expected to be non-negative. This API SHOULD NOT validate this value, that is left to implementations
> of the API.

[specs]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#histogram
2023-11-15 15:58:31 +01:00
Shaun Cox a2c0dd8d10
make severity of level computations const (#1369) 2023-11-15 10:39:55 +01:00
K.J. Valencik 41c6ea8956
Use custom channel in exporters if configured (#1335) 2023-11-14 17:28:55 -05:00
Harold Dost 59728c8947
Remove contrib crates. (#1366) 2023-11-13 22:11:09 +01:00
Julian Tescher 6175c3f1ed
Prepare for patch release (#1368) 2023-11-13 15:18:30 -05:00
Cijo Thomas cb2d127fe0
Flush fix for SimpleLogProcessor (#1308)
SimpleLogProcessor's `force_flush` was incorrectly implemented as it did not do anything assuming there was nothing to flush. But the SimpleLogProcessor uses a queue with pub-sub mechanism to operate, so flush is not a no-op. This is handled correctly for SimpleSpanProcessor.

Instead of borrowing the approach from SimpleSpanProcessor, I have refactored the SimpleLogProcessor to use no queue and instead use a simple Mutex protected exporter/shutdown. I feel this is sufficient (and want to port this to SimpleSpanProcessor as well), but would like to get feedback on the approach - was there some scenario which prompted the queue/pub-sub for SimpleProcessors? Or this approach is sufficient?

There should not be any perf concerns as SimpleProcessors are used for learning/dev scenarios, and not for production. (Except when you are exporting to operating system native tracing like etw, user_events, but for them we have written RentrantProcessor separately.)
2023-11-12 22:32:38 +01:00
Kristopher Wuollett dd03fdae1e
Add generated modules that output const &str for `tracing` compatibility (#1334)
* feat: add generated modules that output const &str for tracing compatibility

* fix: add tracing as a dev-dependency for doc examples

* fix: remove unused code

* fix: remove tracing examples from semconv docs

* docs: remove extra whitespace that was added previously
2023-11-12 10:37:04 -08:00
Harold Dost 5fc4101826
Use faster Rng in RandomIdGenerator (0%-6% performance improvement) (#1106)
Move to SmallRng from ThreadRng

SmallRng provides 0-6% improvement in Traces.

Relates #808
2023-11-12 16:48:42 +01:00
Julian Tescher 7bb97d5e30
Return consistent `Meter` for a given `MeterProvider` (#1351) 2023-11-10 15:10:58 -05:00
Lalit Kumar Bhasin a74ecd1316
[Tracing Appender] Propagate event name to exporters (#1346) 2023-11-10 12:39:06 -05:00
Cijo Thomas 500fdfca09
Nit fixes to md file to reduce warnings (#1364) 2023-11-10 10:50:22 -05:00
Cijo Thomas ddfe9ffa2b
Requesting to move Cijo Thomas from Approver to Maintainer (#1355) 2023-11-09 18:32:28 -05:00
Julian Tescher 5527a11b69
Fix metric export data for unused gauges (#1363) 2023-11-09 18:24:28 -05:00
Cijo Thomas 4f1c3a26ff
Improve contributing guidelines (#1354) 2023-11-09 15:26:21 -05:00
Cijo Thomas d7e46292fd
Span events stored as Vector instead of EvictedQueue (#1350) 2023-11-09 10:48:47 -05:00
Dirkjan Ochtman 747895423e
Move @djc to emeritus (#1359) 2023-11-09 10:42:17 -05:00
Cijo Thomas 154644013f
Use HashMap instead of IndexMap in LogRecord (#1353) 2023-11-09 10:33:50 -05:00
Julian Tescher 74d294c18d
prometheus: Ignore unknown instrument units (#1348)
## Motivation

The [metric unit semantic conventions] suggest that integer counts
should use annotations (e.g. `{packet}`), which breaks the current unit
appending logic as they are not properly escaped.

[metric unit semantic conventions]: https://github.com/open-telemetry/semantic-conventions/blob/v1.23.0/docs/general/metrics.md#instrument-units

## Solution

Ignore unknown units (including annotations) as other language
implementations currently do. This change also removes the `$` mapping
as it is not UCUM.
2023-11-08 11:18:13 -05:00
Harold Dost b8ea7c10e8
Add config.yml for Templates. (#1352) 2023-11-08 11:12:57 -05:00
Shaun Cox 5d5296b138
More distinct naming of metrics constructs in the SDK (#1328) 2023-11-08 11:12:26 -05:00
Harold Dost 4c3f8a0484
Add Issue Templates. (#1347)
Signed-off-by: Harold Dost <h.dost@criteo.com>
2023-11-07 11:40:04 -05:00
Cijo Thomas 6c3dc789fb
Add jaeger tracing example to main examples (#1345) 2023-11-07 11:38:50 -05:00
Harold Dost ab969bf571
Requesting Maintainership for h.dost (#1342) 2023-11-07 11:36:49 -05:00
Cijo Thomas 4cff5c69b3
Span links stored as Vector instead of EvictedQueue (#1313) 2023-11-07 11:19:12 -05:00
Julian Tescher 47881b20a2
Prepare for v0.21.0 release (#1343) 2023-11-06 18:35:16 -05:00
Zhongyang Wu 4dd54a2ab3
Env over compling time config (#1323)
* feat: favor env vars in jaeger exporters

* feat: collectors

* fix unit tests

* unit tests

* unit tests

* add change logs
2023-11-05 21:56:51 -08:00
Kristopher Wuollett e265d24fe4
fix: specify portable sed arguments (#1332)
Copied from ca08c5a34a/tools/format.sh (L16-L19).
2023-11-01 10:37:55 -07:00
Harold Dost ed97a1bd9e
Remove opentelemetry-dynatrace source. (#1321)
We will no longer build/support it as Dynatrace is migrating towards
OTLP ingestion.

Relates #1099
2023-10-26 22:11:57 -07:00
Jan Kühle 2022ace7b4
Move RuntimeChannel type arg T to associated types (#1314)
RuntimeChannel::batch_message_channel needs to be generic over the
message type. The type used to be declared on the RuntimeChannel<T>
trait. This means a RuntimeChannel can only be used with one particular
message type, which feels unfortunate.

    fn install<R: RuntimeChannel<??::BatchMessage>>(runtime: R) {
        // Can't use the same runtime here. :-(
	TracerProvider::builder().with_batch_exporter(e, runtime);
	LoggerProvider::builder().with_batch_exporter(e, runtime);
    }

This change moves the type argument to the batch_message_channel<T>
function and the associated types Receiver<T> and Sender<T>. Channels
are still specific to a message type, but a RuntimeChannel can be used
with any number of message types.

    fn install<R: RuntimeChannel>(runtime: R) {
        // It works. :-)
	TracerProvider::builder().with_batch_exporter(e, runtime);
	LoggerProvider::builder().with_batch_exporter(e, runtime);
    }

This also means the BatchMessage types no longer need to be public.
2023-10-26 22:11:30 -07:00
Harold Dost ad18037d75
opentelemetry-dynatrace: Release 0.4.0 [#1319] (#1319)
Add additional warning.

NOTE: Not going to bump the Otel Version since this crate will be
removed after this.

Signed-off-by: Harold Dost <h.dost@criteo.com>
2023-10-26 16:30:23 -04:00
Harold Dost bcab756503 Bump MSRV in Cargo.toml files.
Signed-off-by: Harold Dost <h.dost@criteo.com>
2023-10-26 10:33:28 +02:00
Harold Dost dd9ff55c45 Bump the MSRV to 1.65
The goal of this is to enable GATs https://blog.rust-lang.org/2022/10/28/gats-stabilization.html

Relates to #1314

Signed-off-by: Harold Dost <h.dost@criteo.com>
2023-10-26 10:33:28 +02:00
Harold Dost 28d8cf9b6f
Add files to expose the currently used external types. (#1303)
To get ready for release candidate, we should keep track of these as it
affects how stable we can consider being.

Add check to CI.
2023-10-23 14:27:06 -07:00
Lalit Kumar Bhasin aa586cbf7e
Fix semconv template files (#1312)
* fix links

* fix

* fix template

* fix template further

* add generated resource file

* fix the doc comments
2023-10-22 14:34:03 -07:00
Ruihang Xia 4db67d52fe
chore: fix unused_doc_comments warning (#1309)
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
2023-10-20 10:22:53 -07:00
Cijo Thomas a612972c20
SpanAttributes modified to use Vec instead of OrderMap/EvictedHashMap (#1293)
* Use Vec for span attributes instead of HashMaps

* fix bench

* revert

* add dropped_attributes_count back

* fix more exporters

* fix datadog exporter

* fix stackdriver exporter

* fix changelogs

* fix doc

* fix lint and other issues

* more fix

* more fixes

* fix clippy

* add comment

* refix test

* ignore dd tests

* fmt

* tests added

* fix comment and tes

* fmr
2023-10-20 10:21:56 -07:00
Eric Zhang e848caf577
Remove extra generic from with_http_client (#1307)
* Remove extra generic from with_http_client

This generic type parameter is not being used anywhere, so when you try to use `with_http_client`, it requires you to specify a dummy type that implements `HttpClient + 'static`.

So this does not work:

```rust
new_pipeline().with_http_client(Arc::new(client))
```

But these work, even though they don't necessarily match the actual type of `client`:

```rust
new_pipeline::<Arc<dyn HttpClient>>().with_http_client(Arc::new(client))

new_pipeline::<reqwest::Client>().with_http_client(Arc::new(client))
```

* Add test and CHANGELOG entry
2023-10-20 10:14:27 -07:00
Cijo Thomas 2fb0c2e29f
Add tracing tests using inmemoryexporter (#1305)
* Add tracing tests using inmemoryexporter

* fix format

* no test postfx
2023-10-20 10:12:31 -07:00
Lalit Kumar Bhasin 03b94b35c9
Add OTLP HTTP Log Exporter example using tracing appender. (#1294)
* initial commit

* fix

* remove jaeger exporter

* add service_name as CARGO_BIN_NAME

* remove jaeger container, as we instead use Debug Exporter

* Update opentelemetry-otlp/examples/basic-otlp-http/README.md

Co-authored-by: Cijo Thomas <cithomas@microsoft.com>

* only keep required ports

* read binary name at compile time

---------

Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2023-10-17 08:23:24 -07:00
Julian Tescher 9700219dee
Use display for standard trace and span id formats (#1299)
Have consistent padding and hex casing by using the `Display` impl of
trace and span ids which is in accordance with the [spec].

[spec]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.26.0/specification/trace/api.md#retrieving-the-traceid-and-spanid
2023-10-16 18:20:50 -04:00
Lalit Kumar Bhasin 175f1cfe4d
Replace regex crate with glob crate (#1301)
* remove regex crate

* update cargo.toml

* fix dependency

* add unittest

* add changelog

* order tests

* fix unit test

* do disk cleanup before tests

* fix disk cleanup

* fix disk cleanup

* fix disk cleanup

* fix disk cleanup

* fix disk cleanup
2023-10-16 12:25:06 -07:00
Lalit Kumar Bhasin 5eaaf53053
Allow specifying OTLP HTTP headers from env variable (#1290) 2023-10-08 15:20:48 -04:00
John Kelly 2e6a43dbfc
Add `opentelemetry::sdk::logs::config()` for parity with `open telemetry::sdk::trace::config()` (#1197) 2023-10-08 15:19:18 -04:00
Shaun Cox 79244e46c6
Use FnOnce instead of Fn in contrib APIs (#1292) 2023-10-06 20:47:02 -07:00
Cijo Thomas d87fc75c2f
Fix temporarlity and aggregation for usereventexporter (#1287)
Co-authored-by: Leighton Chen <lechen@microsoft.com>
2023-10-06 14:25:59 -04:00
Leighton Chen df2551b8a3
Include diagnosing error messages for userevents metrics exporter (#1273) 2023-10-06 14:25:07 -04:00
Cijo Thomas 6713143b59 unwrap_or_default 2023-10-06 12:10:42 +02:00
Cijo Thomas 19dc93cf14 Fix CI 2023-10-06 12:10:42 +02:00
Shaun Cox 17316b1253
Upgrade dependencies (#1279) 2023-10-05 13:17:22 -04:00
Cijo Thomas b26b20a18f
Add basic stress test for tracing (#1286) 2023-10-05 13:13:59 -04:00
Julian Tescher 6c2ce12593
Add Exponential histogram (#1267) 2023-10-05 13:12:26 -04:00
Shaun Cox 08c3d48dc8
Add attach method to Contextualized (#1277) 2023-09-25 12:29:55 -04:00
Zhongyang Wu 16a866ed59
feat: force user to add exporter builder pipeline. (#1272)
feat: force user to add exporter builder pipeline.

Currently, when users don't configure a builder pipeline. We will throw a runtime error.

This change force user to call `with_exporter` before building exporters or installing pipeline and eliminate the `NoExporterBuilder` error
2023-09-23 11:30:20 -07:00
Shaun Cox bea0aa5497
Cleanup crate documentation (#1278)
* Cleanup crate documentation

- mainly this removes circular dev-dependencies between the api,
  sdk, and stdout crates.

* Some things need to be behind "trace" feature
2023-09-23 09:00:16 -07:00
Shaun Cox f7684b0dad
Prefer use of const to static where possible (#1270)
- Changed NOOP_SPAN from a lazy static to a const
- Remove branch in build_with_context for the noop tracer.
  The current context's span() method already returns &NOOP_SPAN in the
  case when no active span is present, which already has the right span
  context value to use.
- Changed other constituents of span context to use const default values too.
2023-09-20 21:43:35 -07:00
Shaun Cox ab9972f0eb
Context holds SynchronizedSpan directly, not via HashMap (#1268)
- lookup on TypeId and downcasting isn't necesary
- Context::with_value and current_with_value are more efficient
  as they no longer clone and overwrite the entry in the map
  which represens the current span
2023-09-20 21:40:49 -07:00
Leighton Chen e7fb708dc5
meter (#1274) 2023-09-19 16:47:47 -07:00
Yuta Yamaguchi cf46a55420
Move metric validation from api to sdk (#1269)
* Move metric validation from api to sdk

* moved validation process for metrics instrument from api to sdk.
* included hyphens in instrument names as valid values.
* increase instrument name maximum length from 63 to 255 characters.

* refactor(metrics): rename InstProvider to InstrumentProvider

* refactor(metrics): define spec limitation to const
2023-09-14 21:33:29 -07:00
Julian Tescher 3ee22ced04
Re-use memory via aggregate functions (#1266)
This simplifies memory reuse on subsequent collection cycles.

Also small ergonomics changes:

* Move `MetricsProducer` config to builders to match other config
* Remove the need for separate `Delta*` and `Cumulative*` aggregate
  types
* Return error earlier if readers are shut down
* Log warning if two instruments have the same name with different
  casing
* Log warning if view is created with empty criteria
2023-09-13 13:58:42 -04:00
Shaun Cox bfb61de163
opentelemetry-contrib api enhancements with new_span benchmark (#1232) 2023-09-12 21:49:10 -04:00
Cijo Thomas c36db502b3
Stdout to print temporality in user readable format (#1260) 2023-09-09 12:43:48 -04:00
Cijo Thomas 52dd8d3eab
Nit updates to OTLP Exmples readme (#1259) 2023-09-09 12:43:13 -04:00
Cijo Thomas e0c9087355
Metric advanced examples - change histogram buckets (#1257) 2023-09-09 12:40:25 -04:00
Cijo Thomas 2b5f4b17d2
Propose Shaun Cox as an approver (#1251) 2023-09-09 12:36:03 -04:00
Cijo Thomas f0da10f41e
Remove dev deps on log appender (#1249)
* Remove dev deps on log appender

* comment
2023-09-08 09:52:41 -07:00
Shaun Cox 9d6bdd15c1 Use edition 2021 resolver
- eliminates a warning when doing cargo update
2023-09-07 15:58:45 +02:00
Max Bruckner 4d26d7ae95
Add Sync bound on the LogExporter and SpanExporter traits (#1240) 2023-09-05 13:27:12 -04:00
Kacz 6412dcd078
feat: add InMemoryLogsExporter (#1231)
* feat: addInMemoryLogExporter

* linting

* Update CHANGELOG.md

* changed finished to emitted logs, moved example

* replace clone_log with cloned()

* remove proj example in favor of single file

* corrected dependency, removed repeated code

* changed finished to emitted logs, moved example

* remove proj example in favor of single file

* corrected dependency, removed repeated code

* corrected dependency, removed repeated code

* fix: endpoint urls for otlp http exporter. (#1210)

* Move opentelemetry_api code back into opentelemetry and remove the former (#1226)

* [user_events log exporter] Upgrade eventheader-dynamic dependency (#1230)

* feat: addInMemoryLogExporter

* linting

* Update CHANGELOG.md

* remove the example from examples

* fixes after rebase

* missing doc, added no_run in examples

* fix ci test(stable) and docs

* more examples ci fixes

* added dev-dependencies to resolve ci issue

* corrected required features

* remove comments about returning error

* Update example description

Co-authored-by: Cijo Thomas <cithomas@microsoft.com>

---------

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
Co-authored-by: Shaun Cox <shaunco@microsoft.com>
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2023-09-02 15:26:35 -07:00
Cijo Thomas 2a2e4b17c7
Remove context from metrics force_flush (#1245) 2023-09-01 17:15:41 -04:00
Jasper Zeng b776b1ec38
feat: add InMemorySpanExporter (#1216) 2023-09-01 17:12:45 -04:00
Max Bruckner b6e91a9baf Add missing env! macro around "CARGO_PKG_VERSION" 2023-08-31 10:48:29 +02:00
Midas Lambrichts 88f271dd13 Bump tokio-streams minimum version to 0.1.1
The `Stream` wrappers that are used were added in 0.1.1:
https://github.com/tokio-rs/tokio/blob/master/tokio-stream/CHANGELOG.md#011-january-4-2021
2023-08-30 13:35:43 +02:00
Midas Lambrichts baa7199b1a Update minimal `thiserror` requirement
The repository uses `transparent`, which was added in v1.0.7:
https://github.com/dtolnay/thiserror/releases/tag/1.0.7
2023-08-30 13:35:43 +02:00
Shaun Cox 8748fb82f4 use futures-util instead of futures and with no default features 2023-08-30 10:03:57 +02:00
Shaun Cox d6f0cfc9e9 smaller dependency footprint to futures by opentelemetry crate 2023-08-30 10:03:57 +02:00
Shaun Cox 25e545f3de
Add .cspell.json configuration file (#1233) 2023-08-29 12:53:51 -07:00
Shaun Cox 08119c44be
opentelemetry crate no longer depends on futures-channel (#1229) 2023-08-28 17:27:42 -04:00
Cijo Thomas 1f9e7652af
Also print datetime in human friendly format for stdout (#1206) 2023-08-28 17:26:12 -04:00
Lalit Kumar Bhasin 6603a5818f
[user_events log exporter] Upgrade eventheader-dynamic dependency (#1230) 2023-08-28 11:21:35 -04:00
Shaun Cox 42e58fc356
Move opentelemetry_api code back into opentelemetry and remove the former (#1226) 2023-08-28 11:20:30 -04:00
Zhongyang Wu f66e9626cb
fix: endpoint urls for otlp http exporter. (#1210) 2023-08-28 11:14:40 -04:00
Shaun Cox 1688ec6824 chore: fix new lints from rustc 1.72 update 2023-08-24 17:29:58 +02:00
Leighton Chen b22f7d1bd4
Update user_events metrics exporter to reflect new schema (#1224)
* cli

* update

* Update mod.rs

* lint
2023-08-23 21:34:59 -07:00
Shaun Cox 759556d590
Change opentelemetry crate to contain only the API, not the SDK #1186 (#1199) 2023-08-23 21:01:28 -07:00
Zhongyang Wu 3c560d9576
fix(zpages): use tonic based generated files. (#1214)
* fix(zpages): use tonic based generated files.

The reason zpages cannot compile after #1202 is prost backed grpcio compiler no longer allow us to add `serde` macros onto the types. Thus, instead of using grpcio types, use tonic types in zpages fixes it.

* add changelog
2023-08-23 09:51:40 -07:00
Leighton Chen 6f7f8bbc1c
Create doc/unit tests for SDK MeterProvider (#1220)
* meter provider

* meterprovider

* lint
2023-08-23 08:49:23 -07:00
Cijo Thomas 2c3017e347
Pretty print stdout in examples (#1212)
* Modify examples to pretty print stdout

* a

* a

* fmt
2023-08-23 08:48:37 -07:00
Max Bruckner a3e0ab6f9e
Make LogData constructible by removing #[non_exhaustive], fixes #1217 (#1222) 2023-08-23 08:47:08 -07:00
Cijo Thomas 495330f635
Try to fix docs CI (#1218) 2023-08-22 10:50:45 -07:00
Leighton Chen 2ba8f9fe10
Add doc tests to opentelemetry metrics api (#1213)
* meter + instrument tests

* provider

* lint
2023-08-20 17:06:55 -07:00
Cijo Thomas 523adb1c5d
Fix stress test for logs to use a noop processor (#1207)
* Fix stress test for logs to use a noop processor

* lint
2023-08-15 22:17:23 -07:00
Julian Tescher 41e8d63652
Add `grpcio` metrics exporter (#1202)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2023-08-14 18:18:47 -07:00
Leighton Chen 2848836a2f
fix pprof (#1205) 2023-08-11 17:56:36 -07:00
Shaun Cox 4fd68e319c Update CHANGELOGs for MSRV bump 2023-08-11 23:40:30 +02:00
Shaun Cox 53ae991a00 bump MSRV to 1.64 and indexmap to 2.0 2023-08-11 23:40:30 +02:00
Cijo Thomas 2d427667db
Metric stdout exporter to print timestamp in human readable format (#1192) 2023-08-11 11:03:28 -07:00
Zhongyang Wu 1d4db1580f
fix: allow user to set arbitrary units in promethus suffix. (#1188) 2023-08-08 16:50:19 -07:00
Cijo Thomas a505104fa6
Default resource to include Telemetry SDK (#1194) 2023-08-08 16:49:18 -07:00
Lalit Kumar Bhasin 17715c8263
[user_events exporter] Fix the exporter log format (#1190) 2023-08-07 18:19:16 -07:00
Cijo Thomas bacefbfbc2
Add Cijo and Lalit to list of approvers (#1193) 2023-08-07 17:52:19 -07:00
Julian Tescher 77db498ead
Restructure OTLP config (#1187) 2023-08-07 09:36:04 -07:00
Julian Tescher 7607ad371e
Implement tonic metrics proto transformations (#1184) 2023-08-04 11:37:38 -07:00
Yunchi Luo 3df6a047bd
datadog: do not set invalid remote context (#1185) 2023-08-03 17:21:54 -07:00
Julian Tescher e12247e9ca
Rename `traces` feature to the more standard `trace` (#1183) 2023-08-03 09:50:58 -07:00
Cijo Thomas fbe789d015
Fix timestamps in log-appenders (#1180) 2023-08-03 09:50:38 -07:00
Julian Tescher a22c822103
Add log appender versions to loggers (#1182) 2023-08-02 17:53:09 -07:00
Shaun Cox 3768a7dd15
Export InstrumentationLibrary attributes (#1179)
- change conversion From<InstrumentationLibrary> to move data rather than copy it in some Cow::Owned cases
2023-08-02 13:53:21 -07:00
Lalit Kumar Bhasin 8dd1a63c70
[Logs API/SDK] - Populate ObservedTimestamp within the SDK (#1178)
* observed ts mandatory

* rename var

* fix lint

* implement default for LogRecord
2023-08-02 11:46:55 -07:00
Cijo Thomas f67dc5c3e1
Fix basic-otlp example dependencies (#1177) 2023-08-01 21:57:41 -07:00
Cijo Thomas a00793c7b9
Set timestamp correctly in log appenders (#1175) 2023-08-01 21:56:19 -07:00
Julian Tescher dfeac078ff
Fix stdout exporter dependency (#1172) 2023-07-30 09:09:47 -07:00
Julian Tescher 771d3c4207
Prepare for v0.20.0 release (#1156) 2023-07-29 14:18:06 -07:00
Lalit Kumar Bhasin 2ca024e9ab
Export logs only if the level/logger/target is enabled. (#1147) 2023-07-29 09:20:51 -07:00
Karolis Gudiškis 8975aa382e
fix: Fix env endpoint use in telemetry agent (#1167) 2023-07-28 22:32:30 -07:00
Cijo Thomas 6962621fb8
Start adding metrics advanced (view) examples (#1170) 2023-07-28 21:55:11 -07:00
Leighton Chen 9f28319307
update (#1169) 2023-07-28 21:52:47 -07:00
Cijo Thomas 1f59a15cbf
Add OTLP LogExporter to the example (#1168) 2023-07-28 21:51:43 -07:00
Bryn Cooke 58ad33a5d0
Add compression support for otlp tonic (#1165) 2023-07-28 21:49:02 -07:00
Richard Janis Goldschmidt ba6f924bcd
proto: fix doc links to tonic, prost (#1162) 2023-07-28 21:45:37 -07:00
Patrick Koenig fb141994e0
Install logger provider (#1164) 2023-07-26 17:48:44 -07:00
Patrick Koenig ccb510fbd6 Add with_log_config to OtlpLogPipeline 2023-07-24 11:30:48 +02:00
Zhongyang Wu b87a827fdf
fix: unit conversion in prom exporter (#1157)
* fix: unit conversion in prom exporter

* re-generate && make fmt

* add change log

* fix: proto changes

* use split_once
2023-07-23 23:11:20 -07:00
Zhongyang Wu e150092934
fix: enable `with_reqwest` when `reqwest_rustls_collector_client` feature is enabled (#1159)
* fix: enable `with_reqwest` when `reqwest_rustls_collector_client` feature is enabled

* add change log
2023-07-23 22:42:14 -07:00
Julian Tescher 25cce7abd5
Replace stream attribute filter with allowed keys (#1161) 2023-07-21 11:17:19 -07:00
William Perron b28e41a41a
Fix EvictedQueue bug with zero capacity (#1151)
The EvictedQueue was checking for the length _before_ inserting, and
popping extra items, then doing the insertion. In the case where the
capacity is set to zero, it caused the pop operation to be a no-op on
the first insert, and then insert an item anyway.

This commit fixes the issue by moving the length check after the insert
and popping any extra items.
2023-07-19 13:38:30 -07:00
Cijo Thomas 0b979a6cd3
Stress test for metric modified to use random attributes (#1126) 2023-07-19 12:34:52 -07:00
Julian Tescher db1fedb138
prometheus: add `without_counter_suffixes` option (#1158) 2023-07-19 12:32:47 -07:00
Patrick Koenig 2c35c55cf8
Don't use CARGO_BIN_NAME for service name (#1150) 2023-07-17 16:30:50 -07:00
Leighton Chen 96f2628b09
Create instance of tracepointstate in user_events metric exporter (#1149) 2023-07-17 13:06:52 -07:00
Julian Tescher 34c7332323
Update OTLP spec version to 1.0.0 (#1154) 2023-07-14 17:19:42 -07:00
Julian Tescher e63385cc18
Update semantic conventions to latest spec (#1153) 2023-07-14 17:16:12 -07:00
Julian Tescher 3976477504
Fix clippy lints introduced in rust 1.71 (#1152) 2023-07-14 14:37:51 -07:00
Lalit Kumar Bhasin 1f1a4fe054
[Logs SDK] Modify LogRecord to use Vector instead of OrderMap for attributes (#1142)
* use vector for attributes

* lint errors

* add comment

* fix lint
2023-07-11 09:34:42 -07:00
Lalit Kumar Bhasin 2d5d544804
Drop include_trace_context parameter from Logs API/SDK (#1133)
* Drop log API include_trace_context parameter

* lint errors

* update Logger:emit doc

* update doc

* update changelog

* Update opentelemetry-api/CHANGELOG.md

Co-authored-by: Leighton Chen <lechen@microsoft.com>

* fix merge errors

* fix tests

---------

Co-authored-by: Leighton Chen <lechen@microsoft.com>
2023-07-10 13:39:16 -07:00
Lalit Kumar Bhasin 309b4e58e3
Logs API/SDK - few perf improvements (#1134)
* initial commit

* fix unit test

* fix doctest

* fix doctest
2023-07-09 20:34:45 -07:00
Joao Grassi 2baa3797a2
Add deprecation note to Dynatrace metrics exporter (#1141) 2023-07-09 20:34:21 -07:00
Max Vorobev 10f2699357
Fix broken link to variables spec (#1145) 2023-07-08 12:22:55 -07:00
Shaun c1050ad64b
Cleanup documentation related to current context and use map_current (#1144) 2023-07-06 11:51:00 -07:00
Leighton Chen 5a1ab17ec6
Otel user_events Metrics exporter. (#1117) 2023-07-06 10:10:57 -07:00
Shaun 0bf18ce307
Add a method (and benchmark) to Context to speed up active span determination by 7x (#1140) 2023-07-05 18:00:58 -07:00
Rudi Floren 89bf91c1f9 stackdriver: add links to exported span 2023-07-03 16:02:45 +02:00
Rudi Floren 1c90bda88a stackdriver: fix invalid parent span id 2023-07-03 16:02:45 +02:00
Lalit 821a7f2dee add attribute 2023-07-03 13:55:58 +02:00
Lalit b8c2648202 explicit type to OrderMap 2023-07-03 13:55:58 +02:00
Lalit Kumar Bhasin 8f63407392 support string and bool 2023-07-03 13:55:58 +02:00
Leighton Chen 38bc35111c
shutdown (#1138) 2023-07-02 22:03:34 -07:00
Dirkjan Ochtman d8a1a4e42a
stackdriver: upgrade gcp-auth to 0.9 (#1137) 2023-07-01 22:24:15 -07:00
Zhongyang Wu fa37b99eb2 fix: replace `futures` creates with `futures-*` crates.
fix #1064
2023-06-26 09:38:07 +02:00
Shaun d240719970
Create tracer using a shared instrumentation libary (#1129) 2023-06-25 13:13:50 -07:00
Rasmus Dyhr Larsen 60a33c9776
Add method to create GcpAuthorizer from existing (#1128) 2023-06-25 13:08:05 -07:00
Rudi Floren 5e6575f7a1
Send resource along with span attributes and kind/status (#1035) 2023-06-25 12:55:35 -07:00
Cijo Thomas 3ee44ae7b7
Minor fixes to readme and processor doc (#1122)
* Minor fixes to readme and processor doc

* omm
2023-06-24 14:32:46 -07:00
Shaun 6682594e63
Introduce key/value map bench (#1121) 2023-06-22 15:22:31 -07:00
Cijo Thomas 6930e87554
Tracing appender and user_event exporter minor fixes (#1123) 2023-06-22 13:26:20 -07:00
Lalit Kumar Bhasin 320957751e
Otel user_events Log exporter. (#1110)
* first draft

* reorganize directory structure

* Update README.md

* remove debugs

* remove exporter traits

* fix CS

* add CS format

* fix review comments

* fix comments

* remove debugs

* lint errors fix

* rename crate

* more lint errors

* modify crate name

* Update opentelemetry-user-events-logs/Cargo.toml

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>

* remove suppressed warnings

* fmt

* remaining format

---------

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2023-06-20 13:21:19 -07:00
Cijo Thomas 71a64d77d1
Update main readme with sig meeting info (#1116)
* Update main readme with sig meeting info

* rework
2023-06-16 11:39:37 -07:00
Harold Dost 4bf6609e9d
Adding Copyright Holders (#1112)
* Adding Copyright Holders

Using the Copyright holder of "The OpenTelemetry Authors" as
recommended.

* Update the LICENSE Files Per the CNCF Guidelines:
  https://github.com/cncf/foundation/blob/main/copyright-notices.md#copyright-notices
* Don't add authors to Cargo.toml
  * Per [RFC 3052](https://rust-lang.github.io/rfcs/3052-optional-authors-field.html)
  * Remove from opentelemetry-proto.

Signed-off-by: Harold Dost <h.dost@criteo.com>

* Update LICENSE

Co-authored-by: Cijo Thomas <cithomas@microsoft.com>

---------

Signed-off-by: Harold Dost <h.dost@criteo.com>
Co-authored-by: Julian Tescher <julian@tescher.me>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2023-06-16 11:39:25 -07:00
Cijo Thomas a08c6406bb
Remove Context from sync instruments (#1076) 2023-06-15 12:51:48 -07:00
Cijo Thomas b29fa99444
Add log appender for tracing (#1085) 2023-06-15 12:48:41 -07:00
Cijo Thomas e56a7112cb
Update main readme with logging status (#1102) 2023-06-15 12:30:21 -07:00
Will Bush d3c8598a79
examples tracing-grpc: upgrade Cargo.toml and fix build and warnings (#1107) 2023-06-15 12:27:02 -07:00
Armin Ruech 49c32c2399
Add deprecation note to Dynatrace exporter (#1113) 2023-06-15 12:23:14 -07:00
Zhongyang Wu e773f92263
chore: clean up examples (#1094)
* chore: move examples to their integrations

* merge upstream

* chore: remove examples

* fix: add `--all-features` to test script
2023-06-12 22:41:57 -07:00
Shaun 00641fb01d
Improve span creation performance another 3-7% (#1101)
- when making a sampling decision, use a static empty set of attributes (if there
  were none provided via the builder) rather than creating  an empty OrderMap
  and later dropping it.
- this also improved performance in some of the always-sample cases too, and I'm
  speculating it had to do with better code generation that resulted from moving
  the mutable variable declarations down into the scopes where they are actually
  used.

still more to come...

shaun@shaun-amd:~/code/open-telemetry/opentelemetry-rust(builder-attributes *)$ taskset -c 2,4 cargo bench -p opentelemetry_sdk --bench trace -- --baseline main start-end-span
start-end-span/always-sample
                        time:   [348.13 ns 349.42 ns 350.84 ns]
                        change: [-0.5069% +0.7799% +2.1015%] (p = 0.25 > 0.05)
                        No change in performance detected.
start-end-span/never-sample
                        time:   [116.25 ns 116.52 ns 116.82 ns]
                        change: [-4.3488% -4.1272% -3.8979%] (p = 0.00 < 0.05)
                        Performance has improved.

start-end-span-4-attrs/always-sample
                        time:   [878.49 ns 907.04 ns 938.14 ns]
                        change: [-6.4936% -2.5370% +1.8532%] (p = 0.24 > 0.05)
                        No change in performance detected.
start-end-span-4-attrs/never-sample
                        time:   [165.72 ns 166.01 ns 166.33 ns]
                        change: [-3.6821% -3.4829% -3.2617%] (p = 0.00 < 0.05)
                        Performance has improved.

start-end-span-8-attrs/always-sample
                        time:   [1.2934 µs 1.3199 µs 1.3499 µs]
                        change: [-10.132% -6.8767% -3.4363%] (p = 0.00 < 0.05)
                        Performance has improved.
start-end-span-8-attrs/never-sample
                        time:   [214.83 ns 215.23 ns 215.67 ns]
                        change: [-2.9651% -2.7390% -2.5258%] (p = 0.00 < 0.05)
                        Performance has improved.

start-end-span-all-attr-types/always-sample
                        time:   [951.15 ns 977.30 ns 1.0084 µs]
                        change: [-7.4325% -3.2210% +1.4973%] (p = 0.15 > 0.05)
                        No change in performance detected.
start-end-span-all-attr-types/never-sample
                        time:   [180.11 ns 180.48 ns 180.90 ns]
                        change: [-2.8578% -2.5975% -2.3072%] (p = 0.00 < 0.05)
                        Performance has improved.

start-end-span-all-attr-types-2x/always-sample
                        time:   [1.5738 µs 1.6032 µs 1.6354 µs]
                        change: [-6.1433% -3.6935% -1.1629%] (p = 0.00 < 0.05)
                        Performance has improved.
start-end-span-all-attr-types-2x/never-sample
                        time:   [247.04 ns 247.98 ns 249.03 ns]
                        change: [-2.4979% -1.9581% -1.4200%] (p = 0.00 < 0.05)
                        Performance has improved.
2023-06-09 10:13:05 -07:00
Shaun 06d17f76bd
OtelString::Owned uses Box<str> instead of String (#1096) 2023-06-07 09:13:19 -07:00
Shaun eb9049264a
remove unused dependencies (#1095) 2023-06-06 22:34:20 -07:00
Shaun 18f6c01ee3
make Tracer::Clone cheaper #1092 (#1093) 2023-06-06 09:15:38 -07:00
Shaun 782f9db07d
cheaper to generate random primitives than byte arrays (#1091) 2023-06-05 12:21:45 -07:00
Shaun Cox b25394552f fix clippy lint new for rustc 1.70 2023-06-05 09:41:12 +02:00
Shaun Cox 9cb677bc06 for benchmarking, enable reports and flamegraphs 2023-06-05 09:41:12 +02:00
Zhongyang Wu 800b9e3e37
fix: allow span id to be less than 16 characters in jaeger propagator (#1084) 2023-06-01 09:59:09 -07:00
Bouke van der Bijl e804992f98 proto: make the tonic/transport feature optional
This should make it possible to compile opentelemetry-proto for wasm
2023-06-01 14:31:33 +02:00
Leighton Chen 8935df04af
Improve stress tests (#1082)
* stress

* stress

* stress

* fmt

* nits

* format

* fmt
2023-05-30 09:46:18 -07:00
Lalit Kumar Bhasin 2e4d396518
Fix OrderMap reference in log subsystem (#1073)
* fix ordermap usage

* fix comment

* fix
2023-05-30 08:43:19 -07:00
Vibhav Pant df5433f93f
Unify trace and logs runtime extensions traits. (#1067)
Merge the TraceRuntime and LogRuntime traits in the trace and logs
module respectively into MessageRuntime, an extension trait to Runtime
generic over the type of Message/Signal type to be sent and
received. All references to the older traits now become
MessageRuntime<trace::BatchMessage> and
MessageRuntime<logs::BatchMessage> respectively.
2023-05-29 10:46:11 +02:00
Cijo Thomas 2a4a9cd390
Add LogAppender for log crate (#1071)
* Add LogAppender for Log crate

* move to API

* use generic and avoid dyn

* format fix

* put logger Type back

* remove loglevel

* name fix
2023-05-26 10:58:08 -07:00
KodrAus 38d6465b6b fix a missing import when http-proto is enabled without grpc-sys 2023-05-26 12:55:20 +02:00
Leighton Chen 53cb06e715
Implement cardinality limits for metric streams (#1066) 2023-05-25 16:13:26 -07:00
David Smitmanis dcd43663ea
Add js-sys as dependency for api crate when building wasm targets (#1078) 2023-05-25 10:39:23 -07:00
Dirkjan Ochtman 0a893ce7dc
stackdriver: upgrade gcp_auth to 0.8 (#1069) 2023-05-23 09:08:55 -07:00
Vibhav Pant e9adef6873
Initial implementation of the logging SDK spec (#788)
* Logging SDK.

* Add From implementations for Any.

* Fix docs links.

* Add Into<Any> impls for f64 and f32.

* Support converting serde_json::Value to Any.

* Fix docs link.

* Remove unused dependency.

* Add LogRecordBuilder, documentation for Severity.

* Add LogRecordBuilder::new().

* with_body: Remove unneeded generic parameter.

* Remove unneeded generic parameters.

* Enforce LogProcessor is Send + Sync.

* export: Use the correct variables.

* LogEmitterProvider: Enable Clone. Add shutdown, try_shutdown.

* Remove From implementation for serde_json values.

* Fix typo.

* Add Default impl for LogRecordBuilder.

* Update to work with opentelemetry-proto v0.14.0.

* Remove tests.

* Avoid using wildcard imports.

* Rename feature/module "log" to "logs".

* Implement Drop for LogEmitterProvider.

* Use std::convert::identity.

* Use opentelemetry-log-exporter as the thread name.

* Use the correct module name.

* Remove From<Severity> impls for SeverityNumber.

* log_emitter: Set emitter version as None.

* Rename attributes_to_keyvalue to attributes_to_keyv_alue

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>

* Update logs

* Fix typos in feature names.

* Add logs protobuf files to GRPCIO_PROTO_FILES.

* Update to opentelemetry-proto 0.19.0.

* Update crates/modules names.

* Remove incorrect exporter example in docs.

* Move stdout logs exporter to the opentelemetry-stdout crate.

* Store resource using Cow instead of Arc.

* Add From<Cow<str>> implementation for Key.

* Update logging SDK.

* Add ordered-float dependency.

* Rewrite LogsExporter.

* Move LogRecord to api crate, simplify resources.

* Add API traits for logs.

* Add api trait impls.

* Add no-op impl for Logger and LoggerProvider.

* Use api traits.

* Add global logger/loggerproviders.

* Add include_trace_context, make the component name param ergonomic.

* Update docs.

* fix: lint

* logs: Rename Any to AnyValue.

* Address docs and lint issues.

---------

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2023-05-17 10:11:59 -07:00
Lalit Kumar Bhasin 69fd972fa6
Move OrderMap module to root of otel-api crate (#1061)
* more OrderMap to root of the otel-api crate

* missed file..

* fix lint

* re export OrderMap

* update changelog

* reorg use
2023-05-16 13:14:14 -07:00
Cijo Thomas bdb777bf72
Add basic example showing how to use various metric instruments (#1062) 2023-05-15 09:53:49 -07:00
Lalit Kumar Bhasin db2c6de742
OTLP HTTP Metrics Exporter (#1020)
* initial changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* fix formatting issues

* changes

* changes

* changes

* fix CI and lint

* more lint

* removed commented code

* fix

* fix format

* review comments
2023-05-12 10:34:41 -07:00
Leighton Chen ecf0dda568
Add microbenching testings for histogram.add() (#1049)
* Update metric.rs

* lint

* lint

* const
2023-05-02 22:56:24 -07:00
Leighton Chen cb65114da9
Add basic stress testing framework + counter.add test (#1045)
* stress

* metric

* Update README.md

* type

* readme

* loop

* fmt

* atomic

* lint
2023-05-02 10:05:12 -07:00
Julian Tescher 3d10816279
metrics: Update histogram min/max/sum to be generic (#1052) 2023-05-01 10:18:48 -07:00
Zhongyang Wu e7fe8c6475
fix: panic when clone data in in memory exporters. (#1054) 2023-04-30 22:53:40 -07:00
Julian Tescher 995fc93d04
prometheus: Add metric namespace config (#1051) 2023-04-30 19:22:29 -07:00
Julian Tescher fa25595b2b
Remove unused files (#1053) 2023-04-30 19:21:55 -07:00
Julian Tescher 71a20ffa05
Ensure semantic conventions schema url stays in sync (#1050) 2023-04-28 11:30:35 -07:00
Cijo Thomas 3f9689dcf7
Update contributing guide to include precommit (#1044) 2023-04-26 15:42:10 -07:00
Julian Tescher 28c1b8318f
Update to otel spec version v1.20.0 (#1039)
* Update to otel spec version v1.20.0

* Fix stackdriver usage
2023-04-26 15:41:09 -07:00
Cijo Thomas 93880e0341
should_sample modified to not have instrumentationlibrary as a parameter (#1041)
Co-authored-by: Leighton Chen <lechen@microsoft.com>
2023-04-26 12:18:58 -07:00
Christopher Schramm 5842ae2117
Wait for exports on the simple span processor's ForceFlush (#1030)
ForceFlush seems to have been left behind in #502. With those changes, the processing is not really synchronous anymore, i.e. OnEnd now only sends the span down the pipe to be processed in the separate thread as soon as possible.

https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#forceflush-1 says:

> In particular, if any SpanProcessor has any associated exporter, it SHOULD try to call the exporter's Export with all spans for which this was not already done and then invoke ForceFlush on it.

As the comment states, all spans previously got exported synchronounsly right away, so that no such spans existed, but now they might be anywhere between the channel and (the end of) the export call. Doin
g nothing in ForceFlush even violates the specification as...

> The built-in SpanProcessors MUST do so.

Awaiting all open tasks from the channel on ForceFlush fixes this.

Previous discussions regarding parts of the specification that this does not tackle in line with Shutdown:

> ForceFlush SHOULD provide a way to let the caller know whether it succeeded, failed or timed out.

https://github.com/open-telemetry/opentelemetry-rust/pull/358#issuecomment-725449486

> ForceFlush SHOULD complete or abort within some timeout.

https://github.com/open-telemetry/opentelemetry-rust/pull/502/files#r603722431

This brings the simple processor a step closer to the batch processor with the obvious main difference of batches and the (not so obvious, also see https://github.com/open-telemetry/opentelemetry-rust/pull/502#issuecomment-809740071) difference that it works without a presumed async runtime.
2023-04-24 12:32:40 -07:00
Julian Tescher a9399e9f4e
Fix SpanRef::set_attributes mutability (#1038) 2023-04-24 10:13:37 -07:00
Julian Tescher d560ff304f
Improve tracer and meter creation ergonomics from #1018 (#1037) 2023-04-24 10:13:13 -07:00
Leighton Chen f42c11d8c4
Add temporality benchmark tests for counter in metrics (#1034) 2023-04-23 11:09:40 -07:00
Cijo Thomas e7163f17cb
Add PR template (#1036)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
2023-04-23 11:07:31 -07:00
Julian Tescher 67bc4f99a8
Create opentelemetry-stdout (#1027) 2023-04-23 11:06:32 -07:00
Leighton Chen 7b3b39d5de
Add support for instrumentation scope attributes (#1021)
* attr

* Update main.rs

* metrics

* fmt

* tests

* tests

* Update metrics.rs

* cov

* Update tracer_provider.rs

* remove tokio

* into

* lint

* remove example

* lint

* test

* Delete main.rs

* changelog

* test

* Update metrics.rs
2023-04-21 10:53:57 -07:00
Cijo Thomas 93eae5d831
Modify Actix example to use OTLP ingestion for Jaeger (#1022)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2023-04-20 12:00:29 -07:00
Ari Seyhun 39d95f5477
feat: use `Cow<'static, str>` instead of `&'static str` (#1018)
* feat: use `Cow<'static, str>` instead of `&'static str`

* style: fix formatting

* fix: zipkin tracer arguments

* fix: versioned tracer arguments

* feat: accept impl parameter for global meter functions

* style: remove unecessary .into calls in docs

* fix: test tracer parameter

* fix: integration test paramaeters

* fix: tracer parameters

* fix: meter parameters

* fix: meter_with_version parameters

* fix: doc code tests
2023-04-17 17:31:06 -07:00
Simen Bekkhus 482d951fa1
feat: upgrade to tonic 0.9 (#1016) 2023-04-17 17:30:45 -07:00
Zhongyang Wu ee3efe0605
feat(metrics): add in memory metrics exporter (#1017)
* feat(metrics): add in memory metrics exporter

* don't run examples

* fix: move in memory exporter behind testing feature flag

* fix: format
2023-04-10 21:56:41 -07:00
Wolfgang Schnerring 3597479ab6
Use the browser-only js-sys workaround only when actually targeting a browser (#1005) (#1008)
wasi runtimes do provide a SystemTime implementation, see
https://github.com/bytecodealliance/wasmtime/blob/main/crates/wasi-common/src/clocks.rs
2023-03-29 15:41:28 -07:00
Ari Seyhun 3b273fa112
feat: add `new` method to `BoxedTracer` (#1009) 2023-03-29 15:40:59 -07:00
Julian Tescher e4ef2a9f23
New metrics SDK (#1000)
This patch updates the metrics SDK to the latest spec. The following
breaking changes are introduced.

Metrics API changes:

* Move `AttributeSet` to SDK as it's not mentioned in the spec or used
  in the api
* Consolidate `AsyncCounter`, `AsyncUpDownCounter`, and `AsyncGauge`
  into `AsyncInstrument` trait and add downcasting for observer
callbacks.
* Add `AsyncInstrumentBuilder` to allow per-instrument callback
  configuration.
* Allow metric `name` and `description` fields to be `Cow<'static, str>`
* Warn on metric misconfiguration when using instrument builder `init`
  rather than returning error
* Update `Meter::register_callback` to take a list of async instruments
  and validate they are registered in the callback through the
associated `Observer`
* Allow registered callbacks to be unregistered.

Metrics SDK changes:

* Introduce `Scope` as type alias for `InstrumentationLibrary`
* Update `Aggregation` to match aggregation spec
* Refactor `BasicController` to spec compliant `ManualReader`
* Refactor `PushController` to spec compliant `PeriodicReader`
* Update metric data fields to match spec, including exemplars.
* Split `MetricsExporter` into `Reader`s and `PushMetricExporter`s
* Add `View` implementation
* Remove `AtomicNumber`s
* Refactor `Processor`s into `Pipeline`

Metrics exporter changes:

* Update otlp exporter to match new metrics data
* Update otlp exporter configuration to allow aggregation and
  temporality selectors to be optional.
* Update prometheus exporter to match new metrics data

Example changes:
* Update otlp metrics and prometheus examples.
* Remove basic example as we should be focusing on the OTLP variants
2023-03-28 11:31:44 -07:00
Zhongyang Wu 879d6ff9d2
release(v0.19): add initial change log (#965)
* release(v0.19): add initial change log until e10344cbfe

* rebase against master

* update CHANGELOG.md

* update gitmodules

* update gitmodules

* Update CHANGELOG.md

* chore: update CHANGELOG
2023-03-25 19:47:56 -07:00
Glynn 8cc3ee3bd0
fix: Fix the array encoding length of datadog version 05 exporter (#1002)
* Fix the array encoding of datadog version 05 exporter

* Fix type for array length

* Fix unit test

* Fix unit test correctly

* opentelemetry-datadog: Add missing Headers

* Version
* Language

* fix: format

---------

Co-authored-by: Harold Dost <h.dost@criteo.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2023-03-25 14:03:33 -07:00
William Perron 01dade6f97
implement w3c trace context response propagation (#998)
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
2023-03-24 13:58:08 -07:00
Dan Chiarlone 7d56e911e5
fixing typo in jaeger-remote-sampler/README.md (#1003) 2023-03-23 10:36:33 -07:00
briankung-bpn 480dfced3f
Fix link to kitchen sink example in README.md (#1001) 2023-03-20 23:37:47 -07:00
Brandon Ogle 675de34657
Tonic Interceptor (#901) 2023-03-19 16:36:05 -07:00
Harold Dost 57147b17bf
chore: Update OpenTelemetry Proto Definitions to 0.19.0 (#990)
Signed-off-by: Harold Dost <h.dost@criteo.com>
2023-03-18 11:56:45 -07:00
Jasper Zeng 6e472f846e
feat: add batch config for opentelemetry otlp pipeline (#979) 2023-03-14 10:10:27 -07:00
Cijo Thomas 0d666d4205
Add warning to jaeger docs about future deprecation: (#996) 2023-03-14 10:08:41 -07:00
Dirkjan Ochtman 592e77a8f3
stackdriver: update gRPC schemas (#992) 2023-03-13 21:40:24 -07:00
Cijo Thomas 62450b9bd0
Few leftover fixes for shift to slack (#994) 2023-03-13 13:04:19 -07:00
Cijo Thomas 6e773fe4de
Switch to Slack (#988) 2023-03-12 22:54:02 -07:00
danielschaffel ac5d1e0191
suggestion: CARGO_BIN_NAME instead of unknown_service as default serv… (#991)
* suggestion: CARGO_BIN_NAME instead of unknown_service as default service name

* update: docs for SdkProvidedResourceDetector struct

* use  instead of env::var
2023-03-12 16:15:54 -07:00
Cijo Thomas 496c67750a
Fix Lint check CI by removing unneccesary conversion (#987) 2023-03-10 16:05:00 -08:00
Cijo Thomas cf84914d8b Minor format update to maintainer and approver list 2023-03-10 17:29:11 +01:00
Dirkjan Ochtman af21beab84
Update some dependencies (#969)
* Update some dependencies

* chore(otlp, stackdriver): add msrv in stackdriver. Update OTLP dependencies.

* chore(jaeger): update jaeger's dependencies

* chore: bump MSRV to 1.60. (#2)

Tonic 0.8 requires MSRV > 1.60

---------

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2023-03-08 20:01:34 -08:00
Zhongyang Wu 6500d04883
doc(sdk): make `JaegerRemoteSampler` public, revise doc (#975)
* doc(sdk): make `JaegerRemoteSampler` public, revise doc

* Update README in examples
2023-02-27 12:36:34 -08:00
Jasper Zeng acd061de37
feat: add otel_scope_info and scope labels (#974)
* feat: add scope attr

* feat: add scope attr

* feat: add scope attr

* feat: must have version scope

* feat: add scope metric info

* feat: add test

* style: rust fmt

* style: rust fmt

* feat: change disable_scope_info to with_scope_info, and let the default value be true
2023-02-27 12:31:15 -08:00
Harold Dost 10b0c4c44b
Add list of maintainers to CONTRIBUTING.md (#973)
* In an effort provide a bit more transparency. This contains a list of
  the maintainers and approvers name and GitHub handles.

Relates #844

Signed-off-by: Harold Dost <h.dost@criteo.com>
2023-02-26 15:30:29 -08:00
Harold Dost 931faea51a
Fix Typo in docs (#971) 2023-02-19 11:12:58 -08:00
Eduardo Canellas e10344cbfe
docs: improve `SdkProvidedResourceDetector` doc (#964) 2023-02-05 10:30:34 -08:00
SebastiaanYN bfeda30583
Only run ParentBased delegate sampler when there is no parent (#948)
* Only run ParentBased delegate sampler when there is no parent

* fix(trace): add test and fix lint issue

---------

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2023-01-31 12:14:15 -08:00
Julian Tescher 26ba27fb96
Update semantic conventions to spec version 1.17.0 (#960) 2023-01-29 13:01:02 -08:00
Zhongyang Wu 99d197d67e
chore: fix lint issues in 1.67 (#959) 2023-01-28 19:20:02 -08:00
Jasper Zeng a82d970a0e
fix: prometheus counters should have _total suffix (#952) 2023-01-28 19:05:45 -08:00
Julian Tescher 01564afcd1
Report otlp http export errors (#945) 2023-01-28 18:15:30 -08:00
Zhongyang Wu a5d80bdbf1
chore(common): bumpe MSRV to 1.57 (#953)
* chore(common): bump MSRV to 1.57

* test(semcov): fix doc tests

* test(trace): add unit test for jaeger remote sampler.

* additional line for EOF
2023-01-24 14:56:23 -08:00
Francesco Ceccon 0ef87ad78a
Fix formatting in ShouldSample docs (#951) 2023-01-23 21:15:48 -08:00
Zhongyang Wu 482edb69e1
fix(metrics): remove in_memory settings (#946)
* feat(metrics): remove memory settings.

memory setting is used to control whether to keep the instruments if there are no updates in this collection internal.

This should instead configure via temporality.
memory = true -> Cumulative
memory = false -> Delta

* test(metrics): add tests for temporality

* fix(metrics): test

* test(metrics): adding more tests
2023-01-23 21:14:54 -08:00
Julian Tescher a095a6aff2
Update semantic conventions (#944) 2023-01-19 10:41:25 -08:00
bestgopher b67a873181
export MetricsExporterBuilder (#943) 2023-01-15 10:53:42 -08:00
Zhongyang Wu c3b1056e0e
chore(jaeger): include length of packet on `SizeLimit` error message & support IPv6 in sync uploader (#938)
* chore(jaeger): update error messages to show details when on UDP size limit errors.

* chore(jaeger): support Ipv6 address for sync uploader
2023-01-02 22:38:56 -08:00
Maxime David 780dfb1e51
feat(datadog): support for unified tagging (#931)
* feat(datadog): support for universal tagging

* universal->unified

* remove blank line

* refctor Mapping

* pr comments
2022-12-31 18:07:43 -08:00
Maxime David b9319be275
feat(datadog): support for unified tagging (#931)
* feat(datadog): support for universal tagging

* universal->unified

* remove blank line

* refctor Mapping

* pr comments
2022-12-31 18:07:28 -08:00
Zhongyang Wu a7263eed4e
fix(otlp): metadata is not set correctly (#937)
* chore(common): fix lint issue with 1.66

* fix(otlp): fix the metadata issue
2022-12-26 20:24:38 -08:00
William Perron bf5ca2f01d
Implement Display on Baggage (#921) 2022-12-12 09:43:42 -08:00
Jack eaa33d4e89
fix(datadog): Update msgpack accounting for sampling_priority (#903)
When @rex-remind101 added 3806258ee5 he didn't
update the length of the map encoded as msgpack.

This increases the numbers so that the messages are valid. I've
confirmed this fixes v0.3 protocol messages, and updated tests to
reflect the changes.

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2022-12-10 19:57:47 -08:00
Zhongyang Wu 906e44f89b
chore(proto): update proto generated files (#933)
* chore(proto): update proto generated file

* chore(proto): update proto generated file
2022-12-10 18:46:34 -08:00
Zhongyang Wu 44b90202fd
chore(common): fix deny. (#919)
* chore(common): fix deny.

Most of the warnings from deny are unmaintained/deprecated create which we depend on indirectly either in dev or build

I don't believe there are any action item for us to fix them.

Also split the doc as separate task in CI. It's confusing to fail the coverage because of the doc failures

* set log level of cargo deny to error

* remove unnecessary entry in deny.toml

* chore: generate proto files

* address comments

* try to fix unsoundness and manually ignore them one by one if needed

* fix(sdk): ignore error if the channel has already shutdown
2022-12-03 13:22:36 -08:00
Coenen Benjamin 3820284d5a
add response headers in response for HttpClient implementations (#918)
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2022-11-28 18:52:11 -08:00
themanforfree 6078e32ab4
handle parent_span_id in jaeger_json (#907) 2022-11-19 11:51:20 -08:00
Bryn Cooke f12cfa7c57
Improve OTLP environment variable handling (#912)
* Improve OTLP environment variable handling
OTLP exporter default endpoint changed to http

There are a couple of places that the OTLP exporter differed from the spec https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md

1. OTEL_EXPORTER_OTLP_PROTOCOL was not supported.
2. The default endpoint used https rather than http.

The following has changed:
1. OTEL_EXPORTER_OTLP_PROTOCOL is supported.
2. If http-proto feature is enabled the default will be to use http-proto rather than grpc.
3. The default endpoint will be set according to the default protocol.
4. The default endpoint uses http rather than https.
5. Tests added.

Fixes #909 #908

* Lint fixes

* Fix changelog PR number
2022-11-12 14:26:05 -08:00
Zhongyang Wu 904329051d
fix(common): 1.65 clippy issue (#911)
- fix new clippy issues with 1.65
- Update generate files
- Update `patch_dependencies.sh`. `cargo update` now automatically downgrade the `time` create a compatible version.
- Remove `--verbose` in `cargo test` in `msrv`
2022-11-07 20:59:27 -08:00
Gary White Jr 5ad9dcdf91
Headers on exporters (#896)
* headers in otlp exporters

* tonic specific headers and grpc patch

* typo

* fmt

* more linting / fmt

* fixed metadata insert -- lesson learned, headers are the way to go :P

* woopsie, fmt

* move headers to their own fn, patch for tonic

* when not compiling with tls lint fails -- try again

* oof I'm pretty sure something else will happen

* tls flag

* get_or_insert
2022-11-01 21:27:36 -07:00
bakape 2d9739bd43 fix `cargo doc` failing on stable Rust 2022-10-30 07:11:35 +01:00
Zhongyang Wu d421aabddf
feat(trace): add TelemetryResourceDetector (#899) 2022-10-23 17:48:25 -07:00
Bryn Cooke 5efe37aeb7
Add `CollectorPipeline::build_collector_exporter` (#895) 2022-10-15 14:45:56 -07:00
Mikhail Katychev 0d05be33f4
added WithContext to the public api of opentelemetry-api (#893) 2022-10-11 15:07:08 -07:00
Sascha Grunert 1faeabc82a
Fix `otel-collector-config.yaml` for insecure Jaeger connections (#892)
The latest exporter deployment will complain about the invalid
configure ion, which now has moved to a new `tls` key.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-10-11 10:36:33 -07:00
Takumi Shimada be3165b2b3
add public functions for AWS trace header (#887)
* add public functions for AWS trace header

* fix clippy warning

* Update opentelemetry-aws/src/lib.rs

Co-authored-by: Dirkjan Ochtman <dirkjan@ochtman.nl>

* Update opentelemetry-aws/src/lib.rs

Co-authored-by: Dirkjan Ochtman <dirkjan@ochtman.nl>

* Update opentelemetry-aws/src/lib.rs

Co-authored-by: Dirkjan Ochtman <dirkjan@ochtman.nl>

* address review comments

* address review comments

* remove unwrap

* add document

Co-authored-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
2022-10-03 20:17:14 -07:00
Zhongyang Wu d571b24ad1
feat(proto): remove build script and generate files using unit tests. (#881) 2022-09-30 12:07:51 -07:00
Zhongyang Wu cde31ec2b4
feat(metrics): add instrument validation to `InstrumentBuilder`. (#884)
[spec](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#general-characteristics) describes some general rule on instrument configurations. This PR add those validation and throw errors when any of them fails.
2022-09-30 12:06:56 -07:00
Zhongyang Wu e5ef3552ef
fix(datadog): send resource along with attributes (#880)
* fix(datadog): send resource along with attributes

* fix(common): coverage script
2022-09-18 17:09:12 -07:00
Julian Tescher d4b9befea0
Match API and SDK crate name underscores (#875) 2022-09-12 19:31:09 -07:00
Julian Tescher b9e6e64776
Add api and sdk crate descriptions (#874) 2022-09-11 20:52:11 -07:00
Julian Tescher 2e1de571c3
Prepare for v0.18.0 release (#779) 2022-09-11 17:13:12 -07:00
Harold Dost 6c1e487658
Perform sampling as explained in the specification. (#839)
Sampling should always defer to the existing sampler. The logic before
this patch reflected something similar to what is described in the
ParentBased sampler.

Signed-off-by: Harold Dost <h.dost@criteo.com>
2022-09-09 13:52:58 -07:00
Julian Tescher ffe1fbbe62
Fix span processor exporting unsampled spans (#871)
Currently span processors will send span data to exporters even if the
sampled flag is false. This patch fixes this by explicitly checking the
sampled state in both the batch and simple span processors.
2022-09-06 10:52:47 -07:00
David Schmitt a57993cdf3
Cleanup external-otlp examples (#872)
* Fix comment header to use simpler language
* Fix comment header to refer to correct binary
* Coalesce use statements
* Update env_logger to 0.9.0
* ensure that both examples are formatted the same
2022-09-05 10:55:00 -07:00
Jasper Zeng 0e6e67e1a2
Feat: add with_batch_processor_config for jaeger pipline (#869)
* feat: add function to set BatchConfig

* feat: add set_batch_config to HasRequiredConfig trait

* feat: add with_batch_processor_config for CollectorPipeline

Signed-off-by: zengxilong <zengxilonglh@gmail.com>

* feat: add with_batch_processor_config for AgentPipeline

Signed-off-by: zengxilong <zengxilonglh@gmail.com>

* add test

Signed-off-by: zengxilong <zengxilonglh@gmail.com>

* feat: add comments

Signed-off-by: zengxilong <zengxilonglh@gmail.com>

* fix comments

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>

Signed-off-by: zengxilong <zengxilonglh@gmail.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2022-09-01 17:54:45 -07:00
Zhongyang Wu 9ea1ee77af
chore(common): bump MSRV to 1.56 (#866)
* chore(common): bump MSRV to 1.56

* chore(common): bump edition to 2021

* fix(jaeger): clippy issue

* fix: patch_depencencies.sh -> patch_dependencies.sh
2022-09-01 00:36:37 -07:00
Hargo Khalsa 043e4b7523
Fix XrayPropagator when no header is present (#867) 2022-08-26 17:01:25 -07:00
Zhongyang Wu c92a1ad5af
fix(common): clippy issues raised by 1.63 (#862)
* fix(common): clippy issue raised by 1.63

* fix(common): nightly issues

* fix(jaeger): take self reference for `collector_password`

* fix(common): pin serde to 1.0142 as workaround of https://github.com/rust-lang/cargo/issues/10954

* fix(doc): fix type link in docs
2022-08-13 18:47:28 -07:00
Filip Kieres aec7d0b643
Update tonic -> 0.8.0 (#859) 2022-08-09 22:56:10 -07:00
Tomek Karwowski 399404d9b3
feat: implementation of collector http client with pure hyper (#853) 2022-08-08 08:04:52 -07:00
Velichko Anton c15b2f1484
Customisation support in Jaeger Propagator. (#852) 2022-08-05 13:31:00 -07:00
Devin c04b6baf1a
Add IPv6 support for Jaeger agent addresses (#856) 2022-08-03 13:57:12 -07:00
Zhongyang Wu d65d5455c5
feat(jaeger): remove internal message queue between exporter and exporting tasks (#848) 2022-07-25 12:32:39 -07:00
Julian Tescher f20c9b4054
Update metrics API and SDK (#819)
This change aligns metrics with the spec, changes include:

* Rename `MeterProvider::meter` to `MeterProvider::versioned_meter` for
  consistency with `TracerProvider` trait.
* Move metrics sdk api types to `opentelemetry-sdk`
* Consolidate instrument builders into `InstrumentBuilder`
* Remove value observers and add gauges.
* Move from batch observer to registered callbacks.
* Rename `ExportKindFor` to `TemporalitySelector`
* Consolidate `PushController` and `PullController` into
  `BasicController`
* Remove `MinMaxSumCountAggregator` and `ArrayAggregator`
* Update examples and exporters for new api/sdk
2022-07-25 09:05:35 -07:00
Weiwei Lin 8df4f49a48
[stackdriver] fix LogEntry.trace not populated correctly (#850) 2022-07-25 05:47:21 -07:00
Weiwei Lin be0e1f6416
[stackdriver] add MonitoredResource::CloudRunRevision (#847) 2022-07-23 12:11:17 -07:00
Y.Matsuda f7bbbdd6e3
Add `SpanExporter::ForceFlush` and default implementation (#845) 2022-07-23 12:08:20 -07:00
Harold Dost ae00d344a9
Add Quick Reference Table for Users (#840)
* Allows at a glance for prospective users to know our current status.

Signed-off-by: Harold Dost <h.dost@criteo.com>
2022-07-16 13:21:24 -07:00
Aleksey Kladov ab7bce3370
chore: cleanup pin-project dep (#830)
* remove pin-project from crates which weren't actually using it
* switch to pin-project-lite to improve compilation time and impose
  fewer deps at consumers (ecosystem migrated to -lite awhile ago
  https://github.com/tokio-rs/tokio/pull/1778)
2022-07-16 13:18:37 -07:00
Harold Dost 63b7350376
Allow for custom samplers to be used with Parent (#833)
This adds the ability for users to combine custom samplers with the built-in Parent-Based Sampler.

Signed-off-by: Harold Dost <h.dost@criteo.com>
2022-07-16 12:23:44 -07:00
Nicholas Wehr f0682a9a46
Support rustls in jaeger reqwest collector (#834) 2022-07-16 12:20:55 -07:00
Zhongyang Wu b3e6e6a1f1
chore(jaeger): add integration tests to github action. (#835) 2022-07-12 09:50:45 -07:00
Harold Dost 2bb8eab172
sdk: Update sampling documentation (#807)
* Move Sampling header into `Sampler`
* Enrich classes to have links in tracing module

Relates #800

Signed-off-by: Harold Dost <github@hdost.com>
2022-07-09 12:12:46 -07:00
Julian Tescher c13a11e62a
Fix span processor stream import (#831) 2022-07-04 11:18:41 -07:00
Zhongyang Wu 20e46eebff
fix(jaeger): reqwest client runs inside a non-tokio runtime (#829) 2022-07-03 18:29:06 -07:00
Zhongyang Wu 703059a4e0
feat(trace): jaeger remote sampler (#797) 2022-07-03 18:04:03 -07:00
Zhongyang Wu 103ed3aed8
fix(common): revert MSRV to 1.49 (#827)
* fix(msrv): revert MSRV to 1.49

* fix: format
2022-06-29 00:46:48 -04:00
Daniel Bloom b5c3ec62e0
fix: update `dashmap` to avoid soundness hole (#818)
xacrimon/dashmap#167 has a soundness hole pre `5.1.0`.
2022-06-27 15:16:19 -07:00
Dirkjan Ochtman 70fa71e13c
Replace lazy_static with once_cell in library crate dependencies (#824) 2022-06-27 14:00:23 -07:00
Dirkjan Ochtman 67dcbc6ec5
stackdriver: reduce boilerplate in key mapping (#826) 2022-06-27 13:58:45 -07:00
Dirkjan Ochtman 39717b14df
stackdriver: update tonic and prost (#825) 2022-06-27 09:47:03 -07:00
Julian Tescher f07ad27f1f
Allow ref counted keys and values (#821)
This updates attribute `Key` and `Value` inner types from `Cow<'static, str>`
to a new private `OtelString` enum to support static, owned, or ref counted
values.
2022-06-25 14:21:15 -07:00
Philipp Oppermann 0435f21561
Set license metadata for new `-api` and `-sdk` subcrates (#822) 2022-06-24 12:08:06 -07:00
Zhongyang Wu e33859f475
msrv: bump from 1.49 to 1.55 (#811) 2022-06-21 16:08:11 -04:00
Gary White Jr 532333f45c
automatically add traces / metrics paths (#806)
* automatically add traces / metrics paths

* Update opentelemetry-otlp/src/span.rs

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>

* fmt

* merge from upstream

* more formatting -- oops

* sometimes compilation doesn't use timeout

* remove fromstr

* ah, import only when using 'grpc-tonic'

* formatting for rustdoc links

* fmt

* _timeout instead of timeout

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2022-06-20 18:10:29 -04:00
Zhongyang Wu 2585d109bf
style(http): re-export types in trait. (#798) 2022-06-15 18:34:30 -07:00
Lindsay Roberts cd3898d524
opentelemetry-jaeger: Fix clearing span context in Propagator (#810)
When `Propagator::extract_with_context()` is run with an Extractor empty
of trace metadata, it returns a null (invalid) Context, clearing
TraceId, and disabling downwards propagation. As there is already an
implicit TraceId (if we're in a Span), we'd like to use it, traces have
to start somewhere.

This just aligns the mechanics with opentelemetry-sdk: if span
extraction errors out we return a clone of the existing context.
2022-06-15 18:31:30 -07:00
Atanas Yankov 4b122f988d
Bump actix-web examples' dependencies (#812) 2022-06-15 18:25:53 -07:00
Georg Semmler bf61775039
Implement a jaeger JSON file exporter a suggested in #804 (#814) 2022-06-15 18:23:10 -07:00
Rex 3806258ee5
feat(datadog): add sampling priority tag in datadog spans (#792)
* [dd-metrics-encode] encode sampling priority into metrics object of data dog exported data. data dog uses this to sample.

* [dd-metrics-encode] resolve ci issues by bumping msrv version

* [dd-metrics-encode] resolve ci issues by bumping msrv version to 1.59
2022-06-10 19:11:26 -04:00
Gus Wynn 7c3a489607
consolidate basic-otlp* examples docker-compose setups (#802)
* consolidate basic-otlp* docker-compose setups

* just copy the docker-compose setup

* Update examples/basic-otlp/Dockerfile

* fix: bump the MSRV to 1.59

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2022-06-09 00:26:29 -04:00
Xavier Tao 1f84f4affc
Update Cargo.toml (#803)
I propose to fix the lower bound of `indexmap` to `1.8` as versions below `1.7` are not compiling. I get the following error: 

```
error[E0432]: unresolved imports `indexmap::map::IntoKeys`, `indexmap::map::IntoValues`
 --> /home/peter/.cargo/git/checkouts/opentelemetry-rust-458e5dd530230e7a/a767fd3/opentelemetry-api/src/trace/order_map.rs:3:29
  |
3 |     Drain, Entry, IntoIter, IntoKeys, IntoValues, Iter, IterMut, Keys, Values, ValuesMut,
  |                             ^^^^^^^^  ^^^^^^^^^^ no `IntoValues` in `map`
  |                             |
  |                             no `IntoKeys` in `map`

error[E0599]: no method named `into_keys` found for struct `IndexMap` in the current scope
  --> /home/peter/.cargo/git/checkouts/opentelemetry-rust-458e5dd530230e7a/a767fd3/opentelemetry-api/src/trace/order_map.rs:95:16
   |
95 |         self.0.into_keys()
   |                ^^^^^^^^^ method not found in `IndexMap<K, V, S>`

error[E0599]: no method named `into_values` found for struct `IndexMap` in the current scope
   --> /home/peter/.cargo/git/checkouts/opentelemetry-rust-458e5dd530230e7a/a767fd3/opentelemetry-api/src/trace/order_map.rs:111:16
    |
111 |         self.0.into_values()
    |                ^^^^^^^^^^^ method not found in `IndexMap<K, V, S>`

error[E0308]: mismatched types
   --> /home/peter/.cargo/git/checkouts/opentelemetry-rust-458e5dd530230e7a/a767fd3/opentelemetry-api/src/trace/order_map.rs:561:29
    |
561 |         Self(IndexMap::from(arr))
    |                             ^^^ expected struct `IndexMap`, found array
    |
    = note: expected struct `IndexMap<K, V>`
                found array `[(K, V); N]`

error[E0308]: mismatched types
   --> /home/peter/.cargo/git/checkouts/opentelemetry-rust-458e5dd530230e7a/a767fd3/opentelemetry-api/src/trace/order_map.rs:647:29
    |
647 |         Self(IndexMap::from(arr))
    |                             ^^^ expected struct `IndexMap`, found array
    |
    = note: expected struct `IndexMap<Key, Value>`
                found array `[(Key, Value); N]`

Some errors have detailed explanations: E0308, E0432, E0599.
For more information about an error, try `rustc --explain E0308`
```
2022-05-23 22:44:28 -07:00
Luca Palmieri a767fd3a7f
Allow O(1) get operations for SpanBuilder::attributes [breaking] (#799)
* Use index_map::IndexMap instead of Vec<KeyValue> to store SpanBuilder's attributes.

* Test suite compiles.

* Rustfmt

* Wrap IndexMap to expose only the methods that are insertion-order preserving.

* Raise MSRV to 1.51 to get support for const generics.

* Fix doctest.

* Fix lint.

* Add specialised implementations to make it easier to work with KeyValue iterators/collections.

* Bump MSRV to get access to array::map.

* Minimise breakages for existing users.

* Fix invocation.

* Rustfmt
2022-05-20 23:40:54 -04:00
Joe Wilm 75348915b5
Support concurrent exports (#781)
* Add support for concurrent exports

Applications generating significant span volume can end up dropping data
due to the synchronous export step. According to the opentelemetry spec,

    This function will never be called concurrently for the same exporter
    instance. It can be called again only after the current call returns.

However, it does not place a restriction on concurrent I/O or anything
of that nature. There is an [ongoing discussion] about tweaking the
language to make this more clear.

With that in mind, this commit makes the exporters return a future that
can be spawned concurrently. Unfortunately, this means that the
`export()` method can no longer be async while taking &mut self. The
latter is desirable to enforce the no concurrent calls line of the spec,
so the choice is made here to return a future instead with the lifetime
decoupled from self. This resulted in a bit of additional verbosity, but
for the most part the async code can still be shoved into an async fn
for the ergonomics.

The main exception to this is the `jaeger` exporter which internally
requires a bunch of mutable references. I plan to discuss with the
opentelemetry team the overall goal of this PR and get buy-in before
making more invasive changes to support this in the jaeger exporter.

[ongoing discussion]: https://github.com/open-telemetry/opentelemetry-specification/issues/2434

* SpanProcessor directly manages concurrent exports

Prior, export tasks were run in "fire and forget" mode with
runtime::spawn. SpanProcessor now manages tasks directly using
FuturesUnordered. This enables limiting overall concurrency (and thus
memory footprint). Additionally, flush and shutdown logic now spawn an
additional task for any unexported spans and wait on _all_ outstanding
tasks to complete before returning.

* Add configuration for BSP max_concurrent_exports

Users may desire to control the level of export concurrency in the batch
span processor. There are two special values:

    max_concurrent_exports = 0: no bound on concurrency
    max_concurrent_exports = 1: no concurrency, makes everything
    synchronous on the messaging task.

* Implement new SpanExporter API for Jaeger

Key points
- decouple exporter from uploaders via channel and spawned task
- some uploaders are a shared I/O resource and cannot be multiplexed
    - necessitates a task queue
    - eg, HttpClient will spawn many I/O tasks internally, AgentUploader
      is a single I/O resource. Different level of abstraction.
- Synchronous API not supported without a Runtime argument. I updated
  the API to thread one through, but maybe this is undesirable. I'm also
  exploiting the fact in the Actix examples that it uses Tokio under the
  hood to pass through the Tokio runtime token.
- Tests pass save for a couple of flakey environment ones which is
  likely a race condition.

* Reduce dependencies on futures

The minimal necessary futures library (core, util, futures proper) is
now used in all packages touched by the concurrent exporters work.

* Remove runtime from Jaeger's install_simple

To keep the API _actually_ simple, we now leverage a thread to run the
jaeger exporter internals.

* Add Arc lost in a rebase

* Fix OTEL_BSP_MAX_CONCURRENT_EXPORTS name and value

Per PR feedback, the default should match the previous behavior of 1
batch at a time.

* Fix remaining TODOs

This finishes the remaining TODOs on the concurrent-exports branch. The
major change included here adds shutdown functionality to the jaeger
exporter which ensures the exporter has finished its tasks before
exiting.

* Restore lint.sh script

This was erroneously committed.

* Make max concurrent exports env configurable

OTEL_BSP_MAX_CONCURRENT_EXPORTS may now be specified in the environment
to configure the number of max concurrent exports. This configurable now
has parity with the other options of the span_processor.
2022-05-16 21:56:00 -04:00
Julian Tescher 02e15b2f7b
Switch to static resource references (#790)
The spec suggests all spans should have an associated `Resource`. This
change switches trace config and span data from `Option<Arc<Resource>>`
to `Cow<'static, Resource>` and removes `Config::with_no_resource` to
accommodate this requirement.
2022-05-02 11:10:58 -04:00
Nikhil Benesch 90a70eeea2
opentelemetry-otlp: upgrade to tonic 0.7 (#783)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2022-05-01 10:46:49 -04:00
Zhongyang Wu f4f8d586b4
fix(datadog): parse the endpoint to remove tailing slash. (#787) 2022-04-29 17:30:24 -04:00
Zhongyang Wu fdf6401af5
feat(common): add schema_url to resource. (#775)
* feat(common): add schema_url to resource.

* doc(common): update links in doc.

* fix(common): typo

* fix(common): return Option for schema_url

* fix(common): use &str for better performance.

* make clippy happy
2022-04-17 14:49:32 -04:00
Srikanth Chekuri 74d0c2d139
Add `set_attributes` method for `Span` (#638)
This adds the convenience method `Span::set_attributes` to set multiple
attributes at a time.

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-04-17 12:42:33 -04:00
Will Eaton 999474a77c
fix typo (#778) 2022-04-10 14:45:44 -04:00
Julian Tescher a8d4cde043
Remove unnecessary string allocations from examples (#777) 2022-04-10 13:42:56 -04:00
Zhongyang Wu a474268aa9
fix(contrib): rename binary propagator's functions. (#776) 2022-04-09 11:23:31 -07:00
Zhongyang Wu 89c147ecf2
feat(datadog): allow custom mapping in datadog. (#770)
* feat(datadog): allow users to override the model.

* feat(datadog): allow users to override the model.

* feat(datadog): allow users to override the model mapping.

* feat(datadog): update submodule

* feat(datadog): update submodule

* doc(datadog): clean up docs
2022-03-28 22:26:51 -04:00
Julian Tescher d55574171a
Update sdk trace docs (#769) 2022-03-27 21:33:46 -04:00
Vibhav Pant 655b5af16b
Update opentelemetry-proto definitions to v0.14.0 (#768) 2022-03-23 16:30:03 -07:00
Julian Tescher 11af0ae0c1
api: clean up trace docs (#765) 2022-03-20 11:58:43 -04:00
Rohith Venkat 3140cfdb15
Move `TracerProvider::force_flush` to SDK (#658)
Co-authored-by: Rohith VenkataRamanaNanthan <rohith.v@thoughtworks.com>
2022-03-19 20:42:47 -04:00
Saul 69534d16ad
docs: link to the otlp crate doc for kitchen sink (#763)
Replace link to the kitchen sink example with the local OTLP one, as it was pointing to the Jaeger one instead since https://github.com/open-telemetry/opentelemetry-rust/pull/618 was merged.
2022-03-19 12:39:09 -04:00
Zhongyang Wu e9860e994d
jaeger: consolidate the config errors (#762)
* fix(jaeger): use `ConfigError` for all errors from pipeline/configurations.

* refactor(jaeger): add docs, removed some error types.

- Fix some typo in exporter docs
- Add docs for propagator.
2022-03-17 22:16:02 -04:00
Julian Tescher 535a1d9fdd
api: replace `StatusCode` and message with `Status` (#760)
The spec defines status as unset, ok, or error with a description. The
current api allows for confusion and misuse by providing invalid
combinations (e.g. `Ok` with a description). This change simplifies the
api and removes these illegal states by moving the status to be an enum
where only the `Status::Error` case accepts a message.
2022-03-13 17:15:58 -04:00
Zhongyang Wu 07047936b4
feat(jaeger): better configuration pipeline. (#748)
* feat(jaeger): better configuration pipeline.

- Separate agent pipeline and collector pipeline. it's now `new_agent_pipeline` and `new_collector_pipeline`
- Add `Configurable` trait to include common attributes shared by agent pipeline and collector pipeline.
- Removed `with_tag` method.
- Make build in http client additive. `surf_collector_client`, `isahc_collector_client`, etc. are now just allow user to choose the http client.

* fix(jaeger): Move CommonConfig and HasRequiredConfig to private mod to meet MSRV requirement. Rename CommonConfig to TransformationConfig.

* chore: make format happy.

* chore: make msrv happy.

* test: add unit tests.

* refactor(jaeger): removed the `Configurable` trait

* fix(jaeger): fix code link
2022-03-13 14:36:35 -04:00
Julian Tescher 7c4545ad4a
api: rename `Span::record_exception` to `Span::record_error` (#756)
This change aligns the error recording methods with Rust's naming
conventions which prefer the term `Error` over `Exception`.

This also removes `Span::record_exception_with_stacktrace` as Rust's
backtrace functionality is not yet stable. Users who wish to record
this data can use `Span::add_event` directly.
2022-03-12 19:29:49 -05:00
Julian Tescher ce6113d472
api: make `TraceStateError` priviate (#755)
This change simplifies the error handling in the `trace` module by
making `TraceStateError` private, and exposing these errors as the more
general `TraceError`.
2022-03-12 18:25:34 -05:00
Julian Tescher 2330d4313f
api: move `SpanKind` display format impl to jaeger (#758)
This format implementation is jaeger specific and not defined in the
otel spec.
2022-03-12 18:19:12 -05:00
Julian Tescher 45a0626cb2
api: unify `Event` and `Link` access patterns (#757)
This makes the data in span `Event`s and `Link`s `pub`, but guards
against future additions by making the structs `non_exhaustive`.
2022-03-12 16:35:47 -05:00
Julian Tescher a451eb3349
semantic-conventions: update to v1.9 spec (#754) 2022-03-12 15:54:09 -05:00
Julian Tescher 75fc04b7f3
Consolidate codecov config (#753) 2022-03-12 14:10:43 -05:00
Zhongyang Wu 027c1f8129
fix(sdk): `meter_with_version` should accept optional parameter for optional parameters. (#752) 2022-03-10 12:44:04 -08:00
Marcus Griep 087fd80aec
chore: reduce Tokio feature demands (#750) 2022-03-08 14:32:44 -05:00
Zhongyang Wu d05489b66f
docs: update msrv to 1.49 to align with the CI (#749) 2022-03-08 03:49:41 -08:00
Zhongyang Wu e09392d688
feat(otlp,sdk): add schema_url to tracer. (#743)
* feat(otlp,sdk): add schema_url to tracer.

* feat(sdk, dynatrace, prometheus, api, datadog, zipkin, proto): add schema_url to InstrumentationLibrary.

* fix: address comments.
2022-03-01 08:38:36 -08:00
Julian Tescher 104d66d799
Remove `Tracer::with_span` (#746)
* Remove `Tracer::with_span`

This method is not part of the trace spec and the same functionality can
be achieved with `mark_span_as_active` or
`Context::current_with_span(span).attach()`.

* Fix dynatrace clippy lints

* fix otlp external example lint

* Fix doc links
2022-03-01 10:27:26 -05:00
Takuya Kajiwara 152daee22c
Update basic-otlp example to show how to set service name (#745) 2022-02-26 15:37:48 -05:00
Carlos 32e542122c
feat(stackdriver): Added mappings from OTel attributes to Google Cloud Traces (#744) 2022-02-23 08:48:35 -05:00
Julian Tescher 5696253044
Move `IdGenerator` to SDK, rename `RandomIdGenerator` (#742)
The [spec] defines `IdGenerator` as part of the SDK. This also renames
the default generator to match other language implementations in calling
the default id generator `RandomIdGenerator`.

[spec]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.9.0/specification/trace/sdk.md#id-generators
2022-02-23 00:59:16 -05:00
Jean-Baptiste Trystram f28265947f
Pull sampling probability from env var `OTEL_TRACES_SAMPLER_ARG` in the default sdk config (#737)
Signed-off-by: jbtrystram <jbtrystram@redhat.com>
2022-02-21 20:05:26 -05:00
Julian Tescher e07cc0383b
Impl default tracer methods and update docs (#740)
Added `Tracer::start_with_context` and `Tracer::span_builder` sensible
default implementations and updated docs.
2022-02-21 20:03:00 -05:00
Julian Tescher 354c83f2b1
Remove `StatusCode::as_str` (#741)
The spec does not define a string representation, this was a
jaeger-specific conversion.
2022-02-21 17:27:06 -05:00
Zhongyang Wu 5f1bd35d08
test(jaeger): setup integration tests for jaeger (#739)
* test(jaeger): add integration test for opentelemtry jaeger

* chore(jaeger): ignore testing harness in code coverage.

* chore(common): add opentelemetry-api and opentelemetry-sdk to coverage.
2022-02-20 13:02:43 -05:00
Julian Tescher cdd8fa0901
Remove serialize feature (#738)
Removes non-spec serialization support to reduce public API surface
area.
2022-02-19 17:15:29 -05:00
Julian Tescher dacd75af20
Split out `opentelemetry-api` and `opentelemetry-sdk` (#735)
* Split out `opentelemetry` crate into api and sdk crates, and re-export
  to maintain existing compatibility.
* Move `util` module to sdk as it was internal and not documented
  publicly.
* Remove api doc tests for now that relied on the sdk.
* Switch default text map propagator to be a noop (allowed by the
  [spec](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/context/api-propagators.md#global-propagators))
* Move `ExportError` and `InstrumentationLibrary` to API.
* Move `SamplingResult` and `SamplingDecision` to trace API.
2022-02-17 13:10:52 -05:00
Harold Dost e108b1e93a
opentelemetry-jaeger: Add Timeout Environment Var (#729)
OTEL_EXPORTER_JAEGER_TIMEOUT is now supported for all cases where a
non-custom HTTP Client is utilized.

Closes #528

Signed-off-by: Harold Dost <github@hdost.com>

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2022-02-15 11:05:32 -05:00
Zhongyang Wu ed71d80264
fix(exmaples): actix web should use `TokioCurrentThread` as runtime (#734) 2022-02-14 15:06:09 -08:00
Harold Dost b695ba1158
Deprecate ValueRecorder in favor of Histogram (#728)
The Metric API Spec is now stable and ValueRecorder was replaced with
Histogram.

* Deprecations - left structs unmarked as clippy threw a fit.
* Update all code examples to use Histograms.
* Remove InstrumentKind::ValueRecorder since it's not part of the API.
** Otherwise we were left with duplicating code int the SDK which does
   exactly the same thing.

Signed-off-by: Harold Dost <github@hdost.com>
2022-02-13 16:27:55 -05:00
Zhongyang Wu aee4249484
docs(proto): add documentation, guard generated types using features (#732)
* docs(proto): add documentation, guard generated types using features

* docs(proto): add doc_auto_cfg.
2022-02-13 15:06:57 -05:00
Harold Dost 0b3b433ce4
opentelemetry-prometheus: Remove deprecate call (#727)
Remove depcecated call to PrometheusExporter::new() which was deprecated
in favor of using ExporterBuilder for new Exporters.

Signed-off-by: Harold Dost <github@hdost.com>

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2022-02-10 20:37:14 -05:00
Harold Dost 60af6e1eff
opentelemetry-zipkin: Add Environment Variables (#718)
As described in https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md
* Add support for:
** OTEL_EXPORTER_ZIPKIN_ENDPOINT
** OTEL_EXPORTER_ZIPKIN_TIMEOUT
* Update Default to use
* Add remove_var to flaky test

Closes #534

Signed-off-by: Harold Dost <h.dost@criteo.com>
2022-02-09 12:53:46 -08:00
Dirkjan Ochtman d818d9bba2
stackdriver: add changelog for 0.14 (#723) 2022-02-07 18:26:44 -05:00
Dirkjan Ochtman 90f6839bb3
stackdriver: some collected fixes for 0.13 release (#722) 2022-02-07 10:36:20 -05:00
Zhongyang Wu 28d13fb3ff
fix dead link in datadog, use `Cow<'static, str>` in `in_span` function, updated protos generated files (#720)
* refactor(proto): update generated files.

* doc(datadog): fix dead link.

* fix(opentelemetry): use Cow<'static, str> for span name in `in_span`.
2022-02-05 20:53:59 -05:00
Matthijs Brobbel 308b60a74b
Add logs to opentelemetry-proto crate (#714)
* Add logs to opentelemetry-proto crate

* Add modified grpcio sources
2022-02-05 12:21:46 -05:00
Zhongyang Wu 561426e4d5
refactor(common): use Cow<'static, str> as message's type in set_status method (#713)
also updated protobuf generated files.

BREAKING CHANGE: For static string passed to `set_stauts`. It doesn't need to convert to String anymore.
2022-01-31 07:58:48 -08:00
Zhongyang Wu 77c0f039f3
[proto] add opentelemetry-proto crates (#710)
* proto: add opentelemetry-proto crate.

Separate generated proto definitions and it's transformation with types in opentelemety into a new crate.

* proto: fix tests.

* proto: add features in proto

* proto: merge upstream

* refactor(otlp,proto): Clean up features and imports

- add the `grpc-tonic` feature
- add the `build-server` feature
- reordered imports in otlp

BREAKING CHANGE: add the `grpc-tonic` feature

* refactor(otlp,proto): remove prost generated files

We can just use tonic generated types without clients.

* refactor(otlp,proto): update submodule

* refactor(otlp): guard trace related code using trace feature

* docs(proto): add proto docs

* feature(proto): update proto version

Update proto version to 0.9. See https://github.com/open-telemetry/opentelemetry-proto/tree/v0.9.0

* refactor(all): merge upstream

* style(all): add one line at the end of files

* fix(examples): fix external-otlp-grpcio-async-std example

Use the new `trace` feature
2022-01-28 17:14:58 -08:00
Julian Tescher d719eaeda5
Prepare for 0.17.0 release (#698) 2022-01-22 11:51:40 -05:00
Dirkjan Ochtman a81c6c6e6c
stackdriver: avoid calling log from inside exporter (#709) 2022-01-20 12:09:46 -05:00
Alex Chi 6d07ff0db7
fix: jaeger collector only works in batch mode (#706) 2022-01-17 23:22:11 -05:00
Zhongyang Wu d03926a4df
fix: rust 1.58.0 warnings and update protos (#707) 2022-01-17 16:30:26 -05:00
Dirkjan Ochtman 605d6c04dd
stackdriver: further improvements (#703)
* stackdriver: reorder items to keep things local

* stackdriver: avoid spawning inside the library

* stackdriver: use a custom error type

* stackdriver: generate protobuf bindings from an integration test
2022-01-13 09:01:11 -08:00
Dirkjan Ochtman 0d116a0d71
stackdriver: implement writing log entries (#702) 2022-01-11 13:34:54 -05:00
Dirkjan Ochtman abd4943ad4
stackdriver: update dependencies (#700) 2022-01-11 12:50:47 -05:00
Dirkjan Ochtman f263dfbce9
Remove authors from crate metadata (see RFC 3052) (#701) 2022-01-11 11:28:40 -05:00
David Pedersen 5d6d000c47
Update tonic, prost, and friends (#660)
* Update tonic, prost, and friends

* Patch tonic to `master` which uses 2018 edition

* remove patch now that tonic is released

* format
2022-01-10 11:52:03 -05:00
Zhongyang Wu 9f3abedd1c
feat: add InstrumentationLibrary to should_sample parameters. (#695) 2022-01-10 10:50:36 -05:00
Julian Tescher a9144091d6
sdk: optimize span creation internals (#693)
* switch from `Option::map` to pattern match in sdk tracer: ~16%
  perf improvement on span creation.
* optimize for common case of single span processor in sdk span: ~1% perf
  improvement on span end

Overall improvement on span start-end benchmark: ~17%
2022-01-09 16:40:47 -05:00
Julian Tescher 0d13190e21
jaeger: update to thrift 0.15 (#697) 2022-01-09 13:43:14 -05:00
Filip Kieres 02ddf1b9ea
Add opentelemetry-dynatrace crate (#679)
* chore: update the NoHttpClient error message

Adds a hint to the error message to make it better understandable to users how to resolve the error

* chore: Use fully qualified stream import (metrics)

* Add opentelemetry-dynatrace crate
2022-01-07 12:06:20 -05:00
Julian Tescher 185ab3c20f
Use fully qualified stream import (#692) 2022-01-04 12:53:50 -05:00
Julian Tescher 47e1f6925b
Fix remaining span id parsing impls (#691) 2022-01-04 12:12:21 -05:00
Julian Tescher f70e104544
Fix broken docs (#688) 2022-01-01 20:32:44 -05:00
Julian Tescher fd480e7e94
trace: spec compliant trace and span ids (#689)
The spec only defines conversions between ids and hex/binary values.
This patch updates the `TraceId` and `SpanId` APIs to be compliant by
removing explicit conversions from u128/u64 (except for test convenience
methods) and adding methods for converting to/from byte arrays and hex
strings.
2022-01-01 17:28:36 -05:00
Julian Tescher 28d2f2897a
trace: switch to parent context references (#687)
Updates `Tracer::start_with_context` to accepet a reference instead of an
owned parent `Context`, and adds `Tracer::build_with_context` to allow a
parent context reference to be passed with a builder as well. This also
removes the need for `SpanBuilder`s to store a context.
2022-01-01 16:57:49 -05:00
Rob Ede 482772f231
Reduce dependency on futures crate (#684) 2021-12-29 05:46:23 -08:00
Julian Tescher 50510e396d
trace: split `tracer` and `versioned_tracer` methods (#682)
The [trace spec] requires that `TracerProvider`s MUST accept optional
`version` and `schema_url` parameters. This introduces ergonomic issues
as rust does not have a variadic solution outside of macros, leading to
many calls with only a single relevant argument (e.g. `tracer(name, None, None)`).

This patch splits the current `TracerProvider::tracer` method into
`TracerProvider::versioned_tracer` which implements the spec mandated
optional fields, as well as a `TracerProvider::tracer` method that
accepts only a `name` parameter as a convenience method for the above
listed common case.

[trace spec]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.4.0/specification/trace/api.md#get-a-tracer
2021-12-24 13:41:44 -05:00
Julian Tescher ec40cd488f
trace: remove unused `Tracer::invalid` method (#683) 2021-12-23 14:59:30 -05:00
Zhongyang Wu 457556bbf5
docs: add examples catalog. (#680) 2021-12-23 11:06:50 -08:00
Zhongyang Wu 5ed5f3e364
fix: clippy warnings in rust 1.57.0 (#678) 2021-12-12 13:16:54 -05:00
Julian Tescher b3fa55361d
Simplify trace core traits (#664)
* Simplify trace core traits

This patch removes the `std::fmt::Debug` and `'static` requirements from
the `TracerProvider`, `Tracer`, and `Span` traits as they are not
generally necessary. `'static` is only required in the global module
context.

* Remove tests that rely on debug impls

* Fix clippy lints

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2021-11-22 12:02:54 -05:00
Lu Ma bfde694319
Add more details in basic-otlp README. (#672)
* Add more details in basic-otlp README.

* Make view result more specific
2021-11-20 10:28:25 -05:00
Zhongyang Wu 3dec6043f5
feat: using `Cow<'static, str>` for instrumentation library. (#670)
It allows users to pass in a `String` if needed, although it will have a performance overhead because we need to clone the string everytime a span gets exported.

User that pass a `'static str` will not be impacted as `Cow::Borrow` just copies the pointer.
2021-11-18 09:54:17 -05:00
Lu Ma f6f69c43f1
Update otel-collector image in basic-otlp-http example (#669) 2021-11-17 20:03:25 -05:00
Zhongyang Wu e606cf1804
Ignore the time/chrono related issue and examples in cargo deny (#671) 2021-11-17 09:51:29 -05:00
Will Brown bd72d1070a
Add with_aggregator_selector for Prometheus (#667)
* Allow set AggregatorSelector on prometheus

* make fn generic
2021-11-14 21:46:18 -05:00
Zhongyang Wu 96e1df98f4
fix: Mapping between Jaeger processes and Otel process. (#663)
* fix: Mapping between Jaeger processes and Otel process.

The spec maps resource tags to process tags and `service.name` entry in resource to be the service name of the process.

####  `Unknown_service` was used as `service.name` process tags even though users provided another name via `with_service_name` function.

Service name serves a special purpose for Jaeger as it requires every span to have a service name. In the open telemetry model, `service.name` is just a resource, which should be provided by users or have a default value but users can override it to be empty.

To address the difference between those two models. We need to answer the following questions.

1. Should we store the service name within the exporter or store it in resource and extract when exporting?
2. What's the priority of different ways to set the service name?
3. Should we report the `service.name` as a process tags/resource for jaeger spans?

In this PR, we implemented the following process
1. We store the service name as part of the `process` field in the exporter
2. The priority of different methods are listed below from high to low
- `with_service_name` method in `PipelineBuilder`
- passing `service.name` resource from `with_trace_config` method in `PipelineBuilder`
- SDK provided service name(it can come from env vars or default `unknown_service`)
3. We append a `service.name` process tag for each Jaeger span

#### Duplicate process tags

Process tags can be set via `with_tags` function in Jaeger pipeline or by the resource within the trace config(`with_trace_config` function in Jaeger pipeline).

We didn't de-duplicate entries from those two functions.

For this problem, we should deprecate the `with_tags` method and asks users to use `with_trace_config` and store the process tags/resource only in one place.

We can store the process tags in either of the following places
- exporter's process tags
- trace config resources

From a performance standpoint, we should store the tags in the exporter's process tags. Jaeger clients only require a process instance for one batch. If we store the tags as resources, we will copy them for each span in the batch, which will be discarded later in Jaeger clients.

However, storing tags in exporters may cause confusion when users install multiple exporters in the tracer provider. Other exporters could get the resource from the trace config while Jaeger exporter will use resources/tags stored in itself.

* fix: deprecated methods

* docs: add docs around tags, process tags and service name.

* fix: make clippy happy
2021-11-09 20:55:01 -05:00
DCjanus 1f2a0753e9
fix: TraceState::valid_key crashes (#665) 2021-11-06 10:31:44 -04:00
Zhongyang Wu 2d37fd1976
fix: detect service.name from OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRIBUTES. (#662)
OTEL_SERVICE_NAME will take priority and if it's not available. We will try to detect the service.name from OTEL_RESOURCE_ATTRIBUTES. If it's also not available. We will use the default one.
2021-10-31 22:14:50 -04:00
Zhongyang Wu d127e949a7
Update grpc files and cargo deny (#659)
* Update grpc generated files.

* Removed chrono dependencies
2021-10-25 22:15:05 -04:00
Julian Tescher 6b3aa02aab
Allow static str and string in span methods (#654)
Improves performance and ergonomics by allowing `&'static str` or
`String` types to be passed to span methods. Also clarifies the
intention behind the object safe trait variants in the global trace
module.
2021-10-23 18:20:04 -04:00
Julian Tescher c92e83d474
otlp: enable directly constructing a SpanExporter (#655)
Currently it is not possible to construct an
`opentelemetry_otlp::SpanExporter` directly. This patch makes both the
builder and the `build_span_exporter` method public so users may
construct one if necessary.
2021-10-18 21:39:58 -04:00
Rafael Fernández López 7403d140d5
examples: add comment why unused variable is relevant (#653)
When checking the examples, make sure that it is explicit for readers
that it's important to bind traces and metrics initialization to
unused variables, so they are not dropped early and will live for the
whole lifetime of the containing block.

Missing to assign to an unused variable will result in an early drop
of the reporting logic, and no traces or metrics will be reported.
2021-10-17 12:40:24 -04:00
Nisheeth Barthwal 9e26b2b30f
export prometheus encoders based on feature (#652) 2021-10-17 12:11:07 -04:00
Daniel (Shijun) Qian 63959b97d0
Change default OTLP/HTTP port number (#649) 2021-10-17 10:54:40 -04:00
Dirkjan Ochtman e589bec4f9
stackdriver: normalize formatting (#646) 2021-10-11 22:23:09 -04:00
Srikanth Chekuri 980e18501a
Fix default resource detection for tracer provider (#641)
* Fix default resource detection for tracer provider

* Fix lint

* Fix test

* More tests

* resource empty optimization
2021-10-07 16:17:19 -04:00
Jan Steinke 542c28a71b
bump prometheus dependency to 0.13 (#644)
* bump prometheus dependency to 0.13

0.13.0

Bug fix: Avoid panics from Instant::elapsed (#406)

Improvement: Allow trailing comma on macros (#390)

Improvement: Add macros for custom registry (#396)

Improvement: Export thread count from process_collector (#401)

Improvement: Add convenience TextEncoder functions to encode directly to string (#402)

Internal change: Clean up the use of macro_use and extern crate (#398)

Internal change: Update dependencies

* also update in example

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2021-10-04 20:49:37 -04:00
Patrice Chalin fdc641868b
Delete website_docs directory (#645)
- Closes #636
2021-10-01 20:57:53 -04:00
Francis Le Roy 2d07745f9f
[OTLP] Changed tonic error message to include the server's message in the error (#642) 2021-10-01 13:00:08 -04:00
MarcusGrass 0be8e3bf1e
Exclude default tonic-build features (#635)
* Exclude default tonic-build features

* Remove now-unnecessary format disable from builder
2021-09-30 23:54:27 -04:00
Dirkjan Ochtman e7ecf58e0b
stackdriver: update gcp_auth dependency (#639) 2021-09-27 21:36:53 -04:00
Zhongyang Wu 32d0576fe0
fix: new lint errors from rust 1.55 (#630)
* fix: new lint errors from rust 1.55

* fix: removed unsed fields.

* fix: removed attributed from bounded sync instruments(counter, recorder, etc.).

We store the attributed directly in the Records when bind the attributes. So there is no need to save it again in the instruments.

* fix: nightly channel's clippy warnings.

Most of them are unused fields.

1. Removed attributes fields in value_recorder and counter.
2. Removed stateful field in PushController.
3. Added two methods for collector_username and collector_password to help users building customer http client with environment variables.
4. Removed default_summary_quantiles and default_histogram_boundaries in prometheus.
5. Renamed the auth field to be _auth. Pending further investigation on whether we should keep this.
6. Removed kind field in MinMaxSumCountAggregator and histogram
2021-09-19 08:03:00 -04:00
Cecile Tonglet 414b3f459f
Implement Serialize & Deserialize for more stuff (#626)
* Implement Serialize & Deserialize for SpanLimits

* More serialize/deserialize

* Credentials (+make it public)

* WIP

* Add Clone to Credentials

* WIP
2021-09-03 03:52:55 -04:00
Cecile Tonglet c02338a1bb
Implement Serialize & Deserialize for Sampler (#622)
* Implement Serialize & Deserialize for Sampler

* WIP

* CLEANUP

* CLEANUP
2021-08-29 19:32:53 -04:00
DCjanus a0899d9ed5
feat: try split batch if payload size larger than max_package_size (#619)
* feat: auto split batch

* recover unexpected delete

* reduce overhead if auto split is off

* improve documentation.

* docs: auto_split

* docs: fix format.

* regenerate protobuf types.

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2021-08-22 21:56:15 -04:00
Rafael Fernández López df01fb3fda
docs: fix opentelemetry-otlp README example (#621) 2021-08-19 10:54:29 -04:00
Zhongyang Wu 1a65a6d08c
fix(doc): replace kitchen sink examples with docs.rs links. (#618)
* Add codecov.yml to ignore generated code
* Update opentelemetry-jaeger CHANGELOG.md, add upgrade note.
2021-08-17 11:32:07 -04:00
stefvic 39d1989f83
Fix grpc protobuf 2.25.0 version (#614)
* Fix grpc protobuf 2.25.0 version

* Revert gitignore, use global
2021-08-11 01:19:58 -04:00
Julian Tescher 4a649eafea
Prepare for v0.16.0 release (#612) 2021-08-07 11:14:57 -07:00
Lance Austin ccc8fb210c
fixing: renamed `Label` to `Attribute` to align with metric specification (#609)
* fixing: renamed `Label` to `Attribute` to align with metric specification

* Label is still being used when referring to Prometheus labels but when referring to OpenTelemetry metrics the term `attribute` is now used.
* The `opentelemetry-proto` library still has the `labels` field and will be deprecated approximately 3 months from July 1st 2021. At that point we can remove it when collecting metrics ( `labels: vec!()`)

* update change log to reference pr
2021-08-04 20:57:16 -04:00
Zhongyang Wu 0f864fe117
[zpage] initial implementation (#595)
* feat: initial commit for zpages.

* feat: implement span aggregation.

* Added proto.

* We use a dedicated SpanAggregator to collect information from ZPagesProcessor so that we could collect information from multiple span processor in the future should we needed to do so.

* Always copy SpanData information and send it to aggregator. It may seems unnecessary to refresh the information on running span whenever a span is started. But consider that if the span is generating too fast. Some span may fail to notify the aggregator they already ended. So to make sure no span is stuck as running span example. We refresh the running span example whenever there is a new span started.

* feat: merge upstreams changes on span processor.

* feat: add TracezResponse

* refactor: SpanSummary.

We aggregate the information for running spans, error spans and spans in different latencies bucket into SpanStats to better manage them.

* feat: add tracing query handler.

* Updated proto.

* feat: add serialization for TracezResponse.

* feat: improve SpanQueue's performance.

* feat: add tracez functions.

* feat: add examples, add counts in span queue, refactor the tracez queries.

1. We use counts to trace the total number of spans. It's different from the len because len function tracks the number of sampled spans.

2. Added examples on how to query tracez results.

* doc: add documentations.

* fix(doc): Add note that this crate is still in experimental state.
2021-08-03 23:40:16 -04:00
Julian Tescher 93b5a8f4eb
Fix intra-doc-links (#607)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2021-08-03 10:03:58 -04:00
Lance Austin 3a639bf116
feat: add method`from_env` to prometheus exporter builder (#605)
* feat: add method`from_env` to promethes exporter builder

Fixes #293

Allows configuring the `PrometheusExporter` using environment variables defined in the semantic conventions of the Otel specification. Currently, supports setting the host and port for prometheus in the builder and will fall back to the defaults defined in the otel specification.

* addressed feedback in favor of impl `Default` over `from_env`

* fixes clippy lint issues after upgrading to rust 1.54

* convert port from String to u16

An error is logged to the global OpenTelemetry error handling when we fail to parse the port from an OS Environment variable
2021-08-02 20:17:10 -04:00
Zhongyang Wu d3bbfd2bc7
feat: add cargo deny (#604)
* fix(examples): add license to examples' cargo.toml

* feat: add cargo deny for security scan. Update tonic and prost version.

* fix: unpublished all examples explicitly in Cargo.toml. Simplify deny.toml
2021-07-29 23:08:00 -04:00
Max Lehuraux ae4aeb364c
Set client-to-agent UDP comm based on runtime (#599)
* Set client to agent udp comm based on runtime

* Remove commented line

* run cargo fmt

* Fix linting issue

* Fix missing implementation of JaegerTraceruntime for TokioCurrentThread

* Add doc for new flags

* Run tests with r-tokio flag

* Expose JaegerTraceRuntime to API

* Rename uploaders and init functions

Co-authored-by: Julian Tescher <jatescher@gmail.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2021-07-28 21:23:26 -04:00
Zhongyang Wu f07cc5681f
fix(otlp): fix error messages. (#603) 2021-07-25 14:31:16 -07:00
David Ramos 7037f71c4d
Make SpanProcessor::on_start take a mutable span (#601) 2021-07-23 09:57:35 -07:00
David Ramos 197c3884bd
Make SpanRef public (#600) 2021-07-23 09:59:15 -04:00
Zhongyang Wu 55d798e7c2
fix(otlp): upgrade tonic to 0.5. (#597)
* fix(otlp): upgrade tonic to 0.5.

We no longer have a universal type for both client with interceptors and the client without interceptors. So instead of using a interceptors we just add the headers for each request as needed.

* chore: remove tower as dependency.
2021-07-14 10:20:47 -04:00
Zhongyang Wu e7d05e77de
feat: enforce span status code's order. (#593) 2021-07-04 19:25:57 -07:00
Zhongyang Wu 7cfcb2226f
feat: add hash for span context & allow spans to clone and export current state at any time. (#592)
We need hash for span context because zPages implementation need it to move spans around between running, error and finished buckets.

Adding an export_data() function helps the zPages implementation to sample the running spans before they finish.
2021-07-04 18:11:50 -07:00
Mark Ingram be5464350b
MetricsExporterBuilder drops exporter_pipeline (#590)
Fixes basic-otlp example
2021-06-30 10:45:34 -04:00
Zhongyang Wu d6c55d9fc0
Merge OTLP metrics and tracing pipeline (#585)
* feat: merge metrics pipeline into otlp pipeline.

* fix: remove trace config from http exporter builder. Rename XXXPipelineBuilder to XXXExporterBuilder

* fix: rename TraceExporter to SpanExporter. Add docs.

* fix: import

* chore: move exporter related configurations into exporter mod.

* chore: fix imports

* fix: lint issues.

* fix: format

* chore: merge upsteam, fix examples

* docs: update docs.

* feat: throw errors if exporter builder is not provided.

* fix: format.
2021-06-26 00:28:45 -04:00
Julian Tescher 86cf44da3b
Internal trace module refactor (#589)
Simplify module structure by combining small single-type modules into
their parent module.
2021-06-25 23:54:19 -04:00
Julian Tescher 6bc174c6b5
Extract `trace::noop` module and update docs (#587)
Clean up docs by:
* Extracting `trace::noop` to clarify their grouping
* Hide internal `util` module docs
* Clean up trace module docs
* Improve `trace::TracerProvider` docs and include examples
2021-06-25 19:24:48 -07:00
Julian Tescher b58d0956b4
Rename `get_tracer` to `tracer` (#586) 2021-06-25 15:22:54 -07:00
Julian Tescher 068aacc74d
datadog: prepare for v0.3.1 patch release (#582) 2021-06-23 16:04:09 -07:00
Amos Wenger 6e6ab8bd2e
fix(datadog): status_code must be 0 or 1 (#580)
opentelemetry's StatusCode enum can be 0 (Unset), 1 (Ok)
or 2 (Error). otel specification says "don't ever use Ok, just leave it
unset".

So for, non-error spans, the opentelemetry-datadog exporter does the
right thing: it sets the datadog trace's status code to 0.

However, for errors, the opentelemetry-datadog exporter sets the
status_code to 2. This isn't explicitly discouraged by the available
Datadog docs, but it causes something really interesting: the trace
shows up with a "red" left border in Datadog APM (instead of a "green"
one). The "Ok/Error" filter filters those traces correctly. However,
half the UI is missing: when opening the trace, there's no '!' in the
left-hand corner, there's no "Errors (1)" tab, and there's no detail
of the error being shown in a user-friendly way.

tl;dr In the Datadog backend, there's some code that does "status_code
!= 0", and some code that does "status_code == 1". The 2 value isn't set
by their Go exporter, and so the opentelemetry-rust exporter should
never use it.
2021-06-23 11:27:43 -07:00
Xiangyu Zhu 269c8004ff
small performance boost for `Resource.get` (#579)
* small performance boost for `Resource.get`

* fix lint
2021-06-22 08:43:57 -04:00
Julian Tescher f6b11566b2
Add missing crate docs and fix doc url syntax (#577) 2021-06-21 15:15:45 -07:00
Julian Tescher 89297b3341
Rename core to common to match spec (#578)
* Rename core to common to match spec

* Fix test imports
2021-06-20 15:18:43 -04:00
Zhongyang Wu b63fc66129
feat: add default resource in TracerProvider if user didn't provide one. (#571) 2021-06-19 15:26:43 -07:00
Zhongyang Wu db20b9c7dd
fix: clippy issue after upgrade to rust 1.53.0 (#574) 2021-06-18 09:11:28 -04:00
Julian Tescher d7ba1ea4f7
Prepare for v0.15.0 release (#572) 2021-06-17 09:14:00 -07:00
Zhongyang Wu 6834b64192
feat: add more resource detectors (#573) 2021-06-15 21:38:48 -07:00
Julian Tescher efbc842c11
semantic-conventions: update to v1.4.0 spec (#570) 2021-06-09 21:51:48 -04:00
Julian Tescher d70a537548
Update example and optional dependencies (#568)
* Update examples and optional dependencies

* Fix grpcio tests
2021-06-08 22:20:11 -04:00
Zhongyang Wu a2dd6e7779
fix: TraceState cannot insert new key-value pairs. (#567) 2021-06-08 17:03:35 -07:00
Julian Tescher dc7d81fdfa
Update trace flags to match spec (#565)
Remove all trace flags except `sampled` as that is the only supported
flag in the current trace spec. Removes `SpanContext::is_deferred` and
`SpanContex::is_debug` as they are also no longer supported.
2021-06-07 11:25:10 -07:00
Julian Tescher 635f10e15d
Move unit into metrics module (#564) 2021-06-06 16:37:19 -07:00
Julian Tescher 99e51c1980
Update lib and tracing module docs with examples (#563) 2021-06-06 09:54:24 -07:00
Zhongyang Wu 1ca62d337e
feat: allow users to use different channels based on runtime in batch span processor (#560) 2021-06-05 09:15:17 -07:00
Damien Mathieu fb576b0e71
move hyper prometheus example into something runnable (#562) 2021-06-02 10:47:31 -07:00
Zhongyang Wu 1235682a46
Update grpcio version and add the coverage badge (#556) 2021-05-21 14:30:04 -07:00
Zhongyang Wu ebb950a1d9
Fix debug loop, add notes for `#[tokio::test]` (#552)
We choose to break the loop at instrument level because debug info on `Accumulator` can be found via other structs and descriptors seem to be more important for instruments.
2021-05-18 07:42:46 -07:00
Luca Palmieri 88e779d53e
Expose the `Error` type to allow users to set custom error handlers (#551)
Expose the `Error` type in the `global` module to allow users to define their own error handlers. This is currently impossible because `Error` is private and therefore users cannot provide a function that satisfies the constraints of `set_error_handler`.
2021-05-13 12:41:30 -07:00
602 changed files with 82686 additions and 41260 deletions

3
.cargo/config.toml Normal file
View File

@ -0,0 +1,3 @@
[resolver]
# https://doc.rust-lang.org/cargo/reference/config.html#resolverincompatible-rust-versions
incompatible-rust-versions = "fallback"

148
.cspell.json Normal file
View File

@ -0,0 +1,148 @@
// http://cspell.org/configuration/
{
"version": "0.2",
"language": "en,en-US",
"useGitignore": true,
"minWordLength": 4,
"ignorePaths": [
"target/**"
],
// list of words to be ignored. unlike `words` below, these won't be
// suggested as corrections for misspelled words.
"ignoreWords": [
"otel",
"rustdoc",
"rustfilt",
"webkpi"
],
// these are words that are always considered incorrect.
"flagWords": [
"recieve",
"reciever",
"seperate",
"hte",
"teh"
],
// these are words that are always correct and can be thought of as our
// workspace dictionary.
"words": [
"actix",
"Antonsson",
"anyvalue",
"appender",
"appenders",
"autobenches",
"Bhasin",
"Björn",
"BLRP",
"chrono",
"Cijo",
"clippy",
"clonable",
"codecov",
"dashmap",
"datapoint",
"deque",
"Dirkjan",
"docsrs",
"Dwarnings",
"eprintln",
"EPYC",
"flamegraph",
"Gerring",
"grpcio",
"Grübel",
"hasher",
"impls",
"isahc",
"Isobel",
"jaegertracing",
"Kühle",
"Kumar",
"Lalit",
"LIBCLANG",
"logrecord",
"MILLIS",
"mpsc",
"msrv",
"mykey",
"myunit",
"myvalue",
"nocapture",
"Ochtman",
"opentelemetry",
"openzipkin",
"otcorrelations",
"OTELCOL",
"OTLP",
"periodicreader",
"Pillai",
"pprof",
"protos",
"prost",
"protoc",
"quantile",
"quantiles",
"Redelmeier",
"reqwest",
"rstest",
"runtimes",
"rustc",
"rustls",
"schemars",
"semconv",
"serde",
"shoppingcart",
"struct",
"Tescher",
"testcontainers",
"testresults",
"thiserror",
"traceparent",
"Traceparent",
"tracerprovider",
"tracestate",
"UCUM",
"Umesan",
"unsampled",
"updown",
"urlencoding",
"usize",
"Utkarsh",
"webpki",
"Zhongyang",
"zipkin"
],
"enabledLanguageIds": [
"jsonc",
"markdown",
"plaintext",
"rust",
"shellscript"
],
"languageSettings": [
{
"languageId": "jsonc",
"includeRegExpList": [
"CStyleComment"
]
},
{
"languageId": "markdown",
"caseSensitive": false
},
{
"languageId": "rust",
"includeRegExpList": [
"CStyleComment",
"strings"
]
},
{
"languageId": "shellscript",
"includeRegExpList": [
"/#.*/g"
]
}
]
}

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
target/

7
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1,7 @@
# Code owners file
## This file controls who is tagged for review for any given pull request.
## For anything not explicitly taken by someone else
* @open-telemetry/rust-approvers

52
.github/ISSUE_TEMPLATE/BUG-REPORT.yml vendored Normal file
View File

@ -0,0 +1,52 @@
name: Bug Report
description: File a bug report
title: "[Bug]: "
labels: ["bug", "triage:todo"]
projects: ["open-telemetry/opentelemetry-rust"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
value: "A bug happened!"
validations:
required: true
- type: textarea
id: api-version
attributes:
label: OpenTelemetry API Version (i.e version of `opentelemetry` crate)
description: What version of the `opentelemetry` crate are you using?
placeholder: 0.x, 1.x, etc.
validations:
required: true
- type: textarea
id: sdk-version
attributes:
label: OpenTelemetry SDK Version (i.e version of `opentelemetry_sdk` crate)
description: What version of the `opentelemetry_sdk` crate are you using?
placeholder: 0.x, 1.x, etc.
validations:
required: true
- type: dropdown
id: browsers
attributes:
label: What Exporter(s) are you seeing the problem on?
multiple: true
options:
- stdout
- OTLP
- Zipkin
- Prometheus
- N/A
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell

View File

@ -0,0 +1,48 @@
---
name: "Feature Request"
description: Request a feature for the OpenTelemetry Rust implementation.
title: "[Feature]: "
labels: ["enhancement", "triage:todo"]
projects: ["open-telemetry/opentelemetry-rust"]
body:
- type: markdown
attributes:
value: |
Thanks for using our library and trying to make it better!
Before opening a feature request against this repo, consider whether the feature
should/could be implemented in the [other OpenTelemetry client
libraries](https://github.com/open-telemetry/). If so, please [open an issue on
opentelemetry-specification](https://github.com/open-telemetry/opentelemetry-specification/issues/new) first.
- type: textarea
id: related-problem
attributes:
label: Related Problems?
description: Is your feature request related to a problem? If so, provide a concise description of the problem.
placeholder: Include the Issue ID from this or other repos.
validations:
required: false
- type: textarea
id: solution
attributes:
label: "Describe the solution you'd like:"
description: What do you want to happen instead? What is the expected behavior?
placeholder: I'd like the api to ...
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Considered Alternatives
description: Which alternative solutions or features have you considered?
placeholder: Some potential solutions
validations:
required: false
- type: textarea
id: additional-context
attributes:
label: Additional Context
description: Add any other context about the feature request here.
placeholder: Some related requests in other project or upstream spec proposals.
validations:
required: false

11
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,11 @@
contact_links:
- name: GitHub Discussions
url: https://github.com/open-telemetry/opentelemetry-rust/discussions/new/choose
about: Please ask questions here.
- name: Slack
url: https://cloud-native.slack.com/archives/C03GDP0H023
about: Or the `#otel-rust` channel in the CNCF Slack instance.
- name: "⚠️ Report a security vulnerability"
url: "https://github.com/open-telemetry/opentelemetry-rust/security/advisories/new"
about: "Report a security vulnerability."

13
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,13 @@
Fixes #
Design discussion issue (if applicable) #
## Changes
Please provide a brief description of the changes here.
## Merge requirement checklist
* [ ] [CONTRIBUTING](https://github.com/open-telemetry/opentelemetry-rust/blob/main/CONTRIBUTING.md) guidelines followed
* [ ] Unit tests added/updated (if applicable)
* [ ] Appropriate `CHANGELOG.md` files updated for non-trivial, user-facing changes
* [ ] Changes in public API reviewed (if applicable)

15
.github/codecov.yaml vendored
View File

@ -10,3 +10,18 @@ coverage:
default:
target: auto
threshold: 0.5%
ignore:
- "opentelemetry/src/testing" # test harnesses
- "opentelemetry-otlp/src/proto" # auto generated files
- "opentelemetry-proto/src/proto" # auto generated files
# examples below
- "examples"
- "opentelemetry-zipkin/examples"
- "opentelemetry-otlp/examples"
- "opentelemetry-http/examples"
- "opentelemetry-prometheus/examples"
- "opentelemetry-appender-tracing/examples"
- "opentelemetry-appender-log/examples"
# stress test
- "stress"

15
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,15 @@
version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 10
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "monthly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"

59
.github/workflows/benchmark.yml vendored Normal file
View File

@ -0,0 +1,59 @@
# This workflow runs a Criterion benchmark on a PR and compares the results against the base branch.
# It is triggered on a PR or a push to main.
#
# The workflow is gated on the presence of the "performance" label on the PR.
#
# The workflow runs on a self-hosted runner pool. We can't use the shared runners for this,
# because they are only permitted to run on the default branch to preserve resources.
#
# In the future, we might like to consider using bencher.dev or the framework used by otel-golang here.
on:
pull_request:
push:
branches:
- main
name: benchmark pull requests
permissions:
contents: read
jobs:
runBenchmark:
name: run benchmark
permissions:
pull-requests: write
# If we're running on main, use our oracle bare-metal runner for accuracy.
# If we're running on a PR, use github's shared workers to save resources.
runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-latest' || 'oracle-bare-metal-64cpu-512gb-x86-64' }}
if: ${{ (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'performance')) || github.event_name == 'push' }}
container:
image: rust:slim-bullseye
env:
# For PRs, compare against the base branch - e.g., 'main'.
# For pushes to main, compare against the previous commit
BRANCH_NAME: ${{ github.event_name == 'pull_request' && github.base_ref || github.event.before }}
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- name: Setup container environment
run: |
apt-get update && apt-get install --fix-missing -y unzip cmake build-essential pkg-config curl git
cargo install cargo-criterion
- name: Make repo safe for Git inside container
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 10 # Fetch a bit of history so we can do perf diffs
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: boa-dev/criterion-compare-action@adfd3a94634fe2041ce5613eb7df09d247555b87 # v3.2.4
with:
branchName: ${{ env.BRANCH_NAME }}

View File

@ -1,102 +1,261 @@
name: CI
env:
CI: true
permissions:
contents: read
on:
pull_request:
push:
branches:
- main
paths-ignore:
- '**.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
strategy:
matrix:
# test both stable and beta versions of Rust on ubuntu-latest
os: [ubuntu-latest]
rust: [stable, beta]
runs-on: ubuntu-latest
# test only stable version of Rust on Windows and MacOS
include:
- rust: stable
os: windows-latest
- rust: stable
os: macos-latest
- rust: stable
os: ubuntu-22.04-arm
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.rust == 'beta' }}
steps:
- uses: actions/checkout@v1
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- name: Free disk space
if: ${{ matrix.os == 'ubuntu-latest'}}
run: |
df -h
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
df -h
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b
with:
toolchain: ${{ matrix.rust }}
components: rustfmt
profile: minimal
- uses: arduino/setup-protoc@v1
- name: "Set rustup profile"
run: rustup set profile minimal
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test
run: ./scripts/test.sh
run: bash ./scripts/test.sh
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b
with:
toolchain: stable
components: rustfmt
profile: minimal
- uses: arduino/setup-protoc@v1
- uses: actions-rs/cargo@v1
components: rustfmt, clippy
- uses: taiki-e/install-action@0eee80d37f55e834144deec670972c19e81a85b0 # v2.56.0
with:
command: fmt
args: --all -- --check
tool: cargo-hack
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Format
run: cargo fmt --all -- --check
- name: Lint
run: ./scripts/lint.sh
non-default-examples:
run: bash ./scripts/lint.sh
external-types:
strategy:
matrix:
example: [examples/external-otlp-grpcio-async-std]
runs-on: ubuntu-latest
member: [opentelemetry, opentelemetry-sdk, opentelemetry-otlp, opentelemetry-zipkin]
runs-on: ubuntu-latest # TODO: Check if this could be covered for Windows. The step used currently fails on Windows.
steps:
- uses: actions/checkout@v1
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
profile: minimal
- uses: arduino/setup-protoc@v1
- name: Build
run: |
cd ${{ matrix.example }}
cargo build --verbose
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b
with:
# Rust version should be kept in sync with the one the release was tested with
# https://github.com/awslabs/cargo-check-external-types/releases
toolchain: nightly-2025-05-04
components: rustfmt
- uses: taiki-e/install-action@0eee80d37f55e834144deec670972c19e81a85b0 # v2.56.0
with:
tool: cargo-check-external-types@0.2.0
- name: external-type-check
working-directory: ${{ matrix.member }}
run: cargo check-external-types --all-features --config allowed-external-types.toml
msrv:
runs-on: ubuntu-latest
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
continue-on-error: true
steps:
- uses: actions/checkout@v1
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.49.0
override: true
- name: Run tests
run: cargo --version &&
cargo test --verbose --manifest-path=opentelemetry/Cargo.toml --features trace,metrics,serialize,rt-tokio,serde,testing &&
cargo test --manifest-path=opentelemetry-jaeger/Cargo.toml &&
cargo test --manifest-path=opentelemetry-zipkin/Cargo.toml
coverage:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b
with:
toolchain: stable
- uses: taiki-e/install-action@0eee80d37f55e834144deec670972c19e81a85b0 # v2.56.0
with:
tool: cargo-msrv
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check MSRV for all crates
run: bash ./scripts/msrv.sh
cargo-deny:
runs-on: ubuntu-latest # This uses the step `EmbarkStudios/cargo-deny-action@v1` which is only supported on Linux
continue-on-error: true # Prevent sudden announcement of a new advisory from failing ci
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Check advisories
uses: EmbarkStudios/cargo-deny-action@30f817c6f72275c6d54dc744fbca09ebc958599f # v2.0.12
with:
command: check advisories
- name: Check licenses
uses: EmbarkStudios/cargo-deny-action@30f817c6f72275c6d54dc744fbca09ebc958599f # v2.0.12
with:
command: check licenses
- name: Check bans
uses: EmbarkStudios/cargo-deny-action@30f817c6f72275c6d54dc744fbca09ebc958599f # v2.0.12
with:
command: check bans
- name: Check sources
uses: EmbarkStudios/cargo-deny-action@30f817c6f72275c6d54dc744fbca09ebc958599f # v2.0.12
with:
command: check sources
docs:
continue-on-error: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- uses: arduino/setup-protoc@v1
- uses: actions-rs/cargo@v1
with:
command: test
args: -p opentelemetry -p opentelemetry-jaeger -p opentelemetry-zipkin -p opentelemetry-datadog -p opentelemetry-aws --all-features --no-fail-fast
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
- uses: actions-rs/grcov@v0.1
id: coverage
- uses: codecov/codecov-action@v1
with:
file: ${{ steps.coverage.outputs.report }}
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b
with:
toolchain: stable
components: rustfmt
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: doc
run: cargo doc --no-deps --all-features
env:
CARGO_INCREMENTAL: '0'
RUSTDOCFLAGS: -Dwarnings
coverage:
continue-on-error: true
runs-on: ubuntu-latest
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'dependencies') }}
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b
with:
toolchain: stable
components: rustfmt,llvm-tools-preview
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@0eee80d37f55e834144deec670972c19e81a85b0 # v2.56.0
with:
tool: cargo-llvm-cov
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: cargo llvm-cov
run: cargo llvm-cov --locked --all-features --workspace --lcov --lib --output-path lcov.info
- name: Upload to codecov.io
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
fail_ci_if_error: true
build-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # stable
with:
toolchain: stable
components: rustfmt
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build examples
run: |
for example in examples/*; do
if [ -d "$example" ]; then
echo "Building $example"
cargo build
fi
done
cargo-machete:
continue-on-error: true
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b
with:
toolchain: stable
- uses: taiki-e/install-action@0eee80d37f55e834144deec670972c19e81a85b0 # v2.56.0
with:
tool: cargo-machete
- name: cargo machete
run: cargo machete

45
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,45 @@
name: "CodeQL Analysis"
env:
CODEQL_ENABLE_EXPERIMENTAL_FEATURES : true # CodeQL support for Rust is experimental
permissions:
contents: read
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
security-events: write # for github/codeql-action/autobuild to send a status report
strategy:
fail-fast: false
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- name: Initialize CodeQL
uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
with:
languages: rust
- name: Autobuild
uses: github/codeql-action/autobuild@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2

25
.github/workflows/fossa.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: FOSSA scanning
on:
push:
branches:
- main
permissions:
contents: read
jobs:
fossa:
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0
with:
api-key: ${{secrets.FOSSA_API_KEY}}
team: OpenTelemetry

38
.github/workflows/integration_tests.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: integration tests
env:
CI: true
on:
pull_request:
types: [ labeled, synchronize, opened, reopened ]
permissions:
contents: read
jobs:
integration_tests:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- name: Free disk space
run: |
df -h
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
df -h
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b
with:
toolchain: stable
components: rustfmt
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run integration tests
run: ./scripts/integration_tests.sh

View File

@ -0,0 +1,33 @@
name: Markdown link check
on:
pull_request:
push:
branches:
- main
paths:
- '**/*.md'
permissions:
contents: read
jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install markdown-link-check
run: npm install -g "git://github.com/tcort/markdown-link-check.git#ef7e09486e579ba7479700b386e7ca90f34cbd0a" # v3.13.7
- name: Run markdown-link-check
run: |
find . -type f \
-name '*.md' \
-not -path '**/CHANGELOG.md' \
| xargs ./scripts/markdown-link-check-with-retry.sh

53
.github/workflows/ossf-scorecard.yml vendored Normal file
View File

@ -0,0 +1,53 @@
name: OSSF Scorecard
on:
push:
branches:
- main
schedule:
- cron: "50 3 * * 0" # once a week
workflow_dispatch:
permissions:
contents: read
jobs:
analysis:
runs-on: ubuntu-latest
permissions:
# Needed for Code scanning upload
security-events: write
# Needed for GitHub OIDC token if publish_results is true
id-token: write
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
with:
results_file: results.sarif
results_format: sarif
publish_results: true
# Upload the results as artifacts (optional). Commenting out will disable
# uploads of run results in SARIF format to the repository Actions tab.
# https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts
- name: "Upload artifact"
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: SARIF file
path: results.sarif
retention-days: 5
# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
with:
sarif_file: results.sarif

23
.github/workflows/pr_naming.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: PR Conventional Commit Validation
on:
pull_request:
types: [opened, synchronize, reopened, edited]
permissions:
contents: read
jobs:
validate-pr-title:
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- name: PR Conventional Commit Validation
uses: ytanikin/pr-conventional-commits@8267db1bacc237419f9ed0228bb9d94e94271a1d # 1.4.1
with:
task_types: '["build","chore","ci","docs","feat","fix","perf","refactor","revert","test"]'
add_label: 'false'

29
.github/workflows/semver.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: Semver compliance
env:
CI: true
permissions:
contents: read
on:
pull_request:
types: [ labeled, synchronize, opened, reopened ]
jobs:
semver-compliance: # This job uses the latest published crate as baseline for comparison.
runs-on: ubuntu-latest
timeout-minutes: 10
if: ${{ github.event.label.name == 'semver-check' || contains(github.event.pull_request.labels.*.name, 'semver-check') }}
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b
with:
toolchain: stable
components: rustfmt
- name: cargo-semver-checks
uses: obi1kenobi/cargo-semver-checks-action@5b298c9520f7096a4683c0bd981a7ac5a7e249ae # v2.8

6
.gitignore vendored
View File

@ -1,4 +1,10 @@
/.vscode/
/target/
*/target/
**/*.rs.bk
Cargo.lock
/.idea/
.cosine
opentelemetry-otlp/tests/integration_test/result.json

11
.gitmodules vendored
View File

@ -1,7 +1,4 @@
[submodule "opentelemetry-otlp/src/proto/opentelemetry-proto"]
path = opentelemetry-otlp/src/proto/opentelemetry-proto
url = https://github.com/open-telemetry/opentelemetry-proto.git
[submodule "opentelemetry-stackdriver/proto/googleapis"]
path = opentelemetry-stackdriver/proto/googleapis
url = https://github.com/googleapis/googleapis.git
shallow = true
[submodule "opentelemetry-proto/src/proto/opentelemetry-proto"]
path = opentelemetry-proto/src/proto/opentelemetry-proto
url = https://github.com/open-telemetry/opentelemetry-proto
branch = tags/v1.5.0

View File

@ -1,5 +0,0 @@
# Code owners file.
# This file controls who is tagged for review for any given pull request.
# For anything not explicitly taken by someone else:
* @open-telemetry/rust-approvers

View File

@ -1,27 +1,47 @@
# Contributing to opentelemetry-rust
The Rust special interest group (SIG) meets regularly. See the
OpenTelemetry
[community](https://github.com/open-telemetry/community#rust-sig)
repo for information on this and other language SIGs.
The Rust special interest group (SIG) meets weekly on Tuesdays at 9 AM Pacific
Time. The meeting is subject to change depending on contributors'
availability. Check the [OpenTelemetry community
calendar](https://github.com/open-telemetry/community?tab=readme-ov-file#calendar)
for specific dates and for Zoom meeting links. "OTel Rust SIG" is the name of
meeting for this group.
See the [public meeting
notes](https://docs.google.com/document/d/1tGKuCsSnyT2McDncVJrMgg74_z8V06riWZa0Sr79I_4/edit)
for a summary description of past meetings. To request edit access,
join the meeting or get in touch on
[Gitter](https://gitter.im/open-telemetry/opentelemetry-rust).
Meeting notes are available as a public [Google
doc](https://docs.google.com/document/d/12upOzNk8c3SFTjsL6IRohCWMgzLKoknSCOOdMakbWo4/edit).
If you have trouble accessing the doc, please get in touch on
[Slack](https://cloud-native.slack.com/archives/C03GDP0H023).
The meeting is open for all to join. We invite everyone to join our meeting,
regardless of your experience level. Whether you're a seasoned OpenTelemetry
developer, just starting your journey, or simply curious about the work we do,
you're more than welcome to participate!
Even though, anybody can contribute, there are benefits of being a member of our
community. See to the [community membership
document](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md)
on how to become a
[**Member**](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#member),
[**Approver**](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver)
and
[**Maintainer**](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer).
## Pull Requests
### Prerequisites
Crate `opentelemetry-otlp` uses gRPC + Protocol Buffers.<br>
Crate `opentelemetry-otlp` uses gRPC + Protocol Buffers.
You can provide the protocol compiler protoc path programmatically (only works with tonic) or build it from source
```sh
export PROTOC=$(which protoc)
```
It is recommended to use "3.15" or newer of protoc, as some of the proto
definitions include "optional" fields, that are not supported in older versions,
resulting in errors as shown
[here](https://github.com/open-telemetry/opentelemetry-proto/issues/451).
Prerequisites to build the protocol compiler protoc from source
- [protoc](https://github.com/protocolbuffers/protobuf)
@ -34,13 +54,13 @@ Everyone is welcome to contribute code to `opentelemetry-rust` via
GitHub pull requests (PRs).
```sh
$ git clone --recurse-submodule https://github.com/open-telemetry/opentelemetry-rust
git clone --recurse-submodule https://github.com/open-telemetry/opentelemetry-rust
```
Enter the newly created directory and add your fork as a new remote:
```sh
$ git remote add <YOUR_FORK> git@github.com:<YOUR_GITHUB_USERNAME>/opentelemetry-rust
git remote add <YOUR_FORK> git@github.com:<YOUR_GITHUB_USERNAME>/opentelemetry-rust
```
Check out a new branch, make modifications, run linters and tests, and
@ -58,22 +78,42 @@ Open a pull request against the main
[opentelemetry-rust](https://github.com/open-telemetry/opentelemetry-rust)
repo.
Your pull request should be named according to the
[conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standard. This ensures that
when the PR is squashed into `main`, the resulting commit message is consistent and makes it easier
for us to generate a changelog standard.
> **Note**
> It is recommended to run [pre-commit script](scripts/precommit.sh) to catch any issues locally.
### How to Receive Comments
* If the PR is not ready for review, please put `[WIP]` in the title,
tag it as `work-in-progress`, or mark it as
[`draft`](https://github.blog/2019-02-14-introducing-draft-pull-requests/).
* Make sure CLA is signed and CI is clear.
- If the PR is not ready for review, please put `[WIP]` in the title or mark it
as [`draft`](https://github.blog/2019-02-14-introducing-draft-pull-requests/).
- Make sure CLA is signed and all required CI checks are clear.
- Submit small, focused PRs addressing a single concern/issue.
- Make sure the PR title reflects the contribution.
- Write a summary that helps understand the change.
- Include usage examples in the summary, where applicable.
- Include benchmarks (before/after) in the summary, for contributions that are
performance enhancements.
### How to Get PRs Merged
A PR is considered to be **ready to merge** when:
* It has received approval from Collaborators/Maintainers.
* Major feedback is resolved.
- It has received approval from
[Approvers](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver).
/
[Maintainers](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer).
- Major feedbacks are resolved.
Any Collaborator/Maintainer can merge the PR once it is **ready to
merge**.
Any Maintainer can merge the PR once it is **ready to merge**. Note, that some
PRs may not be merged immediately if the repo is in the process of a release and
the maintainers decided to defer the PR to the next release train. Also,
maintainers may decide to wait for more than one approval for certain PRs,
particularly ones that are affecting multiple areas, or topics that may warrant
more discussion.
## Design Choices
@ -98,38 +138,67 @@ language rather than conform to specific API names or argument
patterns in the spec.
For a deeper discussion, see:
https://github.com/open-telemetry/opentelemetry-specification/issues/165
<https://github.com/open-telemetry/opentelemetry-specification/issues/165>
### Error Handling
Currently, the Opentelemetry Rust SDK has two ways to handle errors. In the situation where errors are not allowed to return. One should call global error handler to process the errors. Otherwise, one should return the errors.
The Opentelemetry Rust SDK comes with an error type `openetelemetry::Error`. For different function, one error has been defined. All error returned by trace module MUST be wrapped in `opentelemetry::trace::TraceError`. All errors returned by metrics module MUST be wrapped in `opentelemetry::metrics::MetricsError`.
Currently, the Opentelemetry Rust SDK has two ways to handle errors. In the situation where errors are not allowed to return. One should call global error handler to process the errors. Otherwise, one should return the errors.
For users that want to implement their own exporters. It's RECOMMENDED to wrap all errors from the exporter into a crate-level error type, and implement `ExporterError` trait.
The Opentelemetry Rust SDK comes with an error type `opentelemetry::Error`. For different function, one error has been defined. All error returned by trace module MUST be wrapped in `opentelemetry::trace::TraceError`. All errors returned by metrics module MUST be wrapped in `opentelemetry::metrics::MetricError`. All errors returned by logs module MUST be wrapped in `opentelemetry::logs::LogsError`.
For users that want to implement their own exporters. It's RECOMMENDED to wrap all errors from the exporter into a crate-level error type, and implement `ExporterError` trait.
### Priority of configurations
OpenTelemetry supports multiple ways to configure the API, SDK and other components. The priority of configurations is as follows:
- Environment variables
- Compiling time configurations provided in the source code
### Experimental/Unstable features
Use `otel_unstable` feature flag for implementation of specification with [experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.27.0/specification/document-status.md) status. This approach ensures clear demarcation and safe integration of new or evolving features. Utilize the following structure:
```rust
#[cfg(feature = "otel_unstable")]
{
// Your feature implementation
}
```
It's important to regularly review and remove the `otel_unstable` flag from the code once the feature becomes stable. This cleanup process is crucial to maintain the overall code quality and to ensure that stable features are accurately reflected in the main build.
### Optional features
The potential features include:
- Stable and non-experimental features that are compliant with the specification and have a feature flag to minimize compilation size. Example: feature flags for signals (like `logs`, `traces`, `metrics`) and runtimes (`rt-tokio`, `rt-tokio-current-thread`).
- Stable and non-experimental features, although not part of the specification, are crucial for enhancing the tracing/log crate's functionality or boosting performance. These features are also subject to discussion and approval by the OpenTelemetry Rust Maintainers.
All such features should adhere to naming convention `<signal>_<feature_name>`
## Style Guide
* Run `cargo clippy --all` - this will catch common mistakes and improve
- Run `cargo clippy --all` - this will catch common mistakes and improve
your Rust code
* Run `cargo fmt` - this will find and fix code formatting
- Run `cargo fmt` - this will find and fix code formatting
issues.
## Testing and Benchmarking
* Run `cargo test --all` - this will execute code and doc tests for all
- Run `cargo test --all` - this will execute code and doc tests for all
projects in this workspace.
* Run `cargo bench` - this will run benchmarks to show performance
- Run `cargo bench` - this will run benchmarks to show performance
- Run `cargo bench` - this will run benchmarks to show performance
regressions
## Approvers and Maintainers
See the [code owners](CODEOWNERS) file.
### Become an Approver or a Maintainer
See the [community membership document in OpenTelemetry community
repo](https://github.com/open-telemetry/community/blob/master/community-membership.md).
## FAQ
### Where should I put third party propagators/exporters, contrib or standalone crates?
As of now, the specification classify the propagators into three categories: Fully opened standards, platform-specific standards, proprietary headers. The conclusion is only the fully opened standards should live in SDK packages/repos. So here, only fully opened standards should live as independent crate. For more detail and discussion, see [this pr](https://github.com/open-telemetry/opentelemetry-specification/pull/1144).
As of now, the specification classify the propagators into three categories:
Fully opened standards, platform-specific standards, proprietary headers. The
conclusion is only the fully opened standards should live in SDK packages/repos.
So here, only fully opened standards should live as independent crate. For more
detail and discussion, see [this
pr](https://github.com/open-telemetry/opentelemetry-specification/pull/1144).

View File

@ -1,31 +1,94 @@
[workspace]
members = [
"opentelemetry",
"opentelemetry-contrib",
"opentelemetry-datadog",
"opentelemetry-http",
"opentelemetry-jaeger",
"opentelemetry-otlp",
"opentelemetry-prometheus",
"opentelemetry-aws",
"opentelemetry-semantic-conventions",
"opentelemetry-stackdriver",
"opentelemetry-zipkin",
"examples/actix-http",
"examples/actix-http-tracing",
"examples/actix-udp",
"examples/async",
"examples/aws-xray",
"examples/basic",
"examples/basic-otlp",
"examples/basic-otlp-with-selector",
"examples/basic-otlp-http",
"examples/datadog",
"examples/external-otlp-tonic-tokio",
"examples/grpc",
"examples/http",
"examples/tracing-grpc",
"examples/zipkin",
"examples/multiple-span-processors"
"opentelemetry-*",
"opentelemetry-*/examples/*",
"opentelemetry-otlp/tests/*",
"examples/*",
"stress",
]
exclude = ["examples/external-otlp-grpcio-async-std"]
resolver = "2"
# Avoid applying patch to force use of workspace members for this
# not actively maintained crate
exclude = ["opentelemetry-prometheus"]
[profile.bench]
# https://doc.rust-lang.org/cargo/reference/profiles.html#bench
# See function names in profiling reports.
# 2/true is too much, 0 is not enough, 1 is just right for back traces
debug = 1
[workspace.dependencies]
async-trait = "0.1"
bytes = "1"
criterion = "0.5"
futures-core = "0.3"
futures-executor = "0.3"
futures-util = { version = "0.3", default-features = false }
http = { version = "1.1", default-features = false, features = ["std"] }
http-body-util = "0.1"
hyper = { version = "1.3", default-features = false }
hyper-util = "0.1"
log = "0.4.21"
once_cell = "1.13"
pin-project-lite = "0.2"
prost = "0.13"
prost-build = "0.13"
prost-types = "0.13"
rand = { version = "0.9", default-features = false }
reqwest = { version = "0.12", default-features = false }
serde = { version = "1.0", default-features = false }
serde_json = "1.0"
temp-env = "0.3.6"
thiserror = { version = "2", default-features = false }
tonic = { version = "0.13", default-features = false }
tonic-build = "0.13"
tokio = { version = "1", default-features = false }
tokio-stream = "0.1"
# Using `tracing 0.1.40` because 0.1.39 (which is yanked) introduces the ability to set event names in macros,
# required for OpenTelemetry's internal logging macros.
tracing = { version = ">=0.1.40", default-features = false }
# `tracing-core >=0.1.33` is required for compatibility with `tracing >=0.1.40`.
tracing-core = { version = ">=0.1.33", default-features = false }
tracing-subscriber = { version = "0.3", default-features = false }
url = { version = "2.5", default-features = false }
anyhow = "1.0.94"
base64 = "0.22.1"
chrono = { version = "0.4.34", default-features = false }
ctor = "0.2.9"
ctrlc = "3.2.5"
futures-channel = "0.3"
futures-sink = "0.3"
const-hex = "1.14.1"
lazy_static = "1.4.0"
num-format = "0.4.4"
num_cpus = "1.15.0"
opentelemetry-appender-tracing = { path = "opentelemetry-appender-tracing", default-features = false }
opentelemetry-otlp = { path = "opentelemetry-otlp" }
opentelemetry-stdout = { path = "opentelemetry-stdout" }
percent-encoding = "2.0"
rstest = "0.23.0"
schemars = "0.8"
sysinfo = "0.32"
tempfile = "3.3.0"
testcontainers = "0.23.1"
tracing-log = "0.2"
tracing-opentelemetry = "0.31"
typed-builder = "0.20"
uuid = "1.3"
# Aviod use of crates.io version of these crates through the tracing-opentelemetry dependencies
[patch.crates-io]
opentelemetry = { path = "opentelemetry" }
opentelemetry_sdk = { path = "opentelemetry-sdk" }
opentelemetry-stdout = { path = "opentelemetry-stdout" }
[workspace.lints.rust]
rust_2024_compatibility = { level = "warn", priority = -1 }
# No need to enable those, because it either not needed or results in ugly syntax
edition_2024_expr_fragment_specifier = "allow"
if_let_rescope = "allow"
tail_expr_drop_order = "allow"
[workspace.lints.clippy]
all = { level = "warn", priority = 1 }

241
README.md
View File

@ -1,20 +1,14 @@
![OpenTelemetry — An observability framework for cloud-native software.][splash]
[splash]: https://raw.githubusercontent.com/open-telemetry/opentelemetry-rust/main/assets/logo-text.png
# OpenTelemetry Rust
The Rust [OpenTelemetry](https://opentelemetry.io/) implementation.
[![Crates.io: opentelemetry](https://img.shields.io/crates/v/opentelemetry.svg)](https://crates.io/crates/opentelemetry)
[![Documentation](https://docs.rs/opentelemetry/badge.svg)](https://docs.rs/opentelemetry)
[![LICENSE](https://img.shields.io/crates/l/opentelemetry)](./LICENSE)
[![GitHub Actions CI](https://github.com/open-telemetry/opentelemetry-rust/workflows/CI/badge.svg)](https://github.com/open-telemetry/opentelemetry-rust/actions?query=workflow%3ACI+branch%3Amain)
[![Gitter chat](https://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg)](https://gitter.im/open-telemetry/opentelemetry-rust)
[Website](https://opentelemetry.io/) |
[Chat](https://gitter.im/open-telemetry/opentelemetry-rust) |
[Documentation](https://docs.rs/opentelemetry)
[![Documentation](https://docs.rs/opentelemetry/badge.svg)](https://docs.rs/opentelemetry)
[![codecov](https://codecov.io/gh/open-telemetry/opentelemetry-rust/branch/main/graph/badge.svg)](https://codecov.io/gh/open-telemetry/opentelemetry-rust)
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/open-telemetry/opentelemetry-rust/badge)](https://scorecard.dev/viewer/?uri=github.com/open-telemetry/opentelemetry-rust)
[![Slack](https://img.shields.io/badge/slack-@cncf/otel/rust-brightgreen.svg?logo=slack)](https://cloud-native.slack.com/archives/C03GDP0H023)
## Overview
@ -24,101 +18,134 @@ analysis in order to understand your software's performance and behavior. You
can export and analyze them using [Prometheus], [Jaeger], and other
observability tools.
*Compiler support: [requires `rustc` 1.46+][msrv]*
*[Supported Rust Versions](#supported-rust-versions)*
[Prometheus]: https://prometheus.io
[Jaeger]: https://www.jaegertracing.io
[msrv]: #supported-rust-versions
## Project Status
The table below summarizes the overall status of each component. Some components
include unstable features, which are documented in their respective crate
documentation.
| Signal/Component | Overall Status |
| -------------------- | ------------------ |
| Context | Beta |
| Baggage | RC |
| Propagators | Beta |
| Logs-API | Stable* |
| Logs-SDK | Stable |
| Logs-OTLP Exporter | RC |
| Logs-Appender-Tracing | Stable |
| Metrics-API | Stable |
| Metrics-SDK | Stable |
| Metrics-OTLP Exporter | RC |
| Traces-API | Beta |
| Traces-SDK | Beta |
| Traces-OTLP Exporter | Beta |
*OpenTelemetry Rust is not introducing a new end user callable Logging API.
Instead, it provides [Logs Bridge
API](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/api.md),
that allows one to write log appenders that can bridge existing logging
libraries to the OpenTelemetry log data model. The following log appenders are
available:
* [opentelemetry-appender-log](opentelemetry-appender-log/README.md)
* [opentelemetry-appender-tracing](opentelemetry-appender-tracing/README.md)
If you already use the logging APIs from above, continue to use them, and use
the appenders above to bridge the logs to OpenTelemetry. If you are using a
library not listed here, feel free to contribute a new appender for the same.
If you are starting fresh, we recommend using
[tracing](https://github.com/tokio-rs/tracing) as your logging API. It supports
structured logging and is actively maintained. `OpenTelemetry` itself uses
`tracing` for its internal logging.
Project versioning information and stability guarantees can be found
[here](VERSIONING.md).
## Getting Started
```rust
use opentelemetry::{sdk::export::trace::stdout, trace::Tracer};
If you are new to OpenTelemetry, start with the [Stdout
Example](./opentelemetry-stdout/examples/basic.rs). This example demonstrates
how to use OpenTelemetry for logs, metrics, and traces, and display
telemetry data on your console.
fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
// Create a new instrumentation pipeline
let tracer = stdout::new_pipeline().install_simple();
For those using OTLP, the recommended OpenTelemetry Exporter for production
scenarios, refer to the [OTLP Example -
HTTP](./opentelemetry-otlp/examples/basic-otlp-http/README.md) and the [OTLP
Example - gRPC](./opentelemetry-otlp/examples/basic-otlp/README.md).
tracer.in_span("doing_work", |cx| {
// Traced app logic here...
});
Additional examples for various integration patterns can be found in the
[examples](./examples) directory.
Ok(())
}
```
## Overview of crates
See the [examples](./examples) directory for different integration patterns.
The following crates are maintained in this repo:
## Ecosystem
### Related Crates
In addition to `opentelemetry`, the [`open-telemetry/opentelemetry-rust`]
repository contains several additional crates designed to be used with the
`opentelemetry` ecosystem. This includes a collection of trace `SpanExporter`
and metrics pull and push controller implementations, as well as utility and
adapter crates to assist in propagating state and instrumenting applications.
In particular, the following crates are likely to be of interest:
- [`opentelemetry-jaeger`] provides a pipeline and exporter for sending trace
information to [`Jaeger`].
- [`opentelemetry-otlp`] exporter for sending trace and metric data in the OTLP
format to the OpenTelemetry collector.
- [`opentelemetry-prometheus`] provides a pipeline and exporter for sending
metrics information to [`Prometheus`].
- [`opentelemetry-zipkin`] provides a pipeline and exporter for sending trace
information to [`Zipkin`].
- [`opentelemetry-contrib`] provides additional exporters to vendors like
[`Datadog`].
- [`opentelemetry-semantic-conventions`] provides standard names and semantic
* [`opentelemetry`] This is the OpenTelemetry API crate, and is the crate
required to instrument libraries and applications. It contains Context API,
Baggage API, Propagators API, Logging Bridge API, Metrics API, and Tracing
API.
* [`opentelemetry-sdk`] This is the OpenTelemetry SDK crate, and contains the
official OpenTelemetry SDK implementation. It contains Logging SDK, Metrics
SDK, and Tracing SDK. It also contains propagator implementations.
* [`opentelemetry-otlp`] - exporter to send telemetry (logs, metrics and traces)
in the [OTLP
format](https://github.com/open-telemetry/opentelemetry-specification/tree/main/specification/protocol)
to an endpoint accepting OTLP. This could be the [OTel
Collector](https://github.com/open-telemetry/opentelemetry-collector),
telemetry backends like [Jaeger](https://www.jaegertracing.io/),
[Prometheus](https://prometheus.io/docs/prometheus/latest/feature_flags/#otlp-receiver)
or [vendor specific endpoints](https://opentelemetry.io/ecosystem/vendors/).
* [`opentelemetry-stdout`] exporter for sending logs, metrics and traces to
stdout, for learning/debugging purposes.
* [`opentelemetry-http`] This crate contains utility functions to help with
exporting telemetry, propagation, over [`http`].
* [`opentelemetry-appender-log`] This crate provides logging appender to route
logs emitted using the [log](https://docs.rs/log/latest/log/) crate to
opentelemetry.
* [`opentelemetry-appender-tracing`] This crate provides logging appender to
route logs emitted using the [tracing](https://crates.io/crates/tracing) crate
to opentelemetry.
* [`opentelemetry-jaeger-propagator`] provides context propagation using [jaeger
propagation
format](https://www.jaegertracing.io/docs/1.18/client-libraries/#propagation-format).
* [`opentelemetry-prometheus`] provides a pipeline and exporter for sending
metrics to [`Prometheus`].
* [`opentelemetry-semantic-conventions`] provides standard names and semantic
otel conventions.
- [`opentelemetry-stackdriver`] provides an exporter for Google's [Cloud Trace]
(which used to be called StackDriver).
Additionally, there are also several third-party crates which are not
maintained by the `opentelemetry` project. These include:
* [`opentelemetry-zipkin`] provides a pipeline and exporter for sending traces
to [`Zipkin`].
- [`tracing-opentelemetry`] provides integration for applications instrumented
using the [`tracing`] API and ecosystem.
- [`actix-web-opentelemetry`] provides integration for the [`actix-web`] web
server and ecosystem.
- [`opentelemetry-application-insights`] provides an unofficial [Azure
Application Insights] exporter.
- [`opentelemetry-tide`] provides integration for the [`Tide`] web server and
ecosystem.
In addition, there are several other useful crates in the [OTel Rust Contrib
repo](https://github.com/open-telemetry/opentelemetry-rust-contrib). A lot of
crates maintained outside OpenTelemetry owned repos can be found in the
[OpenTelemetry
Registry](https://opentelemetry.io/ecosystem/registry/?language=rust).
If you're the maintainer of an `opentelemetry` ecosystem crate not listed
above, please let us know! We'd love to add your project to the list!
[`open-telemetry/opentelemetry-rust`]: https://github.com/open-telemetry/opentelemetry-rust
[`opentelemetry-jaeger`]: https://crates.io/crates/opentelemetry-jaeger
[`Jaeger`]: https://www.jaegertracing.io
[`opentelemetry`]: https://crates.io/crates/opentelemetry
[`opentelemetry-sdk`]: https://crates.io/crates/opentelemetry-sdk
[`opentelemetry-appender-log`]: https://crates.io/crates/opentelemetry-appender-log
[`opentelemetry-appender-tracing`]: https://crates.io/crates/opentelemetry-appender-tracing
[`opentelemetry-http`]: https://crates.io/crates/opentelemetry-http
[`opentelemetry-otlp`]: https://crates.io/crates/opentelemetry-otlp
[`opentelemetry-stdout`]: https://crates.io/crates/opentelemetry-stdout
[`opentelemetry-jaeger-propagator`]: https://crates.io/crates/opentelemetry-jaeger-propagator
[`opentelemetry-prometheus`]: https://crates.io/crates/opentelemetry-prometheus
[`Prometheus`]: https://prometheus.io
[`opentelemetry-zipkin`]: https://crates.io/crates/opentelemetry-zipkin
[`Zipkin`]: https://zipkin.io
[`opentelemetry-contrib`]: https://crates.io/crates/opentelemetry-contrib
[`Datadog`]: https://www.datadoghq.com
[`opentelemetry-semantic-conventions`]: https://crates.io/crates/opentelemetry-semantic-conventions
[`tracing-opentelemetry`]: https://crates.io/crates/tracing-opentelemetry
[`tracing`]: https://crates.io/crates/tracing
[`actix-web-opentelemetry`]: https://crates.io/crates/actix-web-opentelemetry
[`actix-web`]: https://crates.io/crates/actix-web
[`opentelemetry-application-insights`]: https://crates.io/crates/opentelemetry-application-insights
[Azure Application Insights]: https://docs.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview
[`opentelemetry-tide`]: https://crates.io/crates/opentelemetry-tide
[`Tide`]: https://crates.io/crates/tide
[`opentelemetry-stackdriver`]: https://crates.io/crates/opentelemetry-stackdriver
[Cloud Trace]: https://cloud.google.com/trace/
[`http`]: https://crates.io/crates/http
## Supported Rust Versions
OpenTelemetry is built against the latest stable release. The minimum supported
version is 1.49. The current OpenTelemetry version is not guaranteed to build
version is 1.75. The current OpenTelemetry version is not guaranteed to build
on Rust versions earlier than the minimum supported version.
The current stable Rust compiler and the three most recent minor versions
@ -131,3 +158,55 @@ this policy.
## Contributing
See the [contributing file](CONTRIBUTING.md).
The Rust special interest group (SIG) meets weekly on Tuesdays at 9 AM Pacific
Time. The meeting is subject to change depending on contributors' availability.
Check the [OpenTelemetry community
calendar](https://github.com/open-telemetry/community?tab=readme-ov-file#calendar)
for specific dates and for Zoom meeting links. "OTel Rust SIG" is the name of
meeting for this group.
Meeting notes are available as a public [Google
doc](https://docs.google.com/document/d/12upOzNk8c3SFTjsL6IRohCWMgzLKoknSCOOdMakbWo4/edit).
If you have trouble accessing the doc, please get in touch on
[Slack](https://cloud-native.slack.com/archives/C03GDP0H023).
The meeting is open for all to join. We invite everyone to join our meeting,
regardless of your experience level. Whether you're a seasoned OpenTelemetry
developer, just starting your journey, or simply curious about the work we do,
you're more than welcome to participate!
## Approvers and Maintainers
### Maintainers
* [Cijo Thomas](https://github.com/cijothomas), Microsoft
* [Harold Dost](https://github.com/hdost)
* [Lalit Kumar Bhasin](https://github.com/lalitb), Microsoft
* [Utkarsh Umesan Pillai](https://github.com/utpilla), Microsoft
* [Zhongyang Wu](https://github.com/TommyCpp)
For more information about the maintainer role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer).
### Approvers
* [Anton Grübel](https://github.com/gruebel), Baz
* [Björn Antonsson](https://github.com/bantonsson), Datadog
* [Scott Gerring](https://github.com/scottgerring), Datadog
* [Shaun Cox](https://github.com/shaun-cox), Microsoft
For more information about the approver role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver).
### Emeritus
* [Dirkjan Ochtman](https://github.com/djc)
* [Isobel Redelmeier](https://github.com/iredelmeier)
* [Jan Kühle](https://github.com/frigus02)
* [Julian Tescher](https://github.com/jtescher)
* [Mike Goldsmith](https://github.com/MikeGoldsmith)
For more information about the emeritus role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager).
### Thanks to all the people who have contributed
[![contributors](https://contributors-img.web.app/image?repo=open-telemetry/opentelemetry-rust)](https://github.com/open-telemetry/opentelemetry-rust/graphs/contributors)

77
deny.toml Normal file
View File

@ -0,0 +1,77 @@
[graph]
exclude=[]
[licenses]
allow = [
"MIT",
"Apache-2.0",
"ISC",
"BSD-3-Clause",
]
exceptions = [
{ allow = ["CDLA-Permissive-2.0"], crate = "webpki-roots" }, # This crate is a dependency of `reqwest`.
{ allow = ["Unicode-3.0"], crate = "icu_collections" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "icu_locid" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "icu_locid_transform" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "icu_locid_transform_data" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "icu_locale_core" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "icu_normalizer" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "icu_normalizer_data" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "icu_properties" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "icu_properties_data" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "icu_provider" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "icu_provider_macros" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "potential_utf" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "litemap" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "tinystr" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "writeable" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "unicode-ident" }, # This crate gets used transitively by `reqwest` and other crates.
{ allow = ["Unicode-3.0"], crate = "yoke" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "yoke-derive" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "zerovec" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "zerotrie" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "zerovec-derive" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "zerofrom" }, # This crate gets used transitively by `reqwest`.
{ allow = ["Unicode-3.0"], crate = "zerofrom-derive" }, # This crate gets used transitively by `reqwest`.
]
[licenses.private]
ignore = true
[[licenses.clarify]]
name = "ring"
version = "*"
expression = "MIT AND ISC AND OpenSSL"
license-files = [
{ path = "LICENSE", hash = 0xbd0eed23 }
]
# This section is considered when running `cargo deny check advisories`
# More documentation for the advisories section can be found here:
# https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html
[advisories]
unmaintained = "none"
yanked = "deny"
# This section is considered when running `cargo deny check bans`.
# More documentation about the 'bans' section can be found here:
# https://embarkstudios.github.io/cargo-deny/checks/bans/cfg.html
[bans]
# Lint level for when multiple versions of the same crate are detected
multiple-versions = "warn"
# Lint level for when a crate version requirement is `*`
wildcards = "warn"
# The graph highlighting used when creating dotgraphs for crates
# with multiple versions
# * lowest-version - The path to the lowest versioned duplicate is highlighted
# * simplest-path - The path to the version with the fewest edges is highlighted
# * all - Both lowest-version and simplest-path are used
highlight = "all"
# This section is considered when running `cargo deny check sources`.
# More documentation about the 'sources' section can be found here:
# https://embarkstudios.github.io/cargo-deny/checks/sources/cfg.html
[sources]
unknown-registry = "deny"
unknown-git = "deny"

View File

@ -0,0 +1,175 @@
# Error handling patterns in public API interfaces
## Date
27 Feb 2025
## Summary
This ADR describes the general pattern we will follow when modelling errors in public API interfaces - that is, APIs that are exposed to users of the project's published crates. It summarizes the discussion and final option from [#2571](https://github.com/open-telemetry/opentelemetry-rust/issues/2571); for more context check out that issue.
We will focus on the exporter traits in this example, but the outcome should be applied to _all_ public traits and their fallible operations.
These include [SpanExporter](https://github.com/open-telemetry/opentelemetry-rust/blob/eca1ce87084c39667061281e662d5edb9a002882/opentelemetry-sdk/src/trace/export.rs#L18), [LogExporter](https://github.com/open-telemetry/opentelemetry-rust/blob/eca1ce87084c39667061281e662d5edb9a002882/opentelemetry-sdk/src/logs/export.rs#L115), and [PushMetricExporter](https://github.com/open-telemetry/opentelemetry-rust/blob/eca1ce87084c39667061281e662d5edb9a002882/opentelemetry-sdk/src/metrics/exporter.rs#L11) which form part of the API surface of `opentelemetry-sdk`.
There are various ways to handle errors on trait methods, including swallowing them and logging, panicking, returning a shared global error, or returning a method-specific error. We strive for consistency, and we want to be sure that we've put enough thought into what this looks like that we don't have to make breaking interface changes unnecessarily in the future.
## Design Guidance
### 1. No panics from SDK APIs
Failures during regular operation should not panic, instead returning errors to the caller where appropriate, _or_ logging an error if not appropriate.
Some of the opentelemetry SDK interfaces are dictated by the specification in way such that they may not return errors.
### 2. Consolidate error types within a trait where we can, let them diverge when we can't**
We aim to consolidate error types where possible _without indicating a function may return more errors than it can actually return_.
**Don't do this** - each function's signature indicates that it returns errors it will _never_ return, forcing the caller to write handlers for dead paths:
```rust
enum MegaError {
TooBig,
TooSmall,
TooLong,
TooShort
}
trait MyTrait {
// Will only ever return TooBig,TooSmall errors
fn action_one() -> Result<(), MegaError>;
// These will only ever return TooLong,TooShort errors
fn action_two() -> Result<(), MegaError>;
fn action_three() -> Result<(), MegaError>;
}
```
**Instead, do this** - each function's signature indicates only the errors it can return, providing an accurate contract to the caller:
```rust
enum ErrorOne {
TooBig,
TooSmall,
}
enum ErrorTwo {
TooLong,
TooShort
}
trait MyTrait {
fn action_one() -> Result<(), ErrorOne>;
// Action two and three share the same error type.
// We do not introduce a common error MyTraitError for all operations, as this would
// force all methods on the trait to indicate they return errors they do not return,
// complicating things for the caller.
fn action_two() -> Result<(), ErrorTwo>;
fn action_three() -> Result<(), ErrorTwo>;
}
```
## 3. Consolidate error types between signals where we can, let them diverge where we can't
Consider the `Exporter`s mentioned earlier. Each of them has the same failure indicators - as dictated by the OpenTelemetry spec - and we will
share the error types accordingly:
**Don't do this** - each signal has its own error type, despite having exactly the same failure cases:
```rust
#[derive(Error, Debug)]
pub enum OtelTraceError {
#[error("Shutdown already invoked")]
AlreadyShutdown,
#[error("Operation failed: {0}")]
InternalFailure(String),
/** ... additional errors ... **/
}
#[derive(Error, Debug)]
pub enum OtelLogError {
#[error("Shutdown already invoked")]
AlreadyShutdown,
#[error("Operation failed: {0}")]
InternalFailure(String),
/** ... additional errors ... **/
}
```
**Instead, do this** - error types are consolidated between signals where this can be done appropriately:
```rust
/// opentelemetry-sdk::error
#[derive(Error, Debug)]
pub enum OTelSdkError {
#[error("Shutdown already invoked")]
AlreadyShutdown,
#[error("Operation failed: {0}")]
InternalFailure(String),
/** ... additional errors ... **/
}
pub type OTelSdkResult = Result<(), OTelSdkError>;
/// signal-specific exporter traits all share the same
/// result types for the exporter operations.
// pub trait LogExporter {
// pub trait SpanExporter {
pub trait PushMetricExporter {
fn export(&self, /* ... */) -> OtelSdkResult;
fn force_flush(&self, /* ... */ ) -> OTelSdkResult;
fn shutdown(&self, /* ... */ ) -> OTelSdkResult;
```
If this were _not_ the case - if we needed to mark an extra error for instance for `LogExporter` that the caller could reasonably handle -
we would let that error traits diverge at that point.
### 4. Box custom errors where a savvy caller may be able to handle them, stringify them if not
Note above that we do not box any `Error` into `InternalFailure`. Our rule here is that if the caller cannot reasonably be expected to handle a particular error variant, we will use a simplified interface that returns only a descriptive string. In the concrete example we are using with the exporters, we have a [strong signal in the opentelemetry-specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/sdk.md#export) that indicates that the error types _are not actionable_ by the caller.
If the caller may potentially recover from an error, we will follow the generally-accepted best practice (e.g., see [canonical's guide](https://canonical.github.io/rust-best-practices/error-and-panic-discipline.html) and instead preserve the nested error:
**Don't do this if the OtherError is potentially recoverable by a savvy caller**:
```rust
#[derive(Debug, Error)]
pub enum MyError {
#[error("Error one occurred")]
ErrorOne,
#[error("Operation failed: {0}")]
OtherError(String),
```
**Instead, do this**, allowing the caller to match on the nested error:
```rust
#[derive(Debug, Error)]
pub enum MyError {
#[error("Error one occurred")]
ErrorOne,
#[error("Operation failed: {source}")]
OtherError {
#[from]
source: Box<dyn Error + Send + Sync>,
},
}
```
Note that at the time of writing, there is no instance we have identified within the project that has required this.
### 5. Use thiserror by default
We will use [thiserror](https://docs.rs/thiserror/latest/thiserror/) by default to implement Rust's [error trait](https://doc.rust-lang.org/core/error/trait.Error.html).
This keeps our code clean, and as it does not appear in our interface, we can choose to replace any particular usage with a hand-rolled implementation should we need to.
### 6. Don't use `#[non_exhaustive]` by default
If an `Error` response set is closed - if we can confidently say it is very unlikely to gain new variants in the future - we should not annotate it with `#[non_exhaustive]`. By way of example, the variants of the exporter error types described above are exhaustively documented in the OpenTelemetry Specification, and we can confidently say that we do not expect new variants.

5
docs/adr/README.md Normal file
View File

@ -0,0 +1,5 @@
# Architectural Decision Records
This directory contains architectural decision records made for the opentelemetry-rust project. These allow us to consolidate discussion, options, and outcomes, around key architectural decisions.
* [001 - Error Handling](001_error_handling.md)

378
docs/design/logs.md Normal file
View File

@ -0,0 +1,378 @@
# OpenTelemetry Rust Logs Design
Status:
[Development](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/document-status.md)
## Overview
[OpenTelemetry (OTel)
Logs](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/README.md)
support differs from Metrics and Traces as it does not introduce a new logging
API for end users. Instead, OTel recommends leveraging existing logging
libraries such as [log](https://crates.io/crates/log) and
[tracing](https://crates.io/crates/tracing), while providing bridges (appenders)
to route logs through OpenTelemetry.
OTel took this different approach due to the long history of existing logging
solutions. In Rust, these are [log](https://crates.io/crates/log) and
[tracing](https://crates.io/crates/tracing), and have been embraced in the
community for some time. OTel Rust maintains appenders for these libraries,
allowing users to seamlessly integrate with OpenTelemetry without changing their
existing logging instrumentation.
The `tracing` appender is particularly optimized for performance due to its
widespread adoption and the fact that `tracing` itself has a bridge from the
`log` crate. Notably, OpenTelemetry Rust itself is instrumented using `tracing`
for internal logs. Additionally, when OTel began supporting logging as a signal,
the `log` crate lacked structured logging support, reinforcing the decision to
prioritize `tracing`.
## Benefits of OpenTelemetry Logs
- **Unified configuration** across Traces, Metrics, and Logs.
- **Automatic correlation** with Traces.
- **Consistent Resource attributes** across signals.
- **Multiple destinations support**: Logs can continue flowing to existing
destinations like stdout etc. while also being sent to an
OpenTelemetry-capable backend, typically via an OTLP Exporter or exporters
that export to operating system native systems like `Windows ETW` or `Linux
user_events`.
- **Standalone logging support** for applications that use OpenTelemetry as
their primary logging mechanism.
## Key Design Principles
- High performance - no locks/contention in the hot path with minimal/no heap
allocation where possible.
- Capped resource (memory) usage - well-defined behavior when overloaded.
- Self-observable - exposes telemetry about itself to aid in troubleshooting
etc.
- Robust error handling, returning Result where possible instead of panicking.
- Minimal public API, exposing based on need only.
## Architecture Overview
```mermaid
graph TD
subgraph Application
A1[Application Code]
end
subgraph Logging Libraries
B1[log crate]
B2[tracing crate]
end
subgraph OpenTelemetry
C1[OpenTelemetry Appender for log]
C2[OpenTelemetry Appender for tracing]
C3[OpenTelemetry Logs API]
C4[OpenTelemetry Logs SDK]
C5[OTLP Exporter]
end
subgraph Observability Backend
D1[OTLP-Compatible Backend]
end
A1 --> |Emits Logs| B1
A1 --> |Emits Logs| B2
B1 --> |Bridged by| C1
B2 --> |Bridged by| C2
C1 --> |Sends to| C3
C2 --> |Sends to| C3
C3 --> |Processes with| C4
C4 --> |Exports via| C5
C5 --> |Sends to| D1
```
## Logs API
Logs API is part of the [opentelemetry](https://crates.io/crates/opentelemetry)
crate.
The OTel Logs API is not intended for direct end-user usage. Instead, it is
designed for appender/bridge authors to integrate existing logging libraries
with OpenTelemetry. However, there is nothing preventing it from being used by
end-users.
### API Components
1. **Key-Value Structs**: Used in `LogRecord`, where `Key` struct is shared
across signals but `Value` struct differ from Metrics and Traces. This is
because values in Logs can contain more complex structures than those in
Traces and Metrics.
2. **Traits**:
- `LoggerProvider` - provides methods to obtain Logger.
- `Logger` - provides methods to create LogRecord and emit the created
LogRecord.
- `LogRecord` - provides methods to populate LogRecord.
3. **No-Op Implementations**: By default, the API performs no operations until
an SDK is attached.
### Logs Flow
1. Obtain a `LoggerProvider` implementation.
2. Use the `LoggerProvider` to create `Logger` instances, specifying a scope
name (module/component emitting logs). Optional attributes and version are
also supported.
3. Use the `Logger` to create an empty `LogRecord` instance.
4. Populate the `LogRecord` with body, timestamp, attributes, etc.
5. Call `Logger.emit(LogRecord)` to process and export the log.
If only the Logs API is used (without an SDK), all the above steps result in no
operations, following OpenTelemetrys philosophy of separating API from SDK. The
official Logs SDK provides real implementations to process and export logs.
Users or vendors can also provide alternative SDK implementations.
## Logs SDK
Logs SDK is part of the
[opentelemetry_sdk](https://crates.io/crates/opentelemetry_sdk) crate.
The OpenTelemetry Logs SDK provides an OTel specification-compliant
implementation of the Logs API, handling log processing and export.
### Core Components
#### `SdkLoggerProvider`
This is the implementation of the `LoggerProvider` and deals with concerns such
as processing and exporting Logs.
- Implements the `LoggerProvider` trait.
- Creates and manages `SdkLogger` instances.
- Holds logging configuration, including `Resource` and processors.
- Does not retain a list of created loggers. Instead, it passes an owned clone
of itself to each logger created. This is done so that loggers get a hold of
the configuration (like which processor to invoke).
- Uses an `Arc<LoggerProviderInner>` and delegates all configuration to
`LoggerProviderInner`. This allows cheap cloning of itself and ensures all
clones point to the same underlying configuration.
- As `SdkLoggerProvider` only holds an `Arc` of its inner, it can only take
`&self` in its methods like flush and shutdown. Else it needs to rely on
interior mutability that comes with runtime performance costs. Since methods
like shutdown usually need to mutate interior state, but this component can
only take `&self`, it defers to components like exporter to use interior
mutability to handle shutdown. (More on this in the exporter section)
- An alternative design was to let `SdkLogger` hold a `Weak` reference to the
`SdkLoggerProvider`. This would be a `weak->arc` upgrade in every log
emission, significantly affecting throughput.
- `LoggerProviderInner` implements `Drop`, triggering `shutdown()` when no
references remain. However, in practice, loggers are often stored statically
inside appenders (like tracing-appender), so explicit shutdown by the user is
required.
#### `SdkLogger`
This is an implementation of the `Logger`, and contains functionality to create
and emit logs.
- Implements the `Logger` trait.
- Creates `SdkLogRecord` instances and emits them.
- Calls `OnEmit()` on all registered processors when emitting logs.
- Passes mutable references to each processor (`&mut log_record`), i.e.,
ownership is not passed to the processor. This ensures that the logger avoids
cloning costs. Since a mutable reference is passed, processors can modify the
log, and it will be visible to the next processor in the chain.
- Since the processor only gets a reference to the log, it cannot store it
beyond the `OnEmit()`. If a processor needs to buffer logs, it must explicitly
copy them to the heap.
- This design allows for stack-only log processing when exporting to operating
system native facilities like `Windows ETW` or `Linux user_events`.
- OTLP Exporting requires network calls (HTTP/gRPC) and batching of logs for
efficiency purposes. These exporters buffer log records by copying them to the
heap. (More on this in the BatchLogRecordProcessor section)
#### `LogRecord`
- Holds log data, including attributes.
- Uses an inline array for up to 5 attributes to optimize stack usage.
- Falls back to a heap-allocated `Vec` if more attributes are required.
- Inspired by Gos `slog` library for efficiency.
#### LogRecord Processors
`SdkLoggerProvider` allows being configured with any number of LogProcessors.
They get called in the order of registration. Log records are passed to the
`OnEmit` method of LogProcessor. LogProcessors can be used to process the log
records, enrich them, filter them, and export to destinations by leveraging
LogRecord Exporters.
Similar to [LoggerProvider](#sdkloggerprovider), methods on the `LogProcessor`
trait also takes a immutable self (`&self`) only, forcing the need to use
interior mutability, if any mutation is required. The exception to this is
`set_resource`, which takes a `&mut self`. This is acceptable as `set_resource`
is called by the `SdkLoggerProvider` during build() method only, and is not
required after that.
Following built-in Log processors are provided in the Log SDK:
##### SimpleLogProcessor
This processor is designed to be used for exporting purposes. Export is handled
by an Exporter (which is a separate component). SimpleLogProcessor is "simple"
in the sense that it does not attempt to do any processing - it just calls the
exporter and passes the log record to it. To comply with OTel specification, it
synchronizes calls to the `Export()` method, i.e., only one `Export()` call will
be done at any given time.
SimpleLogProcessor is only used for test/learning purposes and is often used
along with a `stdout` exporter.
##### BatchLogProcessor
This is another "exporting" processor. As with SimpleLogProcessor, a different
component named LogExporter handles the actual export logic. BatchLogProcessor
buffers/batches the logs it receives into an in-memory buffer. It invokes the
exporter every 1 second or when 512 items are in the batch (customizable). It
uses a background thread to do the export, and communication between the user
thread (where logs are emitted) and the background thread occurs with `mpsc`
channels.
The max amount of items the buffer holds is 2048 (customizable). Once the limit
is reached, any *new* logs are dropped. It *does not* apply back-pressure to the
user thread and instead drops logs.
As with SimpleLogProcessor, this component also ensures only one export is
active at a given time. A modified version of this is required to achieve higher
throughput in some environments.
In this design, at most 2048+512 logs can be in memory at any given point. In
other words, that many logs can be lost if the app crashes in the middle.
## LogExporters
LogExporters are responsible for exporting logs to a destination.
`SdkLoggerProvider` does not have a direct knowledge of the `LogExporter`, as it
only deals with `LogProcessors`. It is the `LogProcessor`s that invokes
`LogExporter` methods. Most methods on `LogExporter` trait also only takes
`&self`, following the same reasoning as [LogProcessors](#logrecord-processors)
Some of the exporters are:
1. **InMemoryExporter** - exports to an in-memory list, primarily for
unit-testing. This is used extensively in the repo itself, and external users
are also encouraged to use this.
2. **Stdout exporter** - prints telemetry to stdout. Only for debugging/learning
purposes. The output format is not defined and also is not performance
optimized. A production-recommended version with a standardized output format
is in the plan.
3. **OTLP Exporter** - OTel's official exporter which uses the OTLP protocol
that is designed with the OTel data model in mind. Both HTTP and gRPC-based
exporting is offered.
4. **Exporters to OS Kernel facilities** - These exporters are not maintained in
the core repo but listed for completion. They export telemetry to Windows ETW
or Linux user_events. They are designed for high-performance workloads. Due
to their nature of synchronous exporting, they do not require
buffering/batching. This allows logs to operate entirely on the stack and can
scale easily with the number of CPU cores. (Kernel uses per-CPU buffers for
the events, ensuring no contention)
## `tracing` Log Appender
Tracing appender is part of the
[opentelemetry-appender-tracing](https://crates.io/crates/opentelemetry-appender-tracing)
crate.
The `tracing` appender bridges `tracing` logs to OpenTelemetry. Logs emitted via
`tracing` macros (`info!`, `warn!`, etc.) are forwarded to OpenTelemetry through
this integration.
- `tracing` is designed for high performance, using *layers* or *subscribers* to
handle emitted logs (events).
- The appender implements a `Layer`, receiving logs from `tracing`.
- Uses the OTel Logs API to create `LogRecord`, populate it, and emit it via
`Logger.emit(LogRecord)`.
- If no Logs SDK is present, the process is a no-op.
Note on terminology: Within OpenTelemetry, "tracing" refers to distributed
tracing (i.e creation of Spans) and not in-process structured logging and
execution traces. The crate "tracing" has notion of creating Spans as well as
Events. The events from "tracing" crate is what gets converted to OTel Logs,
when using this appender. Spans created using "tracing" crate is not handled by
this crate.
## Performance
// Call out things done specifically for performance
// Rough draft
1. `LogRecord` is stack allocated and not Boxed unless required by the component
needing to store it beyond the logging call. (eg: BatchProcessor)
2. LogRecords's Attribute storage is specially designed struct, that holds up to
five attributes in stack.
3. When passing `LogRecord`s to processor, a mutable ref is passed. This allows
calling multiple processors one after another, without the need for cloning.
4. `Logger` provides a `Enabled` check which can optimize performance when
no-one is interested in the log. The check is passed from `Logger` to the
processor, which may consult its exporter to make the decision. An example use
case - an ETW or user-events exporter can check for the presence of listener and
convey that decision back to logger, allowing appender to avoid even the cost of
creating a `LogRecord` in the first place if there is no listener. This check is
done for each log emission, and can react dynamically to changes in interest, by
enabling/disabling ETW/user-event listener.
5. `tracing` has a notion of "target", which is expected to be mapped to OTel's
concept of Instrumentation Scope for Logs, when `OpenTelemetry-Tracing-Appender`
bridges `tracing` to OpenTelemetry. Since scopes are tied to Loggers, a naive
approach would require creating a separate logger for each unique target. This
would necessitate an RWLock-protected HashMap lookup, introducing contention and
reducing throughput. To avoid this, `OpenTelemetry-Tracing-Appender` instead
stores the target directly in the LogRecord as a top-level field, ensuring fast
access in the hot path. Components processing the LogRecord can retrieve the
target via LogRecord.target(), treating it as the scope. The OTLP Exporter
already handles this automatically, so end-users will see “target” reflected in
the Instrumentation Scope. An alternative design would be to use thread-local
HashMaps - but it can cause increased memory usage, as there can be 100s of
unique targets. (because `tracing` defaults to using module path as target).
### Perf test - benchmarks
// Share ~~ numbers
### Perf test - stress test
// Share ~~ numbers
## Internal logs
OTel itself is instrumented with `tracing` crate to emit internal logs about its
operations. This is feature gated under "internal-logs", and is enabled by
default for all components. The `opentelemetry` provide few helper macros
`otel_warn` etc., which in turn invokes various `tracing` macros like `warn!`
etc. The cargo package name will be set as `target` when using `tracing`. For
example, logs from `opentelemetry-otlp` will have target set to
"opentelemetry-otlp".
The helper macros are part of public API, so can be used by anyone. But it is
only meant for OTel components itself and anyone writing extensions like custom
Exporters etc.
// TODO: Document the principles followed when selecting severity for internal
logs
When OpenTelemetry components generate logs that could potentially feed back
into OpenTelemetry, this can result in what is known as "telemetry-induced
telemetry." To address this, OpenTelemetry provides a mechanism to suppress such
telemetry using the `Context`. Components are expected to mark telemetry as
suppressed within a specific `Context` by invoking
`Context::enter_telemetry_suppressed_scope()`. The Logs SDK implementation
checks this flag in the current `Context` and ignores logs if suppression is
enabled.
This mechanism relies on proper in-process propagation of the `Context`.
However, external libraries like `hyper` and `tonic`, which are used by
OpenTelemetry in its OTLP Exporters, do not propagate OpenTelemetry's `Context`.
As a result, the suppression mechanism does not work out-of-the-box to suppress
logs originating from these libraries.
// TODO: Document how OTLP can solve this issue without asking external
crates to respect and propagate OTel Context.
## Summary
- OpenTelemetry Logs does not provide a user-facing logging API.
- Instead, it integrates with existing logging libraries (`log`, `tracing`).
- The Logs API defines key traits but performs no operations unless an SDK is
installed.
- The Logs SDK enables log processing, transformation, and export.
- The Logs SDK is performance optimized to minimize copying and heap allocation,
wherever feasible.
- The `tracing` appender efficiently routes logs to OpenTelemetry without
modifying existing logging workflows.

6
docs/design/metrics.md Normal file
View File

@ -0,0 +1,6 @@
# OpenTelemetry Rust Metrics Design
Status:
[Development](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/document-status.md)
TODO:

6
docs/design/traces.md Normal file
View File

@ -0,0 +1,6 @@
# OpenTelemetry Rust Traces Design
Status:
[Development](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/document-status.md)
TODO:

767
docs/metrics.md Normal file
View File

@ -0,0 +1,767 @@
# OpenTelemetry Rust Metrics
Status: **Work-In-Progress**
<details>
<summary>Table of Contents</summary>
* [Introduction](#introduction)
* [Best Practices](#best-practices)
* [Metrics API](#metrics-api)
* [Meter](#meter)
* [Instruments](#instruments)
* [Reporting measurements - use array slices for
attributes](#reporting-measurements---use-array-slices-for-attributes)
* [Reporting measurements via synchronous
instruments](#reporting-measurements-via-synchronous-instruments)
* [Reporting measurements via asynchronous
instruments](#reporting-measurements-via-asynchronous-instruments)
* [MeterProvider Management](#meterprovider-management)
* [Memory Management](#memory-management)
* [Example](#example)
* [Pre-Aggregation](#pre-aggregation)
* [Pre-Aggregation Benefits](#pre-aggregation-benefits)
* [Cardinality Limits](#cardinality-limits)
* [Cardinality Limits - Implications](#cardinality-limits---implications)
* [Cardinality Limits - Example](#cardinality-limits---example)
* [Memory Preallocation](#memory-preallocation)
* [Metrics Correlation](#metrics-correlation)
* [Modelling Metric Attributes](#modelling-metric-attributes)
* [Common Issues Leading to Missing
Metrics](#common-issues-that-lead-to-missing-metrics)
</details>
## Introduction
This document provides comprehensive guidance on leveraging OpenTelemetry
metrics in Rust applications. Whether you're tracking request counts, monitoring
response times, or analyzing resource utilization, this guide equips you with
the knowledge to implement robust and efficient metrics collection.
It covers best practices, API usage patterns, memory management techniques, and
advanced topics to help you design effective metrics solutions while steering
clear of common challenges.
## Best Practices
// TODO: Add link to the examples, once they are modified to show best
practices.
## Metrics API
### Meter
[Meter](https://docs.rs/opentelemetry/latest/opentelemetry/metrics/struct.Meter.html)
provides the ability to create instruments for recording measurements or
accepting callbacks to report measurements.
:stop_sign: You should avoid creating duplicate
[`Meter`](https://docs.rs/opentelemetry/latest/opentelemetry/metrics/struct.Meter.html)
instances with the same name. `Meter` is fairly expensive and meant to be reused
throughout the application. For most applications, a `Meter` should be obtained
from `global` and saved for re-use.
> [!IMPORTANT] Create your `Meter` instance once at initialization time and
> store it for reuse throughout your application's lifecycle.
The fully qualified module name might be a good option for the Meter name.
Optionally, one may create a meter with version, schema_url, and additional
meter-level attributes as well. Both approaches are demonstrated below.
```rust
use opentelemetry::global;
use opentelemetry::InstrumentationScope;
use opentelemetry::KeyValue;
let scope = InstrumentationScope::builder("my_company.my_product.my_library")
.with_version("0.17")
.with_schema_url("https://opentelemetry.io/schema/1.2.0")
.with_attributes([KeyValue::new("key", "value")])
.build();
// creating Meter with InstrumentationScope, comprising of
// name, version, schema and attributes.
let meter = global::meter_with_scope(scope);
// creating Meter with just name
let meter = global::meter("my_company.my_product.my_library");
```
### Instruments
OpenTelemetry defines several types of metric instruments, each optimized for
specific usage patterns. The following table maps OpenTelemetry Specification
instruments to their corresponding Rust SDK types.
:heavy_check_mark: You should understand and pick the right instrument type.
> [!NOTE] Picking the right instrument type for your use case is crucial to
> ensure the correct semantics and performance. Check the [Instrument
Selection](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/supplementary-guidelines.md#instrument-selection)
section from the supplementary guidelines for more information.
| OpenTelemetry Specification | OpenTelemetry Rust Instrument Type |
| --------------------------- | -------------------- |
| [Asynchronous Counter](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#asynchronous-counter) | [`ObservableCounter`](https://docs.rs/opentelemetry/latest/opentelemetry/metrics/struct.ObservableCounter.html) |
| [Asynchronous Gauge](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#asynchronous-gauge) | [`ObservableGauge`](https://docs.rs/opentelemetry/latest/opentelemetry/metrics/struct.ObservableGauge.html) |
| [Asynchronous UpDownCounter](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#asynchronous-updowncounter) | [`ObservableUpDownCounter`](https://docs.rs/opentelemetry/latest/opentelemetry/metrics/struct.ObservableUpDownCounter.html) |
| [Counter](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#counter) | [`Counter`](https://docs.rs/opentelemetry/latest/opentelemetry/metrics/struct.Counter.html) |
| [Gauge](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#gauge) | [`Gauge`](https://docs.rs/opentelemetry/latest/opentelemetry/metrics/struct.Gauge.html) |
| [Histogram](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#histogram) | [`Histogram`](https://docs.rs/opentelemetry/latest/opentelemetry/metrics/struct.Histogram.html) |
| [UpDownCounter](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#updowncounter) | [`UpDownCounter`](https://docs.rs/opentelemetry/latest/opentelemetry/metrics/struct.UpDownCounter.html) |
:stop_sign: You should avoid creating duplicate instruments (e.g., `Counter`)
with the same name. Instruments are fairly expensive and meant to be reused
throughout the application. For most applications, an instrument should be
created once and saved for re-use. Instruments can also be cloned to create
multiple handles to the same instrument, but cloning should not occur on the hot
path. Instead, the cloned instance should be stored and reused.
:stop_sign: Do NOT use invalid instrument names.
> [!NOTE] OpenTelemetry will not collect metrics from instruments that are using
> invalid names. Refer to the [OpenTelemetry
Specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#instrument-name-syntax)
for the valid syntax.
:stop_sign: You should avoid changing the order of attributes while reporting
measurements.
> [!WARNING] The last line of code has bad performance since the attributes are
> not following the same order as before:
```rust
let counter = meter.u64_counter("fruits_sold").build();
counter.add(2, &[KeyValue::new("color", "red"), KeyValue::new("name", "apple")]);
counter.add(3, &[KeyValue::new("color", "green"), KeyValue::new("name", "lime")]);
counter.add(5, &[KeyValue::new("color", "yellow"), KeyValue::new("name", "lemon")]);
counter.add(8, &[KeyValue::new("name", "lemon"), KeyValue::new("color", "yellow")]); // bad performance
```
:heavy_check_mark: If feasible, provide the attributes sorted by `Key`s in
ascending order to minimize memory usage within the Metrics SDK. Using
consistent attribute ordering allows the SDK to efficiently reuse internal data
structures.
```rust
// Good practice: Consistent attribute ordering
let counter = meter.u64_counter("fruits_sold").build();
counter.add(2, &[KeyValue::new("color", "red"), KeyValue::new("name", "apple")]);
```
### Reporting measurements - use array slices for attributes
:heavy_check_mark: When reporting measurements, use array slices for attributes
rather than creating vectors. Arrays are more efficient as they avoid
unnecessary heap allocations on the measurement path. This is true for both
synchronous and observable instruments.
```rust
// Good practice: Using an array slice directly
counter.add(2, &[KeyValue::new("color", "red"), KeyValue::new("name", "apple")]);
// Observable instrument
let _observable_counter = meter
.u64_observable_counter("request_count")
.with_description("Counts HTTP requests")
.with_unit("requests") // Optional: Adding units improves context
.with_callback(|observer| {
// Good practice: Using an array slice directly
observer.observe(
100,
&[KeyValue::new("endpoint", "/api")]
)
})
.build();
// Avoid this: Creating a Vec is unnecessary, and it allocates on the heap each time
// counter.add(2, &vec![KeyValue::new("color", "red"), KeyValue::new("name", "apple")]);
```
### Reporting measurements via synchronous instruments
:heavy_check_mark: Use synchronous Counter when you need to increment counts at
specific points in your code:
```rust
// Example: Using Counter when incrementing at specific code points
use opentelemetry::KeyValue;
fn process_item(counter: &opentelemetry::metrics::Counter<u64>, item_type: &str) {
// Process item...
// Increment the counter with the item type as an attribute
counter.add(1, &[KeyValue::new("type", item_type)]);
}
```
### Reporting measurements via asynchronous instruments
Asynchronous instruments like `ObservableCounter` are ideal for reporting
metrics that are already being tracked or stored elsewhere in your application.
These instruments allow you to observe and report the current state of such
metric.
:heavy_check_mark: Use `ObservableCounter` when you already have a variable
tracking a count:
```rust
// Example: Using ObservableCounter when you already have a variable tracking counts
use opentelemetry::KeyValue;
use std::sync::atomic::{AtomicU64, Ordering};
// An existing variable in your application
static REQUEST_COUNT: AtomicU64 = AtomicU64::new(0);
// In your application code, you update this directly
fn handle_request() {
// Process request...
REQUEST_COUNT.fetch_add(1, Ordering::SeqCst);
}
// When setting up metrics, register an observable counter that reads from your variable
fn setup_metrics(meter: &opentelemetry::metrics::Meter) {
let _observable_counter = meter
.u64_observable_counter("request_count")
.with_description("Number of requests processed")
.with_unit("requests")
.with_callback(|observer| {
// Read the current value from your existing counter
observer.observe(
REQUEST_COUNT.load(Ordering::SeqCst),
&[KeyValue::new("endpoint", "/api")]
)
})
.build();
}
```
> [!NOTE] The callbacks in the Observable instruments are invoked by the SDK
> during each export cycle.
## MeterProvider Management
Most use-cases require you to create ONLY one instance of MeterProvider. You
should NOT create multiple instances of MeterProvider unless you have some
unusual requirement of having different export strategies within the same
application. Using multiple instances of MeterProvider requires users to
exercise caution.
// TODO: Mention about creating per-thread MeterProvider // as shown in
[this](https://github.com/open-telemetry/opentelemetry-rust/pull/2659) // PR
:heavy_check_mark: Properly manage the lifecycle of `MeterProvider` instances if
you create them. Creating a MeterProvider is typically done at application
startup. Follow these guidelines:
* **Cloning**: A `MeterProvider` is a handle to an underlying provider. Cloning
it creates a new handle pointing to the same provider. Clone the
`MeterProvider` when necessary, but re-use the cloned instead of repeatedly
cloning.
* **Set as Global Provider**: Use `opentelemetry::global::set_meter_provider` to
set a clone of the `MeterProvider` as the global provider. This ensures
consistent usage across the application, allowing applications and libraries
to obtain `Meter` from the global instance.
* **Shutdown**: Explicitly call `shutdown` on the `MeterProvider` at the end of
your application to ensure all metrics are properly flushed and exported.
> [!NOTE] If you did not use `opentelemetry::global::set_meter_provider` to set
> a clone of the `MeterProvider` as the global provider, then you should be
> aware that dropping the last instance of `MeterProvider` implicitly calls
> shutdown on the provider.
:heavy_check_mark: Always call `shutdown` on the `MeterProvider` at the end of
your application to ensure proper cleanup.
## Memory Management
In OpenTelemetry,
[measurements](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#measurement)
are reported via the metrics API. The SDK
[aggregates](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#aggregation)
metrics using certain algorithms and memory management strategies to achieve
good performance and efficiency. Here are the rules which OpenTelemetry Rust
follows while implementing the metrics aggregation logic:
1. [**Pre-Aggregation**](#pre-aggregation): aggregation occurs within the SDK.
2. [**Cardinality Limits**](#cardinality-limits): the aggregation logic respects
[cardinality
limits](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#cardinality-limits),
so the SDK does not use an indefinite amount of memory in the event of a
cardinality explosion.
3. [**Memory Preallocation**](#memory-preallocation): SDK tries to pre-allocate
the memory it needs at each instrument creation time.
### Example
Let us take the following example of OpenTelemetry Rust metrics being used to
track the number of fruits sold:
* During the time range (T0, T1]:
* value = 1, color = `red`, name = `apple`
* value = 2, color = `yellow`, name = `lemon`
* During the time range (T1, T2]:
* no fruit has been sold
* During the time range (T2, T3]:
* value = 5, color = `red`, name = `apple`
* value = 2, color = `green`, name = `apple`
* value = 4, color = `yellow`, name = `lemon`
* value = 2, color = `yellow`, name = `lemon`
* value = 1, color = `yellow`, name = `lemon`
* value = 3, color = `yellow`, name = `lemon`
### Example - Cumulative Aggregation Temporality
If we aggregate and export the metrics using [Cumulative Aggregation
Temporality](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md#temporality):
* (T0, T1]
* attributes: {color = `red`, name = `apple`}, count: `1`
* attributes: {color = `yellow`, name = `lemon`}, count: `2`
* (T0, T2]
* attributes: {color = `red`, name = `apple`}, count: `1`
* attributes: {color = `yellow`, name = `lemon`}, count: `2`
* (T0, T3]
* attributes: {color = `red`, name = `apple`}, count: `6`
* attributes: {color = `green`, name = `apple`}, count: `2`
* attributes: {color = `yellow`, name = `lemon`}, count: `12`
Note that the start time is not advanced, and the exported values are the
cumulative total of what happened since the beginning.
### Example - Delta Aggregation Temporality
If we aggregate and export the metrics using [Delta Aggregation
Temporality](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md#temporality):
* (T0, T1]
* attributes: {color = `red`, name = `apple`}, count: `1`
* attributes: {color = `yellow`, name = `lemon`}, count: `2`
* (T1, T2]
* nothing since we do not have any measurement received
* (T2, T3]
* attributes: {color = `red`, name = `apple`}, count: `5`
* attributes: {color = `green`, name = `apple`}, count: `2`
* attributes: {color = `yellow`, name = `lemon`}, count: `10`
Note that the start time is advanced after each export, and only the delta since
last export is exported, allowing the SDK to "forget" previous state.
### Pre-Aggregation
Rather than exporting every individual measurement to the backend, OpenTelemetry
Rust aggregates data locally and only exports the aggregated metrics.
Using the [fruit example](#example), there are six measurements reported during
the time range `(T2, T3]`. Instead of exporting each individual measurement
event, the SDK aggregates them and exports only the summarized results. This
summarization process, illustrated in the following diagram, is known as
pre-aggregation:
```mermaid
graph LR
subgraph SDK
Instrument --> | Measurements | Pre-Aggregation[Pre-Aggregation]
end
subgraph Collector
Aggregation
end
Pre-Aggregation --> | Metrics | Aggregation
```
In addition to the in-process aggregation performed by the OpenTelemetry Rust
Metrics SDK, further aggregations can be carried out by the Collector and/or the
metrics backend.
### Pre-Aggregation Benefits
Pre-aggregation offers several advantages:
1. **Reduced Data Volume**: Summarizes measurements before export, minimizing
network overhead and improving efficiency.
2. **Predictable Resource Usage**: Ensures consistent resource consumption by
applying [cardinality limits](#cardinality-limits) and [memory
preallocation](#memory-preallocation) during SDK initialization. In other
words, metrics memory/network usage remains capped, regardless of the volume
of measurements being made.This ensures that resource utilization remains
stable despite fluctuations in traffic volume.
3. **Improved Performance**: Reduces serialization costs as we work with
aggregated data and not the numerous individual measurements. It also reduces
computational load on downstream systems, enabling them to focus on analysis
and storage.
> [!NOTE] There is no ability to opt out of pre-aggregation in OpenTelemetry.
### Cardinality Limits
The number of distinct combinations of attributes for a given metric is referred
to as the cardinality of that metric. Taking the [fruit example](#example), if
we know that we can only have apple/lemon as the name, red/yellow/green as the
color, then we can say the cardinality is 6 (i.e., 2 names × 3 colors = 6
combinations). No matter how many fruits we sell, we can always use the
following table to summarize the total number of fruits based on the name and
color.
| Color | Name | Count |
| ------ | ----- | ----- |
| red | apple | 6 |
| yellow | apple | 0 |
| green | apple | 2 |
| red | lemon | 0 |
| yellow | lemon | 12 |
| green | lemon | 0 |
In other words, we know how much memory and network are needed to collect and
transmit these metrics, regardless of the traffic pattern or volume.
In real world applications, the cardinality can be extremely high. Imagine if we
have a long running service and we collect metrics with 7 attributes and each
attribute can have 30 different values. We might eventually end up having to
remember the complete set of 30⁷ - or 21.87 billion combinations! This
cardinality explosion is a well-known challenge in the metrics space. For
example, it can cause:
* Surprisingly high costs in the observability system
* Excessive memory consumption in your application
* Poor query performance in your metrics backend
* Potential denial-of-service vulnerability that could be exploited by bad
actors
[Cardinality
limit](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#cardinality-limits)
is a throttling mechanism which allows the metrics collection system to have a
predictable and reliable behavior when there is a cardinality explosion, be it
due to a malicious attack or developer making mistakes while writing code.
OpenTelemetry has a default cardinality limit of `2000` per metric. This limit
can be configured at the individual metric level using the [View
API](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#view)
leveraging the
[`cardinality_limit`](https://docs.rs/opentelemetry_sdk/latest/opentelemetry_sdk/metrics/struct.Stream.html#structfield.cardinality_limit)
setting.
It's important to understand that this cardinality limit applies only at the
OpenTelemetry SDK level, not to the ultimate cardinality of the metric as seen
by the backend system. For example, while a single process might be limited to
2000 attribute combinations per metric, the actual backend metrics system might
see much higher cardinality due to:
1. Resource attributes (such as `service.instance.id`, `host.name`, etc.) that
can be added to each metric
2. Multiple process instances running the same application across your
infrastructure
3. The possibility of reporting different key-value pair combinations in each
export interval, as the cardinality limit only applies to the number of
distinct attribute combinations tracked during a single export interval.
(This is only applicable to Delta temporality)
Therefore, the actual cardinality in your metrics backend can be orders of
magnitude higher than what any single OpenTelemetry SDK process handles in an
export cycle.
#### Cardinality Limits - Implications
Cardinality limits are enforced for each export interval, meaning the metrics
aggregation system only allows up to the configured cardinality limit of
distinct attribute combinations per metric. Understanding how this works in
practice is important:
* **Cardinality Capping**: When the limit is reached within an export interval,
any new attribute combination is not individually tracked but instead folded
into a single aggregation with the attribute `{"otel.metric.overflow": true}`.
This preserves the overall accuracy of aggregates (such as Sum, Count, etc.)
even though information about specific attribute combinations is lost. Every
measurement is accounted for - either with its original attributes or within
the overflow bucket.
* **Temporality Effects**: The impact of cardinality limits differs based on the
temporality mode:
* **Delta Temporality**: The SDK "forgets" the state after each
collection/export cycle. This means in each new interval, the SDK can track
up to the cardinality limit of distinct attribute combinations. Over time,
your metrics backend might see far more than the configured limit of
distinct combinations from a single process.
* **Cumulative Temporality**: Since the SDK maintains state across export
intervals, once the cardinality limit is reached, new attribute combinations
will continue to be folded into the overflow bucket. The total number of
distinct attribute combinations exported cannot exceed the cardinality limit
for the lifetime of that metric instrument.
* **Impact on Monitoring**: While cardinality limits protect your system from
unbounded resource consumption, they do mean that high-cardinality attributes
may not be fully represented in your metrics. Since cardinality capping can
cause metrics to be folded into the overflow bucket, it becomes impossible to
predict which specific attribute combinations were affected across multiple
collection cycles or different service instances.
This unpredictability creates several important considerations when querying
metrics in any backend system:
* **Total Accuracy**: OpenTelemetry Metrics always ensures the total
aggregation (sum of metric values across all attributes) remains accurate,
even when overflow occurs.
* **Attribute-Based Query Limitations**: Any metric query based on specific
attributes could be misleading, as it's possible that measurements recorded
with a superset of those attributes were folded into the overflow bucket due
to cardinality capping.
* **All Attributes Affected**: When overflow occurs, it's not just
high-cardinality attributes that are affected. The entire attribute
combination is replaced with the `{"otel.metric.overflow": true}` attribute,
meaning queries for any attribute in that combination will miss data points.
#### Cardinality Limits - Example
Extending our fruit sales tracking example, imagine we set a cardinality limit
of 3 and we're tracking sales with attributes for `name`, `color`, and
`store_location`:
During a busy sales period at time (T3, T4], we record:
1. 10 red apples sold at Downtown store
2. 5 yellow lemons sold at Uptown store
3. 8 green apples sold at Downtown store
4. 3 red apples sold at Midtown store (at this point, the cardinality limit is
hit, and attributes are replaced with overflow attribute.)
The exported metrics would be:
* attributes: {color = `red`, name = `apple`, store_location = `Downtown`},
count: `10`
* attributes: {color = `yellow`, name = `lemon`, store_location = `Uptown`},
count: `5`
* attributes: {color = `green`, name = `apple`, store_location = `Downtown`},
count: `8`
* attributes: {`otel.metric.overflow` = `true`}, count: `3` ← Notice this
special overflow attribute
If we later query "How many red apples were sold?" the answer would be 10, not
13, because the Midtown sales were folded into the overflow bucket. Similarly,
queries about "How many items were sold in Midtown?" would return 0, not 3.
However, the total count across all attributes (i.e How many total fruits were
sold in (T3, T4] would correctly give 26) would be accurate.
This limitation applies regardless of whether the attribute in question is
naturally high-cardinality. Even low-cardinality attributes like "color"
become unreliable for querying if they were part of attribute combinations
that triggered overflow.
OpenTelemetry's cardinality capping is only applied to attributes provided
when reporting measurements via the [Metrics API](#metrics-api). In other
words, attributes used to create `Meter` or `Resource` attributes are not
subject to this cap.
#### Cardinality Limits - How to Choose the Right Limit
Choosing the right cardinality limit is crucial for maintaining efficient memory
usage and predictable performance in your metrics system. The optimal limit
depends on your temporality choice and application characteristics.
Setting the limit incorrectly can have consequences:
* **Limit too high**: Due to the SDK's [memory
preallocation](#memory-preallocation) strategy, excess memory will be
allocated upfront and remain unused, leading to resource waste.
* **Limit too low**: Measurements will be folded into the overflow bucket
(`{"otel.metric.overflow": true}`), losing granular attribute information and
making attribute-based queries unreliable.
Consider these guidelines when determining the appropriate limit:
##### Choosing the Right Limit for Cumulative Temporality
Cumulative metrics retain every unique attribute combination that has *ever*
been observed since the start of the process.
* You must account for the theoretical maximum number of attribute combinations.
* This can be estimated by multiplying the number of possible values for each
attribute.
* If certain attribute combinations are invalid or will never occur in practice,
you can reduce the limit accordingly.
###### Example - Fruit Sales Scenario
Attributes:
* `name` can be "apple" or "lemon" (2 values)
* `color` can be "red", "yellow", or "green" (3 values)
The theoretical maximum is 2 × 3 = 6 unique attribute sets.
For this example, the simplest approach is to use the theoretical maximum and **set the cardinality limit to 6**.
However, if you know that certain combinations will never occur (for example, if "red lemons" don't exist in your application domain), you could reduce the limit to only account for valid combinations. In this case, if only 5 combinations are valid, **setting the cardinality limit to 5** would be more memory-efficient.
##### Choosing the Right Limit for Delta Temporality
Delta metrics reset their aggregation state after every export interval. This
approach enables more efficient memory utilization by focusing only on attributes
observed during each interval rather than maintaining state for all combinations.
* **When attributes are low-cardinality** (as in the fruit example), use the
same calculation method as with cumulative temporality.
* **When high-cardinality attribute(s) exist** like `user_id`, leverage Delta
temporality's "forget state" nature to set a much lower limit based on active
usage patterns. This is where Delta temporality truly excels - when the set of
active values changes dynamically and only a small subset is active during any
given interval.
###### Example - High Cardinality Attribute Scenario
Export interval: 60 sec
Attributes:
* `user_id` (up to 1 million unique users)
* `success` (true or false, 2 values)
Theoretical limit: 1 million users × 2 = 2 million attribute sets
But if only 10,000 users are typically active during a 60 sec export interval:
10,000 × 2 = 20,000
**You can set the limit to 20,000, dramatically reducing memory usage during
normal operation.**
###### Export Interval Tuning
Shorter export intervals further reduce the required cardinality:
* If your interval is halved (e.g., from 60 sec to 30 sec), the number of unique
attribute sets seen per interval may also be halved.
> [!NOTE] More frequent exports increase CPU/network overhead due to
> serialization and transmission costs.
##### Choosing the Right Limit - Backend Considerations
While delta temporality offers certain advantages for cardinality management,
your choice may be constrained by backend support:
* **Backend Restrictions:** Some metrics backends only support cumulative
temporality. For example, Prometheus requires cumulative temporality and
cannot directly consume delta metrics.
* **Collector Conversion:** To leverage delta temporality's memory advantages
while maintaining backend compatibility, configure your SDK to use delta
temporality and deploy an OpenTelemetry Collector with a delta-to-cumulative
conversion processor. This approach pushes the memory overhead from your
application to the collector, which can be more easily scaled and managed
independently.
TODO: Add the memory cost incurred by each data points, so users can know the
memory impact of setting a higher limits.
TODO: Add example of how query can be affected when overflow occurs, use
[Aspire](https://github.com/dotnet/aspire/pull/7784) tool.
### Memory Preallocation
OpenTelemetry Rust SDK aims to avoid memory allocation on the hot code path.
When this is combined with [proper use of Metrics API](#metrics-api), heap
allocation can be avoided on the hot code path.
## Metrics Correlation
Including `TraceId` and `SpanId` as attributes in metrics might seem like an
intuitive way to achieve correlation with traces or logs. However, this approach
is ineffective and can make metrics practically unusable. Moreover, it can
quickly lead to cardinality issues, resulting in metrics being capped.
A better alternative is to use a concept in OpenTelemetry called
[Exemplars](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#exemplar).
Exemplars provide a mechanism to correlate metrics with traces by sampling
specific measurements and attaching trace context to them.
> [!NOTE] Currently, exemplars are not yet implemented in the OpenTelemetry Rust
> SDK.
## Modelling Metric Attributes
When metrics are being collected, they normally get stored in a [time series
database](https://en.wikipedia.org/wiki/Time_series_database). From storage and
consumption perspective, metrics can be multi-dimensional. Taking the [fruit
example](#example), there are two attributes - "name" and "color". For basic
scenarios, all the attributes can be reported during the [Metrics
API](#metrics-api) invocation, however, for less trivial scenarios, the
attributes can come from different sources:
* [Measurements](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#measurement)
reported via the [Metrics API](#metrics-api).
* Additional attributes provided at meter creation time via
[`meter_with_scope`](https://docs.rs/opentelemetry/latest/opentelemetry/metrics/trait.MeterProvider.html#tymethod.meter_with_scope).
* [Resources](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md)
configured at the `MeterProvider` level.
* Additional attributes provided by the collector. For example, [jobs and
instances](https://prometheus.io/docs/concepts/jobs_instances/) in Prometheus.
### Best Practices for Modeling Attributes
Follow these guidelines when deciding where to attach metric attributes:
* **For static attributes** (constant throughout the process lifetime):
* **Resource-level attributes**: If the dimension applies to all metrics
(e.g., hostname, datacenter), model it as a Resource attribute, or better
yet, let the collector add these automatically.
```rust
// Example: Setting resource-level attributes
let resource = Resource::new(vec![
KeyValue::new("service.name", "payment-processor"),
KeyValue::new("deployment.environment", "production"),
]);
```
* **Meter-level attributes**: If the dimension applies only to a subset of
metrics (e.g., library version), model it as meter-level attributes via
`meter_with_scope`.
```rust
// Example: Setting meter-level attributes
let scope = InstrumentationScope::builder("payment_library")
.with_version("1.2.3")
.with_attributes([KeyValue::new("payment.gateway", "stripe")])
.build();
let meter = global::meter_with_scope(scope);
```
* **For dynamic attributes** (values that change during execution):
* Report these via the Metrics API with each measurement.
* Be mindful that [cardinality limits](#cardinality-limits) apply to these
attributes.
```rust
// Example: Using dynamic attributes with each measurement
counter.add(1, &[
KeyValue::new("customer.tier", customer.tier),
KeyValue::new("transaction.status", status.to_string()),
]);
```
## Common issues that lead to missing metrics
Common pitfalls that can result in missing metrics include:
1. **Invalid instrument names** - OpenTelemetry will not collect metrics from
instruments using invalid names. See the [specification for valid
syntax](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#instrument-name-syntax).
2. **Not calling `shutdown` on the MeterProvider** - Ensure you properly call
`shutdown` at application termination to flush any pending metrics.
3. **Cardinality explosion** - When too many unique attribute combinations are
used, some metrics may be placed in the overflow bucket.
// TODO: Add more specific examples
## References
[OTel Metrics Specification - Supplementary Guidelines](https://opentelemetry.io/docs/specs/otel/metrics/supplementary-guidelines/)

187
docs/migration_0.28.md Normal file
View File

@ -0,0 +1,187 @@
# Migration guide from 0.27 to 0.28
OpenTelemetry Rust 0.28 introduces a large number of breaking changes that
impact all signals (logs/metrics/traces). This guide is intended to help with a
smooth migration for the common use cases of using `opentelemetry`,
`opentelemetry_sdk` `opentelemetry-otlp`, `opentelemetry-appender-tracing`
crates. The detailed changelog for each crate that you use can be consulted for
the full set of changes. This doc covers only the common scenario.
## Tracing Shutdown changes
`opentelemetry::global::shutdown_tracer_provider()` is removed. Now, you should
explicitly call shutdown() on the created tracer provider.
Before (0.27):
```rust
opentelemetry::global::shutdown_tracer_provider();
```
After (0.28):
```rust
let tracer_provider = opentelemetry_sdk::trace::SdkTracerProvider::builder()
.build();
// Clone and set the tracer provider globally. Retain the original to invoke shutdown later.
opentelemetry::global::set_tracer_provider(tracer_provider.clone());
// Shutdown the provider when application is exiting.
tracer_provider.shutdown();
```
This now makes shutdown consistent across signals.
## Rename SDK Structs
`LoggerProvider`, `TracerProvider` are renamed to `SdkLoggerProvider` and
`SdkTracerProvider` respectively. `MeterProvider` was already named
`SdkMeterProvider` and this now ensures consistency across signals.
### Async Runtime Requirements removed
When using OTLP Exporter for Logs, Traces a "batching" exporter is recommended.
Also, metrics always required a component named `PeriodicReader`. These
components previously needed user to pass in an async runtime and enable
appropriate feature flag depending on the runtime.
These components have been re-written to no longer require an async runtime.
Instead they operate by spawning dedicated background thread, and making
blocking calls from the same.
PeriodicReader, BatchSpanProcessor, BatchLogProcessor are the components
affected.
For Logs,Traces replace `.with_batch_exporter(exporter, runtime::Tokio)` with
`.with_batch_exporter(exporter)`.
For Metrics, replace `let reader =
PeriodicReader::builder(exporter, runtime::Tokio).build();` with `let reader =
PeriodicReader::builder(exporter).build();` or more conveniently,
`.with_periodic_exporter(exporter)`.
Please note the following:
* With the new approach, only the following grpc/http clients are supported in
`opentelemetry-otlp`.
`grpc-tonic` (OTLP
Exporter must be created from within a Tokio runtime)
`reqwest-blocking-client`
In other words,
`reqwest` and `hyper` are not supported.
If using exporters other than `opentelemetry-otlp`, consult the docs
for the same to know if there are any restrictions/requirements on async
runtime.
* Timeout enforcement is now moved to Exporters. i.e
BatchProcessor,PeriodicReader does not enforce timeouts. For logs and traces,
`max_export_timeout` (on Processors) or `OTEL_BLRP_EXPORT_TIMEOUT` or
`OTEL_BSP_EXPORT_TIMEOUT` is no longer supported. For metrics, `with_timeout` on
PeriodicReader is no longer supported.
`OTEL_EXPORTER_OTLP_TIMEOUT` can be used to setup timeout for OTLP Exporters
via environment variables, or `.with_tonic().with_timeout()` or
`.with_http().with_timeout()` programmatically.
* If you need the old behavior (your application cannot spawn a new thread, or
need to use another networking client etc.) use appropriate feature flag(s) from
below.
“experimental_metrics_periodicreader_with_async_runtime”
"experimental_logs_batch_log_processor_with_async_runtime"
"experimental_trace_batch_span_processor_with_async_runtime"
**and** adjust the namespace:
Example, when using Tokio runtime.
```rust
let reader = opentelemetry_sdk::metrics::periodic_reader_with_async_runtime::PeriodicReader::builder(exporter, runtime::Tokio).build();
let tracer_provider = SdkTracerProvider::builder()
.with_span_processor(span_processor_with_async_runtime::BatchSpanProcessor::builder(exporter, runtime::Tokio).build())
.build();
let logger_provider = SdkLoggerProvider::builder()
.with_log_processor(log_processor_with_async_runtime::BatchLogProcessor::builder(exporter, runtime::Tokio).build())
.build();
```
## OTLP Default change
"grpc-tonic" feature flag is no longer enabled by default in
`opentelemetry-otlp`. "http-proto" and "reqwest-blocking-client" features are
added as default, to align with the OTel specification.
## Resource Changes
`Resource` creation is moved to a builder pattern, and `Resource::{new, empty,
from_detectors, new_with_defaults, from_schema_url, merge, default}` are
replaced with `Resource::builder()`.
Before:
```rust
Resource::default().with_attributes([
KeyValue::new("service.name", "test_service"),
KeyValue::new("key", "value"),
]);
```
After:
```rust
Resource::builder()
.with_service_name("test_service")
.with_attribute(KeyValue::new("key", "value"))
.build();
```
## Improved internal logging
OpenTelemetry internally used `tracing` to emit its internal logs. This is under
feature-flag "internal-logs" that is enabled by default in all crates. When
using OTel Logging, care must be taken to avoid OTel's own internal log being
fed back to OTel, creating an circular dependency. This can be achieved via proper
filtering. The OTLP Examples in the repo shows how to achieve this. It also
shows how to send OTel's internal logs to stdout using `tracing::Fmt`.
## Full example
A fully runnable example application using OTLP Exporter is provided in this
repo. Comparing the 0.27 vs 0.28 of the example would give a good overview of
the changes required to be made.
[Basic OTLP Example
(0.27)](https://github.com/open-telemetry/opentelemetry-rust/tree/opentelemetry-otlp-0.27.0/opentelemetry-otlp/examples)
[Basic OTLP Example
(0.28)](https://github.com/open-telemetry/opentelemetry-rust/tree/opentelemetry-otlp-0.28.0/opentelemetry-otlp/examples)
This guide covers only the most common breaking changes. If youre using custom
exporters or processors (or authoring one), please consult the changelog for
additional migration details.
## Notes on Breaking Changes and the Path to 1.0
We understand that breaking changes can be challenging, but they are essential
for the growth and stability of the project. With the release of 0.28, the
Metric API (`opentelemetry` crate, "metrics" feature flag) and LogBridge API
(`opentelemetry` crate, "logs" feature flag) are now stable, and we do not
anticipate further breaking changes for these components.
Moreover, the `opentelemetry_sdk` crate for "logs" and "metrics" will have a
very high bar for any future breaking changes. Any changes are expected to
primarily impact those developing custom components, such as custom exporters.
In the upcoming releases, we aim to bring the "traces" feature to the same level
of stability as "logs" and "metrics". Additionally, "opentelemetry-otlp", the
official exporter, will also receive stability guarantees.
We are excited to announce that a 1.0 release, encompassing logs, metrics, and
traces, is planned for June 2025. We appreciate your patience and support as we
work towards this milestone. The 1.0 release will cover the API
(`opentelemetry`), SDK (`opentelemetry_sdk`), OTLP Exporter
(`opentelemetry-otlp`), and Tracing-Bridge (`opentelemetry-appender-tracing`).
We encourage you to share your feedback via GitHub issues or the OTel-Rust Slack
channel [here](https://cloud-native.slack.com/archives/C03GDP0H023).

92
docs/migration_0.29.md Normal file
View File

@ -0,0 +1,92 @@
# Migration Guide from 0.28 to 0.29
OpenTelemetry Rust 0.29 introduces a few breaking changes. This guide aims to
facilitate a smooth migration for common use cases involving the
`opentelemetry`, `opentelemetry_sdk`, `opentelemetry-otlp`, and
`opentelemetry-appender-tracing` crates. For a comprehensive list of changes,
please refer to the detailed changelog for each crate. This document covers only
the most common scenarios. Note that changes that only affect custom
exporter/processor authors are not mentioned in this doc.
OpenTelemetry Metrics API and Log-Bridge API were declared stable in 0.28, and have
no breaking changes.
## Baggage Changes
The Baggage API has been redesigned to align with the OpenTelemetry
specification. While the core API for interacting with Baggage remains the same,
the accepted data types have changed. Baggage Keys now only allow strings (ASCII
printable characters), and Baggage values are restricted to strings.
For detailed changes, see the [changelog](../opentelemetry/CHANGELOG.md). With
version 0.29, the Baggage API has reached "Release Candidate" status, meaning
further breaking changes will be highly restricted.
## Appender-Tracing Changes
The `opentelemetry-appender-tracing` crate, which bridges `tracing` events to
OpenTelemetry logs, has been updated to properly map `tracing` data types to the
OpenTelemetry model. As of version 0.29, this crate is considered "Stable," and
no further breaking changes will be made without a major version bump.
## Configuration via Environment Variables
The 0.29 release aligns OpenTelemetry Rust with the rest of the OpenTelemetry
ecosystem by treating any code-based configuration as final (i.e., it cannot be
overridden by environment variables). This policy was partially true before but
is now applied consistently. If you prefer to configure your application via
environment variables, avoid configuring it programmatically.
## Discontinuing Dedicated Prometheus Exporter
The `opentelemetry-prometheus` crate will be discontinued with the 0.29 release.
Active development on this crate ceased a few months ago. Given that Prometheus
now natively supports OTLP, and considering that the OpenTelemetry Rust project
is still working towards a 1.0 release, we need to focus on essential components
to maintain scope and ensure timely delivery.
Prometheus interoperability remains a key goal for OpenTelemetry. However, the
current `opentelemetry-prometheus` crate requires a major rewrite to eliminate
dependencies on unmaintained crates. We may reintroduce a dedicated Prometheus
exporter in the future once these issues are resolved.
### Migration Guide
For those using Prometheus as a backend, you can integrate with Prometheus using
the following methods:
1. Use the OTLP Exporter to push metrics directly to Prometheus.
2. If you require a pull (scrape) model, push metrics to an OpenTelemetry
Collector using the OTLP Exporter, and configure Prometheus to scrape the
OpenTelemetry Collector.
These alternatives ensure continued Prometheus integration while allowing us to
focus on achieving a stable 1.0 release for OpenTelemetry Rust.
## Next Release
In the [next
release](https://github.com/open-telemetry/opentelemetry-rust/milestone/21), we
expect to stabilize the Metrics SDK and resolve the long-standing question of
`tokio-tracing` vs. `opentelemetry tracing`, which is a prerequisite before
stabilizing Distributed Tracing. Additionally, `Context` is also expected to be
enhanced with the ability to suppress telemetry-induced-telemetry.
## Instrumentation Libraries
Unlike other OpenTelemetry language implementations, OpenTelemetry Rust historically did not
maintain any instrumentations directly. This has recently changed with a
[contribution](https://github.com/open-telemetry/opentelemetry-rust-contrib/pull/202)
from one of the founding members of the OpenTelemetry Rust project to the
contrib repository, providing an instrumentation library for
[`actix-web`](https://github.com/open-telemetry/opentelemetry-rust-contrib/tree/main/opentelemetry-instrumentation-actix-web).
We expect that this instrumentation will serve as a reference implementation demonstrating best practices for
creating OpenTelemetry instrumentations in Rust.
We welcome additional contributions of instrumentation libraries to the contrib repository.
## Thanks
Thank you to everyone who contributed to this milestone. Please share your feedback
through GitHub issues or join the discussion in the OTel-Rust Slack channel
[here](https://cloud-native.slack.com/archives/C03GDP0H023).

68
docs/release_0.30.md Normal file
View File

@ -0,0 +1,68 @@
# Release Notes 0.30
OpenTelemetry Rust 0.30 introduces a few breaking changes to the
`opentelemetry_sdk` crate in the `metrics` feature. These changes were essential
to drive the Metrics SDK towards stability. With this release, the Metrics SDK
is officially declared stable. The Metrics API was declared stable last year,
and previously, the Logs API, SDK, and OTel-Appender-Tracing were also marked
stable. Importantly, no breaking changes have been introduced to components
already marked as stable.
It is worth noting that the `opentelemetry-otlp` crate remains in a
Release-Candidate state and is not yet considered stable. With the API and SDK
for Logs and Metrics now stable, the focus will shift towards further refining
and stabilizing the OTLP Exporters in upcoming releases. Additionally,
Distributed Tracing is expected to progress towards stability, addressing key
interoperability challenges.
For detailed changelogs of individual crates, please refer to their respective
changelog files. This document serves as a summary of the main changes.
## Key Changes
### Metrics SDK Improvements
1. **Stabilized "view" features**: Previously under an experimental feature
flag, views can now be used to modify the name, unit, description, and
cardinality limit of a metric. Advanced view capabilities, such as changing
aggregation or dropping attributes, remain under the experimental feature
flag.
2. **Cardinality capping**: Introduced the ability to cap cardinality and
configure limits using views.
3. **Polished public API**: Refined the public API to hide implementation
details from exporters, enabling future internal optimizations and ensuring
consistency. Some APIs related to authoring custom metric readers have been
moved behind experimental feature flags. These advanced use cases require
more time to finalize the API surface before being included in the stable
release.
### Context-Based Suppression
Added the ability to suppress telemetry based on Context. This feature prevents
telemetry-induced-telemetry scenarios and addresses a long-standing issue. Note
that suppression relies on proper context propagation. Certain libraries used in
OTLP Exporters utilize `tracing` but do not adopt OpenTelemetry's context
propagation. As a result, not all telemetry is automatically suppressed with
this feature. Improvements in this area are expected in future releases.
## Next Release
In the [next
release](https://github.com/open-telemetry/opentelemetry-rust/milestone/22), the
focus will shift to OTLP Exporters and Distributed Tracing, specifically
resolving
[interoperability](https://github.com/open-telemetry/opentelemetry-rust/issues/2420)
issues with `tokio-tracing` and other fixes required to drive Distributed
Tracing towards stability.
## Acknowledgments
Thank you to everyone who contributed to this milestone. We welcome your
feedback through GitHub issues or discussions in the OTel-Rust Slack channel
[here](https://cloud-native.slack.com/archives/C03GDP0H023).
We are also excited to announce that [Anton Grübel](https://github.com/gruebel)
and [Björn Antonsson](https://github.com/bantonsson) have joined the OTel Rust
project as Approvers.

67
examples/README.md Normal file
View File

@ -0,0 +1,67 @@
# Examples
This directory contains some examples that should help you get start crates from `opentelemetry-rust`.
## log-basic
This example uses following crates from this repo:
- opentelemetry(log)
- opentelemetry-appender-tracing
- opentelemetry-stdout
Check this example if you want to understand *how to instrument logs using opentelemetry*.
## metrics-basic
This example uses following crates from this repo:
- opentelemetry(metrics)
- opentelemetry-stdout
Check this example if you want to understand *how to instrument metrics using opentelemetry*.
## metrics-advanced
This example uses following crates from this repo:
- opentelemetry(metrics)
- opentelemetry-stdout
This builds on top of the metrics-basic,
and shows advanced features in Metrics SDK like using Views.
## tracing-grpc
This example uses following crates from this repo:
- opentelemetry(tracing)
- opentelemetry-stdout
The application is built using `tokio`.
Check this example if you want to understand *how to create spans and
propagate/restore context in OpenTelemetry* in a gRPC client-server application.
## tracing-http-propagator
This example uses following crates from this repo:
- opentelemetry(tracing)
- opentelemetry-http
- opentelemetry-stdout
Check this example if you want to understand *how to create spans and
propagate/restore context in OpenTelemetry* in an HTTP client-server
application.
## tracing-jaeger
This example uses following crates from this repo:
- opentelemetry(tracing)
- opentelemetry-otlp
The application is built using `tokio`.
Check this example if you want to understand *how to use OTLP Exporter to export traces to Jaeger*.

View File

@ -1,15 +0,0 @@
[package]
name = "actix-http-tracing"
version = "0.1.0"
edition = "2018"
publish = false
[dependencies]
actix-web = "3.2"
actix-web-opentelemetry = { version = "0.9", features = ["metrics"] }
opentelemetry = { version = "0.11", features = ["metrics", "tokio"] }
opentelemetry-jaeger = { version = "0.10", features = ["tokio"] }
opentelemetry-prometheus = "0.4"
tracing = "0.1"
tracing-opentelemetry = "0.10"
tracing-subscriber = "0.2"

View File

@ -1,72 +0,0 @@
# Actix Web with Tracing example
This example shows how to export data to [Jaeger] and [Prometheus] from an
[actix-web] app instrumented using the [tracing] API and ecosystem.
[Jaeger]: https://www.jaegertracing.io
[Prometheus]: https://prometheus.io
[actix-web]: https://github.com/actix/actix-web
[tracing]: https://github.com/tokio-rs/tracing
## Setup
```shell
# Run jaeger in background
$ docker run -d -p6831:6831/udp -p6832:6832/udp -p16686:16686 -p14268:14268 jaegertracing/all-in-one:latest
# Start the actix web server
$ cargo run
# (from another terminal window)
$ curl localhost:8080/users/@ferris
=> Hello @ferris
# View spans (see the image below)
$ firefox http://localhost:16686/
```
## Generated Telemetry
### Jaeger
After completing the steps above, the following trace information is now
available:
![Jaeger UI](trace.png)
### Prometheus (Optional)
Optional request metrics information is now exposed via `/metrics`:
```shell
$ curl localhost:8080/metrics
# HELP http_requests_duration HTTP request duration per route
# TYPE http_requests_duration histogram
http_requests_duration_bucket{method="GET",route="/users/{username}",status="200",le="0.5"} 1
http_requests_duration_bucket{method="GET",route="/users/{username}",status="200",le="0.9"} 1
http_requests_duration_bucket{method="GET",route="/users/{username}",status="200",le="0.99"} 1
http_requests_duration_bucket{method="GET",route="/users/{username}",status="200",le="+Inf"} 1
http_requests_duration_sum{method="GET",route="/users/{username}",status="200"} 0.001289
http_requests_duration_count{method="GET",route="/users/{username}",status="200"} 1
# HELP http_requests_total HTTP requests per route
# TYPE http_requests_total counter
http_requests_total{method="GET",route="/users/{username}",status="200"} 1
```
### Logs
[tracing] has been configured to report `INFO` and above level logs to stdout
via [`tracing_subscriber::fmt`] and [`tracing_subscriber::EnvFilter`] to produce
the output below:
```shell
Nov 29 13:08:04.932 INFO actix_server::builder: Starting 16 workers
Nov 29 13:08:04.933 INFO actix_server::builder: Starting "actix-web-service-127.0.0.1:8080" service on 127.0.0.1:8080
Nov 29 13:08:08.740 INFO greet_user{username="@ferris"}: actix_http_tracing: preparing to greet user
Nov 29 13:08:08.740 INFO actix_web::middleware::logger: 127.0.0.1:63418 "GET /users/@ferris HTTP/1.1" 200 13 "-" "curl/7.64.1" 0.000758
```
[tracing]: https://github.com/tokio-rs/tracing
[`tracing_subscriber::fmt`]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/index.html
[`tracing_subscriber::EnvFilter`]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html

View File

@ -1,56 +0,0 @@
use actix_web::middleware::Logger;
use actix_web::{web, App, HttpServer};
use actix_web_opentelemetry::RequestTracing;
use opentelemetry::{global, sdk::propagation::TraceContextPropagator};
use std::io;
use tracing_subscriber::prelude::*;
use tracing_subscriber::Registry;
async fn index(username: actix_web::web::Path<String>) -> String {
greet_user(username.as_ref())
}
#[tracing::instrument]
fn greet_user(username: &str) -> String {
tracing::info!("preparing to greet user");
format!("Hello {}", username)
}
#[actix_web::main]
async fn main() -> io::Result<()> {
// Start an (optional) otel prometheus metrics pipeline
let metrics_exporter = opentelemetry_prometheus::exporter().init();
let request_metrics = actix_web_opentelemetry::RequestMetrics::new(
opentelemetry::global::meter("actix_http_tracing"),
Some(|req: &actix_web::dev::ServiceRequest| {
req.path() == "/metrics" && req.method() == actix_web::http::Method::GET
}),
Some(metrics_exporter),
);
// Start an otel jaeger trace pipeline
global::set_text_map_propagator(TraceContextPropagator::new());
let (tracer, _uninstall) = opentelemetry_jaeger::new_pipeline()
.with_service_name("app_name")
.install()
.unwrap();
// Initialize `tracing` using `opentelemetry-tracing` and configure logging
Registry::default()
.with(tracing_subscriber::EnvFilter::new("INFO"))
.with(tracing_subscriber::fmt::layer())
.with(tracing_opentelemetry::layer().with_tracer(tracer))
.init();
// Start actix web with otel and tracing middlewares
HttpServer::new(move || {
App::new()
.wrap(Logger::default())
.wrap(RequestTracing::new())
.wrap(request_metrics.clone())
.service(web::resource("/users/{username}").to(index))
})
.bind("127.0.0.1:8080")?
.run()
.await
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

View File

@ -1,14 +0,0 @@
[package]
name = "actix-http-example"
version = "0.1.0"
edition = "2018"
[dependencies]
opentelemetry = { path = "../../opentelemetry", features = ["rt-tokio"] }
opentelemetry-jaeger = { path = "../../opentelemetry-jaeger", features = ["reqwest_collector_client", "tokio"] }
thrift = "0.13"
futures = "0.3"
actix-web = "4.0.0-beta.4"
actix-service = "2.0.0-beta.5"
env_logger = "0.8.2"
tokio = { version = "1", features = ["full"] }

View File

@ -1,24 +0,0 @@
# Actix-web - Jaeger example with HTTP collector and batch exporter
This example shows how to export spans from an actix-web application and ship them
to the collector directly via HTTP.
It uses the batch exporter to avoid excessive network roundtrips to Jaeger.
## Usage
Launch the application:
```shell
# Run jaeger in background
$ docker run -d -p6831:6831/udp -p6832:6832/udp -p16686:16686 -p14268:14268 jaegertracing/all-in-one:latest
# Start the actix-web server
$ cargo run
# View spans
$ firefox http://localhost:16686/
```
Fire a request:
```bash
curl http://localhost:8088
```

View File

@ -1,49 +0,0 @@
use actix_service::Service;
use actix_web::middleware::Logger;
use actix_web::{web, App, HttpServer};
use opentelemetry::trace::TraceError;
use opentelemetry::{global, sdk::trace as sdktrace};
use opentelemetry::{
trace::{FutureExt, TraceContextExt, Tracer},
Key,
};
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
opentelemetry_jaeger::new_pipeline()
.with_collector_endpoint("http://127.0.0.1:14268/api/traces")
.with_service_name("trace-http-demo")
.install_batch(opentelemetry::runtime::Tokio)
}
async fn index() -> &'static str {
let tracer = global::tracer("request");
tracer.in_span("index", |ctx| {
ctx.span().set_attribute(Key::new("parameter").i64(10));
"Index"
})
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
std::env::set_var("RUST_LOG", "debug");
env_logger::init();
let tracer = init_tracer().expect("Failed to initialise tracer.");
HttpServer::new(move || {
let tracer = tracer.clone();
App::new()
.wrap(Logger::default())
.wrap_fn(move |req, srv| {
tracer.in_span("middleware", move |cx| {
cx.span()
.set_attribute(Key::new("path").string(req.path().to_string()));
srv.call(req).with_context(cx)
})
})
.route("/", web::get().to(index))
})
.bind("127.0.0.1:8088")
.unwrap()
.run()
.await
}

View File

@ -1,13 +0,0 @@
[package]
name = "actix-udp-example"
version = "0.1.0"
edition = "2018"
[dependencies]
opentelemetry = { path = "../../opentelemetry" }
opentelemetry-jaeger = { path = "../../opentelemetry-jaeger" }
thrift = "0.13"
futures = "0.3"
actix-web = "3"
actix-service = "1"
env_logger = "0.8.2"

View File

@ -1,23 +0,0 @@
# Actix-web - Jaeger example with UDP agent
This example shows how to export spans from an actix-web application and ship them
to the Jaeger agent over UDP.
## Usage
Launch the application:
```shell
# Run jaeger in background
$ docker run -d -p6831:6831/udp -p6832:6832/udp -p16686:16686 -p14268:14268 jaegertracing/all-in-one:latest
# Start the actix-web server
$ cargo run
# View spans
$ firefox http://localhost:16686/
```
Fire a request:
```bash
curl http://localhost:8088
```

View File

@ -1,49 +0,0 @@
use actix_service::Service;
use actix_web::middleware::Logger;
use actix_web::{web, App, HttpServer};
use opentelemetry::trace::TraceError;
use opentelemetry::{global, sdk::trace as sdktrace};
use opentelemetry::{
trace::{FutureExt, TraceContextExt, Tracer},
Key,
};
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
opentelemetry_jaeger::new_pipeline()
.with_agent_endpoint("localhost:6831")
.with_service_name("trace-udp-demo")
.install_simple()
}
async fn index() -> &'static str {
let tracer = global::tracer("request");
tracer.in_span("index", |ctx| {
ctx.span().set_attribute(Key::new("parameter").i64(10));
"Index"
})
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
std::env::set_var("RUST_LOG", "debug");
env_logger::init();
let _tracer = init_tracer().expect("Failed to initialise tracer.");
HttpServer::new(|| {
App::new()
.wrap(Logger::default())
.wrap_fn(|req, srv| {
let tracer = global::tracer("request");
tracer.in_span("middleware", move |cx| {
cx.span()
.set_attribute(Key::new("path").string(req.path().to_string()));
srv.call(req).with_context(cx)
})
})
.route("/", web::get().to(index))
})
.bind("127.0.0.1:8088")
.unwrap()
.run()
.await
}

View File

@ -1,11 +0,0 @@
[package]
name = "async"
version = "0.1.0"
edition = "2018"
[dependencies]
futures = "0.3"
thrift = "0.13"
tokio = { version = "1.0", features = ["full"] }
opentelemetry = { path = "../../opentelemetry", features = ["rt-tokio"] }
opentelemetry-jaeger = { path = "../../opentelemetry-jaeger", features = ["tokio"] }

View File

@ -1,24 +0,0 @@
# Async OpenTelemetry Example
This example shows how to instrument asynchronous rust code using async/await.
## Usage
```shell
# Run jaeger in background
$ docker run -d -p6831:6831/udp -p6832:6832/udp -p16686:16686 jaegertracing/all-in-one:latest
# Run server 1 on port 6142
$ ncat -l 6142 # or python -m SimpleHTTPServer 6142
# Run server 2 on port 6143
$ ncat -l 6143 # or python -m SimpleHTTPServer 6143
# Run example app and report spans
$ cargo run
# View spans (see the image below)
$ firefox http://localhost:16686/
```
![Jaeger UI](trace.png)

View File

@ -1,78 +0,0 @@
//! Demonstrates using OpenTelemetry to instrument `async` functions.
//!
//! This is based on the [`hello_world`] example from `tokio`. and implements a
//! simple client that opens a TCP stream, writes "hello world\n", and closes
//! the connection.
//!
//! You can test this out by running:
//!
//! ncat -l 6142
//!
//! And then in a second terminal run:
//!
//! ncat -l 6143
//!
//! And then in a third terminal run:
//!
//! cargo run --example async_fn
//!
//! [`hello_world`]: https://github.com/tokio-rs/tokio/blob/132e9f1da5965530b63554d7a1c59824c3de4e30/tokio/examples/hello_world.rs
use opentelemetry::trace::TraceError;
use opentelemetry::{
global,
sdk::trace as sdktrace,
trace::{FutureExt, TraceContextExt, Tracer},
Context,
};
use std::{error::Error, io, net::SocketAddr};
use tokio::io::AsyncWriteExt;
use tokio::net::TcpStream;
async fn connect(addr: &SocketAddr) -> io::Result<TcpStream> {
let tracer = global::tracer("connector");
let span = tracer.start("Connecting");
let cx = Context::current_with_value(span);
TcpStream::connect(&addr).with_context(cx).await
}
async fn write(stream: &mut TcpStream) -> io::Result<usize> {
let tracer = global::tracer("writer");
let span = tracer.start("Writing");
let cx = Context::current_with_span(span);
stream.write(b"hello world\n").with_context(cx).await
}
async fn run(addr: &SocketAddr) -> io::Result<usize> {
let tracer = global::tracer("runner");
let span = tracer.start(format!("running: {}", addr));
let cx = Context::current_with_span(span);
let mut stream = connect(addr).with_context(cx.clone()).await?;
write(&mut stream).with_context(cx).await
}
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
opentelemetry_jaeger::new_pipeline()
.with_service_name("trace-demo")
.install_batch(opentelemetry::runtime::Tokio)
}
#[tokio::main]
pub async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
let tracer = init_tracer()?;
let addr = "127.0.0.1:6142".parse()?;
let addr2 = "127.0.0.1:6143".parse()?;
let span = tracer.start("root");
let cx = Context::current_with_span(span);
let (run1, run2) = futures::future::join(run(&addr), run(&addr2))
.with_context(cx)
.await;
run1?;
run2?;
global::shutdown_tracer_provider();
Ok(())
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

View File

@ -1,21 +0,0 @@
[package]
name = "aws-xray"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]] # Bin to run the http server
name = "http-server"
path = "src/server.rs"
[[bin]] # Bin to run the client
name = "http-client"
path = "src/client.rs"
[dependencies]
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "1.0", features = ["full"] }
opentelemetry = { path = "../../opentelemetry" }
opentelemetry-aws = { path = "../../opentelemetry-aws", features = ["trace"] }
opentelemetry-http = { path = "../../opentelemetry-http" }

View File

@ -1,27 +0,0 @@
# AWS X-Ray HTTP Client/Server Example
This is a simple example using [hyper] that demonstrates tracing http request from client to server using AWS X-Ray formatted trace IDs. The example
shows key aspects of tracing such as:
- Root Span (on Client)
- Injecting `x-amzn-trace-id` on request
- Child Span (on Client)
- Child Span from a Remote Parent (on Server)
- Extracting parent information from `x-amzn-trace-id`
- SpanContext Propagation (from Client to Server)
- Span Events
- Span Attributes
[hyper]: https://hyper.rs/
## Usage
```shell
# Run server
$ cargo run --bin http-server
# In another tab, run client
$ cargo run --bin http-client
# The spans should be visible in stdout in the order that they were exported.
```

View File

@ -1,51 +0,0 @@
use hyper::{body::Body, Client};
use opentelemetry::{
global,
sdk::export::trace::stdout,
sdk::trace as sdktrace,
trace::{TraceContextExt, Tracer},
Context, KeyValue,
};
use opentelemetry_aws::XrayPropagator;
use opentelemetry_http::HeaderInjector;
fn init_tracer() -> sdktrace::Tracer {
global::set_text_map_propagator(XrayPropagator::new());
// Install stdout exporter pipeline to be able to retrieve the collected spans.
// For the demonstration, use `Sampler::AlwaysOn` sampler to sample all traces. In a production
// application, use `Sampler::ParentBased` or `Sampler::TraceIdRatioBased` with a desired ratio.
stdout::new_pipeline()
.with_trace_config(
sdktrace::config()
.with_sampler(sdktrace::Sampler::AlwaysOn)
.with_id_generator(sdktrace::XrayIdGenerator::default()),
)
.install_simple()
}
#[tokio::main]
async fn main() -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
let _tracer = init_tracer();
let client = Client::new();
let span = global::tracer("example/client").start("say hello");
let cx = Context::current_with_span(span);
let mut req = hyper::Request::builder().uri("http://127.0.0.1:3000");
global::get_text_map_propagator(|propagator| {
propagator.inject_context(&cx, &mut HeaderInjector(req.headers_mut().unwrap()));
println!("Headers: {:?}", req.headers_ref());
});
let res = client.request(req.body(Body::from("Hallo!"))?).await?;
cx.span().add_event(
"Got response!".to_string(),
vec![KeyValue::new("status", res.status().to_string())],
);
Ok(())
}

View File

@ -1,61 +0,0 @@
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Request, Response, Server};
use opentelemetry::{
global,
sdk::export::trace::stdout,
sdk::trace as sdktrace,
trace::{Span, Tracer},
};
use opentelemetry_aws::XrayPropagator;
use opentelemetry_http::HeaderExtractor;
use std::{convert::Infallible, net::SocketAddr};
async fn handle(req: Request<Body>) -> Result<Response<Body>, Infallible> {
let parent_context = global::get_text_map_propagator(|propagator| {
propagator.extract(&HeaderExtractor(req.headers()))
});
let x_amzn_trace_id = req
.headers()
.get("x-amzn-trace-id")
.unwrap()
.to_str()
.unwrap();
let mut span = global::tracer("example/server").start_with_context("hello", parent_context);
span.add_event(format!("Handling - {}", x_amzn_trace_id), Vec::new());
Ok(Response::new(
format!("Hello!, X-Ray Trace Header: {}", x_amzn_trace_id).into(),
))
}
fn init_tracer() -> sdktrace::Tracer {
global::set_text_map_propagator(XrayPropagator::new());
// Install stdout exporter pipeline to be able to retrieve the collected spans.
// For the demonstration, use `Sampler::AlwaysOn` sampler to sample all traces. In a production
// application, use `Sampler::ParentBased` or `Sampler::TraceIdRatioBased` with a desired ratio.
stdout::new_pipeline()
.with_trace_config(
sdktrace::config()
.with_sampler(sdktrace::Sampler::AlwaysOn)
.with_id_generator(sdktrace::XrayIdGenerator::default()),
)
.install_simple()
}
#[tokio::main]
async fn main() {
let _tracer = init_tracer();
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
let make_svc = make_service_fn(|_conn| async { Ok::<_, Infallible>(service_fn(handle)) });
let server = Server::bind(&addr).serve(make_svc);
println!("Listening on {}", addr);
if let Err(e) = server.await {
eprintln!("server error: {}", e);
}
}

View File

@ -1,12 +0,0 @@
[package]
name = "basic-otlp-http"
version = "0.1.0"
authors = ["rdan <dan.rusei@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
opentelemetry = { path = "../../opentelemetry", features = ["rt-tokio", "metrics", "serialize"] }
opentelemetry-otlp = { path = "../../opentelemetry-otlp", features = ["http-proto", "reqwest-client"] }
tokio = { version = "1.0", features = ["full"] }

View File

@ -1,6 +0,0 @@
FROM rust:1.51
COPY . /usr/src/basic-otlp-http/
WORKDIR /usr/src/basic-otlp-http/
RUN cargo build --release
RUN cargo install --path .
CMD ["/usr/local/cargo/bin/basic-otlp-http"]

View File

@ -1,24 +0,0 @@
* The application send data directly to a Collector (port 55681)
* Run the application locally, to run as a docker container you have to change the relative paths from the `Cargo.toml`
* The Collector then sends the data to the appropriate backend, in this case JAEGER
This demo uses `docker-compose` and by default runs against the `otel/opentelemetry-collector-dev:latest` image.
```shell
docker-compose up
or
docker-compose up -d
```
In another terminal run the application `cargo run`
Use the browser to see the trace:
- Jaeger at http://0.0.0.0:16686
Tear it down:
```shell
docker-compose down
```

View File

@ -1,37 +0,0 @@
version: "2"
services:
# Jaeger
jaeger-all-in-one:
image: jaegertracing/all-in-one:latest
ports:
- "16686:16686"
- "14268"
- "14250"
# Collector
otel-collector:
image: otel/opentelemetry-collector-dev:latest
command: ["--config=/etc/otel-collector-config.yaml", "${OTELCOL_ARGS}"]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
ports:
- "1888:1888" # pprof extension
- "13133:13133" # health_check extension
- "4317" # OTLP gRPC receiver
- "55681:55681" # OTLP HTTP receiver
- "55670:55679" # zpages extension
depends_on:
- jaeger-all-in-one
# metrics-rust:
# build:
# dockerfile: $PWD/Dockerfile
# context: ./basic-otlp-http
# environment:
# - OTLP_TONIC_ENDPOINT=otel-collector:4317
# depends_on:
# - otel-collector

View File

@ -1,35 +0,0 @@
receivers:
otlp:
protocols:
http:
grpc:
exporters:
logging:
loglevel: debug
jaeger:
endpoint: jaeger-all-in-one:14250
insecure: true
processors:
batch:
extensions:
health_check:
pprof:
endpoint: :1888
zpages:
endpoint: :55679
service:
extensions: [pprof, zpages, health_check]
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [logging, jaeger]
metrics:
receivers: [otlp]
processors: [batch]
exporters: [logging]

View File

@ -1,48 +0,0 @@
use opentelemetry::trace::TraceError;
use opentelemetry::{global, sdk::trace as sdktrace};
use opentelemetry::{
trace::{TraceContextExt, Tracer},
Key,
};
use std::error::Error;
use std::time::Duration;
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
opentelemetry_otlp::new_pipeline()
.with_endpoint("http://localhost:55681/v1/traces")
.with_http()
.install_batch(opentelemetry::runtime::Tokio)
}
const LEMONS_KEY: Key = Key::from_static_str("ex.com/lemons");
const ANOTHER_KEY: Key = Key::from_static_str("ex.com/another");
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
let _ = init_tracer()?;
let tracer = global::tracer("ex.com/basic");
tracer.in_span("operation", |cx| {
let span = cx.span();
span.add_event(
"Nice operation!".to_string(),
vec![Key::new("bogons").i64(100)],
);
span.set_attribute(ANOTHER_KEY.string("yes"));
tracer.in_span("Sub operation...", |cx| {
let span = cx.span();
span.set_attribute(LEMONS_KEY.string("five"));
span.add_event("Sub span event".to_string(), vec![]);
});
});
// wait for 1 minutes so that we could see metrics being pushed via OTLP every 10 seconds.
tokio::time::sleep(Duration::from_secs(60)).await;
global::shutdown_tracer_provider();
Ok(())
}

View File

@ -1,12 +0,0 @@
[package]
name = "basic-otlp-with-selector"
version = "0.1.0"
edition = "2018"
[dependencies]
futures = "0.3"
lazy_static = "1.4"
opentelemetry = { path = "../../opentelemetry", features = ["rt-tokio", "metrics", "serialize"] }
opentelemetry-otlp = { path = "../../opentelemetry-otlp", features = ["tonic", "metrics"] }
serde_json = "1.0"
tokio = { version = "1.0", features = ["full"] }

View File

@ -1,7 +0,0 @@
# Basic OTLP exporter Example
This example shows how to configure OTLP metrics exporter to use custom aggregator selectors and custom export kind selectors.
## Prerequisite
You should first start a `opentelemetry-collector` on localhost using the default configuration.

View File

@ -1,145 +0,0 @@
use futures::stream::Stream;
use futures::StreamExt;
use opentelemetry::global::shutdown_tracer_provider;
use opentelemetry::sdk::export::metrics::{ExportKind, ExportKindFor};
use opentelemetry::sdk::{
export::metrics::{Aggregator, AggregatorSelector},
metrics::{aggregators, PushController},
};
use opentelemetry::trace::TraceError;
use opentelemetry::{
baggage::BaggageExt,
metrics::{self, Descriptor, ObserverResult},
trace::{TraceContextExt, Tracer},
Context, Key, KeyValue,
};
use opentelemetry::{global, sdk::trace as sdktrace};
use opentelemetry_otlp::ExporterConfig;
use opentelemetry_otlp::Protocol;
use std::error::Error;
use std::sync::Arc;
use std::time::Duration;
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
opentelemetry_otlp::new_pipeline()
.with_endpoint("http://localhost:4317")
.with_tonic()
.install_batch(opentelemetry::runtime::Tokio)
}
// Skip first immediate tick from tokio, not needed for async_std.
fn delayed_interval(duration: Duration) -> impl Stream<Item = tokio::time::Instant> {
opentelemetry::util::tokio_interval_stream(duration).skip(1)
}
#[derive(Debug)]
struct CustomAggregator();
impl AggregatorSelector for CustomAggregator {
fn aggregator_for(
&self,
descriptor: &Descriptor,
) -> Option<Arc<(dyn Aggregator + Sync + std::marker::Send + 'static)>> {
match descriptor.name() {
"ex.com.one" => Some(Arc::new(aggregators::last_value())),
"ex.com.two" => Some(Arc::new(aggregators::histogram(
descriptor,
&[0.0, 0.5, 1.0, 10.0],
))),
_ => Some(Arc::new(aggregators::sum())),
}
}
}
#[derive(Debug, Clone)]
struct CustomExportKindFor();
impl ExportKindFor for CustomExportKindFor {
fn export_kind_for(&self, _descriptor: &Descriptor) -> ExportKind {
ExportKind::Delta
}
}
fn init_meter() -> metrics::Result<PushController> {
let export_config = ExporterConfig {
endpoint: "http://localhost:4317".to_string(),
protocol: Protocol::Grpc,
..ExporterConfig::default()
};
opentelemetry_otlp::new_metrics_pipeline(tokio::spawn, delayed_interval)
.with_export_config(export_config)
.with_export_kind(CustomExportKindFor())
.with_aggregator_selector(CustomAggregator())
.build()
}
const FOO_KEY: Key = Key::from_static_str("ex.com/foo");
const BAR_KEY: Key = Key::from_static_str("ex.com/bar");
const LEMONS_KEY: Key = Key::from_static_str("lemons");
const ANOTHER_KEY: Key = Key::from_static_str("ex.com/another");
lazy_static::lazy_static! {
static ref COMMON_LABELS: [KeyValue; 4] = [
LEMONS_KEY.i64(10),
KeyValue::new("A", "1"),
KeyValue::new("B", "2"),
KeyValue::new("C", "3"),
];
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
let _ = init_tracer()?;
let _started = init_meter()?;
let tracer = global::tracer("ex.com/basic");
let meter = global::meter("ex.com/basic");
let one_metric_callback = |res: ObserverResult<f64>| res.observe(1.0, COMMON_LABELS.as_ref());
let _ = meter
.f64_value_observer("ex.com.one", one_metric_callback)
.with_description("A ValueObserver set to 1.0")
.init();
let value_recorder_two = meter.f64_value_recorder("ex.com.two").init();
let another_recorder = meter.f64_value_recorder("ex.com.two").init();
another_recorder.record(5.5, COMMON_LABELS.as_ref());
let _baggage =
Context::current_with_baggage(vec![FOO_KEY.string("foo1"), BAR_KEY.string("bar1")])
.attach();
let value_recorder = value_recorder_two.bind(COMMON_LABELS.as_ref());
tracer.in_span("operation", |cx| {
let span = cx.span();
span.add_event(
"Nice operation!".to_string(),
vec![Key::new("bogons").i64(100)],
);
span.set_attribute(ANOTHER_KEY.string("yes"));
meter.record_batch_with_context(
// Note: call-site variables added as context Entries:
&Context::current_with_baggage(vec![ANOTHER_KEY.string("xyz")]),
COMMON_LABELS.as_ref(),
vec![value_recorder_two.measurement(2.0)],
);
tracer.in_span("Sub operation...", |cx| {
let span = cx.span();
span.set_attribute(LEMONS_KEY.string("five"));
span.add_event("Sub span event".to_string(), vec![]);
value_recorder.record(1.3);
});
});
// wait for 1 minutes so that we could see metrics being pushed via OTLP every 10 seconds.
tokio::time::sleep(Duration::from_secs(60)).await;
shutdown_tracer_provider();
Ok(())
}

View File

@ -1,12 +0,0 @@
[package]
name = "basic-otlp"
version = "0.1.0"
edition = "2018"
[dependencies]
futures = "0.3"
lazy_static = "1.4"
opentelemetry = { path = "../../opentelemetry", features = ["rt-tokio", "metrics", "serialize"] }
opentelemetry-otlp = { path = "../../opentelemetry-otlp", features = ["tonic", "metrics"] }
serde_json = "1.0"
tokio = { version = "1.0", features = ["full"] }

View File

@ -1,6 +0,0 @@
# Basic OTLP exporter Example
This example shows basic span and metric usage, and exports to the [OpenTelemetry Collector](https://github.com/open-telemetry/opentelemetry-collector) via OTLP.
## Prerequisite
You should first start a `opentelemetry-collector` on localhost using the default configuration.

View File

@ -1,110 +0,0 @@
use futures::stream::Stream;
use futures::StreamExt;
use opentelemetry::global::shutdown_tracer_provider;
use opentelemetry::sdk::metrics::{selectors, PushController};
use opentelemetry::trace::TraceError;
use opentelemetry::{
baggage::BaggageExt,
metrics::{self, ObserverResult},
trace::{TraceContextExt, Tracer},
Context, Key, KeyValue,
};
use opentelemetry::{global, sdk::trace as sdktrace};
use opentelemetry_otlp::ExporterConfig;
use std::error::Error;
use std::time::Duration;
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
opentelemetry_otlp::new_pipeline()
.with_endpoint("http://localhost:4317")
.with_tonic()
.install_batch(opentelemetry::runtime::Tokio)
}
// Skip first immediate tick from tokio, not needed for async_std.
fn delayed_interval(duration: Duration) -> impl Stream<Item = tokio::time::Instant> {
opentelemetry::util::tokio_interval_stream(duration).skip(1)
}
fn init_meter() -> metrics::Result<PushController> {
let export_config = ExporterConfig {
endpoint: "http://localhost:4317".to_string(),
..ExporterConfig::default()
};
opentelemetry_otlp::new_metrics_pipeline(tokio::spawn, delayed_interval)
.with_export_config(export_config)
.with_aggregator_selector(selectors::simple::Selector::Exact)
.build()
}
const FOO_KEY: Key = Key::from_static_str("ex.com/foo");
const BAR_KEY: Key = Key::from_static_str("ex.com/bar");
const LEMONS_KEY: Key = Key::from_static_str("lemons");
const ANOTHER_KEY: Key = Key::from_static_str("ex.com/another");
lazy_static::lazy_static! {
static ref COMMON_LABELS: [KeyValue; 4] = [
LEMONS_KEY.i64(10),
KeyValue::new("A", "1"),
KeyValue::new("B", "2"),
KeyValue::new("C", "3"),
];
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
let _ = init_tracer()?;
let _started = init_meter()?;
let tracer = global::tracer("ex.com/basic");
let meter = global::meter("ex.com/basic");
let one_metric_callback = |res: ObserverResult<f64>| res.observe(1.0, COMMON_LABELS.as_ref());
let _ = meter
.f64_value_observer("ex.com.one", one_metric_callback)
.with_description("A ValueObserver set to 1.0")
.init();
let value_recorder_two = meter.f64_value_recorder("ex.com.two").init();
let another_recorder = meter.f64_value_recorder("ex.com.two").init();
another_recorder.record(5.5, COMMON_LABELS.as_ref());
let _baggage =
Context::current_with_baggage(vec![FOO_KEY.string("foo1"), BAR_KEY.string("bar1")])
.attach();
let value_recorder = value_recorder_two.bind(COMMON_LABELS.as_ref());
tracer.in_span("operation", |cx| {
let span = cx.span();
span.add_event(
"Nice operation!".to_string(),
vec![Key::new("bogons").i64(100)],
);
span.set_attribute(ANOTHER_KEY.string("yes"));
meter.record_batch_with_context(
// Note: call-site variables added as context Entries:
&Context::current_with_baggage(vec![ANOTHER_KEY.string("xyz")]),
COMMON_LABELS.as_ref(),
vec![value_recorder_two.measurement(2.0)],
);
tracer.in_span("Sub operation...", |cx| {
let span = cx.span();
span.set_attribute(LEMONS_KEY.string("five"));
span.add_event("Sub span event".to_string(), vec![]);
value_recorder.record(1.3);
});
});
// wait for 1 minutes so that we could see metrics being pushed via OTLP every 10 seconds.
tokio::time::sleep(Duration::from_secs(60)).await;
shutdown_tracer_provider();
Ok(())
}

View File

@ -1,13 +0,0 @@
[package]
name = "basic"
version = "0.1.0"
edition = "2018"
[dependencies]
futures = "0.3"
lazy_static = "1.4"
opentelemetry = { path = "../../opentelemetry", features = ["serialize", "rt-tokio", "metrics"] }
opentelemetry-jaeger = { path = "../../opentelemetry-jaeger", features = ["tokio"] }
serde_json = "1.0"
thrift = "0.13"
tokio = { version = "1.0", features = ["full"] }

View File

@ -1,18 +0,0 @@
# Basic OpenTelemetry Example
This example shows basic span and metric usage, and exports to Jaeger.
## Usage
```shell
# Run jaeger in background
$ docker run -d -p6831:6831/udp -p6832:6832/udp -p16686:16686 -p14268:14268 jaegertracing/all-in-one:latest
# Report spans
$ cargo run
# View spans (see the image below)
$ firefox http://localhost:16686/
```
![Jaeger UI](trace.png)

View File

@ -1,104 +0,0 @@
use futures::stream::{Stream, StreamExt};
use opentelemetry::global;
use opentelemetry::global::shutdown_tracer_provider;
use opentelemetry::sdk::{metrics::PushController, trace as sdktrace};
use opentelemetry::trace::TraceError;
use opentelemetry::{
baggage::BaggageExt,
metrics::{MetricsError, ObserverResult},
trace::{TraceContextExt, Tracer},
Context, Key, KeyValue,
};
use std::error::Error;
use std::time::Duration;
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
opentelemetry_jaeger::new_pipeline()
.with_service_name("trace-demo")
.with_tags(vec![
KeyValue::new("exporter", "jaeger"),
KeyValue::new("float", 312.23),
])
.install_batch(opentelemetry::runtime::Tokio)
}
// Skip first immediate tick from tokio, not needed for async_std.
fn delayed_interval(duration: Duration) -> impl Stream<Item = tokio::time::Instant> {
opentelemetry::util::tokio_interval_stream(duration).skip(1)
}
fn init_meter() -> PushController {
opentelemetry::sdk::export::metrics::stdout(tokio::spawn, delayed_interval)
.with_formatter(|batch| {
serde_json::to_value(batch)
.map(|value| value.to_string())
.map_err(|err| MetricsError::Other(err.to_string()))
})
.init()
}
const FOO_KEY: Key = Key::from_static_str("ex.com/foo");
const BAR_KEY: Key = Key::from_static_str("ex.com/bar");
const LEMONS_KEY: Key = Key::from_static_str("ex.com/lemons");
const ANOTHER_KEY: Key = Key::from_static_str("ex.com/another");
lazy_static::lazy_static! {
static ref COMMON_LABELS: [KeyValue; 4] = [
LEMONS_KEY.i64(10),
KeyValue::new("A", "1"),
KeyValue::new("B", "2"),
KeyValue::new("C", "3"),
];
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
let _tracer = init_tracer()?;
let _started = init_meter();
let tracer = global::tracer("ex.com/basic");
let meter = global::meter("ex.com/basic");
let one_metric_callback = |res: ObserverResult<f64>| res.observe(1.0, COMMON_LABELS.as_ref());
let _ = meter
.f64_value_observer("ex.com.one", one_metric_callback)
.with_description("A ValueObserver set to 1.0")
.init();
let value_recorder_two = meter.f64_value_recorder("ex.com.two").init();
let _baggage =
Context::current_with_baggage(vec![FOO_KEY.string("foo1"), BAR_KEY.string("bar1")])
.attach();
let value_recorder = value_recorder_two.bind(COMMON_LABELS.as_ref());
tracer.in_span("operation", |cx| {
let span = cx.span();
span.add_event(
"Nice operation!".to_string(),
vec![Key::new("bogons").i64(100)],
);
span.set_attribute(ANOTHER_KEY.string("yes"));
meter.record_batch_with_context(
// Note: call-site variables added as context Entries:
&Context::current_with_baggage(vec![ANOTHER_KEY.string("xyz")]),
COMMON_LABELS.as_ref(),
vec![value_recorder_two.measurement(2.0)],
);
tracer.in_span("Sub operation...", |cx| {
let span = cx.span();
span.set_attribute(LEMONS_KEY.string("five"));
span.add_event("Sub span event".to_string(), vec![]);
value_recorder.record(1.3);
});
});
shutdown_tracer_provider(); // sending remaining spans.
Ok(())
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

View File

@ -1,8 +0,0 @@
[package]
name = "datadog"
version = "0.1.0"
edition = "2018"
[dependencies]
opentelemetry = { path = "../../opentelemetry" }
opentelemetry-datadog = { path = "../../opentelemetry-datadog", features = ["reqwest-blocking-client"] }

View File

@ -1,15 +0,0 @@
# Datadog Exporter Example
Sends spans to a datadog-agent collector.
## Usage
First run version 7.22.0 or above of the datadog-agent locally as described [here](https://docs.datadoghq.com/agent/)
Then run the example to report spans:
```shell
$ cargo run
```
Traces should appear in the datadog APM dashboard

View File

@ -1,41 +0,0 @@
use opentelemetry::global;
use opentelemetry::global::shutdown_tracer_provider;
use opentelemetry::{
trace::{Span, TraceContextExt, Tracer},
Key,
};
use opentelemetry_datadog::{new_pipeline, ApiVersion};
use std::thread;
use std::time::Duration;
fn bar() {
let tracer = global::tracer("component-bar");
let mut span = tracer.start("bar");
span.set_attribute(Key::new("span.type").string("sql"));
span.set_attribute(Key::new("sql.query").string("SELECT * FROM table"));
thread::sleep(Duration::from_millis(6));
span.end()
}
fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
let tracer = new_pipeline()
.with_service_name("trace-demo")
.with_version(ApiVersion::Version05)
.install_simple()?;
tracer.in_span("foo", |cx| {
let span = cx.span();
span.set_attribute(Key::new("span.type").string("web"));
span.set_attribute(Key::new("http.url").string("http://localhost:8080/foo"));
span.set_attribute(Key::new("http.method").string("GET"));
span.set_attribute(Key::new("http.status_code").i64(200));
thread::sleep(Duration::from_millis(6));
bar();
thread::sleep(Duration::from_millis(6));
});
shutdown_tracer_provider();
Ok(())
}

View File

@ -1,19 +0,0 @@
[package]
name = "external-otlp-grpcio-async-std"
version = "0.1.0"
edition = "2018"
[dependencies]
async-std = { version = "1.9.0", features = ["attributes"] }
env_logger = "0.8.2"
futures = "0.3"
opentelemetry = { path = "../../opentelemetry", features = [
"rt-async-std",
"serialize"
] }
opentelemetry-otlp = { path = "../../opentelemetry-otlp", features = [
"grpc-sys",
"openssl-vendored"
], default-features = false }
serde_json = "1.0"
url = "2.2.0"

View File

@ -1,19 +0,0 @@
# External OTLP collector with grpcio and async-std with TLS
This example shows basic span, and exports to OTLP enabled collectors, like honeycomb, lightstep and other services.
Use this service in case you don't use `tokio`s runtime, for example with web frameworks like `tide` or any `async-std` library that
makes you use it as a runtime.
As these services all reside outside your own infrastructure, they require TLS for encryption to ensure your data safety.
With this example, you can export to any service that supports OTLP by using environment variables.
The following example exports data to Honeycomb:
```shell
cd examples/external-otlp-grpcio-async-std/
OTLP_GRPCIO_ENDPOINT=https://api.honeycomb.io:443 \
OTLP_GRPCIO_X_HONEYCOMB_TEAM=token \
OTLP_GRPCIO_X_HONEYCOMB_DATASET=dataset \
cargo run
```
The only required variable is `OTLP_GRPCIO_ENDPOINT` and any other variable that beggins with the prefix `OTLP_GRPCIO_` will be sent as headers
e.g.: `OTLP_GRPCIO_X_HONEYCOMB_TEAM` becomes `x-honeycomb-team` and `OTLP_GRPCIO_X_HONEYCOMB_DATASET` becomes `x-honeycomb-dataset`.

View File

@ -1,103 +0,0 @@
//! This should show how to connect to a third party collector like
//! honeycomb or lightstep using tonic with tls and using tokio as reactor.
//! To run this you have to specify a few environment variables like in the example:
//! ```shell
//! OTLP_GRPCIO_ENDPOINT=https://api.honeycomb.io:443 \
//! OTLP_GRPCIO_X_HONEYCOMB_TEAM=token \
//! OTLP_GRPCIO_X_HONEYCOMB_DATASET=dataset \
//! cargo run --bin external-otlp-tonic-tokio
//! ```
use async_std::task::sleep;
use opentelemetry::trace::TraceError;
use opentelemetry::{global, sdk::trace as sdktrace};
use opentelemetry::{
trace::{TraceContextExt, Tracer},
Key,
};
use url::Url;
use std::{
collections::HashMap,
env::{set_var, vars},
time::Duration,
};
use std::{
env::{remove_var, var},
error::Error,
};
// Use the variables to try and export the example to any external collector that accepts otlp
// like: oltp itself, honeycomb or lightstep
const ENDPOINT: &str = "OTLP_GRPCIO_ENDPOINT";
const HEADER_PREFIX: &str = "OTLP_GRPCIO_";
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
let endpoint = var(ENDPOINT).unwrap_or_else(|_| {
panic!(
"You must specify and endpoint to connect to with the variable {:?}.",
ENDPOINT
)
});
let endpoint = Url::parse(&endpoint).expect("endpoint is not a valid url");
remove_var(ENDPOINT);
let headers: HashMap<_, _> = vars()
.filter(|(name, _)| name.starts_with(HEADER_PREFIX))
.map(|(name, value)| {
let header_name = name
.strip_prefix(HEADER_PREFIX)
.unwrap()
.replace("_", "-")
.to_ascii_lowercase();
(header_name, value)
})
.collect();
let grpcio_endpoint = format!(
"{}:{}",
endpoint.host_str().unwrap(),
endpoint.port_or_known_default().unwrap()
);
opentelemetry_otlp::new_pipeline()
.with_endpoint(grpcio_endpoint)
.with_grpcio()
.with_headers(headers)
.with_tls(true)
.install_batch(opentelemetry::runtime::AsyncStd)
}
const LEMONS_KEY: Key = Key::from_static_str("ex.com/lemons");
const ANOTHER_KEY: Key = Key::from_static_str("ex.com/another");
#[async_std::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
if let Err(std::env::VarError::NotPresent) = var("RUST_LOG") {
set_var("RUST_LOG", "debug")
};
env_logger::init();
let _ = init_tracer()?;
let tracer = global::tracer("ex.com/basic");
tracer.in_span("operation", |cx| {
let span = cx.span();
span.add_event(
"Nice operation!".to_string(),
vec![Key::new("bogons").i64(100)],
);
span.set_attribute(ANOTHER_KEY.string("yes"));
tracer.in_span("Sub operation...", |cx| {
let span = cx.span();
span.set_attribute(LEMONS_KEY.string("five"));
span.add_event("Sub span event".to_string(), vec![]);
});
});
// wait for 1 minutes so that we could see metrics being pushed via OTLP every 10 seconds.
sleep(Duration::from_secs(60)).await;
global::shutdown_tracer_provider();
Ok(())
}

View File

@ -1,13 +0,0 @@
[package]
name = "external-otlp-tonic-tokio"
version = "0.1.0"
edition = "2018"
[dependencies]
futures = "0.3"
opentelemetry = { path = "../../opentelemetry", features = ["rt-tokio", "metrics", "serialize"] }
opentelemetry-otlp = { path = "../../opentelemetry-otlp", features = ["tonic", "tls", "tls-roots"] }
serde_json = "1.0"
tokio = { version = "1.0", features = ["full"] }
tonic = "0.4.0"
url = "2.2.0"

View File

@ -1,16 +0,0 @@
# External OTLP collector with tonic and tokio with TLS
This example shows basic span, and exports to OTLP enabled collectors, like honeycomb, lightstep and other services.
As these services all reside outside your own infrastructure, they require TLS for encryption to ensure your data safety.
With this example, you can export to any service that supports OTLP by using environment variables.
The following example exports data to Honeycomb:
```shell
OTLP_TONIC_ENDPOINT=https://api.honeycomb.io:443 \
OTLP_TONIC_X_HONEYCOMB_TEAM=token \
OTLP_TONIC_X_HONEYCOMB_DATASET=dataset \'
cargo run --bin external-otlp-tonic-tokio
```
The only required variable is `OTLP_TONIC_ENDPOINT` and any other variable that beggins with the prefix `OTLP_TONIC_` will be sent as headers
e.g.: `OTLP_TONIC_X_HONEYCOMB_TEAM` becomes `x-honeycomb-team` and `OTLP_TONIC_X_HONEYCOMB_DATASET` becomes `x-honeycomb-dataset`.

View File

@ -1,103 +0,0 @@
//! This should show how to connect to a third party collector like
//! honeycomb or lightstep using tonic with tls and using tokio as reactor.
//! To run this you have to specify a few environment variables like in the example:
//! ```shell
//! OTLP_TONIC_ENDPOINT=https://api.honeycomb.io:443 \
//! OTLP_TONIC_X_HONEYCOMB_TEAM=token \
//! OTLP_TONIC_X_HONEYCOMB_DATASET=dataset \'
//! cargo run --bin external-otlp-tonic-tokio
//! ```
use opentelemetry::trace::TraceError;
use opentelemetry::{global, sdk::trace as sdktrace};
use opentelemetry::{
trace::{TraceContextExt, Tracer},
Key,
};
use tonic::{
metadata::{MetadataKey, MetadataMap},
transport::ClientTlsConfig,
};
use url::Url;
use opentelemetry::global::shutdown_tracer_provider;
use std::{env::vars, str::FromStr, time::Duration};
use std::{
env::{remove_var, var},
error::Error,
};
// Use the variables to try and export the example to any external collector that accepts otlp
// like: oltp itself, honeycomb or lightstep
const ENDPOINT: &str = "OTLP_TONIC_ENDPOINT";
const HEADER_PREFIX: &str = "OTLP_TONIC_";
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
let endpoint = var(ENDPOINT).unwrap_or_else(|_| {
panic!(
"You must specify and endpoint to connect to with the variable {:?}.",
ENDPOINT
)
});
let endpoint = Url::parse(&endpoint).expect("endpoint is not a valid url");
remove_var(ENDPOINT);
let mut metadata = MetadataMap::new();
for (key, value) in vars()
.filter(|(name, _)| name.starts_with(HEADER_PREFIX))
.map(|(name, value)| {
let header_name = name
.strip_prefix(HEADER_PREFIX)
.map(|h| h.replace("_", "-"))
.map(|h| h.to_ascii_lowercase())
.unwrap();
(header_name, value)
})
{
metadata.insert(MetadataKey::from_str(&key).unwrap(), value.parse().unwrap());
}
opentelemetry_otlp::new_pipeline()
.with_endpoint(endpoint.as_str())
.with_tonic()
.with_metadata(dbg!(metadata))
.with_tls_config(
ClientTlsConfig::new().domain_name(
endpoint
.host_str()
.expect("the specified endpoint should have a valid host"),
),
)
.install_batch(opentelemetry::runtime::Tokio)
}
const LEMONS_KEY: Key = Key::from_static_str("ex.com/lemons");
const ANOTHER_KEY: Key = Key::from_static_str("ex.com/another");
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
let _ = init_tracer()?;
let tracer = global::tracer("ex.com/basic");
tracer.in_span("operation", |cx| {
let span = cx.span();
span.add_event(
"Nice operation!".to_string(),
vec![Key::new("bogons").i64(100)],
);
span.set_attribute(ANOTHER_KEY.string("yes"));
tracer.in_span("Sub operation...", |cx| {
let span = cx.span();
span.set_attribute(LEMONS_KEY.string("five"));
span.add_event("Sub span event".to_string(), vec![]);
});
});
// wait for 1 minutes so that we could see metrics being pushed via OTLP every 10 seconds.
tokio::time::sleep(Duration::from_secs(60)).await;
shutdown_tracer_provider();
Ok(())
}

View File

@ -1,25 +0,0 @@
[package]
name = "grpc"
version = "0.1.0"
edition = "2018"
[[bin]] # Bin to run the gRPC server
name = "grpc-server"
path = "src/server.rs"
doc = false
[[bin]] # Bin to run the gRPC client
name = "grpc-client"
path = "src/client.rs"
doc = false
[dependencies]
http = "0.2"
tonic = "0.4"
prost = "0.7"
tokio = { version = "1.0", features = ["full"] }
opentelemetry = { path = "../../opentelemetry" }
opentelemetry-jaeger = { path = "../../opentelemetry-jaeger" }
[build-dependencies]
tonic-build = "0.4"

View File

@ -1,24 +0,0 @@
# GRPC example
Example showing [Tonic] client and server interaction with OpenTelemetry context propagation.
[Tonic]: https://github.com/hyperium/tonic
Examples
--------
```shell
# Run jaeger in background
$ docker run -d -p6831:6831/udp -p6832:6832/udp -p16686:16686 jaegertracing/all-in-one:latest
# Run the server
$ cargo run --bin grpc-server
# Now run the client to make a request to the server
$ cargo run --bin grpc-client
# View spans (see the image below)
$ firefox http://localhost:16686/
```
![Jaeger UI](trace.png)

View File

@ -1,4 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::compile_protos("proto/helloworld.proto")?;
Ok(())
}

View File

@ -1,17 +0,0 @@
syntax = "proto3";
package helloworld;
service Greeter {
// Our SayHello rpc accepts HelloRequests and returns HelloReplies
rpc SayHello (HelloRequest) returns (HelloReply);
}
message HelloRequest {
// Request message contains the name to be greeted
string name = 1;
}
message HelloReply {
// Reply contains the greeting message
string message = 1;
}

View File

@ -1,61 +0,0 @@
use hello_world::greeter_client::GreeterClient;
use hello_world::HelloRequest;
use opentelemetry::global;
use opentelemetry::global::shutdown_tracer_provider;
use opentelemetry::sdk::propagation::TraceContextPropagator;
use opentelemetry::trace::TraceError;
use opentelemetry::{
propagation::Injector,
trace::{TraceContextExt, Tracer},
Context, KeyValue,
};
struct MetadataMap<'a>(&'a mut tonic::metadata::MetadataMap);
impl<'a> Injector for MetadataMap<'a> {
/// Set a key and value in the MetadataMap. Does nothing if the key or value are not valid inputs
fn set(&mut self, key: &str, value: String) {
if let Ok(key) = tonic::metadata::MetadataKey::from_bytes(key.as_bytes()) {
if let Ok(val) = tonic::metadata::MetadataValue::from_str(&value) {
self.0.insert(key, val);
}
}
}
}
pub mod hello_world {
tonic::include_proto!("helloworld");
}
fn tracing_init() -> Result<impl Tracer, TraceError> {
global::set_text_map_propagator(TraceContextPropagator::new());
opentelemetry_jaeger::new_pipeline()
.with_service_name("grpc-client")
.install_simple()
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
let tracer = tracing_init()?;
let mut client = GreeterClient::connect("http://[::1]:50051").await?;
let span = tracer.start("client-request");
let cx = Context::current_with_span(span);
let mut request = tonic::Request::new(HelloRequest {
name: "Tonic".into(),
});
global::get_text_map_propagator(|propagator| {
propagator.inject_context(&cx, &mut MetadataMap(request.metadata_mut()))
});
let response = client.say_hello(request).await?;
cx.span().add_event(
"response-received".to_string(),
vec![KeyValue::new("response", format!("{:?}", response))],
);
shutdown_tracer_provider();
Ok(())
}

View File

@ -1,81 +0,0 @@
use tonic::{transport::Server, Request, Response, Status};
use hello_world::greeter_server::{Greeter, GreeterServer};
use hello_world::{HelloReply, HelloRequest};
use opentelemetry::global;
use opentelemetry::sdk::propagation::TraceContextPropagator;
use opentelemetry::trace::TraceError;
use opentelemetry::{
propagation::Extractor,
trace::{Span, Tracer},
KeyValue,
};
use std::error::Error;
pub mod hello_world {
tonic::include_proto!("helloworld"); // The string specified here must match the proto package name.
}
struct MetadataMap<'a>(&'a tonic::metadata::MetadataMap);
impl<'a> Extractor for MetadataMap<'a> {
/// Get a value for a key from the MetadataMap. If the value can't be converted to &str, returns None
fn get(&self, key: &str) -> Option<&str> {
self.0.get(key).and_then(|metadata| metadata.to_str().ok())
}
/// Collect all the keys from the MetadataMap.
fn keys(&self) -> Vec<&str> {
self.0
.keys()
.map(|key| match key {
tonic::metadata::KeyRef::Ascii(v) => v.as_str(),
tonic::metadata::KeyRef::Binary(v) => v.as_str(),
})
.collect::<Vec<_>>()
}
}
#[derive(Debug, Default)]
pub struct MyGreeter {}
#[tonic::async_trait]
impl Greeter for MyGreeter {
async fn say_hello(
&self,
request: Request<HelloRequest>, // Accept request of type HelloRequest
) -> Result<Response<HelloReply>, Status> {
let parent_cx =
global::get_text_map_propagator(|prop| prop.extract(&MetadataMap(request.metadata())));
let mut span = global::tracer("greeter").start_with_context("Processing reply", parent_cx);
span.set_attribute(KeyValue::new("request", format!("{:?}", request)));
// Return an instance of type HelloReply
let reply = hello_world::HelloReply {
message: format!("Hello {}!", request.into_inner().name), // We must use .into_inner() as the fields of gRPC requests and responses are private
};
Ok(Response::new(reply)) // Send back our formatted greeting
}
}
fn tracing_init() -> Result<impl Tracer, TraceError> {
global::set_text_map_propagator(TraceContextPropagator::new());
opentelemetry_jaeger::new_pipeline()
.with_service_name("grpc-server")
.install_simple()
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
let _tracer = tracing_init()?;
let addr = "[::1]:50051".parse()?;
let greeter = MyGreeter::default();
Server::builder()
.add_service(GreeterServer::new(greeter))
.serve(addr)
.await?;
Ok(())
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

View File

@ -1,20 +0,0 @@
[package]
name = "http"
version = "0.1.0"
edition = "2018"
[[bin]] # Bin to run the http server
name = "http-server"
path = "src/server.rs"
doc = false
[[bin]] # Bin to run the client
name = "http-client"
path = "src/client.rs"
doc = false
[dependencies]
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "1.0", features = ["full"] }
opentelemetry = { path = "../../opentelemetry" }
opentelemetry-http = { path = "../../opentelemetry-http" }

View File

@ -1,44 +0,0 @@
use hyper::{body::Body, Client};
use opentelemetry::global;
use opentelemetry::sdk::export::trace::stdout;
use opentelemetry::sdk::{
propagation::TraceContextPropagator,
trace::{self, Sampler},
};
use opentelemetry::{
trace::{TraceContextExt, Tracer},
Context, KeyValue,
};
use opentelemetry_http::HeaderInjector;
fn init_tracer() -> impl Tracer {
global::set_text_map_propagator(TraceContextPropagator::new());
// Install stdout exporter pipeline to be able to retrieve the collected spans.
// For the demonstration, use `Sampler::AlwaysOn` sampler to sample all traces. In a production
// application, use `Sampler::ParentBased` or `Sampler::TraceIdRatioBased` with a desired ratio.
stdout::new_pipeline()
.with_trace_config(trace::config().with_sampler(Sampler::AlwaysOn))
.install_simple()
}
#[tokio::main]
async fn main() -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
let _tracer = init_tracer();
let client = Client::new();
let span = global::tracer("example/client").start("say hello");
let cx = Context::current_with_span(span);
let mut req = hyper::Request::builder().uri("http://127.0.0.1:3000");
global::get_text_map_propagator(|propagator| {
propagator.inject_context(&cx, &mut HeaderInjector(&mut req.headers_mut().unwrap()))
});
let res = client.request(req.body(Body::from("Hallo!"))?).await?;
cx.span().add_event(
"Got response!".to_string(),
vec![KeyValue::new("status", res.status().to_string())],
);
Ok(())
}

View File

@ -1,49 +0,0 @@
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Request, Response, Server};
use opentelemetry::{
global,
sdk::export::trace::stdout,
sdk::{
propagation::TraceContextPropagator,
trace::{self, Sampler},
},
trace::{Span, Tracer},
};
use opentelemetry_http::HeaderExtractor;
use std::{convert::Infallible, net::SocketAddr};
async fn handle(req: Request<Body>) -> Result<Response<Body>, Infallible> {
let parent_cx = global::get_text_map_propagator(|propagator| {
propagator.extract(&HeaderExtractor(req.headers()))
});
let mut span = global::tracer("example/server").start_with_context("hello", parent_cx);
span.add_event("handling this...".to_string(), Vec::new());
Ok(Response::new("Hello, World!".into()))
}
fn init_tracer() -> impl Tracer {
global::set_text_map_propagator(TraceContextPropagator::new());
// Install stdout exporter pipeline to be able to retrieve the collected spans.
// For the demonstration, use `Sampler::AlwaysOn` sampler to sample all traces. In a production
// application, use `Sampler::ParentBased` or `Sampler::TraceIdRatioBased` with a desired ratio.
stdout::new_pipeline()
.with_trace_config(trace::config().with_sampler(Sampler::AlwaysOn))
.install_simple()
}
#[tokio::main]
async fn main() {
let _tracer = init_tracer();
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
let make_svc = make_service_fn(|_conn| async { Ok::<_, Infallible>(service_fn(handle)) });
let server = Server::bind(&addr).serve(make_svc);
println!("Listening on {}", addr);
if let Err(e) = server.await {
eprintln!("server error: {}", e);
}
}

View File

@ -0,0 +1,20 @@
[package]
name = "logs-basic"
version = "0.1.0"
edition = "2021"
license = "Apache-2.0"
rust-version = "1.75.0"
publish = false
autobenches = false
[[bin]]
name = "logs-basic"
path = "src/main.rs"
bench = false
[dependencies]
opentelemetry_sdk = { path = "../../opentelemetry-sdk", features = ["logs"] }
opentelemetry-stdout = { workspace = true, features = ["logs"] }
opentelemetry-appender-tracing = { workspace = true }
tracing = { workspace = true, features = ["std"]}
tracing-subscriber = { workspace = true, features = ["env-filter","registry", "std", "fmt"] }

View File

@ -0,0 +1,17 @@
# OpenTelemetry Log Appender for tracing - Example
This example shows how to use the opentelemetry-appender-tracing crate, which is a
[logging
appender](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/glossary.md#log-appender--bridge)
that bridges logs from the [tracing crate](https://tracing.rs/tracing/#events) to
OpenTelemetry. The example setups a LoggerProvider with stdout exporter, so logs
are emitted to stdout.
## Usage
Run the following, and Logs emitted using [tracing](https://docs.rs/tracing/latest/tracing/)
will be written out to stdout.
```shell
cargo run
```

View File

@ -0,0 +1,53 @@
use opentelemetry_appender_tracing::layer;
use opentelemetry_sdk::logs::SdkLoggerProvider;
use opentelemetry_sdk::Resource;
use tracing::error;
use tracing_subscriber::{prelude::*, EnvFilter};
fn main() {
let exporter = opentelemetry_stdout::LogExporter::default();
let provider: SdkLoggerProvider = SdkLoggerProvider::builder()
.with_resource(
Resource::builder()
.with_service_name("log-appender-tracing-example")
.build(),
)
.with_simple_exporter(exporter)
.build();
// To prevent a telemetry-induced-telemetry loop, OpenTelemetry's own internal
// logging is properly suppressed. However, logs emitted by external components
// (such as reqwest, tonic, etc.) are not suppressed as they do not propagate
// OpenTelemetry context. Until this issue is addressed
// (https://github.com/open-telemetry/opentelemetry-rust/issues/2877),
// filtering like this is the best way to suppress such logs.
//
// The filter levels are set as follows:
// - Allow `info` level and above by default.
// - Completely restrict logs from `hyper`, `tonic`, `h2`, and `reqwest`.
//
// Note: This filtering will also drop logs from these components even when
// they are used outside of the OTLP Exporter.
let filter_otel = EnvFilter::new("info")
.add_directive("hyper=off".parse().unwrap())
.add_directive("tonic=off".parse().unwrap())
.add_directive("h2=off".parse().unwrap())
.add_directive("reqwest=off".parse().unwrap());
let otel_layer = layer::OpenTelemetryTracingBridge::new(&provider).with_filter(filter_otel);
// Create a new tracing::Fmt layer to print the logs to stdout. It has a
// default filter of `info` level and above, and `debug` and above for logs
// from OpenTelemetry crates. The filter levels can be customized as needed.
let filter_fmt = EnvFilter::new("info").add_directive("opentelemetry=debug".parse().unwrap());
let fmt_layer = tracing_subscriber::fmt::layer()
.with_thread_names(true)
.with_filter(filter_fmt);
tracing_subscriber::registry()
.with(otel_layer)
.with(fmt_layer)
.init();
error!(name: "my-event-name", target: "my-system", event_id = 20, user_name = "otel", user_email = "otel@opentelemetry.io", message = "This is an example message");
let _ = provider.shutdown();
}

View File

@ -0,0 +1,19 @@
[package]
name = "metrics-advanced"
version = "0.1.0"
edition = "2021"
license = "Apache-2.0"
rust-version = "1.75.0"
publish = false
autobenches = false
[[bin]]
name = "metrics-advanced"
path = "src/main.rs"
bench = false
[dependencies]
opentelemetry = { path = "../../opentelemetry", features = ["metrics"] }
opentelemetry_sdk = { path = "../../opentelemetry-sdk" }
opentelemetry-stdout = { workspace = true, features = ["metrics"] }
tokio = { workspace = true, features = ["full"] }

View File

@ -0,0 +1,14 @@
# Metric SDK Advanced Configuration Example
This example shows how to customize the OpenTelemetry Rust Metric SDK. This
shows how to change temporality, how to customize the aggregation using the
concept of "Views" etc. The examples write output to stdout, but could be
replaced with other exporters.
## Usage
Run the following, and the Metrics will be written out to stdout.
```shell
$ cargo run
```

View File

@ -0,0 +1,120 @@
use opentelemetry::global;
use opentelemetry::KeyValue;
use opentelemetry_sdk::metrics::{Instrument, SdkMeterProvider, Stream, Temporality};
use opentelemetry_sdk::Resource;
use std::error::Error;
fn init_meter_provider() -> opentelemetry_sdk::metrics::SdkMeterProvider {
// for example 1
let my_view_rename_and_unit = |i: &Instrument| {
if i.name() == "my_histogram" {
Some(
Stream::builder()
.with_name("my_histogram_renamed")
.with_unit("milliseconds")
.build()
.unwrap(),
)
} else {
None
}
};
// for example 2
let my_view_change_cardinality = |i: &Instrument| {
if i.name() == "my_second_histogram" {
// Note: If Stream is invalid, build() will return an error. By
// calling `.ok()`, any such error is ignored and treated as if the
// view does not match the instrument. If this is not the desired
// behavior, consider handling the error explicitly.
Stream::builder().with_cardinality_limit(2).build().ok()
} else {
None
}
};
// Build exporter using Delta Temporality.
let exporter = opentelemetry_stdout::MetricExporterBuilder::default()
.with_temporality(Temporality::Delta)
.build();
let resource = Resource::builder()
.with_service_name("metrics-advanced-example")
.build();
let provider = SdkMeterProvider::builder()
.with_periodic_exporter(exporter)
.with_resource(resource)
.with_view(my_view_rename_and_unit)
.with_view(my_view_change_cardinality)
.build();
global::set_meter_provider(provider.clone());
provider
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
let meter_provider = init_meter_provider();
let meter = global::meter("mylibraryname");
// Example 1 - Rename metric using View.
// This instrument will be renamed to "my_histogram_renamed",
// and its unit changed to "milliseconds"
// using view.
let histogram = meter
.f64_histogram("my_histogram")
.with_unit("ms")
.with_description("My histogram example description")
.build();
// Record measurements using the histogram instrument.
histogram.record(
10.5,
&[
KeyValue::new("mykey1", "myvalue1"),
KeyValue::new("mykey2", "myvalue2"),
KeyValue::new("mykey3", "myvalue3"),
KeyValue::new("mykey4", "myvalue4"),
],
);
// Example 2 - Change cardinality using View.
let histogram2 = meter
.f64_histogram("my_second_histogram")
.with_unit("ms")
.with_description("My histogram example description")
.build();
// Record measurements using the histogram instrument. This metric will have
// a cardinality limit of 2, as set in the view. Because of this, only the
// first two distinct attribute combinations will be recorded, and the rest
// will be folded into the overflow attribute. Any number of measurements
// can be recorded as long as they use the same or already-seen attribute
// combinations.
histogram2.record(1.5, &[KeyValue::new("mykey1", "v1")]);
histogram2.record(1.2, &[KeyValue::new("mykey1", "v2")]);
// Repeatedly emitting measurements for "v1" and "v2" will not
// trigger overflow, as they are already seen attribute combinations.
histogram2.record(1.7, &[KeyValue::new("mykey1", "v1")]);
histogram2.record(1.8, &[KeyValue::new("mykey1", "v2")]);
// Emitting measurements for new attribute combinations will trigger
// overflow, as the cardinality limit of 2 has been reached.
// All the below measurements will be folded into the overflow attribute.
histogram2.record(1.23, &[KeyValue::new("mykey1", "v3")]);
histogram2.record(1.4, &[KeyValue::new("mykey1", "v4")]);
histogram2.record(1.6, &[KeyValue::new("mykey1", "v5")]);
histogram2.record(1.7, &[KeyValue::new("mykey1", "v6")]);
histogram2.record(1.8, &[KeyValue::new("mykey1", "v7")]);
// Metrics are exported by default every 60 seconds when using stdout exporter,
// however shutting down the MeterProvider here instantly flushes
// the metrics, instead of waiting for the 60 sec interval.
meter_provider.shutdown()?;
Ok(())
}

View File

@ -0,0 +1,20 @@
[package]
name = "metrics-basic"
version = "0.1.0"
edition = "2021"
license = "Apache-2.0"
rust-version = "1.75.0"
publish = false
autobenches = false
[[bin]]
name = "metrics-basic"
path = "src/main.rs"
bench = false
[dependencies]
opentelemetry = { path = "../../opentelemetry", features = ["metrics"] }
opentelemetry_sdk = { path = "../../opentelemetry-sdk", features = ["metrics"] }
opentelemetry-stdout = { workspace = true, features = ["metrics"] }
tokio = { workspace = true, features = ["full"] }

View File

@ -0,0 +1,13 @@
# Metric Instrument Usage Example
This example shows how to use the various metric instruments to report metrics. The
example setups a MeterProvider with stdout exporter, so metrics can be seen on
the stdout.
## Usage
Run the following, and the Metrics will be written out to stdout.
```shell
$ cargo run
```

View File

@ -0,0 +1,176 @@
use opentelemetry::{global, KeyValue};
use opentelemetry_sdk::metrics::SdkMeterProvider;
use opentelemetry_sdk::Resource;
use std::error::Error;
use std::vec;
fn init_meter_provider() -> opentelemetry_sdk::metrics::SdkMeterProvider {
let exporter = opentelemetry_stdout::MetricExporterBuilder::default()
// Build exporter using Delta Temporality (Defaults to Temporality::Cumulative)
// .with_temporality(opentelemetry_sdk::metrics::Temporality::Delta)
.build();
let provider = SdkMeterProvider::builder()
.with_periodic_exporter(exporter)
.with_resource(
Resource::builder()
.with_service_name("metrics-basic-example")
.build(),
)
.build();
global::set_meter_provider(provider.clone());
provider
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
// Initialize the MeterProvider with the stdout Exporter.
let meter_provider = init_meter_provider();
// Create a meter from the above MeterProvider.
let meter = global::meter("mylibraryname");
// Create a Counter Instrument.
let counter = meter.u64_counter("my_counter").build();
// Record measurements using the Counter instrument.
counter.add(
10,
&[
KeyValue::new("mykey1", "myvalue1"),
KeyValue::new("mykey2", "myvalue2"),
],
);
// Create a ObservableCounter instrument and register a callback that reports the measurement.
let _observable_counter = meter
.u64_observable_counter("my_observable_counter")
.with_description("My observable counter example description")
.with_unit("myunit")
.with_callback(|observer| {
observer.observe(
100,
&[
KeyValue::new("mykey1", "myvalue1"),
KeyValue::new("mykey2", "myvalue2"),
],
)
})
.build();
// Create a UpCounter Instrument.
let updown_counter = meter.i64_up_down_counter("my_updown_counter").build();
// Record measurements using the UpCounter instrument.
updown_counter.add(
-10,
&[
KeyValue::new("mykey1", "myvalue1"),
KeyValue::new("mykey2", "myvalue2"),
],
);
// Create a Observable UpDownCounter instrument and register a callback that reports the measurement.
let _observable_up_down_counter = meter
.i64_observable_up_down_counter("my_observable_updown_counter")
.with_description("My observable updown counter example description")
.with_unit("myunit")
.with_callback(|observer| {
observer.observe(
100,
&[
KeyValue::new("mykey1", "myvalue1"),
KeyValue::new("mykey2", "myvalue2"),
],
)
})
.build();
// Create a Histogram Instrument.
let histogram = meter
.f64_histogram("my_histogram")
.with_description("My histogram example description")
// Setting boundaries is optional. By default, the boundaries are set to
// [0.0, 5.0, 10.0, 25.0, 50.0, 75.0, 100.0, 250.0, 500.0, 750.0, 1000.0, 2500.0, 5000.0, 7500.0, 10000.0]
.with_boundaries(vec![0.0, 5.0, 10.0, 15.0, 20.0, 25.0])
.build();
// Record measurements using the histogram instrument.
histogram.record(
10.5,
&[
KeyValue::new("mykey1", "myvalue1"),
KeyValue::new("mykey2", "myvalue2"),
],
);
// Note that there is no ObservableHistogram instrument.
// Create a Gauge Instrument.
let gauge = meter
.f64_gauge("my_gauge")
.with_description("A gauge set to 1.0")
.with_unit("myunit")
.build();
gauge.record(
1.0,
&[
KeyValue::new("mykey1", "myvalue1"),
KeyValue::new("mykey2", "myvalue2"),
],
);
// Create a ObservableGauge instrument and register a callback that reports the measurement.
let _observable_gauge = meter
.f64_observable_gauge("my_observable_gauge")
.with_description("An observable gauge set to 1.0")
.with_unit("myunit")
.with_callback(|observer| {
observer.observe(
1.0,
&[
KeyValue::new("mykey1", "myvalue1"),
KeyValue::new("mykey2", "myvalue2"),
],
)
})
.build();
// Metrics are exported by default every 60 seconds when using stdout
// exporter, however shutting down the MeterProvider here instantly flushes
// the metrics, instead of waiting for the 60 sec interval. Shutdown returns
// a result, which is bubbled up to the caller The commented code below
// demonstrates handling the shutdown result, instead of bubbling up the
// error.
meter_provider.shutdown()?;
// let shutdown_result = meter_provider.shutdown();
// Handle the shutdown result.
// match shutdown_result {
// Ok(_) => println!("MeterProvider shutdown successfully"),
// Err(e) => {
// match e {
// opentelemetry_sdk::error::ShutdownError::InternalFailure(message) => {
// // This indicates some internal failure during shutdown. The
// // error message is intended for logging purposes only and
// // should not be used to make programmatic decisions.
// println!("MeterProvider shutdown failed: {}", message)
// }
// opentelemetry_sdk::error::ShutdownError::AlreadyShutdown => {
// // This indicates some user code tried to shutdown
// // elsewhere. user need to review their code to ensure
// // shutdown is called only once.
// println!("MeterProvider already shutdown")
// }
// opentelemetry_sdk::error::ShutdownError::Timeout(e) => {
// // This indicates the shutdown timed out, and a good hint to
// // user to increase the timeout. (Shutdown method does not
// // allow custom timeout today, but that is temporary)
// println!("MeterProvider shutdown timed out after {:?}", e)
// }
// }
// }
// }
Ok(())
}

View File

@ -1,10 +0,0 @@
[package]
name = "multiple-span-processors"
version = "0.1.0"
edition = "2018"
[dependencies]
opentelemetry = { path = "../../opentelemetry", features = ["rt-tokio"] }
opentelemetry-zipkin = { path = "../../opentelemetry-zipkin", default-features=false, features=["reqwest-client"]}
opentelemetry-jaeger = { path = "../../opentelemetry-jaeger", features = ["tokio"] }
tokio = { version = "1.0", features = ["full"] }

View File

@ -1,17 +0,0 @@
# Work with multiple span processors
Opentelemetry supports export spans into multiple different destinations. One way to do so is to use multiple span processors.
In this example, we demonstrate how to send spans to both Jaeger and Zipkin backend.
To run this example.
1. Start the Jaeger and Zipkin. Run `docker-compose up`
2. Use `cargo run` to run the example.
3. Check the output in Jaeger and Zipkin. The console should also output the SpanData.
4. Use `docker-compose down -v` to tear down the Jaeger and Zipkin backend.

Some files were not shown because too many files have changed in this diff Show More