Skip to content
代码片段 群组 项目
提交 43574cb1 编辑于 作者: Michael Kozono's avatar Michael Kozono
浏览文件

Merge branch 'mwaw/add_uuid_to_service_ping_metadata_364645' into 'master'

Add uuid to Service Ping metadata report

See merge request gitlab-org/gitlab!92236
No related branches found
No related tags found
无相关合并请求
......@@ -52,13 +52,22 @@ def execute
ServicePing::DevopsReport.new(response).execute
end
submit_payload({ metadata: { metrics: metrics_collection_time(usage_data) } }, path: METADATA_PATH)
submit_payload(metadata(usage_data), path: METADATA_PATH)
end
private
attr_reader :payload, :skip_db_write
def metadata(service_ping_payload)
{
metadata: {
uuid: service_ping_payload[:uuid],
metrics: metrics_collection_time(service_ping_payload)
}
}
end
def metrics_collection_time(payload, parents = [])
return [] unless payload.is_a?(Hash)
......
......@@ -117,8 +117,11 @@ sequenceDiagram
> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/295289) in GitLab 15.2. [Feature flag `measure_service_ping_metric_collection`](https://gitlab.com/gitlab-org/gitlab/-/issues/358128) removed.
```ruby
{"metadata"=>
{"metrics"=>
{
"metadata"=>
{
"uuid"=>"0000000-0000-0000-0000-000000000000",
"metrics"=>
[{"name"=>"version", "time_elapsed"=>1.1811964213848114e-05},
{"name"=>"installation_type", "time_elapsed"=>0.00017242692410945892},
{"name"=>"license_billable_users", "time_elapsed"=>0.009520471096038818},
......
......@@ -385,24 +385,26 @@
let(:metric_double) { instance_double(Gitlab::Usage::ServicePing::LegacyMetricTimingDecorator, duration: 123) }
let(:payload) do
{
metric_a: metric_double,
metric_group: {
metric_b: metric_double
},
metric_without_timing: "value",
recorded_at: Time.current
}
uuid: 'uuid',
metric_a: metric_double,
metric_group: {
metric_b: metric_double
},
metric_without_timing: "value",
recorded_at: Time.current
}
end
let(:metadata_payload) do
{
metadata: {
metrics: [
{ name: 'metric_a', time_elapsed: 123 },
{ name: 'metric_group.metric_b', time_elapsed: 123 }
]
uuid: 'uuid',
metrics: [
{ name: 'metric_a', time_elapsed: 123 },
{ name: 'metric_group.metric_b', time_elapsed: 123 }
]
}
}
}
end
it 'submits metadata' do
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册