Giter Site home page Giter Site logo

dio_firebase_performance's Introduction

dio_fire_png

Description

Dio's Interceptor implementation that sends http request metric data to Firebase.

STATUS: works for us in production.

Usage

final dio = Dio();
final performanceInterceptor = DioFirebasePerformanceInterceptor();
dio.interceptors.add(performanceInterceptor);

SUGGESTION: If you use dio client as a singleton you can use this interceptor as singleton as well.

dio_firebase_performance's People

Contributors

abahnj avatar andreacimino avatar arifcse10 avatar bounty1342 avatar ercadev avatar frully avatar vishna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dio_firebase_performance's Issues

Update firebase_performance to 0.8.0

I got this error when trying to update firebase_performance:

Because dio_firebase_performance 0.3.1-dev.3 depends on firebase_performance ^0.7.0 and no versions of dio_firebase_performance match >0.3.1-dev.3 <0.4.0, dio_firebase_performance ^0.3.1-dev.3 requires firebase_performance ^0.7.0.
So, because alia_flutter depends on both dio_firebase_performance ^0.3.1-dev.3 and firebase_performance ^0.8.0+13, version solving failed.
pub get failed (1; So, because alia_flutter depends on both dio_firebase_performance ^0.3.1-dev.3 and firebase_performance ^0.8.0+13, version solving failed.)

Null safety support

The last release of this plugin was 0.3.0 but this is not null safety, I need for my project that this plugin to be null safety.

dio_firebase_performance does not compile with dio: ^4.0.0-prev2

Seems dio has changed the API of the 4.0 versions, and the package does not compile anymore.

Here are the errors:
`../../.pub-cache/hosted/pub.dartlang.org/dio-4.0.0-prev2/lib/src/interceptor.dart:225:8: Context: This is the overridden method ('onError').
void onError(
^
../../../.pub-cache/git/dio_firebase_performance-9cbaeebb70c6fc9cf6f4a202b70b5f82781f224d/lib/src/dio_firebase_performance.dart:39:27: Error: Too few positional arguments: 2 required, 1 given.
return super.onRequest(options);
^

../../../.pub-cache/git/dio_firebase_performance-9cbaeebb70c6fc9cf6f4a202b70b5f82781f224d/lib/src/dio_firebase_performance.dart:45:35: Error: The getter 'request' isn't defined for the class 'Response'.

  • 'Response' is from 'package:dio/src/response.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/dio-4.0.0-prev2/lib/src/response.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'request'.
    final requestKey = response.request.extra.hashCode;
    ^^^^^^^
    ../../../.pub-cache/git/dio_firebase_performance-9cbaeebb70c6fc9cf6f4a202b70b5f82781f224d/lib/src/dio_firebase_performance.dart:51:28: Error: Too few positional arguments: 2 required, 1 given.
    return super.onResponse(response);
    ^
    ../../../.pub-cache/git/dio_firebase_performance-9cbaeebb70c6fc9cf6f4a202b70b5f82781f224d/lib/src/dio_firebase_performance.dart:57:30: Error: The getter 'request' isn't defined for the class 'DioError'.
  • 'DioError' is from 'package:dio/src/dio_error.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/dio-4.0.0-prev2/lib/src/dio_error.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'request'.
    final requestKey = err.request?.extra.hashCode;
    ^^^^^^^
    `

Incompatible with firebase_performance: ^0.4.0+1

dependencies:
  dio_firebase_performance: ^0.1.0
  firebase_performance: ^0.4.0+1

Error

Because dio_firebase_performance 0.1.0 depends on firebase_performance ^0.3.1+7 and no versions of dio_firebase_performance match >0.1.0 <0.2.0, dio_firebase_performance ^0.1.0 requires firebase_performance ^0.3.1+7.
So, because my_project depends on both dio_firebase_performance ^0.1.0 and firebase_performance ^0.4.0+1, version solving failed.
pub get failed (1; So, because my_project depends on both dio_firebase_performance ^0.1.0 and firebase_performance ^0.4.0+1, version solving failed.)

Please widen the range of firebase_performance to

  firebase_performance: ">=0.3.0 <2.0.0"

Is iit support dio download ?

It is very useful library connect between dio and firebase_performance.
But it seem not work at dio.download.

Here is exception

E/flutter (11107): If you're running a test, you can call the `TestWidgetsFlutterBinding.ensureInitialized()` as the first line in your test's `main()` method to initialize the binding.
E/flutter (11107): #0      defaultBinaryMessenger.<anonymous closure> (package:flutter/src/services/binary_messenger.dart:97:7)
E/flutter (11107): #1      defaultBinaryMessenger (package:flutter/src/services/binary_messenger.dart:110:4)
E/flutter (11107): #2      MethodChannel.binaryMessenger (package:flutter/src/services/platform_channel.dart:142:62)
E/flutter (11107): #3      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:148:36)
E/flutter (11107): #4      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:331:12)
E/flutter (11107): #5      new FirebasePerformance._ (package:firebase_performance/src/firebase_performance.dart:16:13)
E/flutter (11107): #6      FirebasePerformance.instance (package:firebase_performance/src/firebase_performance.dart:32:27)
E/flutter (11107): #7      FirebasePerformance.instance (package:firebase_performance/src/firebase_performance.dart)
E/flutter (11107): #8      DioFirebasePerformanceInterceptor.onRequest (package:dio_firebase_performance/src/dio_firebase_performance.dart:29:42)
E/flutter (11107): #9      DioMixin.fetch._requestInterceptorWrapper.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:dio/src/dio_mixin.dart:502:28)
E/flutter (11107): #10     DioMixin.checkIfNeedEnqueue (package:dio/src/dio_mixin.dart:795:22)
E/flutter (11107): #11     DioMixin.fetch._requestInterceptorWrapper.<anonymous closure>.<anonymous closure> (package:dio/src/dio_mixin.dart:500:22)
E/flutter (11107): #12     new Future.<anonymous closure> (dart:async/future.dart:174:37)
E/flutter (11107): #13     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
E/flutter (11107): #14     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)
E/flutter (11107): #15     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)
E/flutter (11107): #16     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

Where to get the request content length from

When initialized like the readme, the content size is not reported to Firebase.
I've figured out how to set the response content length

    final performanceInterceptor = DioFirebasePerformanceInterceptor(
        responseContentLengthMethod: (Response response) {
      return int.parse(response.headers['content-length'][0]);
    });

There is also a parameter requestContentLengthMethod, however how do I get the content longth of the request. I'm not seing anything in the RequestOptions object. Do we need to somehow calculate this on our own?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.