kandi background
Explore Kits

DIAL | This is DIAL client written in Android

 by   entertailion Java Version: Current License: No License

 by   entertailion Java Version: Current License: No License

Download this library from

kandi X-RAY | DIAL Summary

DIAL is a Java library. DIAL has no bugs, it has no vulnerabilities and it has low support. However DIAL build file is not available. You can download it from GitHub.
<p>this is dial client written in android. the <a href="http://www.dial-multiscreen.org/dial-protocol-specification">dial protocol</a> allows tv devices to be discovered and controlled.</p>. <p>the current version will discover both google tv and chromecast devices. the client is a proof of concept for controlling chromecast devices using open api’s. the current code does not rely on the google cast sdk and the os on the chromecast device does not need to be hacked. the chromecast device also does not need to have developer options enabled. </p>. <p>after the dial servers are discovered and the user selects a particular device in the ui, an attempt is made to connect to the chromecast device and play a youtube video. most of the chromecast-specific logic is contained in mainactivity.onactivityresult. operations are done via http and web sockets. chromecast apps use a protocol called ramp for media playback which is not currently supported by the client. </p>. <p>this holds promise for being to control
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • DIAL has a low active ecosystem.
  • It has 140 star(s) with 22 fork(s). There are 33 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 4 open issues and 1 have been closed. On average issues are closed in 1 days. There are no pull requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of DIAL is current.
DIAL Support
Best in #Java
Average in #Java
DIAL Support
Best in #Java
Average in #Java

quality kandi Quality

  • DIAL has 0 bugs and 0 code smells.
DIAL Quality
Best in #Java
Average in #Java
DIAL Quality
Best in #Java
Average in #Java

securitySecurity

  • DIAL has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • DIAL code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
DIAL Security
Best in #Java
Average in #Java
DIAL Security
Best in #Java
Average in #Java

license License

  • DIAL does not have a standard license declared.
  • Check the repository for any license declaration and review the terms closely.
  • Without a license, all rights are reserved, and you cannot use the library in your applications.
DIAL License
Best in #Java
Average in #Java
DIAL License
Best in #Java
Average in #Java

buildReuse

  • DIAL releases are not available. You will need to build from source code and install.
  • DIAL has no build file. You will be need to create the build yourself to build the component from source.
DIAL Reuse
Best in #Java
Average in #Java
DIAL Reuse
Best in #Java
Average in #Java
Top functions reviewed by kandi - BETA

kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample Here

Get all kandi verified functions for this library.

Get all kandi verified functions for this library.

DIAL Key Features

DIAL client

Manually extracting OpenTelemetry context from golang into a string?

copy iconCopydownload iconDownload
package main

import (
    "context"
    "fmt"

    "go.opentelemetry.io/otel/exporters/stdout/stdouttrace"
    "go.opentelemetry.io/otel/propagation"
    sdktrace "go.opentelemetry.io/otel/sdk/trace"
)

func main() {

    // common init
    // You may also want to set them as globals
    exp, _ := stdouttrace.New(stdouttrace.WithPrettyPrint())
    bsp := sdktrace.NewSimpleSpanProcessor(exp) // You should use batch span processor in prod
    tp := sdktrace.NewTracerProvider(
        sdktrace.WithSampler(sdktrace.AlwaysSample()),
        sdktrace.WithSpanProcessor(bsp),
    )

    propgator := propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})

    ctx, span := tp.Tracer("foo").Start(context.Background(), "parent-span-name")
    defer span.End()

    // Serialize the context into carrier
    carrier := propagation.MapCarrier{}
    propgator.Inject(ctx, carrier)
    // This carrier is sent accros the process
    fmt.Println(carrier)

    // Extract the context and start new span as child
    // In your receiving function
    parentCtx := propgator.Extract(context.Background(), carrier)
    _, childSpan := tp.Tracer("foo").Start(parentCtx, "child-span-name")
    childSpan.AddEvent("some-dummy-event")
    childSpan.End()
}

Anthos on VMWare deploy seesaw, health check in error 403 Forbidden

copy iconCopydownload iconDownload
gkectl delete loadbalancer --config admin-cluster.yaml --seesaw-group-file seesaw-for-gke-admin.yaml
amin-cluster.yaml
admin-cluster-ipblock.yaml
admin-seesaw-ipblock.yaml

gkeadm delete admin-workstation
 
gkeadm create admin-workstation --auto-create-service-accounts

