Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dart support ? #552

Open
joe-getcouragenow opened this issue Aug 28, 2020 · 20 comments
Open

Dart support ? #552

joe-getcouragenow opened this issue Aug 28, 2020 · 20 comments

Comments

@joe-getcouragenow
Copy link

GRPC is fully supported and dart, and i want to make grpc middleware in dart to use opentelemtry.

SO i was wondering if Dart would be possible to support.

I regularly code gen the golanf and dart code from a protobuf all the time and it works fine.

For example to gen chat.proto from a make file.


protoc-go:
	protoc -I grpc-web/pkg/proto grpc-web/pkg/proto/v2.proto --gofast_out=plugins=grpc:./grpc-web/pkg/api/v2

proto-dart:
	pub global activate protoc_plugin
	mkdir -p $(SAMPLE_FSPATH)/lib/api/v1/google/protobuf

ifeq ($(GO_OS), windows)
	@echo Windows detected
	protoc empty.proto timestamp.proto wrappers.proto --proto_path=$(LIB_FSPATH)/server/third_party/google/protobuf/ --plugin=$(HOME_PATH)/AppData/Roaming/Pub/Cache/bin/protoc-gen-dart.bat --dart_out=grpc:"$(PROTO_OUTPUT)/client/lib/chat_view/api/v1/google/protobuf"
	protoc chat.proto --proto_path=$(LIB_FSPATH)/server/api/proto/v1/ --plugin=$(HOME_PATH)/AppData/Roaming/Pub/Cache/bin/protoc-gen-dart.bat --dart_out=grpc:"$(PROTO_OUTPUT)/client/lib/chat_view/api/v1/"
else
	protoc empty.proto timestamp.proto wrappers.proto --proto_path=$(LIB_FSPATH)/server/third_party/google/protobuf --plugin=protoc-gen-dart=$(HOME)/.pub-cache/bin/protoc-gen-dart --dart_out=grpc:$(SAMPLE_FSPATH)/lib/api/v1/google/protobuf
	protoc chat.proto --proto_path=$(LIB_FSPATH)/server/api/proto/v1/ --plugin=protoc-gen-dart=$(HOME)/.pub-cache/bin/protoc-gen-dart --dart_out=grpc:$(SAMPLE_FSPATH)/client/lib/chat_view/api/v1/
endif
@tigrannajaryan
Copy link
Member

Yes, that should work. What sort of Dart support do you expect from this repository? This repository merely contains proto file definitions which are language independent.

@ghenry
Copy link

ghenry commented Sep 26, 2020

I was just Googling this too.

@andrewhsu
Copy link
Member

having a look at this issue in the spec issue triage mtg today, are we looking for an api/sdk for dart? if so, this issue should be moved to open-telemetry/community to track request.

@tigrannajaryan
Copy link
Member

@open-telemetry/governance-committee I don't have permissions to transfer this to the open-telemetry/community repo, can you please do it?

@mtwo
Copy link
Member

mtwo commented Oct 27, 2020

I'm on the GC and lack the permissions to move this issue. @SergeyKanzhelev @bhs are you able to move it? Not sure who has admin privileges in this repo.

@yurishkuro yurishkuro transferred this issue from open-telemetry/opentelemetry-proto Oct 27, 2020
@joe-getcouragenow
Copy link
Author

Yes, that should work. What sort of Dart support do you expect from this repository? This repository merely contains proto file definitions which are language independent.

There are a ton of good and bad telemetry thingies for Flutter. https://pub.dev/packages?q=crashy

Just want to be able to use opentel from flutter / dart language because life is too short for another telemetry framework and i like to have options...

I am really surprised no one has done this actually yet.

