anchor.diff:  %% Get RRD database for given metric.
   %% @end
   %%--------------------------------------------------------------------
  --spec get_metric_internal(rest_auth:auth(), subject_type(), subject_id(),
  -    subject_type(), subject_id(), metric_type(), step(), oneprovider:id(),
  -    format()) -> {ok, binary()} | {error, term()}.
  -get_metric_internal(
  -    _Auth, SubjectType, SubjectId, undefined, _,
  -    MetricType, Step, ProviderId, Format
  -) ->
  +-spec get_metric_internal(od_space:id(), undefined | od_user:id(),
  +    metric_type(), step(), oneprovider:id()) -> {ok, binary()} | {error, term()}.
  +get_metric_internal(SpaceId, undefined, MetricType, Step, ProviderId) ->
       MonitoringId = #monitoring_id{
  -        main_subject_type = SubjectType,
  -        main_subject_id = SubjectId,
  +        main_subject_type = space,
  +        main_subject_id = SpaceId,
           metric_type = MetricType,
           provider_id = ProviderId
       },
  -    worker_proxy:call(monitoring_worker, {export, MonitoringId, Step, Format});
  -get_metric_internal(
  -    _Auth, SubjectType, SubjectId, SecondarySubjectType, SecondarySubjectId,
  -    MetricType, Step, ProviderId, Format
  -) ->
  +    worker_proxy:call(monitoring_worker, {export, MonitoringId, Step, json});
  +get_metric_internal(SpaceId, UserId, MetricType, Step, ProviderId) ->
       MonitoringId = #monitoring_id{
  -        main_subject_type = SubjectType,
  -        main_subject_id = SubjectId,
  +        main_subject_type = space,
  +        main_subject_id = SpaceId,
           metric_type = MetricType,
  -        secondary_subject_id = SecondarySubjectId,
  -        secondary_subject_type = SecondarySubjectType,
  +        secondary_subject_type = user,
  +        secondary_subject_id = UserId,
           provider_id = ProviderId
       },
  -    worker_proxy:call(monitoring_worker, {export, MonitoringId, Step, Format}).
  +    worker_proxy:call(monitoring_worker, {export, MonitoringId, Step, json}).
  
positive.code: 
  
  %% @private
  -spec get_metric(session:id(), od_space:id(), subject_type(), subject_id(),
      subject_type(), subject_id(), metric_type(), step()) ->
      {ok, [maps:map()]} | {error, term()}.
  get_metric(
      SessionId, SpaceId,
      SubjectType, SubjectId, SecondarySubjectType, SecondarySubjectId,
      Metric, Step
  ) ->
      case space_logic:get_provider_ids(SessionId, SpaceId) of
          {ok, Providers} ->
              Json = lists:map(fun(ProviderId) ->
                  case get_metric_internal(
                      SessionId,
                      SubjectType, SubjectId,
                      SecondarySubjectType, SecondarySubjectId,
                      Metric, Step,
                      ProviderId,
                      json
                  ) of
                      {ok, Data} ->
                          DecodedJson = json_utils:decode(Data),
                          #{
  
negative.code:                 end
              end, Providers),
              {ok, Json};
          Error ->
              Error
      end.
  
  
  