open-telemetry / community

OpenTelemetry community content
https://opentelemetry.io
Apache License 2.0
776 stars 233 forks source link

Dart support ? #552

Open joe-getcouragenow opened 4 years ago

joe-getcouragenow commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

I was just Googling this too.

andrewhsu commented 4 years ago

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 commented 4 years ago

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

mtwo commented 4 years ago

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.

joe-getcouragenow commented 3 years ago

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:

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

austinlparker commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 1 year ago

interested in this as well

k-koleda commented 11 months ago

Any updates on this please?

icardschool1 commented 9 months ago

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

icardschool1 commented 9 months ago

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 commented 9 months ago

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 commented 3 months ago

Any updates on this please?

svrnm commented 3 months ago

Any updates on this please?

What kind of updates are you looking for?

gustavosett commented 3 months ago

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 commented 3 months ago

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.