things i would extend for are:

  • flutter has first class grpc and protobuf support. so no show stoppers there.

  • store and forward using hive. So offline client logs, metrics are eventually sent to the Collector.

  • hive is a very fast kv store for dart that runs on web, native, everywhere ( https://github.com/hivedb/hive#benchmark ).

  • Hive is designed to work with protobuf schema evolutions also :). The fields are numbered ( https://github.com/hivedb/hive/blob/master/hive/example/lib/main.g.dart#L20 ). I use gprc and hive together currently and can update my grpc protos, and still have the flutter app using the same grpc tick along fine. So schema evolution works well.

  • Write adapters for opentel protobuf generated code, such that the offline support is automatically generated. Hive has type adapters that are code generated just like protobuf ( https://github.com/hivedb/hive/search?q=TypeAdapter ).

  • make a Test harness that is crashy also ( https://github.com/flutter/crashy )

  • add a crash handler to make it easy to use.

What have i missed ?? Would be curious to hear what the maintainers viewpoints are...

@austinlparker
Copy link
Member

I think this would be a great idea - it seems like the actual work of an integration would be an exporter from hive that could batch and forward reports to a collector via OTLP, since dart/flutter can use the existing JS API/SDK? Might also need an adapter for hive that can accept OTLP from the SDK - I'm not super familiar with the ecosystem on that side, unfortunately. It seems like it wouldn't require that much work all told, presumably the biggest amount of effort would be seeing if the JS GRPC instrumentation worked out of the box with Dart?

@gedw99
Copy link

gedw99 commented May 27, 2021

@austinlparker

in flutter you can reuse JS but only for flutter web.

Another way is to use the golang sdk of open tel, and cross compile it to WASM ( for flutter Web) and native ( for desktops and mobiles).
Then the compiles golang code is exposed to Flutter as a flutter plugin over FFI.
I do it this way for lots of things, and its nice because the Flutter GUI is single threaded, but the plugin is not, and so you free up the GUI thread. I use tinygo to compile the WASM for Flutter Web, and then shared objects for Flutter Desktop, and then gomobile for Flutter Mobile.
As far as storage, you can use golang also. For flutter Web, the golang code uses indexdb. For flutter Native, you use a golang indexdb.
This makes the opentel an actual plugin.

SO if a flutter web wants to do logs, metrics, traces, they just have to call that code from their flutter code.

@MateusAmin
Copy link

MateusAmin commented Aug 5, 2021

Yes, that should work. What sort of Dart support do you expect from this repository? This repository merely contains proto file definitions which are language independent.

There are a ton of good and bad telemetry thingies for Flutter. https://pub.dev/packages?q=crashy

Just want to be able to use opentel from flutter / dart language because life is too short for another telemetry framework and i like to have options...

I am really surprised no one has done this actually yet.

things i would extend for are:

* flutter has first class grpc and protobuf support. so no show stoppers there.

* store and forward using hive. So offline client logs, metrics are eventually sent to the Collector.

* hive is a very fast kv store for dart that runs on web, native, everywhere ( https://github.com/hivedb/hive#benchmark ).

* Hive is designed to work with protobuf schema evolutions also :). The fields are numbered ( https://github.com/hivedb/hive/blob/master/hive/example/lib/main.g.dart#L20 ). I use gprc and hive together currently and can update my grpc protos, and still have the flutter app using the same grpc tick along fine. So schema evolution works well.

* Write adapters for opentel protobuf generated code, such that the offline support is automatically generated. Hive has type adapters that are code generated just like protobuf ( https://github.com/hivedb/hive/search?q=TypeAdapter ).

* make a Test harness that is crashy also ( https://github.com/flutter/crashy )

* add a crash handler to make it easy to use.

What have i missed ?? Would be curious to hear what the maintainers viewpoints are...

Good plan.

I would be interested in this without offline support to keep things clean. Might start there then add offline support as a flag or separate package.

This might be the best project to fork:

https://github.com/getsentry/sentry-dart

@thundering-herd
Copy link

Hej,
I also got interested in instrumenting mobile applications written in Flutter. Are there any plans or ideas on how to accomplish this iva OpenTelemetry?

@agorges
Copy link

agorges commented Aug 12, 2022

Hard to find, even with google:

https://github.com/Workiva/opentelemetry-dart.git

I have not checked it out yet.
Just in case someone landed here...

@kirinnee
Copy link

interested in this as well

@k-koleda
Copy link

Any updates on this please?

@icardschool1
Copy link

How to implement this in flutter based mobile application , seems there is no support till now to add tracing of mobile apps

@icardschool1
Copy link

Hard to find, even with google:

https://github.com/Workiva/opentelemetry-dart.git

I have not checked it out yet. Just in case someone landed here...

How to implement this on Dart based (Flutter Framework Mobile Application ) ?

@svrnm
Copy link
Member

svrnm commented Jan 31, 2024

Hard to find, even with google:
Workiva/opentelemetry-dart.git
I have not checked it out yet. Just in case someone landed here...

How to implement this on Dart based (Flutter Framework Mobile Application ) ?

As of today there are at least 3 unofficial dart packages that implement some portions of the OTel API&SDK, you might take a look which ones work with Flutter:

https://pub.dev/packages?q=opentelemetry

Note, that the client side telemetry working group is still in progress of setting standards for mobile and browser, you can get in touch with them and provide your help to move this matter forward, take a look for "Client Instrumentation" at https://github.com/open-telemetry/community?tab=readme-ov-file#special-interest-groups to find how to get in touch

@gustavosett
Copy link

Any updates on this please?

@svrnm
Copy link
Member

svrnm commented Jul 16, 2024

Any updates on this please?

What kind of updates are you looking for?

@gustavosett
Copy link

Any updates on this please?

What kind of updates are you looking for?

Hey Friend
If there is some oficial Dart implementation of Otel that I can contribute for or anything else about this context

@svrnm
Copy link
Member

svrnm commented Jul 16, 2024

Hey Friend If there is some oficial Dart implementation of Otel that I can contribute for or anything else about this context

No, there is no official dart implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests