tracelit 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tracelit/configuration.rb +28 -0
- data/lib/tracelit/instrumentation.rb +11 -7
- data/lib/tracelit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 86262dd99fea01fd4acc26d9f1ab54b5915773a6cceb6b6c8ee6ed7f5dcda873
|
|
4
|
+
data.tar.gz: 0c20478da0332cee72943c947e35fd47a298406672d719cccd2ee7a437261307
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3a5dfff925583f87d19772888916e24d7864ab4b63b341a53393db72fe0bdf7b4caaaf582a88a5583edb2167f399d498dfd055c76ad42c228ba7c4acbe6baa28
|
|
7
|
+
data.tar.gz: 22143eb50a74f98d630e227e4aa695685b06914ce4ef72b8b5eaa84a142a5da20793a5f1e5fd694fab210dbda53d0bb358c90dbc9a19331b63d5f903f80df9bd
|
|
@@ -38,6 +38,34 @@ module Tracelit
|
|
|
38
38
|
@resource_attributes = {}
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
# Resolves the current commit SHA with zero developer friction.
|
|
42
|
+
# Checks common CI/CD environment variables first, then falls back
|
|
43
|
+
# to running `git rev-parse HEAD` in the project directory.
|
|
44
|
+
def resolved_commit_sha
|
|
45
|
+
return @resolved_commit_sha if defined?(@resolved_commit_sha)
|
|
46
|
+
|
|
47
|
+
sha = ENV["COMMIT_SHA"] ||
|
|
48
|
+
ENV["GIT_COMMIT_SHA"] ||
|
|
49
|
+
ENV["GIT_COMMIT"] ||
|
|
50
|
+
ENV["GITHUB_SHA"] ||
|
|
51
|
+
ENV["HEROKU_SLUG_COMMIT"] ||
|
|
52
|
+
ENV["SOURCE_VERSION"] || # Heroku alt
|
|
53
|
+
ENV["RENDER_GIT_COMMIT"] || # Render
|
|
54
|
+
ENV["FLY_APP_VERSION"] || # Fly.io
|
|
55
|
+
ENV["RAILWAY_GIT_COMMIT_SHA"] # Railway
|
|
56
|
+
|
|
57
|
+
if sha.nil? || sha.empty?
|
|
58
|
+
begin
|
|
59
|
+
sha = `git rev-parse HEAD 2>/dev/null`.strip
|
|
60
|
+
sha = nil if sha.empty?
|
|
61
|
+
rescue StandardError
|
|
62
|
+
sha = nil
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
@resolved_commit_sha = sha
|
|
67
|
+
end
|
|
68
|
+
|
|
41
69
|
# Returns an array of human-readable error strings.
|
|
42
70
|
# Empty array means the configuration is valid.
|
|
43
71
|
# Never raises — callers decide whether to warn or abort.
|
|
@@ -41,14 +41,18 @@ module Tracelit
|
|
|
41
41
|
OpenTelemetry::SDK.configure do |otel|
|
|
42
42
|
# Resource attributes identify this service in Tracelit.
|
|
43
43
|
# These populate the `resource` Map column on every telemetry row.
|
|
44
|
+
base_attrs = {
|
|
45
|
+
OpenTelemetry::SemanticConventions::Resource::SERVICE_NAME => config.resolved_service_name,
|
|
46
|
+
OpenTelemetry::SemanticConventions::Resource::DEPLOYMENT_ENVIRONMENT => config.environment,
|
|
47
|
+
"telemetry.sdk.language" => "ruby",
|
|
48
|
+
"telemetry.sdk.name" => detect_framework,
|
|
49
|
+
"telemetry.sdk.version" => Tracelit::VERSION,
|
|
50
|
+
}
|
|
51
|
+
sha = config.resolved_commit_sha
|
|
52
|
+
base_attrs["service.commit_sha"] = sha if sha
|
|
53
|
+
|
|
44
54
|
otel.resource = OpenTelemetry::SDK::Resources::Resource.create(
|
|
45
|
-
|
|
46
|
-
OpenTelemetry::SemanticConventions::Resource::SERVICE_NAME => config.resolved_service_name,
|
|
47
|
-
OpenTelemetry::SemanticConventions::Resource::DEPLOYMENT_ENVIRONMENT => config.environment,
|
|
48
|
-
"telemetry.sdk.language" => "ruby",
|
|
49
|
-
"telemetry.sdk.name" => detect_framework,
|
|
50
|
-
"telemetry.sdk.version" => Tracelit::VERSION,
|
|
51
|
-
}.merge(config.resource_attributes)
|
|
55
|
+
base_attrs.merge(config.resource_attributes)
|
|
52
56
|
)
|
|
53
57
|
|
|
54
58
|
# Build the OTLP exporter once — shared by both processors
|
data/lib/tracelit/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tracelit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tracelit
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-05-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: opentelemetry-sdk
|