gkectl create loadbalancer --config admin-cluster.yaml
gkectl delete loadbalancer --config admin-cluster.yaml --seesaw-group-file seesaw-for-gke-admin.yaml
amin-cluster.yaml
admin-cluster-ipblock.yaml
admin-seesaw-ipblock.yaml

gkeadm delete admin-workstation
 
gkeadm create admin-workstation --auto-create-service-accounts

gkectl create loadbalancer --config admin-cluster.yaml

How to set X-Forwarded-For with httputil.ReverseProxy

copy iconCopydownload iconDownload
type MyRoundTripper struct{}

func (t *MyRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
    req.Header["X-Forwarded-For"] = []string{"1.2.3.4"}
    return http.DefaultTransport.RoundTrip(req)
}

func main() {
    http.ListenAndServe(":80", &httputil.ReverseProxy{
        Director: director,
        Transport: &MyRoundTripper{},
    })
}
func main() {
    http.ListenAndServe(":80", func(w http.ResponseWriter, r *http.Request) {
        r.RemoteAddr = ""
        proxy := &httputil.ReverseProxy{ Director: director } 
        proxy.ServeHTTP(w, r)    
    })
}
type MyRoundTripper struct{}

func (t *MyRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
    req.Header["X-Forwarded-For"] = []string{"1.2.3.4"}
    return http.DefaultTransport.RoundTrip(req)
}

func main() {
    http.ListenAndServe(":80", &httputil.ReverseProxy{
        Director: director,
        Transport: &MyRoundTripper{},
    })
}
func main() {
    http.ListenAndServe(":80", func(w http.ResponseWriter, r *http.Request) {
        r.RemoteAddr = ""
        proxy := &httputil.ReverseProxy{ Director: director } 
        proxy.ServeHTTP(w, r)    
    })
}

Manually Download and Place a golang mod file

copy iconCopydownload iconDownload
$ export GO111MODULE=on
$ export GOPROXY=https://goproxy.cn
$ echo "export GO111MODULE=on" >> ~/.profile
$ echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
$ source ~/.profile
C:\> $env:GO111MODULE = "on"
C:\> $env:GOPROXY = "https://goproxy.cn"
# Set the GOPROXY environment variable
export GOPROXY=https://goproxy.io,direct
# Set environment variable allow bypassing the proxy for specified repos (optional)
export GOPRIVATE=git.mycompany.com,github.com/my/private
$ export GO111MODULE=on
$ export GOPROXY=https://goproxy.cn
$ echo "export GO111MODULE=on" >> ~/.profile
$ echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
$ source ~/.profile
C:\> $env:GO111MODULE = "on"
C:\> $env:GOPROXY = "https://goproxy.cn"
# Set the GOPROXY environment variable
export GOPROXY=https://goproxy.io,direct
# Set environment variable allow bypassing the proxy for specified repos (optional)
export GOPRIVATE=git.mycompany.com,github.com/my/private
$ export GO111MODULE=on
$ export GOPROXY=https://goproxy.cn
$ echo "export GO111MODULE=on" >> ~/.profile
$ echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
$ source ~/.profile
C:\> $env:GO111MODULE = "on"
C:\> $env:GOPROXY = "https://goproxy.cn"
# Set the GOPROXY environment variable
export GOPROXY=https://goproxy.io,direct
# Set environment variable allow bypassing the proxy for specified repos (optional)
export GOPRIVATE=git.mycompany.com,github.com/my/private
$ export GO111MODULE=on
$ export GOPROXY=https://goproxy.cn
$ echo "export GO111MODULE=on" >> ~/.profile
$ echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
$ source ~/.profile
C:\> $env:GO111MODULE = "on"
C:\> $env:GOPROXY = "https://goproxy.cn"
# Set the GOPROXY environment variable
export GOPROXY=https://goproxy.io,direct
# Set environment variable allow bypassing the proxy for specified repos (optional)
export GOPRIVATE=git.mycompany.com,github.com/my/private

Flutter TimePicker to RFC 3339 format

