question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MonitoredResource logs not showing up under the monitored resource

See original GitHub issue

https://github.com/logary/logary/blob/master/src/targets/Logary.Targets.Stackdriver/Target_Stackdriver.fs#L110

Repro: dotnet build and dotnet run here https://github.com/logary/logary/tree/master/src/tests/Logary.Targets.Stackdriver.Tests with another resource here https://github.com/logary/logary/blob/master/src/tests/Logary.Targets.Stackdriver.Tests/Program.fs#L52

In case a more extensive repro is needed; this issue can be to document how to e.g. log to a container resource in GKE; right now this repo only contains tests for the global resource and all that the docs show is the global resource (which does work).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
amanda-tarafacommented, Sep 6, 2018

@haf I’ve ran the following code (basically logary’s own F# Hello World example tweaked to use Stackdriver as a target) and I can confirm that the entry does not appear under Global but under the proper GKE container, and all the labels for the resource have their correct value. That is I can’t reproduce the issue. As you can see the values I used are hard-coded, but I got them from a test cluster I have running on GCP. I ran it with made up values as well, not corresponding to any cluster I have on GCP, and the entry got logged properly under those made up values. So I suspect that your trouble is around how you are getting those values, which might be due to googleapis/gax-dotnet#276 or another issue on our side, or maybe an issue on your side. I haven’t found code on your repo that is trying to obtain that metadata so I cannot tell for sure where the issue might be. If you are able to reproduce it again, please send as a stripped down version of the code as possible so I can take a look. The code I ran:

let logger = Log.create "Hello World logger"

[<EntryPoint>]
let main argv =
    use mre = new System.Threading.ManualResetEventSlim(false)
    use sub = Console.CancelKeyPress.Subscribe (fun _ -> mre.Set())

    let projectId = "cloudsharptest"

    let logname = "logary-testing-log"

    let resource = Container("cluster-1", "kube-system", "2984358405818061623", "heapster-v1.5.2-56fb496965-8w9rp", "heapster-nanny", "europe-west1-b")

    let conf = StackdriverConf.create(projectId, logname, resource)

    let logary =
        Config.create "Logary.ConsoleApp" "localhost"
        |> Config.target (Stackdriver.create conf "target-name")
        |> Config.build
        |> Hopac.Hopac.run

    logger.info (eventX "testing logary")

    mre.Wait()
    
    0 // return an integer exit code

And the entry correctly logged (sorry for the shapeless red blobs): image

1reaction
amanda-tarafacommented, Sep 5, 2018

I think this might be a symptom of googleapis/gax-dotnet#276 .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing logs with cloud logging
My objective is to write to a file which is to be created weekly, and i have previously managed to do that. However...
Read more >
MonitoredResource - Logging
An object representing a resource that can be used for monitoring, ... of the labels listed in the associated monitored resource descriptor.
Read more >
About Cloud Logging - API documentation
CommonResource sets the monitored resource associated with all log entries written from a Logger. If not provided, the resource is automatically detected based ......
Read more >
MonitoredResource (Cloud Monitoring API v3 (Rev. 540) ...
This is the Java data model class that specifies how to parse/serialize into the JSON that is transmitted over HTTP when working with...
Read more >
Troubleshooting Logs
If you are not seeing any logs in the Logs page after you've set up ingestion, it may be caused by incorrect resource...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found