copy iconCopydownload iconDownload
            final now = new DateTime.now();
            final selectedTime = new DateTime(now.year, now.month, now.day, timeOfDay.hour, timeOfDay.minute

grpc.WithInsecure is deprecated: use insecure.NewCredentials() instead

copy iconCopydownload iconDownload
grpc.Dial(":9950", grpc.WithTransportCredentials(insecure.NewCredentials()))

android:exported needs to be explicitly specified for &lt;activity&gt;. Apps targeting Android 12 and higher are required to specify

copy iconCopydownload iconDownload
<receiver android:name="<name_of_the_entry>"
                android:exported="false or true"
                tools:node="merge" />
     <activity
                android:name="<activity which is giving error>"
                android:exported="true"
                tools:node="merge" />
<activity android:name="name_of_the_activity_inside_library>"
    android:exported="false|true"
    tools:node="merge" />
debugImplementation "androidx.fragment:fragment-testing:<version>"
androidTestImplementation "androidx.fragment:fragment-testing:<version>"
debugImplementation "androidx.fragment:fragment-testing:<version>"
androidTestImplementation "androidx.fragment:fragment-testing:<version>"
 android:exported="true"
androidTestImplementation "androidx.test.ext:junit:1.1.3"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.0.4"
> java.util.concurrent.ExecutionException: com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/xxxxx.tmp/base.apk (at Binary XML file line #129): YOUR.FULLY.QUALIFIED.NAME.FAILING.ACTIVITY: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present
<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity"
android:exported="true"
tools:node="merge"/>

<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity"
android:exported="true"
tools:node="merge"/>

<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity"
android:exported="true"
tools:node="merge"/>
 <activity
        android:name="com.test.activity.SplashActivity"
        android:clearTaskOnLaunch="true"
        android:label="@string/app_name"
        android:launchMode="singleTop"
        android:noHistory="true"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar"
        android:exported="true">
   <receiver
        android:name="com.test.receiver.ShareReceiver"
        android:exported="true">
        <intent-filter>
            <action android:name="com.test.fcm.android.action.broadcast" />
        </intent-filter>
    </receiver>

   <service
        android:name="com.google.android.gms.tagmanager.InstallReferrerService"
        android:exported="true" />
testImplementation 'junit:junit:4.13.2' 
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.razorpay:checkout:1.6.15'
 <activity
        android:name="com.test.activity.SplashActivity"
        android:clearTaskOnLaunch="true"
        android:label="@string/app_name"
        android:launchMode="singleTop"
        android:noHistory="true"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar"
        android:exported="true">
   <receiver
        android:name="com.test.receiver.ShareReceiver"
        android:exported="true">
        <intent-filter>
            <action android:name="com.test.fcm.android.action.broadcast" />
        </intent-filter>
    </receiver>

   <service
        android:name="com.google.android.gms.tagmanager.InstallReferrerService"
        android:exported="true" />
testImplementation 'junit:junit:4.13.2' 
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.razorpay:checkout:1.6.15'
 <activity
        android:name="com.test.activity.SplashActivity"
        android:clearTaskOnLaunch="true"
        android:label="@string/app_name"
        android:launchMode="singleTop"
        android:noHistory="true"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar"
        android:exported="true">
   <receiver
        android:name="com.test.receiver.ShareReceiver"
        android:exported="true">
        <intent-filter>
            <action android:name="com.test.fcm.android.action.broadcast" />
        </intent-filter>
    </receiver>

   <service
        android:name="com.google.android.gms.tagmanager.InstallReferrerService"
        android:exported="true" />
testImplementation 'junit:junit:4.13.2' 
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.razorpay:checkout:1.6.15'
"com.google.dagger:hilt-android:2.38.1"
"com.google.dagger:hilt-android-gradle-plugin:2.38.1"
"com.google.dagger:hilt-android-compiler:2.38.1"
"com.google.dagger:hilt-android-testing:2.38.1"
"com.google.dagger:hilt-android:2.40.5"
"com.google.dagger:hilt-android-gradle-plugin:2.40.5"
"com.google.dagger:hilt-android-compiler:2.40.5"
"com.google.dagger:hilt-android-testing:2.40.5" 
"com.google.dagger:hilt-android:2.38.1"
"com.google.dagger:hilt-android-gradle-plugin:2.38.1"
"com.google.dagger:hilt-android-compiler:2.38.1"
"com.google.dagger:hilt-android-testing:2.38.1"
"com.google.dagger:hilt-android:2.40.5"
"com.google.dagger:hilt-android-gradle-plugin:2.40.5"
"com.google.dagger:hilt-android-compiler:2.40.5"
"com.google.dagger:hilt-android-testing:2.40.5" 
<receiver
    android:name="com.razorpay.RzpTokenReceiver"
    android:exported="false">
    <intent-filter>
        <action android:name="rzp.device_token.share" />
    </intent-filter>
</receiver>

<activity
    android:name="com.razorpay.CheckoutActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:exported="true"
    android:theme="@style/CheckoutTheme">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <data
            android:host="rzp.io"
            android:scheme="io.rzp" />
    </intent-filter>
</activity>
android:exported="true" <!-- or false as required -->
<activity
     android:name=".MainActivity"
     android:exported="true" <** add this line on AndroidManifest.xml**
     android:launchMode="singleTop"
     android:theme="@style/LaunchTheme"
 </activity>

Couchbase with Azure Linux VM

copy iconCopydownload iconDownload
couchbase:// 
http://
couchbase:// 
http://

Prometheus cannot scrape from spring-boot application over HTTPS

copy iconCopydownload iconDownload
- job_name: 'spring-actuator'
metrics_path: '/actuator/prometheus/'
scrape_interval: 60s
scheme: https
static_configs:
  - targets: [ 'backend:8443' ]
tls_config:
  cert_file: /path/to/cert.crt
  key_file: /path/to/cert.key
  insecure_skip_verify: true
target=https://127.0.0.1:8443/actuator/prometheus/
msg="Scrape failed"
err="Get \"https://127.0.0.1:8443/actuator/prometheus/\": dial tcp 127.0.0.1:8443: connect: connection refused"
up{job="<job-name>", instance="<instance-id>"}: 1 if the instance is healthy, i.e. reachable, or 0 if the scrape failed.
scrape_configs:
- job_name: node
  static_configs:
  - targets: ['localhost:9100']
scrape_configs: 
  - job_name: prometheus 
    static_configs: 
      - targets: ["localhost:9090"] 
  - job_name: eventservice 
    static_configs: 
      - targets: ["events:9090"] 
  - job_name: bookingservice 
    static_configs: 
      - targets: ["bookings:9090"] 
static_configs:
  - targets: ['192.168.1.117:':8080', '192.168.1.117:8081']
scrape_configs:
  - job_name: 'node'
    scheme: https
    tls_config:
        # Prometheus will check that the node_exporter presents a certificate
        # signed by this ca.
        ca_file: 'ca.crt'
        # The cert and key are presented to node_exporter to authenticate
        # Prometheus as a client.
        cert_file: 'client.crt'
        key_file: 'client.key'

    static_configs:
    - targets: ['myserver.net:443']
target=https://127.0.0.1:8443/actuator/prometheus/
msg="Scrape failed"
err="Get \"https://127.0.0.1:8443/actuator/prometheus/\": dial tcp 127.0.0.1:8443: connect: connection refused"
up{job="<job-name>", instance="<instance-id>"}: 1 if the instance is healthy, i.e. reachable, or 0 if the scrape failed.
scrape_configs:
- job_name: node
  static_configs:
  - targets: ['localhost:9100']
scrape_configs: 
  - job_name: prometheus 
    static_configs: 
      - targets: ["localhost:9090"] 
  - job_name: eventservice 
    static_configs: 
      - targets: ["events:9090"] 
  - job_name: bookingservice 
    static_configs: 
      - targets: ["bookings:9090"] 
static_configs:
  - targets: ['192.168.1.117:':8080', '192.168.1.117:8081']
scrape_configs:
  - job_name: 'node'
    scheme: https
    tls_config:
        # Prometheus will check that the node_exporter presents a certificate
        # signed by this ca.
        ca_file: 'ca.crt'
        # The cert and key are presented to node_exporter to authenticate
        # Prometheus as a client.
        cert_file: 'client.crt'
        key_file: 'client.key'

    static_configs:
    - targets: ['myserver.net:443']
target=https://127.0.0.1:8443/actuator/prometheus/
msg="Scrape failed"
err="Get \"https://127.0.0.1:8443/actuator/prometheus/\": dial tcp 127.0.0.1:8443: connect: connection refused"
up{job="<job-name>", instance="<instance-id>"}: 1 if the instance is healthy, i.e. reachable, or 0 if the scrape failed.
scrape_configs:
- job_name: node
  static_configs:
  - targets: ['localhost:9100']
scrape_configs: 
  - job_name: prometheus 
    static_configs: 
      - targets: ["localhost:9090"] 
  - job_name: eventservice 
    static_configs: 
      - targets: ["events:9090"] 
  - job_name: bookingservice 
    static_configs: 
      - targets: ["bookings:9090"] 
static_configs:
  - targets: ['192.168.1.117:':8080', '192.168.1.117:8081']
scrape_configs:
  - job_name: 'node'
    scheme: https
    tls_config:
        # Prometheus will check that the node_exporter presents a certificate
        # signed by this ca.
        ca_file: 'ca.crt'
        # The cert and key are presented to node_exporter to authenticate
        # Prometheus as a client.
        cert_file: 'client.crt'
        key_file: 'client.key'

    static_configs:
    - targets: ['myserver.net:443']
target=https://127.0.0.1:8443/actuator/prometheus/
msg="Scrape failed"
err="Get \"https://127.0.0.1:8443/actuator/prometheus/\": dial tcp 127.0.0.1:8443: connect: connection refused"
up{job="<job-name>", instance="<instance-id>"}: 1 if the instance is healthy, i.e. reachable, or 0 if the scrape failed.
scrape_configs:
- job_name: node
  static_configs:
  - targets: ['localhost:9100']
scrape_configs: 
  - job_name: prometheus 
    static_configs: 
      - targets: ["localhost:9090"] 
  - job_name: eventservice 
    static_configs: 
      - targets: ["events:9090"] 
  - job_name: bookingservice 
    static_configs: 
      - targets: ["bookings:9090"] 
static_configs:
  - targets: ['192.168.1.117:':8080', '192.168.1.117:8081']
scrape_configs:
  - job_name: 'node'
    scheme: https
    tls_config:
        # Prometheus will check that the node_exporter presents a certificate
        # signed by this ca.
        ca_file: 'ca.crt'
        # The cert and key are presented to node_exporter to authenticate
        # Prometheus as a client.
        cert_file: 'client.crt'
        key_file: 'client.key'

    static_configs:
    - targets: ['myserver.net:443']
target=https://127.0.0.1:8443/actuator/prometheus/
msg="Scrape failed"
err="Get \"https://127.0.0.1:8443/actuator/prometheus/\": dial tcp 127.0.0.1:8443: connect: connection refused"
up{job="<job-name>", instance="<instance-id>"}: 1 if the instance is healthy, i.e. reachable, or 0 if the scrape failed.
scrape_configs:
- job_name: node
  static_configs:
  - targets: ['localhost:9100']
scrape_configs: 
  - job_name: prometheus 
    static_configs: 
      - targets: ["localhost:9090"] 
  - job_name: eventservice 
    static_configs: 
      - targets: ["events:9090"] 
  - job_name: bookingservice 
    static_configs: 
      - targets: ["bookings:9090"] 
static_configs:
  - targets: ['192.168.1.117:':8080', '192.168.1.117:8081']
scrape_configs:
  - job_name: 'node'
    scheme: https
    tls_config:
        # Prometheus will check that the node_exporter presents a certificate
        # signed by this ca.
        ca_file: 'ca.crt'
        # The cert and key are presented to node_exporter to authenticate
        # Prometheus as a client.
        cert_file: 'client.crt'
        key_file: 'client.key'

    static_configs:
    - targets: ['myserver.net:443']
target=https://127.0.0.1:8443/actuator/prometheus/
msg="Scrape failed"
err="Get \"https://127.0.0.1:8443/actuator/prometheus/\": dial tcp 127.0.0.1:8443: connect: connection refused"
up{job="<job-name>", instance="<instance-id>"}: 1 if the instance is healthy, i.e. reachable, or 0 if the scrape failed.
scrape_configs:
- job_name: node
  static_configs:
  - targets: ['localhost:9100']
scrape_configs: 
  - job_name: prometheus 
    static_configs: 
      - targets: ["localhost:9090"] 
  - job_name: eventservice 
    static_configs: 
      - targets: ["events:9090"] 
  - job_name: bookingservice 
    static_configs: 
      - targets: ["bookings:9090"] 
static_configs:
  - targets: ['192.168.1.117:':8080', '192.168.1.117:8081']
scrape_configs:
  - job_name: 'node'
    scheme: https
    tls_config:
        # Prometheus will check that the node_exporter presents a certificate
        # signed by this ca.
        ca_file: 'ca.crt'
        # The cert and key are presented to node_exporter to authenticate
        # Prometheus as a client.
        cert_file: 'client.crt'
        key_file: 'client.key'

    static_configs:
    - targets: ['myserver.net:443']

self-hosted posthog has been down right after I rebooted my vps

copy iconCopydownload iconDownload
   caddy:
        image: caddy
        restart: unless-stopped
        ports:
            - '80:80'
            - '443:443'

Community Discussions

Trending Discussions on DIAL
  • Manually extracting OpenTelemetry context from golang into a string?
  • Anthos on VMWare deploy seesaw, health check in error 403 Forbidden
  • How to set X-Forwarded-For with httputil.ReverseProxy
  • Flutter Error: No named parameter with the name 'displayLarge'
  • How to set a write deadline for GoLang bufio.Writer?
  • Manually Download and Place a golang mod file
  • Flutter TimePicker to RFC 3339 format
  • Golang with Cassandra db using docker-compose : cannot connect (gocql)
  • grpc.WithInsecure is deprecated: use insecure.NewCredentials() instead
  • android:exported needs to be explicitly specified for &lt;activity&gt;. Apps targeting Android 12 and higher are required to specify
Trending Discussions on DIAL

QUESTION

Manually extracting OpenTelemetry context from golang into a string?

Asked 2022-Apr-16 at 18:20

I'm building a simple client server app which I want to trace across the client execution to a server microservice that calls a second server microservice.

Simply speaking, it's not more complicated than CLI -> ServiceA -> ServiceB.

The challenge I'm having is how to serialize the context - most of the docs I've looked at appear to do some form of automated HTTP header injection (e.g. https://opentelemetry.lightstep.com/core-concepts/context-propagation/) , but I do not have access to that. I need to serialize (I think) the context of the trace/span in the client and push it to the server, where I'll rehydrate it. (Mind you, I'd love this to be simpler, but I cannot figure it out).

So the object looks like this (called "job"):

    args := &types.SubmitArgs{
        SerializedOtelContext: serializedOtelContext,
    }

    job := &types.Job{}

    tracer := otel.GetTracerProvider().Tracer("myservice.org")
    _, span := tracer.Start(ctx, "Submitting Job to RPC")
    err := system.JsonRpcMethod(rpcHost, rpcPort, "Submit", args, job)

The function to submit to JsonRpcMethod is here:

func JsonRpcMethod(
    host string,
    port int,
    method string,
    req, res interface{},
) error {
    client, err := rpc.DialHTTP("tcp", fmt.Sprintf("%s:%d", host, port))
    if err != nil {
        return fmt.Errorf("Error in dialing. %s", err)
    }
    return client.Call(fmt.Sprintf("JobServer.%s", method), req, res)
}

And the function that receives it is here:

func (server *JobServer) Submit(args *types.SubmitArgs, reply *types.Job) error {
    //nolint
    job, err := server.RequesterNode.Scheduler.SubmitJob(args.Spec, args.Deal)
    if err != nil {
        return err
    }
    *reply = *job
    return nil
}

My question is how do I, in the receiving function ("Submit" above) extract the trace/span from the sender?

ANSWER

Answered 2022-Apr-16 at 18:20

Here is a small program to illustrate the usage. Hope this makes it clear.

package main

import (
    "context"
    "fmt"

    "go.opentelemetry.io/otel/exporters/stdout/stdouttrace"
    "go.opentelemetry.io/otel/propagation"
    sdktrace "go.opentelemetry.io/otel/sdk/trace"
)

func main() {

    // common init
    // You may also want to set them as globals
    exp, _ := stdouttrace.New(stdouttrace.WithPrettyPrint())
    bsp := sdktrace.NewSimpleSpanProcessor(exp) // You should use batch span processor in prod
    tp := sdktrace.NewTracerProvider(
        sdktrace.WithSampler(sdktrace.AlwaysSample()),
        sdktrace.WithSpanProcessor(bsp),
    )

    propgator := propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})

    ctx, span := tp.Tracer("foo").Start(context.Background(), "parent-span-name")
    defer span.End()

    // Serialize the context into carrier
    carrier := propagation.MapCarrier{}
    propgator.Inject(ctx, carrier)
    // This carrier is sent accros the process
    fmt.Println(carrier)

    // Extract the context and start new span as child
    // In your receiving function
    parentCtx := propgator.Extract(context.Background(), carrier)
    _, childSpan := tp.Tracer("foo").Start(parentCtx, "child-span-name")
    childSpan.AddEvent("some-dummy-event")
    childSpan.End()
}

Source https://stackoverflow.com/questions/71895937

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install DIAL

You can download it from GitHub.
You can use DIAL like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the DIAL component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases
Explore Kits

Save this library and start creating your kit

Share this Page

share link
Consider Popular Java Libraries
Try Top Libraries by entertailion
Compare Java Libraries with Highest Support
Compare Java Libraries with Highest Quality
Compare Java Libraries with Highest Security
Compare Java Libraries with Permissive License
Compare Java Libraries with Highest Reuse
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases
Explore Kits

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.